# -*- cperl -*-
eval 'exec $CBROOT/bin/perl $0 ${1+"$@"}'
  unless $running_under_some_shell;
use strict;
use NP::Model;
use Net::IP;

my $servers = NP::Model->server->get_servers_iterator(query => [ip_version => 'v6']);

while (my $server = $servers->next) {
    print $server->ip, "\n";
    my $ip = Net::IP->new($server->ip);
    unless ($ip) {
        $server->deletion_on('now');
        $server->update;
        next;
    }

    if ($server->ip ne $ip->short) {
        print "Updating to ", $ip->short, "\n";
        $server->ip($ip->short);
        $server->update;
    }

}

{'repo_name': 'abh/ntppool', 'stars': '167', 'repo_language': 'Perl', 'file_name': 'tvblob', 'mime_type': 'text/plain', 'hash': 4621640906653225335, 'source_dataset': 'data'}


tinymce.addI18n('ca',{
"Cut": "Retalla",
"Heading 5": "Encap\u00e7alament 5",
"Header 2": "Cap\u00e7alera 2",
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "El vostre navegador no suporta l'acc\u00e9s directe al portaobjectes. Si us plau, feu servir les dreceres de teclat Ctrl+X\/C\/V.",
"Heading 4": "Encap\u00e7alament 4",
"Div": "Div",
"Heading 2": "Encap\u00e7alament 2",
"Paste": "Enganxa",
"Close": "Tanca",
"Font Family": "Fam\u00edlia de la font",
"Pre": "Pre",
"Align right": "Aliniat a la dreta",
"New document": "Nou document",
"Blockquote": "Cita",
"Numbered list": "Llista enumerada",
"Heading 1": "Encap\u00e7alament 1",
"Headings": "Encap\u00e7alaments",
"Increase indent": "Augmentar sagnat",
"Formats": "Formats",
"Headers": "Cap\u00e7aleres",
"Select all": "Seleccionar-ho tot",
"Header 3": "Cap\u00e7alera 3",
"Blocks": "Blocs",
"Undo": "Desfer",
"Strikethrough": "Ratllat",
"Bullet list": "Llista no ordenada",
"Header 1": "Cap\u00e7alera 1",
"Superscript": "Super\u00edndex",
"Clear formatting": "Eliminar format",
"Font Sizes": "Mides de la font",
"Subscript": "Sub\u00edndex",
"Header 6": "Cap\u00e7alera 6",
"Redo": "Refer",
"Paragraph": "Par\u00e0graf",
"Ok": "Acceptar",
"Bold": "Negreta",
"Code": "Codi",
"Italic": "Cursiva",
"Align center": "Centrat",
"Header 5": "Cap\u00e7alera 5",
"Heading 6": "Encap\u00e7alament 6",
"Heading 3": "Encap\u00e7alament 3",
"Decrease indent": "Disminuir sagnat",
"Header 4": "Cap\u00e7alera 4",
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Enganxar ara est\u00e0 en mode text pla. Els continguts s'enganxaran com a text pla fins que desactivis aquesta opci\u00f3. ",
"Underline": "Subratllat",
"Cancel": "Cancel\u00b7la",
"Justify": "Justificat",
"Inline": "En l\u00ednia",
"Copy": "Copia",
"Align left": "Aliniat a l'esquerra",
"Visual aids": "Assist\u00e8ncia visual",
"Lower Greek": "Grec menor",
"Square": "Quadrat",
"Default": "Per defecte",
"Lower Alpha": "Alfa menor",
"Circle": "Cercle",
"Disc": "Disc",
"Upper Alpha": "Alfa major",
"Upper Roman": "Roman major",
"Lower Roman": "Roman menor",
"Name": "Nom",
"Anchor": "\u00c0ncora",
"You have unsaved changes are you sure you want to navigate away?": "Teniu canvis sense desar, esteu segur que voleu deixar-ho ara?",
"Restore last draft": "Restaurar l'\u00faltim esborrany",
"Special character": "Car\u00e0cter especial",
"Source code": "Codi font",
"B": "B",
"R": "R",
"G": "G",
"Color": "Color",
"Right to left": "De dreta a esquerra",
"Left to right": "D'esquerra a dreta",
"Emoticons": "Emoticones",
"Robots": "Robots",
"Document properties": "Propietats del document",
"Title": "T\u00edtol",
"Keywords": "Paraules clau",
"Encoding": "Codificaci\u00f3",
"Description": "Descripci\u00f3",
"Author": "Autor",
"Fullscreen": "Pantalla completa",
"Horizontal line": "L\u00ednia horitzontal",
"Horizontal space": "Espai horitzontal",
"Insert\/edit image": "Inserir\/editar imatge",
"General": "General",
"Advanced": "Avan\u00e7at",
"Source": "Font",
"Border": "Vora",
"Constrain proportions": "Mantenir proporcions",
"Vertical space": "Espai vertical",
"Image description": "Descripci\u00f3 de la imatge",
"Style": "Estil",
"Dimensions": "Dimensions",
"Insert image": "Inserir imatge",
"Zoom in": "Ampliar",
"Contrast": "Contrast",
"Back": "Tornar",
"Gamma": "Gamma",
"Flip horizontally": "Capgirar horitzontalment",
"Resize": "Canviar mida",
"Sharpen": "Remarcar vores",
"Zoom out": "Empetitir",
"Image options": "Opcions d'imatge",
"Apply": "Aplicar",
"Brightness": "Brillantor",
"Rotate clockwise": "Girar a la dreta",
"Rotate counterclockwise": "Girar a l'esquerra",
"Edit image": "Editar imatge",
"Color levels": "Nivells de color",
"Crop": "Escap\u00e7ar",
"Orientation": "Orientaci\u00f3",
"Flip vertically": "Capgirar verticalment",
"Invert": "Invertir",
"Insert date\/time": "Inserir data\/hora",
"Remove link": "Treure enlla\u00e7",
"Url": "URL",
"Text to display": "Text per mostrar",
"Anchors": "\u00c0ncores",
"Insert link": "Inserir enlla\u00e7",
"New window": "Finestra nova",
"None": "Cap",
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL que has escrit sembla un enlla\u00e7 extern. Vols afegir-li el prefix obligatori http:\/\/ ?",
"Target": "Dest\u00ed",
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL que has escrit sembla una adre\u00e7a de correu electr\u00f2nic. Vols afegir-li el prefix obligatori mailto: ?",
"Insert\/edit link": "Inserir\/editar enlla\u00e7",
"Insert\/edit video": "Inserir\/editar v\u00eddeo",
"Poster": "P\u00f3ster",
"Alternative source": "Font alternativa",
"Paste your embed code below:": "Enganxau el codi a sota:",
"Insert video": "Inserir v\u00eddeo",
"Embed": "Incloure",
"Nonbreaking space": "Espai fixe",
"Page break": "Salt de p\u00e0gina",
"Paste as text": "Enganxar com a text",
"Preview": "Previsualitzaci\u00f3",
"Print": "Imprimir",
"Save": "Desa",
"Could not find the specified string.": "No es pot trobar el text especificat.",
"Replace": "Rempla\u00e7ar",
"Next": "Seg\u00fcent",
"Whole words": "Paraules senceres",
"Find and replace": "Buscar i rempla\u00e7ar",
"Replace with": "Rempla\u00e7ar amb",
"Find": "Buscar",
"Replace all": "Rempla\u00e7ar-ho tot",
"Match case": "Coincidir maj\u00fascules",
"Prev": "Anterior",
"Spellcheck": "Comprovar ortrografia",
"Finish": "Finalitzar",
"Ignore all": "Ignorar tots",
"Ignore": "Ignorar",
"Add to Dictionary": "Afegir al diccionari",
"Insert row before": "Inserir fila a sobre",
"Rows": "Files",
"Height": "Al\u00e7ada",
"Paste row after": "Enganxar fila a sota",
"Alignment": "Aliniament",
"Border color": "Color de vora",
"Column group": "Grup de columna",
"Row": "Fila",
"Insert column before": "Inserir columna abans",
"Split cell": "Dividir cel\u00b7les",
"Cell padding": "Marge intern",
"Cell spacing": "Espai entre cel\u00b7les",
"Row type": "Tipus de fila",
"Insert table": "Inserir taula",
"Body": "Cos",
"Caption": "Encap\u00e7alament",
"Footer": "Peu",
"Delete row": "Esborrar fila",
"Paste row before": "Enganxar fila a sobre",
"Scope": "\u00c0mbit",
"Delete table": "Esborrar taula",
"H Align": "Al\u00edniament H",
"Top": "Superior",
"Header cell": "Cel\u00b7la de cap\u00e7alera",
"Column": "Columna",
"Row group": "Grup de fila",
"Cell": "Cel\u00b7la",
"Middle": "Mitj\u00e0",
"Cell type": "Tipus de cel\u00b7la",
"Copy row": "Copiar fila",
"Row properties": "Propietats de fila",
"Table properties": "Propietats de taula",
"Bottom": "Inferior",
"V Align": "Al\u00edniament V",
"Header": "Cap\u00e7alera",
"Right": "A la dreta",
"Insert column after": "Inserir columna despr\u00e9s",
"Cols": "Cols",
"Insert row after": "Inserir fila a sota",
"Width": "Amplada",
"Cell properties": "Propietats de cel\u00b7la",
"Left": "A l'esquerra",
"Cut row": "Retallar fila",
"Delete column": "Esborrar columna",
"Center": "Centrat",
"Merge cells": "Fusionar cel\u00b7les",
"Insert template": "Inserir plantilla",
"Templates": "Plantilles",
"Background color": "Color del fons",
"Custom...": "Personalitzar...",
"Custom color": "Personalitzar el color",
"No color": "Sense color",
"Text color": "Color del text",
"Show blocks": "Mostrar blocs",
"Show invisible characters": "Mostrar car\u00e0cters invisibles",
"Words: {0}": "Paraules: {0}",
"Insert": "Inserir",
"File": "Arxiu",
"Edit": "Edici\u00f3",
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "\u00c0rea de text amb format. Premeu ALT-F9 per mostrar el men\u00fa, ALT F10 per la barra d'eines i ALT-0 per ajuda.",
"Tools": "Eines",
"View": "Veure",
"Table": "Taula",
"Format": "Format"
});

{'repo_name': 'arastta/arastta', 'stars': '254', 'repo_language': 'PHP', 'file_name': 'banner.php', 'mime_type': 'text/x-php', 'hash': 7398185624020035087, 'source_dataset': 'data'}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{F6CBE303-3B5F-4CCC-B0B7-D81A6BD462C9}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>ProtoBuf.CodeGenerator</RootNamespace>
    <AssemblyName>protogen</AssemblyName>
    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>../ProtoBuf.snk</AssemblyOriginatorKeyFile>
    <ApplicationIcon>ProtoGen.ico</ApplicationIcon>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>3.5</OldToolsVersion>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'iOS|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\iOS\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <CodeAnalysisLogFile>bin\Debug\protogen.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
    <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Unity|AnyCPU'">
    <OutputPath>bin\Unity\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <CodeAnalysisLogFile>bin\Release\protogen.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
    <CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'CoreOnly|AnyCPU'">
    <OutputPath>bin\CoreOnly\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <Optimize>true</Optimize>
    <DebugType>pdbonly</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <CodeAnalysisLogFile>bin\Release\protogen.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    <CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
    <CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
    <CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="CommandLineOptions.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="csharp.xslt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <SubType>Designer</SubType>
    </Content>
    <Content Include="descriptor.proto">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="descriptor.cs" />
    <Compile Include="InputFileLoader.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <Content Include="..\Tools\protoc-license.txt">
      <Link>protoc-license.txt</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <EmbeddedResource Include="..\Tools\protoc.exe">
      <Link>protoc.exe</Link>
    </EmbeddedResource>
    <None Include="app.config" />
    <None Include="protobuf-net.proto">
    </None>
    <None Include="ProtoGen.ico" />
    <None Include="Properties\Usage.txt" />
    <Content Include="common.xslt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="vb.xslt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      <SubType>Designer</SubType>
    </Content>
    <Content Include="xml.xslt">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="bin\Debug\" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\protobuf-net\protobuf-net.csproj">
      <Project>{8374E4D7-2A91-48F1-9360-09B09CF27C3F}</Project>
      <Name>protobuf-net</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

{'repo_name': 'microsoft/vsminecraft', 'stars': '187', 'repo_language': 'Java', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 8314795371723458488, 'source_dataset': 'data'}


/*
 * Copyright (c) 2011 Yan Pujante
 *
 * 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.linkedin.glu.orchestration.engine.core.action.execution

import org.linkedin.glu.orchestration.engine.action.execution.ActionExecutionFactory
import org.linkedin.glu.orchestration.engine.action.execution.ActionExecution
import org.linkedin.glu.orchestration.engine.action.descriptor.ActionDescriptor
import org.linkedin.glu.orchestration.engine.action.descriptor.NoOpActionDescriptor
import org.linkedin.glu.orchestration.engine.agents.MountPointStateProvider
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.linkedin.glu.orchestration.engine.action.descriptor.ScriptTransitionActionDescriptor
import org.linkedin.glu.agent.rest.client.AgentFactory
import org.linkedin.util.annotations.Initializable
import org.linkedin.glu.orchestration.engine.action.descriptor.AgentActionDescriptor
import org.linkedin.glu.orchestration.engine.action.descriptor.AgentURIProvider
import org.linkedin.glu.agent.api.Agent
import org.linkedin.glu.agent.rest.client.EncryptionKeysProvider
import org.linkedin.util.clock.Timespan
import org.linkedin.glu.orchestration.engine.action.descriptor.ScriptLifecycleInstallActionDescriptor
import org.linkedin.glu.orchestration.engine.action.descriptor.ScriptLifecycleUninstallActionDescriptor
import org.linkedin.util.reflect.ObjectProxyBuilder
import org.linkedin.glu.orchestration.engine.agents.RecoverableAgent

/**
 * This implementation uses a convention:
 * @author yan@pongasoft.com */
public class ActionExecutionFactoryImpl implements ActionExecutionFactory
{
  public static final String MODULE = ActionExecutionFactoryImpl.class.getName();
  public static final Logger log = LoggerFactory.getLogger(MODULE);

  public static final String ENCRYPTION_KEYS = 'encryptionKeys'

  @Initializable(required = true)
  AgentFactory agentFactory

  @Initializable(required = true)
  AgentURIProvider agentURIProvider

  @Initializable
  MountPointStateProvider mountPointStateProvider

  @Initializable(required = false)
  EncryptionKeysProvider encryptionKeysProvider

  /**
   *  the timeout for the agent operations */
  @Initializable(required = false)
  Timespan timeout = Timespan.parse('10s')

  /**
   *  the timeout for state propagation (ZooKeeper) */
  @Initializable(required = false)
  Timespan timeoutForStatePropagation = Timespan.parse('2s')

  /**
   * when a communication exception is detected with the agent, it will sleep for this time
   * before trying again */
  @Initializable(required = false)
  Timespan agentRecoveryTimeout = Timespan.parse('5s')

  // wait for 10s (default) for the agent to restart
  @Initializable(required = false)
  Timespan selfUpgradeWaitForRestartTimeout = Timespan.parse("10s")

  /**
   * when a communication exception is detected with the agent, it will retry a certain number of
   * times */
  @Initializable(required = false)
  int agentRecoveryNumRetries = 10

  /**
   * For NoOpActionDescriptor: do nothing
   */
  def NoOpActionDescriptor_execution = { NoOpActionDescriptor ad ->
    // nothing to do (noop)
    if(log.isDebugEnabled())
      log.debug("noop: ${ad.toMetadata()}")
  }

  /**
   * For ScriptTransitionActionDescriptor: execute the action (transition) on the agent and wait
   * for the action to complete
   */
  def ScriptTransitionActionDescriptor_execution = { ScriptTransitionActionDescriptor ad ->
    withAgent(ad) { Agent agent ->

      String mountPoint = ad.mountPoint

      // 1. we clear any error which could be left over
      agent.clearError(mountPoint: mountPoint)

      // 2. we execute the transition action
      Map actionArgs = computeActionArgs(ad)
      agent.executeAction(mountPoint: mountPoint, action: ad.action, actionArgs: actionArgs)

      // // TODO MED YP: this is somewhat hacky but it will do for now
      if(mountPoint == "/self/upgrade")
      {
        if(ad.action == 'prepare' || ad.action == 'rollback')
        {
          if(log.isDebugEnabled())
            log.debug("sleeping before waiting for state for ${ad.action}")
          Thread.sleep(selfUpgradeWaitForRestartTimeout.durationInMilliseconds)
        }
      }

      // 3. we wait for the action to be completed
      def success = false
      while(!success)
      {
        success = agent.waitForState(mountPoint: mountPoint, state: ad.toState, timeout: timeout)
        if(!success)
        {
          if(Thread.currentThread().isInterrupted())
          {
            agent.interruptAction(mountPoint: mountPoint, action: ad.action)
            throw new InterruptedException()
          }
        }
      }

      // 4. we wait for the state to propagate through ZooKeeper (glu-134)
      if(mountPointStateProvider)
      {
        success = false
        while(!success)
        {
          success = mountPointStateProvider.waitForState(ad.fabric,
                                                         ad.agent,
                                                         mountPoint,
                                                         ad.toState,
                                                         timeoutForStatePropagation)
          if(!success)
          {
            if(Thread.currentThread().isInterrupted())
            {
              // we know that the action already completed (step 3) but somehow
              // it did not propagate yet to ZooKeeper and has been interrupted
              throw new InterruptedException()
            }
          }
        }
      }
    }
  }

  /**
   * For ScriptLifecycleInstallActionDescriptor: installs the script
   */
  def ScriptLifecycleInstallActionDescriptor_execution = { ScriptLifecycleInstallActionDescriptor ad ->
    withAgent(ad) { Agent agent ->
      def args =
      [
        mountPoint: ad.mountPoint,
        parent: ad.parent,
        initParameters: ad.initParameters
      ]
      if(ad.script instanceof Map)
        args.putAll(ad.script)
      else
        args.scriptLocation = ad.script
      agent.installScript(args)
    }
  }

  /**
   * For ScriptLifecycleUninstallActionDescriptor: uninstalls the script
   */
  def ScriptLifecycleUninstallActionDescriptor_execution = { ScriptLifecycleUninstallActionDescriptor ad ->
    withAgent(ad) { Agent agent ->
      agent.clearError(mountPoint: ad.mountPoint)

      agent.uninstallScript(mountPoint: ad.mountPoint)
    }
  }

  /**
   * Compute the action args (automatically adds encryption keys if any present)
   */
  Map computeActionArgs(ScriptTransitionActionDescriptor ad)
  {
    def Map args = [ : ]

    Map encryptionKeys = encryptionKeysProvider?.getEncryptionKeys()

    if (encryptionKeys) {
      args.put(ENCRYPTION_KEYS, encryptionKeys)
    }

    if(ad.actionArgs)
      args.putAll(ad.actionArgs)

    return args
  }

  /**
   * Compute the agent URI and call the closure with the {@link Agent}.
   */
  private def withAgent(AgentActionDescriptor ad, Closure closure)
  {
    agentFactory.withRemoteAgent(agentURIProvider.getAgentURI(ad.fabric, ad.agent)) { Agent agent ->
      def agentProxy = new RecoverableAgent(agent, agentRecoveryNumRetries, agentRecoveryTimeout)
      agent = ObjectProxyBuilder.createProxy(agentProxy, Agent.class)
      closure(agent)
    }
  }

  @Override
  <V> ActionExecution<V> createAction(ActionDescriptor actionDescriptor)
  {
    Closure actionClosure = this."${actionDescriptor.class.simpleName}_execution"

    return new ClosureActionExecution<V>(actionDescriptor: actionDescriptor,
                                         actionClosure: actionClosure)
  }
}

{'repo_name': 'pongasoft/glu', 'stars': '515', 'repo_language': 'Groovy', 'file_name': 'TestPluginService.groovy', 'mime_type': 'text/x-c++', 'hash': -2363547026482988962, 'source_dataset': 'data'}


/*
 * Copyright (C) 2015 Ericsson AB. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer
 *    in the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name of Ericsson nor the names of its contributors
 *    may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#pragma once

#if ENABLE(WEB_RTC)

#include "IceCandidate.h"
#include "MediaPayload.h"
#include "RealtimeMediaSource.h"
#include <wtf/Vector.h>

namespace WebCore {

struct PeerMediaDescription {
    void addPayload(MediaPayload&& payload) { payloads.append(WTFMove(payload)); }
    void addSsrc(unsigned ssrc) { ssrcs.append(ssrc); }
    void clearSsrcs() { ssrcs.clear(); }
    void addIceCandidate(IceCandidate&& candidate) { iceCandidates.append(WTFMove(candidate)); }

    String type;
    unsigned short port { 9 };
    String address { "0.0.0.0"_s };
    String mode { "sendrecv"_s };
    String mid;

    Vector<MediaPayload> payloads;

    bool rtcpMux { true };
    String rtcpAddress;
    unsigned short rtcpPort { 0 };

    String mediaStreamId;
    String mediaStreamTrackId;

    String dtlsSetup { "actpass"_s };
    String dtlsFingerprintHashFunction;
    String dtlsFingerprint;

    Vector<unsigned> ssrcs;
    String cname;

    String iceUfrag;
    String icePassword;
    Vector<IceCandidate> iceCandidates;
};

} // namespace WebCore

#endif // ENABLE(WEB_RTC)

{'repo_name': 'ultralight-ux/WebCore', 'stars': '113', 'repo_language': 'C++', 'file_name': 'WebKitTargetConditionals.xcconfig', 'mime_type': 'text/plain', 'hash': 3942265361458796315, 'source_dataset': 'data'}


{'repo_name': 'ritaswc/wechat_app_template', 'stars': '185', 'repo_language': 'JavaScript', 'file_name': 'bson.js', 'mime_type': 'text/plain', 'hash': 4546501991143518611, 'source_dataset': 'data'}