text:
panini
======
Requirements

PHP 5.5+
MYSQL 5.5+

Note:
'compiled' directory needs write permissions.


text:
package com.rtg.sam;

import htsjdk.samtools.SAMRecord;

import junit.framework.TestCase;

/**
 */
public class DuplicateSamFilterTest extends TestCase {

  public void testSingleEnd() {
    final DuplicateSamFilter dsf = new DuplicateSamFilter();

    assertFalse(dsf.acceptRecord(null));

    final SAMRecord rec1 = new SAMRecord(null);

    assertFalse(dsf.acceptRecord(rec1));

    rec1.setReadName("IronSheik");

    assertTrue(dsf.acceptRecord(rec1));

    rec1.setSecondaryAlignment(true);

    final SAMRecord rec2 = new SAMRecord(null);
    rec2.setReadName("Sabu");
    rec2.setSecondaryAlignment(true);

    final SAMRecord rec3 = new SAMRecord(null);
    rec3.setReadName("IronSheik");
    rec3.setSecondaryAlignment(true);

    assertTrue(dsf.acceptRecord(rec1));
    assertTrue(dsf.acceptRecord(rec2));
    assertFalse(dsf.acceptRecord(rec1));
    assertFalse(dsf.acceptRecord(rec3));
  }

  public void testPairedEnd() {
    final DuplicateSamFilter dsf = new DuplicateSamFilter();

    assertFalse(dsf.acceptRecord(null));

    final SAMRecord rec1f = new SAMRecord(null);

    assertFalse(dsf.acceptRecord(rec1f));

    final String firstReadName = "IronSheik";
    final String secondReadName = "Sabu";

    rec1f.setReadName(firstReadName);
    rec1f.setReadPairedFlag(true);
    rec1f.setFirstOfPairFlag(true);

    assertTrue(dsf.acceptRecord(rec1f));

    rec1f.setSecondaryAlignment(true);

    final SAMRecord rec2f = new SAMRecord(null);
    rec2f.setReadPairedFlag(true);
    rec2f.setFirstOfPairFlag(true);
    rec2f.setReadName(secondReadName);
    rec2f.setSecondaryAlignment(true);

    final SAMRecord rec3fdup = new SAMRecord(null);
    rec3fdup.setReadPairedFlag(true);
    rec3fdup.setFirstOfPairFlag(true);
    rec3fdup.setReadName(firstReadName);
    rec3fdup.setSecondaryAlignment(true);

    final SAMRecord rec1s = new SAMRecord(null);
    rec1s.setReadName(firstReadName);
    rec1s.setReadPairedFlag(true);
    rec1s.setFirstOfPairFlag(false);
    rec1s.setSecondaryAlignment(true);

    final SAMRecord rec2s = new SAMRecord(null);
    rec2s.setReadPairedFlag(true);
    rec2s.setFirstOfPairFlag(false);
    rec2s.setReadName(secondReadName);
    rec2s.setSecondaryAlignment(true);

    final SAMRecord rec3sdup = new SAMRecord(null);
    rec3sdup.setReadPairedFlag(true);
    rec3sdup.setFirstOfPairFlag(false);
    rec3sdup.setReadName(firstReadName);
    rec3sdup.setSecondaryAlignment(true);

    assertTrue(dsf.acceptRecord(rec1f));
    assertTrue(dsf.acceptRecord(rec1s));
    assertTrue(dsf.acceptRecord(rec2f));
    assertTrue(dsf.acceptRecord(rec2s));
    assertFalse(dsf.acceptRecord(rec1f));
    assertFalse(dsf.acceptRecord(rec1s));
    assertFalse(dsf.acceptRecord(rec3fdup));
    assertFalse(dsf.acceptRecord(rec3sdup));
  }
}

redpajama_set_name: RedPajamaGithub


text:
class CreateAssignmentsFromProjectsUsers  < ActiveRecord::Migration
  def change
    rename_table :projects_users, :assignments

    add_column :assignments, :title, :string, :default => nil
    add_column :assignments, :completed_at, :datetime, :default => nil
    add_column :assignments, :started_at, :datetime, :default => nil
  end
end


text:
// Copyright 2019 Google LLC
//
// 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.

/**
 * parseError() parses an error from iron-ajax.
 */
function parseError(originalError) {
  if (!originalError) {
    // error is undefined because its request is aborted programmatically.
    return null;
  }

  let error = {};

  if (originalError.response && originalError.response.message) {
    error.message = originalError.response.message;
    error.traceDump = originalError.response.traceDump;
  } else {
    error.message = 'Unexpected error occurred.';
    error.traceDump = 'It might be a network failure. Please try again' +
        ' in a moment.\nIf the problem persists, please report to' +
        ' clusterfuzz-dev [at] chromium [dot] org.';
  }

  return error;
}


text:
package com.google.aggregate.adtech.worker.model;

import com.google.scp.operator.protos.shared.backend.ErrorSummaryProto.ErrorSummary;

/**
 * Describes a category of error message, used to distinguish between processing or validation
 * failures reported by the {@link ErrorSummary} class.
 */
public enum ErrorCounter {
  ATTRIBUTION_REPORT_TO_MISMATCH,
  ATTRIBUTION_REPORT_TO_MALFORMED,
  ORIGINAL_REPORT_TIME_MISMATCH,
  ORIGINAL_REPORT_TIME_TOO_OLD,
  NUM_REPORTS_WITH_ERRORS,
  NUM_REPORTS_DEBUG_NOT_ENABLED
}


text:
package org.boon.validation;

public class ValidationException extends Exception {
    private String field;

    public ValidationException( String message, String field ) {
        super( message );
        this.field = field;
    }

    public String getField() {
        return field;
    }

    public void setField( String field ) {
        this.field = field;
    }

}


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Hello World</title>
  <link rel="stylesheet" href="css/todos.css"/>

Todos

        <input id="new-todo" type="text" placeholder="What needs to be done?">

main

        <input id="toggle-all" type="checkbox">
        Mark all as complete

        Clear completed

      Double-click to edit a todo.

      Created by

      Jérôme Gravel-Niquet.

Rewritten by: TodoMVC.


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace StageBitz.UserWeb.Company {

    public partial class CompanyFinanceHistory {

        /// <summary>
        /// lnkCompanyInventory control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlAnchor lnkCompanyInventory;

        /// <summary>
        /// lnkCompanyBilling control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlAnchor lnkCompanyBilling;

        /// <summary>
        /// spanCreateNewProject control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.HtmlControls.HtmlGenericControl spanCreateNewProject;

        /// <summary>
        /// lnkCreateNewProject control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.UserWeb.Controls.Project.CreateNewProjectLink lnkCreateNewProject;

        /// <summary>
        /// sbCompanyWarningDisplay control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.UserWeb.Controls.Project.CompanyWarningDisplay sbCompanyWarningDisplay;

        /// <summary>
        /// planMonitor control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.UserWeb.Controls.Company.PlanMonitor planMonitor;

        /// <summary>
        /// transactionSearch control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::StageBitz.UserWeb.Controls.Finance.TransactionSearch transactionSearch;
    }
}


text:
Extend rails_admin text fields with markitup-rails. Instead of lumping this all in to the rails_admin gem, or maintaining a fork, I've opted to make a small change to rails_admin which makes it easy for me extend it via this gem.

**NOTE:** Currently dependent on a forked branch of rails_admin (Waiting on pull request acceptance) https://github.com/robertjwhitney/rails_admin/tree/adds_plugins_js_for_extending

TODO:

- Make custom configuration of markitup js accessible outside of gem source.
- Don't autoload redcarpet if another rendering engine is desired.
- Tests

## Installation

Add this line to your application's Gemfile:

    gem 'rails_admin_markitup'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install rails_admin_markitup

## Usage

Include the plugin javascript by overriding the plugins.js manifest file at rails_admin/plugins.js

```javascript
//= require 'rails_admin_markitup/rails_admin_markitup'
```

Apply the custom type to any field you want in your rails_admin initializer:

```ruby
config.model 'Story' do
  edit do
    field :title
    field :body, :markitup
  end
end

```

To enable previews, mount the Markitup engine in `routes.rb`

```ruby
mount Markitup::Rails::Engine, at: "markitup", as: "markitup"
```

You can also use the built-in markdown helper to render the content in your views (via redcarpet)

```ruby
<%= parse_markdown("YOUR MARKDOWN CONTENT HERE") %>
```

Or define you own.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
exports.BattleScripts = {
        init: function() {
                        for (var i in this.data.Learnsets) {
                                if (i in normal) {
        	                        this.modData('Pokedex', i).types = ['Ghost'];
                                        this.modData('Learnsets', i).learnset.extremespeed = ['5L0'];
                                        this.modData('Learnsets', i).learnset.hypervoice = ['5L0'];
                                        this.modData('Learnsets', i).learnset.whirlwind = ['5L0'];
                                        this.modData('Learnsets', i).learnset.rapidspin = ['5L0'];
                                } else if (i in fire) {
                                        this.modData('Pokedex', i).types = ['Water'];
                                        this.modData('Learnsets', i).learnset.flareblitz = ['5L0'];
                                        this.modData('Learnsets', i).learnset.fireblast = ['5L0'];
                                        this.modData('Learnsets', i).learnset.willowisp = ['5L0'];
                                        this.modData('Learnsets', i).learnset.flamecharge = ['5L0'];
                                } else if (i in grass) {
                                        this.modData('Pokedex', i).types = ['Fire'];
                                        this.modData('Learnsets', i).learnset.woodhammer = ['5L0'];
                                        this.modData('Learnsets', i).learnset.leafstorm = ['5L0'];
                                        this.modData('Learnsets', i).learnset.leechseed = ['5L0'];
                                        this.modData('Learnsets', i).learnset.bulletseed = ['5L0'];
                                } else if (i in water) {
                                        this.modData('Pokedex', i).types = ['Grass'];
                                        this.modData('Learnsets', i).learnset.waterfall = ['5L0'];
                                        this.modData('Learnsets', i).learnset.surf = ['5L0'];
                                        this.modData('Learnsets', i).learnset.soak = ['5L0'];
                                        this.modData('Learnsets', i).learnset.aquajet = ['5L0'];
                                } else if (i in electric) {
                                        this.modData('Pokedex', i).types = ['Dark'];
                                        this.modData('Learnsets', i).learnset.wildcharge = ['5L0'];
                                        this.modData('Learnsets', i).learnset.thunderbolt = ['5L0'];
                                        this.modData('Learnsets', i).learnset.thunderwave = ['5L0'];
                                        this.modData('Learnsets', i).learnset.voltswitch = ['5L0'];
                                } else if (i in ground) {
                                        this.modData('Pokedex', i).types = ['Flying'];
                                        this.modData('Learnsets', i).learnset.earthquake = ['5L0'];
                                        this.modData('Learnsets', i).learnset.earthpower = ['5L0'];
                                        this.modData('Learnsets', i).learnset.spikes = ['5L0'];
                                        this.modData('Learnsets', i).learnset.bonemerang = ['5L0'];
                                } else if (i in poison) {
                                        this.modData('Pokedex', i).types = ['Steel'];
                                        this.modData('Learnsets', i).learnset.gunkshot = ['5L0'];
                                        this.modData('Learnsets', i).learnset.sludgewave = ['5L0'];
                                        this.modData('Learnsets', i).learnset.toxicspikes = ['5L0'];
                                        this.modData('Learnsets', i).learnset.coil = ['5L0'];
                                } else if (i in bug) {
                                        this.modData('Pokedex', i).types = ['Dragon'];
                                        this.modData('Learnsets', i).learnset.megahorn = ['5L0'];
                                        this.modData('Learnsets', i).learnset.bugbuzz = ['5L0'];
                                        this.modData('Learnsets', i).learnset.quiverdance = ['5L0'];
                                        this.modData('Learnsets', i).learnset.uturn = ['5L0'];
                                } else if (i in ice) {
                                        this.modData('Pokedex', i).types = ['Rock'];
                                        this.modData('Learnsets', i).learnset.iciclecrash = ['5L0'];
                                        this.modData('Learnsets', i).learnset.icebeam = ['5L0'];
                                        this.modData('Learnsets', i).learnset.haze = ['5L0'];
                                        this.modData('Learnsets', i).learnset.iceshard = ['5L0'];
                                } else if (i in fighting) {
                                        this.modData('Pokedex', i).types = ['Psychic'];
                                        this.modData('Learnsets', i).learnset.hijumpkick = ['5L0'];
                                        this.modData('Learnsets', i).learnset.aurasphere = ['5L0'];
                                        this.modData('Learnsets', i).learnset.bulkup = ['5L0'];
                                        this.modData('Learnsets', i).learnset.drainpunch = ['5L0'];
                                } else if (i in psychic) {
                                        this.modData('Pokedex', i).types = ['Fighting'];
                                        this.modData('Learnsets', i).learnset.zenheadbutt = ['5L0'];
                                        this.modData('Learnsets', i).learnset.psychic = ['5L0'];
                                        this.modData('Learnsets', i).learnset.trickroom = ['5L0'];
                                        this.modData('Learnsets', i).learnset.cosmicpower = ['5L0'];
                                } else if (i in flying) {
                                        this.modData('Pokedex', i).types = ['Ground'];
                                        this.modData('Learnsets', i).learnset.bravebird = ['5L0'];
                                        this.modData('Learnsets', i).learnset.hurricane = ['5L0'];
                                        this.modData('Learnsets', i).learnset.tailwind = ['5L0'];
                                        this.modData('Learnsets', i).learnset.airslash = ['5L0'];
                                } else if (i in rock) {
                                        this.modData('Pokedex', i).types = ['Ice'];
                                        this.modData('Learnsets', i).learnset.stoneedge = ['5L0'];
                                        this.modData('Learnsets', i).learnset.paleowave = ['5L0'];
                                        this.modData('Learnsets', i).learnset.stealthrock = ['5L0'];
                                        this.modData('Learnsets', i).learnset.rockblast = ['5L0'];
                                } else if (i in ghost) {
                                        this.modData('Pokedex', i).types = ['Normal'];
                                        this.modData('Learnsets', i).learnset.shadowstrike = ['5L0'];
                                        this.modData('Learnsets', i).learnset.shadowball = ['5L0'];
                                        this.modData('Learnsets', i).learnset.destinybond = ['5L0'];
                                        this.modData('Learnsets', i).learnset.nightshade = ['5L0'];
                                } else if (i in dark) {
                                        this.modData('Pokedex', i).types = ['Electric'];
                                        this.modData('Learnsets', i).learnset.crunch = ['5L0'];
                                        this.modData('Learnsets', i).learnset.darkpulse = ['5L0'];
                                        this.modData('Learnsets', i).learnset.nastyplot = ['5L0'];
                                        this.modData('Learnsets', i).learnset.fling = ['5L0'];
                                } else if (i in steel) {
                                        this.modData('Pokedex', i).types = ['Poison'];
                                        this.modData('Learnsets', i).learnset.ironhead = ['5L0'];
                                        this.modData('Learnsets', i).learnset.flashcannon = ['5L0'];
                                        this.modData('Learnsets', i).learnset.autotomize = ['5L0'];
                                        this.modData('Learnsets', i).learnset.geargrind = ['5L0'];
                                } else if (i in dragon) {
                                        this.modData('Pokedex', i).types = ['Bug'];
                                        this.modData('Learnsets', i).learnset.outrage = ['5L0'];
                                        this.modData('Learnsets', i).learnset.dracometeor = ['5L0'];
                                        this.modData('Learnsets', i).learnset.dragondance = ['5L0'];
                                        this.modData('Learnsets', i).learnset.dragontail = ['5L0'];
                                }
                        }
        }
};


text:
<?php

declare(strict_types=1);

namespace App\Entity;

use App\Entity\Common\IdTrait;
use App\Repository\CompanyTranslationRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslationTrait;

#[ORM\Entity(repositoryClass: CompanyTranslationRepository::class)]
class CompanyTranslation implements TranslationInterface
{
    use IdTrait;
    use TranslationTrait;

    #[ORM\Column(nullable: true)]
    private $title;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $description = null;

    public function getTitle(): ?string
    {
        return $this->title;
    }

    public function setTitle(?string $title): self
    {
        $this->title = $title;

        return $this;
    }

    public function getDescription(): ?string
    {
        return $this->description;
    }

    public function setDescription(?string $description): self
    {
        $this->description = $description;

        return $this;
    }
}


text:
{% if value %}
  {{ value|linebreaksbr }}
{% endif %}


text:
module Vectorise.Utils.Hoisting
  ( Inline(..)
  , addInlineArity
  , inlineMe

  , hoistBinding
  , hoistExpr
  , hoistVExpr
  , hoistPolyVExpr
  , takeHoisted
  )
where

import GhcPrelude

import Vectorise.Monad
import Vectorise.Env
import Vectorise.Vect
import Vectorise.Utils.Poly

import CoreSyn
import CoreUtils
import CoreUnfold
import Type
import Id
import BasicTypes  (Arity)
import FastString
import Control.Monad

-- Inline ---------------------------------------------------------------------

-- |Records whether we should inline a particular binding.
--
data Inline
        = Inline Arity
        | DontInline

-- |Add to the arity contained within an `Inline`, if any.
--
addInlineArity :: Inline -> Int -> Inline
addInlineArity (Inline m) n = Inline (m+n)
addInlineArity DontInline _ = DontInline

-- |Says to always inline a binding.
--
inlineMe :: Inline
inlineMe = Inline 0

-- Hoisting --------------------------------------------------------------------

hoistBinding :: Var -> CoreExpr -> VM ()
hoistBinding v e = updGEnv $ \env ->
  env { global_bindings = (v,e) : global_bindings env }

hoistExpr :: FastString -> CoreExpr -> Inline -> VM Var
hoistExpr fs expr inl
  = do
      var <- mk_inline `liftM` newLocalVar fs (exprType expr)
      hoistBinding var expr
      return var
  where
    mk_inline var = case inl of
                      Inline arity -> var `setIdUnfolding`
                                      mkInlineUnfoldingWithArity arity expr
                      DontInline   -> var

hoistVExpr :: VExpr -> Inline -> VM VVar
hoistVExpr (ve, le) inl
  = do
      fs <- getBindName
      vv <- hoistExpr ('v' `consFS` fs) ve inl
      lv <- hoistExpr ('l' `consFS` fs) le (addInlineArity inl 1)
      return (vv, lv)

-- |Hoist a polymorphic vectorised expression into a new top-level binding (representing a closure
-- function).
--
-- The hoisted expression is parameterised by (1) a set of type variables and (2) a set of value
-- variables that are passed as conventional type and value arguments.  The latter is implicitly
-- extended by the set of 'PA' dictionaries required for the type variables.
--
hoistPolyVExpr :: [TyVar] -> [Var] -> Inline -> VM VExpr -> VM VExpr
hoistPolyVExpr tvs vars inline p
  = do { inline' <- addInlineArity inline . (+ length vars) <$> polyArity tvs
       ; expr <- closedV . polyAbstract tvs $ \args ->
                   mapVect (mkLams $ tvs ++ args ++ vars) <$> p
       ; fn   <- hoistVExpr expr inline'
       ; let varArgs = varsToCoreExprs vars
       ; mapVect (\e -> e `mkApps` varArgs) <$> polyVApply (vVar fn) (mkTyVarTys tvs)
       }

takeHoisted :: VM [(Var, CoreExpr)]
takeHoisted
  = do
      env <- readGEnv id
      setGEnv $ env { global_bindings = [] }
      return $ global_bindings env


text:
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
  <link rel="stylesheet" type="text/css" href="css/application.css" />

Flatlander Crafted Gems

- an Angular store -

      <product-title></product-title>

    <product-gallery></product-gallery>

    <product-tabs></product-tabs>


text:
/* Get Programming with JavaScript
 * Listing 4.14
 * A function to display player information
 */

var player1;
var player2;
var player;
var showPlayerInfo;

player1 = {
    name: "Kandra",
    place: "The Dungeon of Doom",
    health: 50
};

player2 = {
    name: "Dax",
    place: "The Old Library",
    health: 40
};

showPlayerInfo = function () {
    console.log(player.name);
    console.log("------------------------------");
    console.log(player.name + " is in " + player.place);
    console.log(player.name + " has health " + player.health);
    console.log("------------------------------");
    console.log("");
};

player = player1;
showPlayerInfo();

player = player2;
showPlayerInfo();

/* Further Adventures
 *
 * 1) Write a function that just shows
 *    where the player is.
 *
 * 2) Write a function that just shows
 *    the player's health.
 *
 * 3) Change the showPlayerInfo function
 *    to use your two functions.
 *
 */


text:
package org.keycloak.authentication.authenticators.browser;

import org.jboss.logging.Logger;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.authentication.Authenticator;
import org.keycloak.constants.AdapterConstants;
import org.keycloak.models.IdentityProviderModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.services.Urls;
import org.keycloak.services.managers.ClientSessionCode;

import javax.ws.rs.core.Response;
import java.util.List;

/**
 * @author Stian Thorgersen
 */
public class IdentityProviderAuthenticator implements Authenticator {

    private static final Logger LOG = Logger.getLogger(IdentityProviderAuthenticator.class);

    @Override
    public void authenticate(AuthenticationFlowContext context) {
        if (context.getUriInfo().getQueryParameters().containsKey(AdapterConstants.KC_IDP_HINT)) {
            String providerId = context.getUriInfo().getQueryParameters().getFirst(AdapterConstants.KC_IDP_HINT);
            if (providerId == null || providerId.equals("")) {
                LOG.tracef("Skipping: kc_idp_hint query parameter is empty");
                context.attempted();
            } else {
                LOG.tracef("Redirecting: %s set to %s", AdapterConstants.KC_IDP_HINT, providerId);
                redirect(context, providerId);
            }
        } else if (context.getAuthenticatorConfig() != null && context.getAuthenticatorConfig().getConfig().containsKey(IdentityProviderAuthenticatorFactory.DEFAULT_PROVIDER)) {
            String defaultProvider = context.getAuthenticatorConfig().getConfig().get(IdentityProviderAuthenticatorFactory.DEFAULT_PROVIDER);
            LOG.tracef("Redirecting: default provider set to %s", defaultProvider);
            redirect(context, defaultProvider);
        } else {
            LOG.tracef("No default provider set or %s query parameter provided", AdapterConstants.KC_IDP_HINT);
            context.attempted();
        }
    }

    private void redirect(AuthenticationFlowContext context, String providerId) {
        List<IdentityProviderModel> identityProviders = context.getRealm().getIdentityProviders();
        for (IdentityProviderModel identityProvider : identityProviders) {
            if (identityProvider.isEnabled() && providerId.equals(identityProvider.getAlias())) {
                String accessCode = new ClientSessionCode<>(context.getSession(), context.getRealm(), context.getAuthenticationSession()).getCode();
                String clientId = context.getAuthenticationSession().getClient().getClientId();
                Response response = Response.seeOther(
                        Urls.identityProviderAuthnRequest(context.getUriInfo().getBaseUri(), providerId, context.getRealm().getName(), accessCode, clientId))
                        .build();

                LOG.debugf("Redirecting to %s", providerId);
                context.forceChallenge(response);
                return;
            }
        }

        LOG.warnf("Provider not found or not enabled for realm %s", providerId);
        context.attempted();
    }

    @Override
    public void action(AuthenticationFlowContext context) {
    }

    @Override
    public boolean requiresUser() {
        return false;
    }

    @Override
    public boolean configuredFor(KeycloakSession session, RealmModel realm, UserModel user) {
        return true;
    }

    @Override
    public void setRequiredActions(KeycloakSession session, RealmModel realm, UserModel user) {
    }

    @Override
    public void close() {
    }

}


text:
package it.finsiel.siged.mvc.presentation.action.protocollo;

import it.finsiel.siged.constant.Constants;
import it.finsiel.siged.model.InvioFascicolo;
import it.finsiel.siged.model.organizzazione.Utente;
import it.finsiel.siged.mvc.business.FascicoloDelegate;
import it.finsiel.siged.mvc.business.LookupDelegate;
import it.finsiel.siged.mvc.business.TitoliDestinatarioDelegate;
import it.finsiel.siged.mvc.presentation.actionform.protocollo.FascicoloForm;
import it.finsiel.siged.mvc.presentation.helper.DestinatarioView;
import it.finsiel.siged.mvc.vo.protocollo.DestinatarioVO;
import it.finsiel.siged.mvc.vo.protocollo.InvioFascicoliVO;
import it.finsiel.siged.util.DateUtil;
import it.finsiel.siged.util.StringUtil;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

public class InvioFascicoloAction extends Action {

    // ----------------------------------------------------- Instance Variables

    /**
     * The Log instance for this application.
     */
    static Logger logger = Logger.getLogger(InvioFascicoloAction.class
            .getName());

    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        ActionMessages errors = new ActionMessages();
        HttpSession session = request.getSession();
        FascicoloForm fascicoloForm = (FascicoloForm) form;

        Utente utente = (Utente) session.getAttribute(Constants.UTENTE_KEY);
        session.setAttribute("fascicoloForm", fascicoloForm);

        if (form == null) {
            logger.info(" Creating new InvioFascicoloAction");
            form = new FascicoloForm();
            request.setAttribute(mapping.getAttribute(), form);
        }
        if (request.getParameter("aggiungiDestinatario") != null) {

            errors = fascicoloForm.validateInvioProtocollo(mapping, request);
            if (!errors.isEmpty()) {
                saveErrors(request, errors);
            } else {
                aggiungiDestinatario(fascicoloForm, session);
            }

        } else if (request.getParameter("rimuoviDestinatari") != null) {
            String[] destinatari = fascicoloForm.getDestinatarioSelezionatoId();
            if (destinatari != null) {
                for (int i = 0; i < destinatari.length; i++) {
                    fascicoloForm.rimuoviDestinatario(destinatari[i]);
                    destinatari[i] = null;
                }
            } else {
                errors.add("rimuoviDestinatari", new ActionMessage(
                        "destinatario_rimuovi"));
                saveErrors(request, errors);
            }
        } else if (request.getParameter("cercaDestinatari") != null) {
            session.setAttribute("tornaInvioFascicolo", Boolean.TRUE);
            if ("F".equals(fascicoloForm.getTipoDestinatario())) {
                request.setAttribute("cognome", fascicoloForm
                        .getNominativoDestinatario());
                session.setAttribute("provenienza","personaFisicaFascicolo");
                return mapping.findForward("cercaPersonaFisica");
            } else {
                request.setAttribute("descrizioneDitta", fascicoloForm
                        .getNominativoDestinatario());
                session.setAttribute("provenienza","personaGiuridicaFacicolo");
                return mapping.findForward("cercaPersonaGiuridica");
            }
        } else if (request.getParameter("destinatarioId") != null
                && !request.getParameter("destinatarioId").equals("")) {
            String destinatarioId = (String) request
                    .getParameter("destinatarioId");
            aggiornaDestinatarioForm(destinatarioId, fascicoloForm);

        } else if (request.getParameter("btnAnnullaInvioProtocollo") != null) {
            return mapping.findForward("tornaFascicolo");
        } else if (request.getParameter("btnInvioProtocollo") != null) {
            errors = fascicoloForm.validateInvioProtocollo(mapping, request);
            if (!errors.isEmpty()) {
                saveErrors(request, errors);
            } else {
                InvioFascicolo invioF = new InvioFascicolo();
                aggiornaInvioFascicoloModel(fascicoloForm, invioF, utente);
                FascicoloDelegate fd = FascicoloDelegate.getInstance();

                String[] allegati = fascicoloForm
                        .getDocumentiAllegatiSelezionati();
                if (allegati != null) {
                    for (int i = 0; i < allegati.length; i++) {
                        if (Integer.parseInt(allegati[i]) == fascicoloForm
                                .getDocumentoPrincipaleSelezionato()) {
                            errors.add("documento", new ActionMessage(
                                    "selezione_allegati_invio_fascicolo", "",
                                    ""));
                            break;
                        }
                    }
                }
                if (!errors.isEmpty()) {
                    saveErrors(request, errors);
                } else {
                    if (fd.inviaFascicolo(invioF, utente.getValueObject()
                            .getUsername(),fascicoloForm.getVersione()) == 1) {
                        errors.add("invio_fascicolo", new ActionMessage(
                                "fascicolo_registrato", "Inviato",
                                "al protocollo"));
                    } else {
                        errors.add("invio_fascicolo", new ActionMessage(
                                "errore_nel_salvataggio"));
                    }
                    saveErrors(request, errors);
                    request.setAttribute("fascicoloId", new Integer(
                            fascicoloForm.getId()));
                    return mapping.findForward("tornaFascicolo");
                }
            }

        } else if (request.getParameter("btnAnnullaAction") != null) { // :TODO
            // da
            // Verificare
            fascicoloForm.setDestinatarioSelezionatoId(null);
            fascicoloForm.setDocumentoPrincipaleSelezionato(0);
            fascicoloForm.rimuoviDestinatari();
        }
        return (mapping.findForward("input"));
    }

    // private boolean isFascicoloScartabile(FascicoloForm fascicolo) {
    //
    // boolean closable = true;
    // Iterator it = fascicolo.getDocumentiFascicolo().iterator();
    // ProtocolloDelegate pd = ProtocolloDelegate.getInstance();
    // while (it.hasNext()) {
    // FileVO d = (FileVO) it.next();
    // if ("L".equals(d.getStatoDocumento())) {
    // closable = false;
    // break;
    // }
    // }
    // return closable;
    // }

    private void aggiornaInvioFascicoloModel(FascicoloForm form,
            InvioFascicolo invioFascicolo, Utente utente) {
        invioFascicolo.setFascicoloId(form.getId());
        aggiornaDestinatariModel(form, invioFascicolo, utente);
        aggiornaDocumentiModel(form, invioFascicolo, utente);
    }

    private void aggiornaDocumentiModel(FascicoloForm form,
            InvioFascicolo invioFascicolo, Utente utente) {
        Collection documentiInvio = new ArrayList();
        // documento principale
        int documentoPrincipaleId = form.getDocumentoPrincipaleSelezionato();
        documentiInvio.add(getDocumentoInvio(form, documentoPrincipaleId, "1",
                utente));
        // allegati
        String[] documenti = form.getDocumentiAllegatiSelezionati();
        if (documenti != null) {
            for (int i = 0; i < documenti.length; i++) {
                int documentoId = (new Integer(documenti[i])).intValue();
                documentiInvio.add(getDocumentoInvio(form, documentoId, "0",
                        utente));
            }
        }
        invioFascicolo.setDocumenti(documentiInvio);
    }

    private InvioFascicoliVO getDocumentoInvio(FascicoloForm form,
            int documentoId, String flagPrincipale, Utente utente) {
        int ufficioMittenteId = utente.getUfficioInUso();
        int utenteMittenteId = utente.getValueObject().getId().intValue();
        int aooId = utente.getUfficioVOInUso().getAooId();
        InvioFascicoliVO ifVO = new InvioFascicoliVO();
        ifVO.setAooId(aooId);
        ifVO.setDocumentoId(documentoId);
        ifVO.setFascicoloId(form.getId());
        ifVO.setFlagDocumentoPrincipale(flagPrincipale);
        ifVO.setUfficioMittenteId(ufficioMittenteId);
        ifVO.setUtenteMittenteId(utenteMittenteId);

        return ifVO;
    }

    // private void aggiornaDestinatariForm(ProtocolloUscita protocollo,
    // FascicoloForm form) {
    // Organizzazione org = Organizzazione.getInstance();
    // for (Iterator i = protocollo.getDestinatari().iterator(); i.hasNext();) {
    // DestinatarioVO destinatario = (DestinatarioVO) i.next();
    // DestinatarioView dest = new DestinatarioView();
    // dest.setDestinatario(destinatario.getDestinatario().trim());
    // dest
    // .setFlagTipoDestinatario(destinatario
    // .getFlagTipoDestinatario());
    // dest.setCitta(destinatario.getCitta());
    // dest.setEmail(destinatario.getEmail());
    // dest.setIndirizzo(destinatario.getIndirizzo());
    // dest.setMezzoSpedizione(destinatario.getMezzoSpedizione());
    // Date dataSped = destinatario.getDataSpedizione();
    // if (dataSped != null) {
    // dest.setDataSpedizione(DateUtil
    // .formattaData(dataSped.getTime()));
    // }
    // dest.setFlagConoscenza(destinatario.getFlagConoscenza());
    // form.aggiungiDestinatario(dest);
    // }
    // }

    private void aggiornaDestinatariModel(FascicoloForm form,
            InvioFascicolo invioF, Utente utente) {
        invioF.removeDestinatari();
        Collection destinatari = form.getDestinatari();
        // boolean spedito = false;
        if (destinatari != null) {
            for (Iterator i = destinatari.iterator(); i.hasNext();) {
                DestinatarioView dest = (DestinatarioView) i.next();
                DestinatarioVO destinatario = new DestinatarioVO();
                destinatario.setDestinatario(dest.getDestinatario());
                destinatario.setFlagTipoDestinatario(dest
                        .getFlagTipoDestinatario());
                destinatario.setEmail(dest.getEmail());
                destinatario.setIndirizzo(dest.getIndirizzo());
                destinatario.setCodicePostale(dest.getCapDestinatario());
                destinatario.setNote(dest.getNote());
                destinatario.setCitta(dest.getCitta());
                destinatario
                        .setTitoloDestinatario(dest.getTitoloDestinatario());
                // if (dest.getDataSpedizione() != null) {
                // spedito = true;
                // }
                destinatario.setDataSpedizione(DateUtil.toDate(dest
                        .getDataSpedizione()));
                destinatario.setFlagConoscenza(dest.getFlagConoscenza());
                invioF.addDestinatari(destinatario);
            }
        }
    }

   /* private void aggiornaDestinatarioForm(String id, FascicoloForm form) {
        DestinatarioView destinatario = new DestinatarioView();

        destinatario = form.getDestinatario(id);
        form.setTipoDestinatario(destinatario.getFlagTipoDestinatario());
        form.setNominativoDestinatario(destinatario.getDestinatario());
        form.setCitta(destinatario.getCitta());
        form.setEmailDestinatario(destinatario.getEmail());
        form.setIndirizzoDestinatario(destinatario.getIndirizzo());
        form.setDataSpedizione(destinatario.getDataSpedizione());
        form.setFlagConoscenza(destinatario.getFlagConoscenza());
        form.setDestinatarioMezzoId(destinatario.getDestinatarioMezzoId());
        form.setMezzoSpedizione("" + destinatario.getMezzoSpedizioneId());
    }*/

    private void aggiornaDestinatarioForm(String id, FascicoloForm form) {
        DestinatarioView destinatario = new DestinatarioView();
        form.setFlagConoscenza(false);
        destinatario = form.getDestinatario(id);
        form.setIdx(Integer.parseInt(id));
        form.setTipoDestinatario(destinatario.getFlagTipoDestinatario());
        form.setNominativoDestinatario(destinatario.getDestinatario());
        // if (form.getIndirizzoDestinatario()== null &&
        // (form.getIndirizzoDestinatario().equals(""))) {
        // form.setCitta("_");
        // }
        // else{
        String citta = "";
        if (destinatario.getCapDestinatario() != null) {
            citta = destinatario.getCapDestinatario();
        }
        if (destinatario.getCitta() != null) {
            if (citta.equals("")) {
                citta = destinatario.getCitta();
            } else {
                citta = citta + ' ' + destinatario.getCitta();
            }
        }
        form.setCitta(StringUtil.getStringa(citta));
        // }
        form.setEmailDestinatario(destinatario.getEmail());
        form.setIndirizzoDestinatario(destinatario.getIndirizzo());
        form.setCapDestinatario(destinatario.getCapDestinatario());
        form.setMezzoSpedizioneId(destinatario.getMezzoSpedizioneId());
        form.setTitoloDestinatario(TitoliDestinatarioDelegate.getInstance()
                .getTitoloDestinatario(destinatario.getTitoloId())
                .getDescription());
        form.setTitoloId(destinatario.getTitoloId());
        form.setDataSpedizione(destinatario.getDataSpedizione());
        form.setFlagConoscenza(destinatario.getFlagConoscenza());
        form.setNote(destinatario.getNote());
        form.setDestinatarioMezzoId(destinatario.getDestinatarioMezzoId());
    }

    private void aggiungiDestinatario(FascicoloForm form,
            HttpSession session) {
        DestinatarioView destinatario = new DestinatarioView();
        destinatario.setFlagTipoDestinatario(form.getTipoDestinatario());
        destinatario.setDestinatario(form.getNominativoDestinatario().trim());
        destinatario.setEmail(form.getEmailDestinatario());
        destinatario.setCapDestinatario(form.getCapDestinatario());
        destinatario.setCitta(form.getCitta());
        destinatario.setIndirizzo(form.getIndirizzoDestinatario());
        destinatario.setDataSpedizione(form.getDataSpedizione());
        destinatario.setMezzoSpedizioneId(form.getMezzoSpedizioneId());

        destinatario.setIdx(form.getIdx());
        String desc = LookupDelegate.getInstance().getDescMezzoSpedizione(
                form.getMezzoSpedizioneId()).getDescription();
        destinatario.setMezzoDesc(desc);

        destinatario.setTitoloDestinatario("--");
        destinatario.setTitoloId(form.getTitoloId());
        if (form.getTitoloId() > 0) {
            destinatario.setTitoloDestinatario(TitoliDestinatarioDelegate
                    .getInstance().getTitoloDestinatario(form.getTitoloId())
                    .getDescription());
        }
        destinatario.setNote(form.getNote());
        destinatario.setFlagConoscenza(form.getFlagConoscenza());
        form.aggiungiDestinatario(destinatario);
        form.inizializzaDestinatarioForm();
    }

}


text:
import resolve from 'rollup-plugin-node-resolve';

// Add here external dependencies that actually you use.
const globals = {
    '@angular/core': 'ng.core',
    '@angular/common': 'ng.common',
    'rxjs/Observable': 'Rx',
    'rxjs/Observer': 'Rx',
    'rxjs/add/operator/map': 'Rx'
};

export default {
    entry: './dist/modules/integrity-webview-client.es5.js',
    dest: './dist/bundles/integrity-webview-client.umd.js',
    format: 'umd',
    exports: 'named',
    moduleName: 'ng.integrityWebviewClient',
    plugins: [resolve()],
    external: Object.keys(globals),
    globals: globals,
    onwarn: () => { return }
}


text:
<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\ConsejocomunalSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Consejocomunals';
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a('Create Consejocomunal', ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'idConsejoComunal',
            'NombreConsejoComunal',
            'fechaInscripcionConsejoComunal',
            'Parroquias_idParroquias',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>translate.storage.subtitles.SubtitleUnit</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Home

         Trees

         Indices

         Help

Translate Toolkit

        Package translate ::
        Package storage ::
        Module subtitles ::
        Class SubtitleUnit

[hide private]

[frames] | no frames]

Class SubtitleUnit

source code

  <map id="uml_class_diagram_for_translat_270" name="uml_class_diagram_for_translat_270">
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#rich_parsers" title="A list of functions to use for parsing a string into a rich string tree." alt="" coords="17,28,316,47"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#source" title="translate.storage.base.TranslationUnit.source" alt="" coords="17,47,316,65"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#target" title="translate.storage.base.TranslationUnit.target" alt="" coords="17,65,316,84"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#rich_source" title="translate.storage.base.TranslationUnit.rich_source" alt="" coords="17,84,316,103"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#rich_target" title="translate.storage.base.TranslationUnit.rich_target" alt="" coords="17,103,316,121"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#xid" title="translate.storage.base.TranslationUnit.xid" alt="" coords="17,121,316,140"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#rid" title="translate.storage.base.TranslationUnit.rid" alt="" coords="17,140,316,159"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#__eq__" title="Compares two TranslationUnits." alt="" coords="17,161,316,180"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#__str__" title="Converts to a string representation that can be parsed back using  parsestring()." alt="" coords="17,180,316,199"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#rich_to_multistring" title="Convert a "rich" string tree to a multistring:" alt="" coords="17,199,316,217"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#multistring_to_rich" title="Convert a multistring to a list of "rich" string trees:" alt="" coords="17,217,316,236"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#setsource" title="Sets the source string to the given value." alt="" coords="17,236,316,255"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#settarget" title="Sets the target string to the given value." alt="" coords="17,255,316,273"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#gettargetlen" title="Returns the length of the target string." alt="" coords="17,273,316,292"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#setid" title="Sets the unique identified for this unit." alt="" coords="17,292,316,311"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#addlocation" title="Add one location to the list of locations." alt="" coords="17,311,316,329"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#addlocations" title="Add a location or a list of locations." alt="" coords="17,329,316,348"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#getcontext" title="Get the message context." alt="" coords="17,348,316,367"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#setcontext" title="Set the message context" alt="" coords="17,367,316,385"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#addnote" title="Adds a note (comment)." alt="" coords="17,385,316,404"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html#buildfromunit" title="Build a native unit from a foreign unit, preserving as much information as  possible." alt="" coords="17,423,316,441"/>
<area shape="rect" href="translate.storage.base.TranslationUnit-class.html" title="Base class for translation units." alt="" coords="16,11,317,443"/>
<area shape="rect" href="translate.storage.subtitles.SubtitleUnit-class.html#__init__" title="Constructs a TranslationUnit containing the given source string." alt="" coords="31,497,303,516"/>
<area shape="rect" href="translate.storage.subtitles.SubtitleUnit-class.html#getnotes" title="Returns all notes about this unit." alt="" coords="31,516,303,535"/>
<area shape="rect" href="translate.storage.subtitles.SubtitleUnit-class.html#getlocations" title="A list of source code locations." alt="" coords="31,535,303,553"/>
<area shape="rect" href="translate.storage.subtitles.SubtitleUnit-class.html#getid" title="A unique identifier for this unit." alt="" coords="31,553,303,572"/>
<area shape="rect" href="translate.storage.subtitles.SubtitleUnit-class.html" title="A subtitle entry that is translatable" alt="" coords="29,472,304,573"/>
</map>

A subtitle entry that is translatable

        Instance Methods
        [hide private]

          __init__(self,
        source=None,
        encoding="utf_8")

      Constructs a TranslationUnit containing the given source string.

            source code

      string

          getid(self)

      A unique identifier for this unit.

            source code

Inherited from base.TranslationUnit:
      __eq__,
      __str__,
      getcontext,
      getunits,
      hasplural,
      isblank,
      isfuzzy,
      isheader,
      isobsolete,
      isreview,
      istranslatable,
      istranslated,
      makeobsolete,
      markfuzzy,
      markreviewneeded,
      merge,
      multistring_to_rich,
      setcontext,
      setid,
      unit_iter

Inherited from object:
      __delattr__,
      __getattribute__,
      __hash__,
      __new__,
      __reduce__,
      __reduce_ex__,
      __repr__,
      __setattr__

      Source

Inherited from base.TranslationUnit:
      getsourcelanguage,
      setsource

Inherited from base.TranslationUnit (private):
      _get_rich_source,
      _set_rich_source

      Target

Inherited from base.TranslationUnit:
      gettargetlanguage,
      gettargetlen,
      settarget

Inherited from base.TranslationUnit (private):
      _get_rich_target,
      _set_rich_target

      Notes

          getnotes(self,
        origin=None)

      Returns all notes about this unit.

            source code

Inherited from base.TranslationUnit:
      addnote,
      removenotes

      Locations

      List

          getlocations(self)

      A list of source code locations.

            source code

Inherited from base.TranslationUnit:
      addlocation,
      addlocations

      Errors

Inherited from base.TranslationUnit:
      adderror,
      geterrors

        Class Methods
        [hide private]

Inherited from base.TranslationUnit:
      buildfromunit,
      rich_to_multistring

        Class Variables
        [hide private]

Inherited from base.TranslationUnit:
      rich_parsers

        Properties
        [hide private]

Inherited from base.TranslationUnit:
      rid,
      xid

Inherited from object:
      __class__

      Source

Inherited from base.TranslationUnit:
      rich_source,
      source

      Target

Inherited from base.TranslationUnit:
      rich_target,
      target

        Method Details
        [hide private]

__init__(self,
        source=None,
        encoding="utf_8")

(Constructor)

  	source code

Constructs a TranslationUnit containing the given source string.

Overrides:
        object.__init__

(inherited documentation)

getnotes(self,
        origin=None)

  	source code

Returns all notes about this unit.

It will probably be freeform text or something reasonable that can be
  synthesised by the format. It should not include location comments (see
  getlocations()).

Overrides:
        base.TranslationUnit.getnotes

(inherited documentation)

getlocations(self)

  	source code

A list of source code locations.

Returns: List

Overrides:
        base.TranslationUnit.getlocations

(inherited documentation)

getid(self)

  	source code

A unique identifier for this unit.

Returns: string

an identifier for this unit that is unique in the store

Derived classes should override this in a way that guarantees
          a unique identifier for each unit in the store.

Overrides:
        base.TranslationUnit.getid

(inherited documentation)

         Home

         Trees

         Indices

         Help

Translate Toolkit

    Generated by Epydoc 3.0.1 on Wed Mar  3 16:37:43 2010

      http://epydoc.sourceforge.net


text:
package java.lang;

import java.io.*;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.AllPermission;
import java.nio.channels.Channel;
import java.nio.channels.spi.SelectorProvider;
import sun.nio.ch.Interruptible;
import sun.net.InetAddressCachePolicy;
import sun.reflect.Reflection;
import sun.security.util.SecurityConstants;
import sun.reflect.annotation.AnnotationType;

/**
 * The System class contains several useful class fields
 * and methods. It cannot be instantiated.
 *
 *
Among the facilities provided by the System class
 * are standard input, standard output, and error output streams;
 * access to externally defined properties and environment
 * variables; a means of loading files and libraries; and a utility
 * method for quickly copying a portion of an array.
 *
 * @author  unascribed
 * @since   JDK1.0
 */
public final class System {

    /* First thing---register the natives */
    private static native void registerNatives();
    static {
        registerNatives();
    }

    /** Don't let anyone instantiate this class */
    private System() {
    }

    /**
     * The "standard" input stream. This stream is already
     * open and ready to supply input data. Typically this stream
     * corresponds to keyboard input or another input source specified by
     * the host environment or user.
     */
    public final static InputStream in = nullInputStream();

    /**
     * The "standard" output stream. This stream is already
     * open and ready to accept output data. Typically this stream
     * corresponds to display output or another output destination
     * specified by the host environment or user.
     *

     * For simple stand-alone Java applications, a typical way to write
     * a line of output data is:
     *

     *     System.out.println(data)
     *

     *

     * See the println methods in class PrintStream.
     *
     * @see     java.io.PrintStream#println()
     * @see     java.io.PrintStream#println(boolean)
     * @see     java.io.PrintStream#println(char)
     * @see     java.io.PrintStream#println(char[])
     * @see     java.io.PrintStream#println(double)
     * @see     java.io.PrintStream#println(float)
     * @see     java.io.PrintStream#println(int)
     * @see     java.io.PrintStream#println(long)
     * @see     java.io.PrintStream#println(java.lang.Object)
     * @see     java.io.PrintStream#println(java.lang.String)
     */
    public final static PrintStream out = nullPrintStream();

    /**
     * The "standard" error output stream. This stream is already
     * open and ready to accept output data.
     *

     * Typically this stream corresponds to display output or another
     * output destination specified by the host environment or user. By
     * convention, this output stream is used to display error messages
     * or other information that should come to the immediate attention
     * of a user even if the principal output stream, the value of the
     * variable out, has been redirected to a file or other
     * destination that is typically not continuously monitored.
     */
    public final static PrintStream err = nullPrintStream();

    /* The security manager for the system.
     */
    private static volatile SecurityManager security = null;

    /**
     * Reassigns the "standard" input stream.
     *
     *
First, if there is a security manager, its checkPermission
     * method is called with a RuntimePermission("setIO") permission
     *  to see if it's ok to reassign the "standard" input stream.
     *

     *
     * @param in the new standard input stream.
     *
     * @throws SecurityException
     *        if a security manager exists and its
     *        checkPermission method doesn't allow
     *        reassigning of the standard input stream.
     *
     * @see SecurityManager#checkPermission
     * @see java.lang.RuntimePermission
     *
     * @since   JDK1.1
     */
    public static void setIn(InputStream in) {
        checkIO();
        setIn0(in);
    }

    /**
     * Reassigns the "standard" output stream.
     *
     *
First, if there is a security manager, its checkPermission
     * method is called with a RuntimePermission("setIO") permission
     *  to see if it's ok to reassign the "standard" output stream.
     *
     * @param out the new standard output stream
     *
     * @throws SecurityException
     *        if a security manager exists and its
     *        checkPermission method doesn't allow
     *        reassigning of the standard output stream.
     *
     * @see SecurityManager#checkPermission
     * @see java.lang.RuntimePermission
     *
     * @since   JDK1.1
     */
    public static void setOut(PrintStream out) {
        checkIO();
        setOut0(out);
    }

    /**
     * Reassigns the "standard" error output stream.
     *
     *
First, if there is a security manager, its checkPermission
     * method is called with a RuntimePermission("setIO") permission
     *  to see if it's ok to reassign the "standard" error output stream.
     *
     * @param err the new standard error output stream.
     *
     * @throws SecurityException
     *        if a security manager exists and its
     *        checkPermission method doesn't allow
     *        reassigning of the standard error output stream.
     *
     * @see SecurityManager#checkPermission
     * @see java.lang.RuntimePermission
     *
     * @since   JDK1.1
     */
    public static void setErr(PrintStream err) {
        checkIO();
        setErr0(err);
    }

    private static volatile Console cons = null;
    /**
     * Returns the unique {@link java.io.Console Console} object associated
     * with the current Java virtual machine, if any.
     *
     * @return  The system console, if any, otherwise <tt>null</tt>.
     *
     * @since   1.6
     */
     public static Console console() {
         if (cons == null) {
             synchronized (System.class) {
                 cons = sun.misc.SharedSecrets.getJavaIOAccess().console();
             }
         }
         return cons;
     }

    /**
     * Returns the channel inherited from the entity that created this
     * Java virtual machine.
     *
     *
 This method returns the channel obtained by invoking the
     * {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
     * inheritedChannel} method of the system-wide default
     * {@link java.nio.channels.spi.SelectorProvider} object.

     *
     *
 In addition to the network-oriented channels described in
     * {@link java.nio.channels.spi.SelectorProvider#inheritedChannel
     * inheritedChannel}, this method may return other kinds of
     * channels in the future.
     *
     * @return  The inherited channel, if any, otherwise <tt>null</tt>.
     *
     * @throws  IOException
     *          If an I/O error occurs
     *
     * @throws  SecurityException
     *          If a security manager is present and it does not
     *          permit access to the channel.
     *
     * @since 1.5
     */
    public static Channel inheritedChannel() throws IOException {
        return SelectorProvider.provider().inheritedChannel();
    }

    private static void checkIO() {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new RuntimePermission("setIO"));
        }
    }

    private static native void setIn0(InputStream in);
    private static native void setOut0(PrintStream out);
    private static native void setErr0(PrintStream err);

    /**
     * Sets the System security.
     *
     *
 If there is a security manager already installed, this method first
     * calls the security manager's checkPermission method
     * with a RuntimePermission("setSecurityManager")
     * permission to ensure it's ok to replace the existing
     * security manager.
     * This may result in throwing a SecurityException.
     *
     *
 Otherwise, the argument is established as the current
     * security manager. If the argument is null and no
     * security manager has been established, then no action is taken and
     * the method simply returns.
     *
     * @param      s   the security manager.
     * @exception  SecurityException  if the security manager has already
     *             been set and its checkPermission method
     *             doesn't allow it to be replaced.
     * @see #getSecurityManager
     * @see SecurityManager#checkPermission
     * @see java.lang.RuntimePermission
     */
    public static
    void setSecurityManager(final SecurityManager s) {
        try {
            s.checkPackageAccess("java.lang");
        } catch (Exception e) {
            // no-op
        }
        setSecurityManager0(s);
    }

    private static synchronized
    void setSecurityManager0(final SecurityManager s) {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            // ask the currently installed security manager if we
            // can replace it.
            sm.checkPermission(new RuntimePermission
                                     ("setSecurityManager"));
        }

        if ((s != null) && (s.getClass().getClassLoader() != null)) {
            // New security manager class is not on bootstrap classpath.
            // Cause policy to get initialized before we install the new
            // security manager, in order to prevent infinite loops when
            // trying to initialize the policy (which usually involves
            // accessing some security and/or system properties, which in turn
            // calls the installed security manager's checkPermission method
            // which will loop infinitely if there is a non-system class
            // (in this case: the new security manager class) on the stack).
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
                    s.getClass().getProtectionDomain().implies
                        (SecurityConstants.ALL_PERMISSION);
                    return null;
                }
            });
        }

        security = s;
        InetAddressCachePolicy.setIfNotSet(InetAddressCachePolicy.FOREVER);
    }

    /**
     * Gets the system security interface.
     *
     * @return  if a security manager has already been established for the
     *          current application, then that security manager is returned;
     *          otherwise, null is returned.
     * @see     #setSecurityManager
     */
    public static SecurityManager getSecurityManager() {
        return security;
    }

    /**
     * Returns the current time in milliseconds.  Note that
     * while the unit of time of the return value is a millisecond,
     * the granularity of the value depends on the underlying
     * operating system and may be larger.  For example, many
     * operating systems measure time in units of tens of
     * milliseconds.
     *
     *
 See the description of the class Date for
     * a discussion of slight discrepancies that may arise between
     * "computer time" and coordinated universal time (UTC).
     *
     * @return  the difference, measured in milliseconds, between
     *          the current time and midnight, January 1, 1970 UTC.
     * @see     java.util.Date
     */
    public static native long currentTimeMillis();

    /**
     * Returns the current value of the most precise available system
     * timer, in nanoseconds.
     *
     *
This method can only be used to measure elapsed time and is
     * not related to any other notion of system or wall-clock time.
     * The value returned represents nanoseconds since some fixed but
     * arbitrary time (perhaps in the future, so values may be
     * negative).  This method provides nanosecond precision, but not
     * necessarily nanosecond accuracy. No guarantees are made about
     * how frequently values change. Differences in successive calls
     * that span greater than approximately 292 years (263
     * nanoseconds) will not accurately compute elapsed time due to
     * numerical overflow.
     *
     *
 For example, to measure how long some code takes to execute:
     *

     *   long startTime = System.nanoTime();
     *   // ... the code being measured ...
     *   long estimatedTime = System.nanoTime() - startTime;
     *

     *
     * @return The current value of the system timer, in nanoseconds.
     * @since 1.5
     */
    public static native long nanoTime();

    /**
     * Copies an array from the specified source array, beginning at the
     * specified position, to the specified position of the destination array.
     * A subsequence of array components are copied from the source
     * array referenced by src to the destination array
     * referenced by dest. The number of components copied is
     * equal to the length argument. The components at
     * positions srcPos through
     * srcPos+length-1 in the source array are copied into
     * positions destPos through
     * destPos+length-1, respectively, of the destination
     * array.
     *

     * If the src and dest arguments refer to the
     * same array object, then the copying is performed as if the
     * components at positions srcPos through
     * srcPos+length-1 were first copied to a temporary
     * array with length components and then the contents of
     * the temporary array were copied into positions
     * destPos through destPos+length-1 of the
     * destination array.
     *

     * If dest is null, then a
     * NullPointerException is thrown.
     *

     * If src is null, then a
     * NullPointerException is thrown and the destination
     * array is not modified.
     *

     * Otherwise, if any of the following is true, an
     * ArrayStoreException is thrown and the destination is
     * not modified:
     *

     *
The src argument refers to an object that is not an
     *     array.
     *
The dest argument refers to an object that is not an
     *     array.
     *
The src argument and dest argument refer
     *     to arrays whose component types are different primitive types.
     *
The src argument refers to an array with a primitive
     *    component type and the dest argument refers to an array
     *     with a reference component type.
     *
The src argument refers to an array with a reference
     *    component type and the dest argument refers to an array
     *     with a primitive component type.
     *

     *

     * Otherwise, if any of the following is true, an
     * IndexOutOfBoundsException is
     * thrown and the destination is not modified:
     *

     *
The srcPos argument is negative.
     *
The destPos argument is negative.
     *
The length argument is negative.
     *
srcPos+length is greater than
     *     src.length, the length of the source array.
     *
destPos+length is greater than
     *     dest.length, the length of the destination array.
     *

     *

     * Otherwise, if any actual component of the source array from
     * position srcPos through
     * srcPos+length-1 cannot be converted to the component
     * type of the destination array by assignment conversion, an
     * ArrayStoreException is thrown. In this case, let
     * k be the smallest nonnegative integer less than
     * length such that src[srcPos+k]
     * cannot be converted to the component type of the destination
     * array; when the exception is thrown, source array components from
     * positions srcPos through
     * srcPos+k-1
     * will already have been copied to destination array positions
     * destPos through
     * destPos+k-1 and no other
     * positions of the destination array will have been modified.
     * (Because of the restrictions already itemized, this
     * paragraph effectively applies only to the situation where both
     * arrays have component types that are reference types.)
     *
     * @param      src      the source array.
     * @param      srcPos   starting position in the source array.
     * @param      dest     the destination array.
     * @param      destPos  starting position in the destination data.
     * @param      length   the number of array elements to be copied.
     * @exception  IndexOutOfBoundsException  if copying would cause
     *               access of data outside array bounds.
     * @exception  ArrayStoreException  if an element in the src
     *               array could not be stored into the dest array
     *               because of a type mismatch.
     * @exception  NullPointerException if either src or
     *               dest is null.
     */
    public static native void arraycopy(Object src,  int  srcPos,
                                        Object dest, int destPos,
                                        int length);

    /**
     * Returns the same hash code for the given object as
     * would be returned by the default method hashCode(),
     * whether or not the given object's class overrides
     * hashCode().
     * The hash code for the null reference is zero.
     *
     * @param x object for which the hashCode is to be calculated
     * @return  the hashCode
     * @since   JDK1.1
     */
    public static native int identityHashCode(Object x);

    /**
     * System properties. The following properties are guaranteed to be defined:
     *

     *
java.version
Java version number
     *
java.vendor
Java vendor specific string
     *
java.vendor.url
Java vendor URL
     *
java.home
Java installation directory
     *
java.class.version
Java class version number
     *
java.class.path
Java classpath
     *
os.name
Operating System Name
     *
os.arch
Operating System Architecture
     *
os.version
Operating System Version
     *
file.separator
File separator ("/" on Unix)
     *
path.separator
Path separator (":" on Unix)
     *
line.separator
Line separator ("\n" on Unix)
     *
user.name
User account name
     *
user.home
User home directory
     *
user.dir
User's current working directory
     *

     */

    private static Properties props;
    private static native Properties initProperties(Properties props);

    /**
     * Determines the current system properties.
     *

     * First, if there is a security manager, its
     * checkPropertiesAccess method is called with no
     * arguments. This may result in a security exception.
     *

     * The current set of system properties for use by the
     * {@link #getProperty(String)} method is returned as a
     * Properties object. If there is no current set of
     * system properties, a set of system properties is first created and
     * initialized. This set of system properties always includes values
     * for the following keys:
     *

     *
Key
     *     Description of Associated Value

     *
java.version
     *     Java Runtime Environment version

     *
java.vendor
     *     Java Runtime Environment vendor	</tr
     *
java.vendor.url
     *     Java vendor URL

     *
java.home
     *     Java installation directory

     *
java.vm.specification.version
     *     Java Virtual Machine specification version

     *
java.vm.specification.vendor
     *     Java Virtual Machine specification vendor

     *
java.vm.specification.name
     *     Java Virtual Machine specification name

     *
java.vm.version
     *     Java Virtual Machine implementation version

     *
java.vm.vendor
     *     Java Virtual Machine implementation vendor

     *
java.vm.name
     *     Java Virtual Machine implementation name

     *
java.specification.version
     *     Java Runtime Environment specification  version

     *
java.specification.vendor
     *     Java Runtime Environment specification  vendor

     *
java.specification.name
     *     Java Runtime Environment specification  name

     *
java.class.version
     *     Java class format version number

     *
java.class.path
     *     Java class path

     *
java.library.path
     *     List of paths to search when loading libraries

     *
java.io.tmpdir
     *     Default temp file path

     *
java.compiler
     *     Name of JIT compiler to use

     *
java.ext.dirs
     *     Path of extension directory or directories

     *
os.name
     *     Operating system name

     *
os.arch
     *     Operating system architecture

     *
os.version
     *     Operating system version

     *
file.separator
     *     File separator ("/" on UNIX)

     *
path.separator
     *     Path separator (":" on UNIX)

     *
line.separator
     *     Line separator ("\n" on UNIX)

     *
user.name
     *     User's account name

     *
user.home
     *     User's home directory

     *
user.dir
     *     User's current working directory

     *

     *

     * Multiple paths in a system property value are separated by the path
     * separator character of the platform.
     *

     * Note that even if the security manager does not permit the
     * getProperties operation, it may choose to permit the
     * {@link #getProperty(String)} operation.
     *
     * @return     the system properties
     * @exception  SecurityException  if a security manager exists and its
     *             checkPropertiesAccess method doesn't allow access
     *              to the system properties.
     * @see        #setProperties
     * @see        java.lang.SecurityException
     * @see        java.lang.SecurityManager#checkPropertiesAccess()
     * @see        java.util.Properties
     */
    public static Properties getProperties() {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPropertiesAccess();
        }

        return props;
    }

    /**
     * Sets the system properties to the Properties
     * argument.
     *

     * First, if there is a security manager, its
     * checkPropertiesAccess method is called with no
     * arguments. This may result in a security exception.
     *

     * The argument becomes the current set of system properties for use
     * by the {@link #getProperty(String)} method. If the argument is
     * null, then the current set of system properties is
     * forgotten.
     *
     * @param      props   the new system properties.
     * @exception  SecurityException  if a security manager exists and its
     *             checkPropertiesAccess method doesn't allow access
     *              to the system properties.
     * @see        #getProperties
     * @see        java.util.Properties
     * @see        java.lang.SecurityException
     * @see        java.lang.SecurityManager#checkPropertiesAccess()
     */
    public static void setProperties(Properties props) {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPropertiesAccess();
        }
        if (props == null) {
            props = new Properties();
            initProperties(props);
        }
        System.props = props;
    }

    /**
     * Gets the system property indicated by the specified key.
     *

     * First, if there is a security manager, its
     * checkPropertyAccess method is called with the key as
     * its argument. This may result in a SecurityException.
     *

     * If there is no current set of system properties, a set of system
     * properties is first created and initialized in the same manner as
     * for the getProperties method.
     *
     * @param      key   the name of the system property.
     * @return     the string value of the system property,
     *             or null if there is no property with that key.
     *
     * @exception  SecurityException  if a security manager exists and its
     *             checkPropertyAccess method doesn't allow
     *              access to the specified system property.
     * @exception  NullPointerException if key is
     *             null.
     * @exception  IllegalArgumentException if key is empty.
     * @see        #setProperty
     * @see        java.lang.SecurityException
     * @see        java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
     * @see        java.lang.System#getProperties()
     */
    public static String getProperty(String key) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPropertyAccess(key);
        }

        return props.getProperty(key);
    }

    /**
     * Gets the system property indicated by the specified key.
     *

     * First, if there is a security manager, its
     * checkPropertyAccess method is called with the
     * key as its argument.
     *

     * If there is no current set of system properties, a set of system
     * properties is first created and initialized in the same manner as
     * for the getProperties method.
     *
     * @param      key   the name of the system property.
     * @param      def   a default value.
     * @return     the string value of the system property,
     *             or the default value if there is no property with that key.
     *
     * @exception  SecurityException  if a security manager exists and its
     *             checkPropertyAccess method doesn't allow
     *             access to the specified system property.
     * @exception  NullPointerException if key is
     *             null.
     * @exception  IllegalArgumentException if key is empty.
     * @see        #setProperty
     * @see        java.lang.SecurityManager#checkPropertyAccess(java.lang.String)
     * @see        java.lang.System#getProperties()
     */
    public static String getProperty(String key, String def) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPropertyAccess(key);
        }

        return props.getProperty(key, def);
    }

    /**
     * Sets the system property indicated by the specified key.
     *

     * First, if a security manager exists, its
     * SecurityManager.checkPermission method
     * is called with a PropertyPermission(key, "write")
     * permission. This may result in a SecurityException being thrown.
     * If no exception is thrown, the specified property is set to the given
     * value.
     *

     *
     * @param      key   the name of the system property.
     * @param      value the value of the system property.
     * @return     the previous value of the system property,
     *             or null if it did not have one.
     *
     * @exception  SecurityException  if a security manager exists and its
     *             checkPermission method doesn't allow
     *             setting of the specified property.
     * @exception  NullPointerException if key or
     *             value is null.
     * @exception  IllegalArgumentException if key is empty.
     * @see        #getProperty
     * @see        java.lang.System#getProperty(java.lang.String)
     * @see        java.lang.System#getProperty(java.lang.String, java.lang.String)
     * @see        java.util.PropertyPermission
     * @see        SecurityManager#checkPermission
     * @since      1.2
     */
    public static String setProperty(String key, String value) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key,
                SecurityConstants.PROPERTY_WRITE_ACTION));
        }

        return (String) props.setProperty(key, value);
    }

    /**
     * Removes the system property indicated by the specified key.
     *

     * First, if a security manager exists, its
     * SecurityManager.checkPermission method
     * is called with a PropertyPermission(key, "write")
     * permission. This may result in a SecurityException being thrown.
     * If no exception is thrown, the specified property is removed.
     *

     *
     * @param      key   the name of the system property to be removed.
     * @return     the previous string value of the system property,
     *             or null if there was no property with that key.
     *
     * @exception  SecurityException  if a security manager exists and its
     *             checkPropertyAccess method doesn't allow
     *              access to the specified system property.
     * @exception  NullPointerException if key is
     *             null.
     * @exception  IllegalArgumentException if key is empty.
     * @see        #getProperty
     * @see        #setProperty
     * @see        java.util.Properties
     * @see        java.lang.SecurityException
     * @see        java.lang.SecurityManager#checkPropertiesAccess()
     * @since 1.5
     */
    public static String clearProperty(String key) {
        checkKey(key);
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new PropertyPermission(key, "write"));
        }

        return (String) props.remove(key);
    }

    private static void checkKey(String key) {
        if (key == null) {
            throw new NullPointerException("key can't be null");
        }
        if (key.equals("")) {
            throw new IllegalArgumentException("key can't be empty");
        }
    }

    /**
     * Gets the value of the specified environment variable. An
     * environment variable is a system-dependent external named
     * value.
     *
     *
If a security manager exists, its
     * {@link SecurityManager#checkPermission checkPermission}
     * method is called with a
     * {@link RuntimePermission}("getenv."+name)
     * permission.  This may result in a {@link SecurityException}
     * being thrown.  If no exception is thrown the value of the
     * variable name is returned.
     *
     *
System
     * properties and environment variables are both
     * conceptually mappings between names and values.  Both
     * mechanisms can be used to pass user-defined information to a
     * Java process.  Environment variables have a more global effect,
     * because they are visible to all descendants of the process
     * which defines them, not just the immediate Java subprocess.
     * They can have subtly different semantics, such as case
     * insensitivity, on different operating systems.  For these
     * reasons, environment variables are more likely to have
     * unintended side effects.  It is best to use system properties
     * where possible.  Environment variables should be used when a
     * global effect is desired, or when an external system interface
     * requires an environment variable (such as PATH).
     *
     *
On UNIX systems the alphabetic case of name is
     * typically significant, while on Microsoft Windows systems it is
     * typically not.  For example, the expression
     * System.getenv("FOO").equals(System.getenv("foo"))
     * is likely to be true on Microsoft Windows.
     *
     * @param  name the name of the environment variable
     * @return the string value of the variable, or null
     *         if the variable is not defined in the system environment
     * @throws NullPointerException if name is null
     * @throws SecurityException
     *         if a security manager exists and its
     *         {@link SecurityManager#checkPermission checkPermission}
     *         method doesn't allow access to the environment variable
     *         name
     * @see    #getenv()
     * @see    ProcessBuilder#environment()
     */
    public static String getenv(String name) {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new RuntimePermission("getenv."+name));
        }

        return ProcessEnvironment.getenv(name);
    }

    /**
     * Returns an unmodifiable string map view of the current system environment.
     * The environment is a system-dependent mapping from names to
     * values which is passed from parent to child processes.
     *
     *
If the system does not support environment variables, an
     * empty map is returned.
     *
     *
The returned map will never contain null keys or values.
     * Attempting to query the presence of a null key or value will
     * throw a {@link NullPointerException}.  Attempting to query
     * the presence of a key or value which is not of type
     * {@link String} will throw a {@link ClassCastException}.
     *
     *
The returned map and its collection views may not obey the
     * general contract of the {@link Object#equals} and
     * {@link Object#hashCode} methods.
     *
     *
The returned map is typically case-sensitive on all platforms.
     *
     *
If a security manager exists, its
     * {@link SecurityManager#checkPermission checkPermission}
     * method is called with a
     * {@link RuntimePermission}("getenv.*")
     * permission.  This may result in a {@link SecurityException} being
     * thrown.
     *
     *
When passing information to a Java subprocess,
     * system properties
     * are generally preferred over environment variables.
     *
     * @return the environment as a map of variable names to values
     * @throws SecurityException
     *         if a security manager exists and its
     *         {@link SecurityManager#checkPermission checkPermission}
     *         method doesn't allow access to the process environment
     * @see    #getenv(String)
     * @see    ProcessBuilder#environment()
     * @since  1.5
     */
    public static java.util.Map<String,String> getenv() {
        SecurityManager sm = getSecurityManager();
        if (sm != null) {
            sm.checkPermission(new RuntimePermission("getenv.*"));
        }

        return ProcessEnvironment.getenv();
    }

    /**
     * Terminates the currently running Java Virtual Machine. The
     * argument serves as a status code; by convention, a nonzero status
     * code indicates abnormal termination.
     *

     * This method calls the exit method in class
     * Runtime. This method never returns normally.
     *

     * The call System.exit(n) is effectively equivalent to
     * the call:
     *

     * Runtime.getRuntime().exit(n)
     *

     *
     * @param      status   exit status.
     * @throws  SecurityException
     *        if a security manager exists and its checkExit
     *        method doesn't allow exit with the specified status.
     * @see        java.lang.Runtime#exit(int)
     */
    public static void exit(int status) {
        Runtime.getRuntime().exit(status);
    }

    /**
     * Runs the garbage collector.
     *

     * Calling the gc method suggests that the Java Virtual
     * Machine expend effort toward recycling unused objects in order to
     * make the memory they currently occupy available for quick reuse.
     * When control returns from the method call, the Java Virtual
     * Machine has made a best effort to reclaim space from all discarded
     * objects.
     *

     * The call System.gc() is effectively equivalent to the
     * call:
     *

     * Runtime.getRuntime().gc()
     *

     *
     * @see     java.lang.Runtime#gc()
     */
    public static void gc() {
        Runtime.getRuntime().gc();
    }

    /**
     * Runs the finalization methods of any objects pending finalization.
     *

     * Calling this method suggests that the Java Virtual Machine expend
     * effort toward running the finalize methods of objects
     * that have been found to be discarded but whose finalize
     * methods have not yet been run. When control returns from the
     * method call, the Java Virtual Machine has made a best effort to
     * complete all outstanding finalizations.
     *

     * The call System.runFinalization() is effectively
     * equivalent to the call:
     *

     * Runtime.getRuntime().runFinalization()
     *

     *
     * @see     java.lang.Runtime#runFinalization()
     */
    public static void runFinalization() {
        Runtime.getRuntime().runFinalization();
    }

    /**
     * Enable or disable finalization on exit; doing so specifies that the
     * finalizers of all objects that have finalizers that have not yet been
     * automatically invoked are to be run before the Java runtime exits.
     * By default, finalization on exit is disabled.
     *
     *
If there is a security manager,
     * its checkExit method is first called
     * with 0 as its argument to ensure the exit is allowed.
     * This could result in a SecurityException.
     *
     * @deprecated  This method is inherently unsafe.  It may result in
     *      finalizers being called on live objects while other threads are
     *      concurrently manipulating those objects, resulting in erratic
     *      behavior or deadlock.
     * @param value indicating enabling or disabling of finalization
     * @throws  SecurityException
     *        if a security manager exists and its checkExit
     *        method doesn't allow the exit.
     *
     * @see     java.lang.Runtime#exit(int)
     * @see     java.lang.Runtime#gc()
     * @see     java.lang.SecurityManager#checkExit(int)
     * @since   JDK1.1
     */
    @Deprecated
    public static void runFinalizersOnExit(boolean value) {
        Runtime.getRuntime().runFinalizersOnExit(value);
    }

    /**
     * Loads a code file with the specified filename from the local file
     * system as a dynamic library. The filename
     * argument must be a complete path name.
     *

     * The call System.load(name) is effectively equivalent
     * to the call:
     *

     * Runtime.getRuntime().load(name)
     *

     *
     * @param      filename   the file to load.
     * @exception  SecurityException  if a security manager exists and its
     *             checkLink method doesn't allow
     *             loading of the specified dynamic library
     * @exception  UnsatisfiedLinkError  if the file does not exist.
     * @exception  NullPointerException if filename is
     *             null
     * @see        java.lang.Runtime#load(java.lang.String)
     * @see        java.lang.SecurityManager#checkLink(java.lang.String)
     */
    public static void load(String filename) {
        Runtime.getRuntime().load0(getCallerClass(), filename);
    }

    /**
     * Loads the system library specified by the libname
     * argument. The manner in which a library name is mapped to the
     * actual system library is system dependent.
     *

     * The call System.loadLibrary(name) is effectively
     * equivalent to the call
     *

     * Runtime.getRuntime().loadLibrary(name)
     *

     *
     * @param      libname   the name of the library.
     * @exception  SecurityException  if a security manager exists and its
     *             checkLink method doesn't allow
     *             loading of the specified dynamic library
     * @exception  UnsatisfiedLinkError  if the library does not exist.
     * @exception  NullPointerException if libname is
     *             null
     * @see        java.lang.Runtime#loadLibrary(java.lang.String)
     * @see        java.lang.SecurityManager#checkLink(java.lang.String)
     */
    public static void loadLibrary(String libname) {
        Runtime.getRuntime().loadLibrary0(getCallerClass(), libname);
    }

    /**
     * Maps a library name into a platform-specific string representing
     * a native library.
     *
     * @param      libname the name of the library.
     * @return     a platform-dependent native library name.
     * @exception  NullPointerException if libname is
     *             null
     * @see        java.lang.System#loadLibrary(java.lang.String)
     * @see        java.lang.ClassLoader#findLibrary(java.lang.String)
     * @since      1.2
     */
    public static native String mapLibraryName(String libname);

    /**
     * The following two methods exist because in, out, and err must be
     * initialized to null.  The compiler, however, cannot be permitted to
     * inline access to them, since they are later set to more sensible values
     * by initializeSystemClass().
     */
    private static InputStream nullInputStream() throws NullPointerException {
        if (currentTimeMillis() > 0) {
            return null;
        }
        throw new NullPointerException();
    }

    private static PrintStream nullPrintStream() throws NullPointerException {
        if (currentTimeMillis() > 0) {
            return null;
        }
        throw new NullPointerException();
    }

    /**
     * Initialize the system class.  Called after thread initialization.
     */
    private static void initializeSystemClass() {
        props = new Properties();
        initProperties(props);
        sun.misc.Version.init();
        FileInputStream fdIn = new FileInputStream(FileDescriptor.in);
        FileOutputStream fdOut = new FileOutputStream(FileDescriptor.out);
        FileOutputStream fdErr = new FileOutputStream(FileDescriptor.err);
        setIn0(new BufferedInputStream(fdIn));
        setOut0(new PrintStream(new BufferedOutputStream(fdOut, 128), true));
        setErr0(new PrintStream(new BufferedOutputStream(fdErr, 128), true));

        // Load the zip library now in order to keep java.util.zip.ZipFile
        // from trying to use itself to load this library later.
        loadLibrary("zip");

        // Setup Java signal handlers for HUP, TERM, and INT (where available).
        Terminator.setup();

        // The order in with the hooks are added here is important as it
        // determines the order in which they are run.
        // (1)Console restore hook needs to be called first.
        // (2)Application hooks must be run before calling deleteOnExitHook.
        Shutdown.add(sun.misc.SharedSecrets.getJavaIOAccess().consoleRestoreHook());
        Shutdown.add(ApplicationShutdownHooks.hook());
        Shutdown.add(sun.misc.SharedSecrets.getJavaIODeleteOnExitAccess());

        // Initialize any miscellenous operating system settings that need to be
        // set for the class libraries. Currently this is no-op everywhere except
        // for Windows where the process-wide error mode is set before the java.io
        // classes are used.
        sun.misc.VM.initializeOSEnvironment();

        // Set the maximum amount of direct memory.  This value is controlled
        // by the vm option -XX:MaxDirectMemorySize=<size>.  This method acts
        // as an initializer only if it is called before sun.misc.VM.booted().
        sun.misc.VM.maxDirectMemory();

        // Set a boolean to determine whether ClassLoader.loadClass accepts
        // array syntax.  This value is controlled by the system property
        // "sun.lang.ClassLoader.allowArraySyntax".  This method acts as
        // an initializer only if it is called before sun.misc.VM.booted().
        sun.misc.VM.allowArraySyntax();

        // Subsystems that are invoked during initialization can invoke
        // sun.misc.VM.isBooted() in order to avoid doing things that should
        // wait until the application class loader has been set up.
        sun.misc.VM.booted();

        // The main thread is not added to its thread group in the same
        // way as other threads; we must do it ourselves here.
        Thread current = Thread.currentThread();
        current.getThreadGroup().add(current);

        // Allow privileged classes outside of java.lang
        sun.misc.SharedSecrets.setJavaLangAccess(new sun.misc.JavaLangAccess(){
            public sun.reflect.ConstantPool getConstantPool(Class klass) {
                return klass.getConstantPool();
            }
            public void setAnnotationType(Class klass, AnnotationType type) {
                klass.setAnnotationType(type);
            }
            public AnnotationType getAnnotationType(Class klass) {
                return klass.getAnnotationType();
            }
            public <E extends Enum<E>>
                    E[] getEnumConstantsShared(Class<E> klass) {
                return klass.getEnumConstantsShared();
            }
            public void blockedOn(Thread t, Interruptible b) {
                t.blockedOn(b);
            }
        });
    }

    /* returns the class of the caller. */
    static Class getCallerClass() {
        // NOTE use of more generic Reflection.getCallerClass()
        return Reflection.getCallerClass(3);
    }
}