text:
// Copyright 2016 The Oppia Authors. All Rights Reserved.
//
// 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.

/**
 * @fileoverview End-to-end tests for testing accessibility features
 * and check for any console errors
 */

var action = require('../protractor_utils/action.js');
var general = require('../protractor_utils/general.js');
var waitFor = require('../protractor_utils/waitFor.js');
var users = require('../protractor_utils/users.js');
var workflow = require('../protractor_utils/workflow.js');

var LibraryPage = require('../protractor_utils/LibraryPage.js');
const { browser } = require('protractor');

var backButton = element(by.css('.protractor-test-back-button'));
var categoryBar = element(by.css(
  '.protractor-test-search-bar-dropdown-toggle'));
var continueButton = element(by.css('.protractor-test-continue-button'));
var mainContent = element(by.css('.protractor-test-main-content'));
var nextButton = element(by.css('.protractor-test-next-button'));
var oppiaLogo = element(by.css('.protractor-test-oppia-main-logo'));
var searchBar = element(by.css('.protractor-test-search-input'));
var skipLink = element(by.css('.protractor-test-skip-link'));

var EXPLORATION = {
  title: 'A new exploration',
  category: 'Learning',
  objective: 'The goal is to create a new exploration',
  language: 'English'
};

describe('screenreader and keyboard user accessibility features', function() {
  var oppiaContentContainer = element(
    by.css('.protractor-test-content-container'));
  var ERROR_MESSAGE = 'Content container taking too long to load';
  var libraryPage = null;
  var GET_STARTED_URL = 'http://localhost:9001/get-started';
  var COMMUNITY_LIBRARY_URL = 'http://localhost:9001/community-library';
  var LEARNER_DASHBOARD_URL = 'http://localhost:9001/learner-dashboard';
  var CREATOR_DASHBOARD_URL = 'http://localhost:9001/creator-dashboard';
  var ABOUT_URL = 'http://localhost:9001/about';
  var PREFERENCES_URL = 'http://localhost:9001/preferences';
  var PRIVACY_POLICY_URL = 'http://localhost:9001/privacy-policy';
  var DONATE_URL = 'http://localhost:9001/donate';

  var holdCtrlAndPressKey = async function(key) {
    await browser.actions().sendKeys(
      protractor.Key.chord(protractor.Key.CONTROL, key)).perform();
  };

  beforeAll(async function() {
    // Should create a user and login.
    await users.createAndLoginSuperAdminUser(
      'user11@accessibility.com', 'user11accessibility');
    libraryPage = new LibraryPage.LibraryPage();
  });

  afterAll(async function() {
    await users.logout();
  });

  var checkActionShortcuts = async function(key, elementToFocus) {
    await waitFor.presenceOf(elementToFocus, 'Element took too long to load');
    // Should move the focus to the elementToFocus.
    await browser.actions().sendKeys(key).perform();
    expect(
      await browser.driver.switchTo().activeElement()
        .getAttribute('class')).toEqual(
      await elementToFocus.getAttribute('class'));

    // Should move the focus away from the elementToFocus.
    // Tab must be pressed twice to move focus away from categoryBar.
    // The categoryBar shares the same class as the next element in DOM order.
    await browser.actions().sendKeys(protractor.Key.TAB).perform();
    await browser.actions().sendKeys(protractor.Key.TAB).perform();
    expect(
      await browser.driver.switchTo().activeElement()
        .getAttribute('class')).not.toEqual(
      await elementToFocus.getAttribute('class'));

    // Should move the focus back to the elementToFocus.
    await browser.actions().sendKeys(key).perform();
    expect(
      await browser.driver.switchTo().activeElement()
        .getAttribute('class')).toEqual(
      await elementToFocus.getAttribute('class'));
  };

  it('should skip to the main content element', async function() {
    await libraryPage.get();
    await browser.actions().sendKeys('s').perform();
    await action.click('Skip link', skipLink);
    expect(await mainContent.getAttribute('class')).toEqual(
      await (await browser.driver.switchTo().activeElement())
        .getAttribute('class'));
  });

  it('should navigate to the get-started page when ctrl+6 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('6');
      await waitFor.urlRedirection(GET_STARTED_URL);
    });

  it('should navigate to the community-library page when ctrl+1 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('1');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
    });

  it('should navigate to the learner-dashboard page when ctrl+2 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('2');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
    });

  it('should navigate to the creator-dashboard page when ctrl+3 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('3');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
    });

  it('should navigate to about page when ctrl+4 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('4');
      await waitFor.urlRedirection(ABOUT_URL);
    });

  it('should navigate to the notifications page when ctrl+5 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);
    });

  it('should navigate to the preferences page when ctrl+5 is pressed',
    async function() {
      await browser.get('get-started');
      await waitFor.urlRedirection(GET_STARTED_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('about');
      await waitFor.urlRedirection(ABOUT_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('privacy-policy');
      await waitFor.urlRedirection(PRIVACY_POLICY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('learner-dashboard');
      await waitFor.urlRedirection(LEARNER_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('donate');
      await waitFor.urlRedirection(DONATE_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('creator-dashboard');
      await waitFor.urlRedirection(CREATOR_DASHBOARD_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);

      await browser.get('community-library');
      await waitFor.urlRedirection(COMMUNITY_LIBRARY_URL);
      await waitFor.presenceOf(oppiaContentContainer, ERROR_MESSAGE);

      await holdCtrlAndPressKey('5');
      await waitFor.urlRedirection(PREFERENCES_URL);
    });

  it('should test the action shortcuts in library page',
    async function() {
      // Should test the skip to main content shortcut.
      await libraryPage.get();
      await waitFor.pageToFullyLoad();
      await checkActionShortcuts('/', searchBar);

      await libraryPage.get();
      await waitFor.pageToFullyLoad();
      await checkActionShortcuts('s', skipLink);

      await libraryPage.get();
      await waitFor.pageToFullyLoad();
      await checkActionShortcuts('c', categoryBar);
    });

  it('should move focus to skip to main content button in exploration player',
    async function() {
      // Should create and play a dummy exploration.
      await workflow.createAndPublishTwoCardExploration(
        EXPLORATION.title,
        EXPLORATION.category,
        EXPLORATION.objective,
        EXPLORATION.language,
        true
      );
      await libraryPage.get();
      await libraryPage.findExploration('A new exploration');
      await libraryPage.playExploration('A new exploration');

      // Should test the skip to main content shortcut.
      await checkActionShortcuts('s', skipLink);
    });

  it('should move focus to next and back buttons in exploration player',
    async function() {
      // Play a dummy exploration.
      await libraryPage.get();
      await libraryPage.findExploration('A new exploration');
      await libraryPage.playExploration('A new exploration');
      // Do not change order of actions below.
      // The exploration needs to be navigated in a specific order.

      // Should press 'j' key to navigate to the next card.
      await waitFor.elementToBeClickable(continueButton);
      await checkActionShortcuts('j', continueButton);
      await browser.actions().sendKeys(protractor.Key.ENTER).perform();

      // Should press 'k' key to navigate to the previous card.
      await waitFor.elementToBeClickable(backButton);
      await checkActionShortcuts('k', backButton);
      await browser.actions().sendKeys(protractor.Key.ENTER).perform();

      // Should press 'j' key to navigate to the next card.
      await waitFor.elementToBeClickable(nextButton);
      await checkActionShortcuts('j', nextButton);
      await browser.actions().sendKeys(protractor.Key.ENTER).perform();

      // Should safely exit out of the exploration.
      await action.click('Oppia Logo', oppiaLogo);
    });

  afterEach(async function() {
    await general.checkForConsoleErrors([]);
  });
});

describe('Cache Slugs', function() {
  it('should check that errors get logged for missing resources',
    async function() {
      await browser.get('/console_errors');
      var expectedErrors = [
        'http://localhost:9001/build/fail/logo/288x128_logo_white.png',
        'http://localhost:9001/build/fail/logo/288x128_logo_white.webp'
      ];
      await general.checkForConsoleErrors(expectedErrors);
    });
});


text:
FactoryGirl.define do
  factory :user do
    email "example@example.com"
    password "secret1234"
    password_confirmation "secret1234"
  end
end

redpajama_set_name: RedPajamaGithub


text:
using Assets.Scripts.Utils.Views;

namespace Assets.Scripts.Tests.Views
{
    public class GameView : ViewBase
    {
        public MainMenuView MainMenuView;

        public override void OnBackKey()
        {
            SwitchTo(MainMenuView);
        }
	}
}


text:
package com.amazonaws.services.directory.model;

import com.amazonaws.AmazonServiceException;

/**
 *

 * The maximum number of manual snapshots for the directory has been reached.
 * You can use the GetSnapshotLimits operation to determine the snapshot
 * limits for a directory.
 *

 */
public class SnapshotLimitExceededException extends AmazonServiceException {
    private static final long serialVersionUID = 1L;

    @com.fasterxml.jackson.annotation.JsonProperty("RequestId")
    private String requestId;

    /**
     * Constructs a new SnapshotLimitExceededException with the specified error
     * message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public SnapshotLimitExceededException(String message) {
        super(message);
    }

    /**
     * @param requestId
     */

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    /**
     * @return
     */

    public String getRequestId() {
        return this.requestId;
    }

    /**
     * @param requestId
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */

    public SnapshotLimitExceededException withRequestId(String requestId) {
        setRequestId(requestId);
        return this;
    }

}


text:
layout: post97
title:  Admin API
categories: XAP97
parent: administration-and-monitoring-overview.html
weight: 100
---

{% summary%}{% endsummary %}

{%comment%}
{%section%}
{%column width=50% %}
# Overview
The Admin API provides a way to administer and monitor all of GigaSpaces services and components using a simple API. The API provides information and the ability to operate on the currently running [GigaSpaces Agent](/product_overview/service-grid.html#gsa), [GigaSpaces Manager](/product_overview/service-grid.html#gsm), [GigaSpaces Container](/product_overview/service-grid.html#gsc), [Lookup Service](/product_overview/service-grid.html#lus), [Processing Unit](./packaging-and-deployment.html) and Spaces.
{%endcolumn%}
{%column width=45% %}
![archi_manag.jpg](/attachment_files/archi_manag.jpg)
{%endcolumn%}
{%endsection%}

{% tip %}
You can use the [GigaSpaces Universal Deployer](/sbp/universal-deployer.html) to deploy complex multi processing unit applications.
{% endtip %}

{%endcomment%}

Before diving into the Admin API, here are some code examples showing how the Admin API can be used to display information on the of currently deployed services / components:

{% inittab admin_test|top %}
{% tabcontent GSA %}

{% highlight java %}

Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
for (GridServiceAgent gsa : admin.getGridServiceAgents()) {
    System.out.println("GSA [" + gsa.getUid() + "] running on Machine [" + gsa.getMachine().getHostAddress());
    for (AgentProcessDetails processDetails : gsa.getProcessesDetails()) {
        System.out.println("   -> Process [" + Arrays.toString(processDetails.getCommand()) + "]");
    }
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent GSM %}

{% highlight java %}

Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
for (GridServiceManager gsm : admin.getGridServiceManagers()) {
    System.out.println("GSM [" + gsm.getUid() + "] running on Machine " + gsm.getMachine().getHostAddress());
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent GSC %}

{% highlight java %}

Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
for (GridServiceContainer gsc : admin.getGridServiceContainers()) {
    System.out.println("GSC [" + gsc.getUid() + "] running on Machine " + gsc.getMachine().getHostAddress());
    for (ProcessingUnitInstance puInstance : gsc.getProcessingUnitInstances()) {
        System.out.println("   -> PU [" + puInstance.getName() + "][" +
        puInstance.getInstanceId() + "][" + puInstance.getBackupId() + "]");
    }
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent Processing Unit %}

{% highlight java %}
Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
for (ProcessingUnit processingUnit : admin.getProcessingUnits()) {
    System.out.println("Processing Unit: " + processingUnit.getName() + " status: " + processingUnit.getStatus());
    if (processingUnit.isManaged()) {
        System.out.println("   -> Managing GSM: " + processingUnit.getManagingGridServiceManager().getUid());
    } else {
        System.out.println("   -> Managing GSM: NA");
    }
    for (GridServiceManager backupGSM : processingUnit.getBackupGridServiceManagers()) {
        System.out.println("   -> Backup GSM: " + backupGSM.getUid());
    }
    for (ProcessingUnitInstance processingUnitInstance : processingUnit) {
        System.out.println("   [" + processingUnitInstance.getClusterInfo() + "] on GSC [" +
         processingUnitInstance.getGridServiceContainer().getUid() + "]");
        if (processingUnitInstance.isEmbeddedSpaces()) {
            System.out.println("      -> Embedded Space [" + processingUnitInstance.getSpaceInstance().getUid() + "]");
        }
        Map<String, ServiceDetails> services = processingUnitInstance.getServiceDetailsByServiceId();

        for (ServiceDetails details : services.values()) {
        	System.out.println("      -> Service " + details);
        }
    }
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent Space %}

{% highlight java %}

for (Space space : admin.getSpaces()) {
    System.out.println("Space [" + space.getUid() + "] numberOfInstances [" +
     space.getNumberOfInstances() + "] numberOfbackups [" +
     space.getNumberOfBackups() + "]");
    System.out.println("  Stats: Write [" + space.getStatistics().getWriteCount() + "/" +
    space.getStatistics().getWritePerSecond() + "]");
    for (SpaceInstance spaceInstance : space) {
        System.out.println("   -> INSTANCE [" + spaceInstance.getUid() + "] instanceId [" + spaceInstance.getInstanceId() +
        "] backupId [" + spaceInstance.getBackupId() + "] Mode [" + spaceInstance.getMode() + "]");
        System.out.println("         -> Host: " + spaceInstance.getMachine().getHostAddress());
        System.out.println("         -> Stats: Write [" + spaceInstance.getStatistics().getWriteCount() + "/" +
        spaceInstance.getStatistics().getWritePerSecond() + "]");
    }
    for (SpacePartition spacePartition : space.getPartitions()) {
        System.out.println("   -> Partition [" + spacePartition.getPartitiondId() + "]");
        for (SpaceInstance spaceInstance : spacePartition) {
            System.out.println("      -> INSTANCE [" + spaceInstance.getUid() + "]");
        }
    }
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent Virtual Machine %}

{% highlight java %}

Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
System.out.println("VM TOTAL STATS: Heap Committed [" +
	admin.getVirtualMachines().getStatistics().getMemoryHeapCommittedInGB() +"GB]");
	System.out.println("VM TOTAL STATS: GC PERC [" +
	admin.getVirtualMachines().getStatistics().getGcCollectionPerc() + "], Heap Used [" +
 	admin.getVirtualMachines().getStatistics().getMemoryHeapPerc() + "%]");
for (VirtualMachine virtualMachine : admin.getVirtualMachines()) {
    System.out.println("VM [" + virtualMachine.getUid() + "] " +
			"Host [" + virtualMachine.getMachine().getHostAddress() + "] " +
            "GC Perc [" + virtualMachine.getStatistics().getGcCollectionPerc() + "], " +
            "Heap Usage [" + virtualMachine.getStatistics().getMemoryHeapPerc() + "%]");

    for (ProcessingUnitInstance processingUnitInstance : virtualMachine.getProcessingUnitInstances()) {
        System.out.println("   -> PU [" + processingUnitInstance.getUid() + "]");
    }
    for (SpaceInstance spaceInstance : virtualMachine.getSpaceInstances()) {
        System.out.println("   -> Space [" + spaceInstance.getUid() + "]");
    }
}
{% endhighlight %}

{% endtabcontent %}
{% tabcontent Machine %}

{% highlight java %}

Admin admin = new AdminFactory().addGroup("myGroup").createAdmin();
// wait till things get discovered (you can also use specific waitFor)
for (Machine machine : admin.getMachines()) {
    System.out.println("Machine [" + machine.getUid() + "], " +
            "TotalPhysicalMem [" + machine.getOperatingSystem().getDetails().getTotalPhysicalMemorySizeInGB() + "GB], " +
            "FreePhysicalMem [" + machine.getOperatingSystem().getStatistics().getFreePhysicalMemorySizeInGB() + "GB]]");
    for (SpaceInstance spaceInstance : machine.getSpaceInstances()) {
        System.out.println("   -> Space [" + spaceInstance.getUid() + "]");
    }
    for (ProcessingUnitInstance processingUnitInstance : machine.getProcessingUnitInstances()) {
        System.out.println("   -> PU [" + processingUnitInstance.getUid() + "]");
    }
}
{% endhighlight %}

{% endtabcontent %}
{% endinittab %}

{% tip %}
See a fully running example of a [Scaling Agent](/sbp/scaling-agent.html) as part of the Solutions & Patterns section.
{% endtip %}

# Admin Construction

The Admin API uses the `AdminFactory` in order to create `Admin` instances. Once working with the `Admin` is done, its `Admin#close()` method should be called.

The Admin discovers all the advertised services from the [Lookup Service](/product_overview/service-grid.html#lus). In order to define which lookup groups the `AdminFactory#addGroup` can be used. The lookup locators can also be used for non multicast enabled environment using `AdminFactory#addLocator` can be used. If the services started are secured, the username and password can be set on the Admin API as well.

# Discovery Process

Once the `Admin` is created, it will start to receive discovery events of all the advertised services / components within its lookup groups / lookup locators. Note, the events occur asynchronously and the data model within the Admin gets initialized in the background with services coming and going.

This means that just creating the `Admin` and calling a specific "getter" for a data structure might not return what is currently deployed, and one should wait till the structures are filled. Some components has a waitFor method that allow to wait for specific number of services to be up. When navigating the data model, the Admin API will provide its most up to date state of the system it is monitoring.

# Domain Model

The Admin Domain Model has representation to all GigaSpaces level main actors. They include:

![admin_DomainModel.jpg](/attachment_files/admin_DomainModel.jpg)

{% whr %}

{%section%}
{%column width=45% %}
- [GridServiceAgent](#GridServiceAgentLink)
- [GridServiceAgents](#GridServiceAgentsLink)
- [GridServiceManager](#GridServiceManagerLink)
- [GridServiceManagers](#GridServiceManagersLink)
- [GridServiceContainer](#GridServiceContainerLink)
- [GridServiceContainers](#GridServiceContainersLink)
- [LookupService](#LookupServiceLink)
- [LookupServices](#LookupServicesLink)
- [ProcessingUnit](#ProcessingUnitLink)
- [ProcessingUnitInstance](#ProcessingUnitInstanceLink)
- [ProcessingUnits](#ProcessingUnitsLink)
- [ServiceMonitors](#servicemonitors)

{%endcolumn%}
{%column width=45% %}

- [Space](#SpaceLink)
- [SpaceInstance](#SpaceInstanceLink)
- [Spaces](#SpacesLink)
- [VirtualMachine](#VirtualMachineLink)
- [VirtualMachines](#VirtualMachinesLink)
- [Machine](#MachineLink)
- [Machines](#MachinesLink)
- [OperatingSystem](#OperatingSystemLink)
- [OperatingSystems](#OperatingSystemsLink)
- [Transport](#TransportLink)
- [Transports](#TransportsLink)
{%endcolumn%}
{%endsection%}

{%anchor GridServiceAgentLink%}

{: .table .table-bordered}
|Name            |[GridServiceAgent](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsa/GridServiceAgent.html)|
|Description     |A process manager that manages Service Grid processes such as GSM, GSC and LUS. More info [here](/product_overview/service-grid.html#gsa).|
|Main Operations |Allows to list all the currently managed processes.- Start processes (GSM, GSC, LUS).       |
|Runtime Events  | |

{%anchor GridServiceAgentsLink%}

{: .table .table-bordered}
|Name            |[GridServiceAgents](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsa/GridServiceAgents.html)|
|Description     |Holds all the currently discovered Grid Service Agents.|
|Main Operations |Get all the currently discovered Grid Service Agents.Wait for X number of Grid Service Agents to be up.|
|Runtime Events  |Register for Grid Service Agent addition (discovery) and removals events. |

{%anchor GridServiceManagerLink%}

{: .table .table-bordered}
|Name            | [GridServiceManager](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsm/GridServiceManager.html)|
|Description     |Managing Processing Unit deployments and Grid Service Containers. More info [here](/product_overview/service-grid.html#gsm).|
|Main Operations |Deploy Processing Units. Deploy pure Space Processing Units. Get the Grid Service Agent Managing it. Restart itself (if managed by a Grid Service Agent).Kill itself (if managed by a Grid Service Agent).|
|Runtime Events  |  |

{%anchor GridServiceManagersLink%}

{: .table .table-bordered}
|Name            |[GridServiceManagers](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsm/GridServiceManagers.html)|
|Description     |Holds all the currently discovered Grid Service Managers.|
|Main Operations |Deploy Processing Units on a random Grid Service Manager. Deploy pure Space Processing Units on a random Grid Service Manager. Get all the currently discovered Grid Service Managers. Wait for X number of Grid Service Managers to be up.|
|Runtime Events  |Register for Grid Service Manager addition (discovery) and removals events.|

{%anchor GridServiceContainerLink%}

{: .table .table-bordered}
|Name            |[GridServiceContainer](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsc/GridServiceContainer.html)|
|Description     | Container hosting Processing Unit Instances deployed from the GSM. More info [here](/product_overview/service-grid.html#gsc).|
|Main Operations | List currently running Processing Units Instances.|
|Runtime Events  | Register for Processing Unit Instance additions and removals events.|

{%anchor GridServiceContainersLink%}

{: .table .table-bordered}
|Name            | [GridServiceContainers](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/gsc/GridServiceContainers.html)|
|Description     |Holds all the currently discovered Grid Service Containers.|
|Main Operations |Get all the currently discovered Grid Service Containers.{% wbr %}- Wait for X number of Grid Service Containers to be up.|
|Runtime Events  |Register for Grid Service Container addition (discovery) and removals events.  |

{%anchor LookupServiceLink%}

{: .table .table-bordered}
|Name            | [LookupService](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/lus/LookupService.html)|
|Description     | A registry of services (GSM, GSC, Space Instances, Processing Unit Instances) that can be lookup up using it. More info [here](/product_overview/the-lookup-service.html#lus).|
|Main Operations | Get the Lookup Groups and Locator it was started with.|
|Runtime Events  |  |

{%anchor LookupServicesLink%}

{: .table .table-bordered}
|Name            |[LookupServices](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/lus/LookupServices.html)|
|Description     |Holds all the currently discovered Lookup Services.|
|Main Operations |Get all the currently discovered Lookup Services.Wait for X number of Lookup Services to be up.|
|Runtime Events  |Register for Lookup Service addition (discovery) and removals events. |

{%anchor ProcessingUnitLink%}

{: .table .table-bordered}
|Name            |  [ProcessingUnit](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/pu/ProcessingUnit.html)|
|Description     | A deployable processing unit running one or more Processing Unit Instances. Managed by the Grid Service Manager.|
|Main Operations |Undeploy the Processing Unit{% wbr %}- Increase the number of Processing Units Instances (if allowed).{% wbr %}- Decrease the number of Processing Unit Instances (if allowed).{% wbr %}- Get the deployment status of the Processing Unit.{% wbr %}- Get the managing Grid Service Manager.{% wbr %}- Get the list of backup Grid Service Managers.{% wbr %}- List all the currently running Processing Unit Instances.{% wbr %}- Wait for X number of Processing Unit Instances or be up.{% wbr %}- Get an embedded Space that the Processing Unit has.{% wbr %}- Wait for an embedded Space to be correlated (discovered) with the Processing Unit.|
|Runtime Events  |Register for Processing Unit Instances additions and removals events.{% wbr %}- Register for Processing Unit Instance provision attempts, failures, success and pending events.{% wbr %}- Register for Managing Grid Service Manager change events.{% wbr %}- Register for Space correlation events.{% wbr %}- Register for deployment status change events.{% wbr %}- Register for backup Grid Service Manager change events.|

{%anchor ProcessingUnitInstanceLink%}

{: .table .table-bordered}
|Name            | [ProcessingUnitInstance](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/pu/ProcessingUnitInstance.html)|
|Description     | An actual instance of a Processing Unit running within a Grid Service Container.|
|Main Operations | Destroy itself (if SLA is breached, will be instantiated again).{% wbr %}- Decrease itself (and destroying itself in the process). Will not attempt to create it again.{% wbr %}- Relocate itself to a different Grid Service Container.{% wbr %}- List all its inner services (such as event containers).{% wbr %}- Get the embedded Space Instance running within it (if there is one).{% wbr %}- Get the JEE container details if it is a web processing unit.|
|Runtime Events  | - [ServiceMonitors](#servicemonitors)|

{%anchor ProcessingUnitsLink%}

{: .table .table-bordered}
|Name            |[ProcessingUnits](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/pu/ProcessingUnits.html)|
|Description     |  Holds all the currently deployed Processing Units|
|Main Operations |Get all the currently deployed Processing Units.{% wbr %}- Wait for (and return) a Processing by a specific name.|
|Runtime Events  |Register for Processing Unit deployments and undeployment events.{% wbr %}- Register for all Processing Unit Instance addition and removal events (across all Processing Units).{% wbr %}- Register for all Processing Unit Instance provision attempts, failures, success and pending events (across all Processing Units).{% wbr %}- Register for Managing Grid Service Manager change events on all Processing Units.{% wbr %}- Register for backup Grid Service Manager change events on all Processing Units.|

{%anchor SpaceLink%}

{: .table .table-bordered}
|Name            | [Space](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/space/Space.html)|
|Description     | Composed of one or more Space Instances to form a Space topology (cluster)|
|Main Operations | Get all the currently running Space Instance that are part of the Space.{% wbr %}- Wait for X number of Space Instances to be up.{% wbr %}- Get aggregated Space statistics.{% wbr %}- Get a clustered [GigaSpace](./the-gigaspace-interface.html) to perform Space operations.|
|Runtime Events  | Register for Space Instance additions and removals events.{% wbr %}- Register for Space Instance change mode events (for all Space Instances that are part of the Space).{% wbr %}- Register for Space Instance replication status change events (for all Space Instances that are part of the Space).{% wbr %}- Register for aggregated Space statistics events (if monitoring).|

{%anchor SpaceInstanceLink%}

{: .table .table-bordered}
|Name            |[SpaceInstance](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/space/SpaceInstance.html)|
|Description     |An actual instance of a Space that is part of a topology (cluster), usually running within a Processing Unit Instance|
|Main Operations | Get its Space Mode (primary or backup).{% wbr %}- Get its replication targets.{% wbr %}- Get a direct [GigaSpace](./the-gigaspace-interface.html) to perform Space operations.{% wbr %}- Get Space Instance statistics.|
|Runtime Events  |Register for replication status change events.{% wbr %}- Register for Space Mode change events{% wbr %}- Register for Space Instance statistics (if monitoring).|

{%anchor SpacesLink%}

{: .table .table-bordered}
|Name            |[Spaces](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/space/Spaces.html)|
|Description     | Holds all the currently running Spaces|
|Main Operations |Get all the currently running Spaces.{% wbr %}- Wait for (and return) a specific Space by name.|
|Runtime Events |Register for Space additions and removal events.{% wbr %}- Register for Space Instance additions and removal events (across all Spaces).{% wbr %}- Register for Space Instance Mode change events (across all Space Instances).{% wbr %}- Register for Space Instance replication change events (across all Space Instances).{% wbr %}- Register for aggregated Space level statistics change events (across all Spaces, if monitoring).{% wbr %}- Register for Space Instance statistics change events (across all Space Instances, if monitoring).|

{%anchor VirtualMachineLink%}

{: .table .table-bordered}
|Name            |  [VirtualMachine](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/vm/VirtualMachine.html)|
|Description     | A virtual machine (JVM) that is currently running at least one GigaSpaces component / service.|
|Main Operations |Get the Grid Service Agent (if exists).{% wbr %}- Get the Grid Service Manager (if exists).{% wbr %}- Get the Grid Service Container (if exists).{% wbr %}- Get all the Processing Unit Instances that are running within the Virtual Machine.{% wbr %}- Get all the Space Instances that are running within the Virtual Machine.{% wbr %}- Get the details of the Virtual Machine (min/max memory, and so on).{% wbr %}- Get the statistics of the Virtual Machine (heap used, and so on).|
|Runtime Events  | Register for Processing Unit Instance additions and removals events.{% wbr %}- Register for Space Instance additions and removals events.{% wbr %}- Register for statistics change events (if monitoring).|

{%anchor VirtualMachinesLink%}

{: .table .table-bordered}
|Name            |[VirtualMachines](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/vm/VirtualMachines.html)|
|Description     | Holds all the currently discovered Virtual Machines|
|Main Operations | Get all the currently discovered Virtual Machines.{% wbr %}- Get aggregated Virtual Machines details.{% wbr %}- Get aggregated Virtual Machines statistics.|
|Runtime Events  | Register for Virtual Machines additions and removals events.{% wbr %}- Register for aggregated Virtual Machines statistics events (if monitoring).{% wbr %}- Register for Virtual Machine level statistics change events (across all Virtual Machines, if monitoring).|

{%anchor MachineLink%}

{: .table .table-bordered}
|Name            | [Machine](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/machine/Machine.html)|
|Description     | An actual Machine (identified by its host address) running one or more GigaSpaces components / services in one or more Virtual Machines. Associated with one Operating System|
|Main Operations | Get all the Grid Service Agents running on the Machine.{% wbr %}- Get all the Grid Service Containers running on the Machine.{% wbr %}- Get all the Grid Service Managers running on the Machine.{% wbr %}- Get all the Virtual Machines running on the Machine.{% wbr %}- Get all the Processing Unit Instances running on the Machine.{% wbr %}- Get all the Space Instances running on the Machine.{% wbr %}- Get the Operating System the Machine is running on.|
|Runtime Events  | Register for Space Instances additions and removals events from the Machine.{% wbr %}- Register for Processing Unit Instance additions and removals events from the Machine.|

{%anchor MachinesLink%}

{: .table .table-bordered}
|Name            | [Machines](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/machine/Machines.html)|
|Description     | Holds all the currently discovered Machines|
|Main Operations |  * Get all the currently running Machines.{% wbr %}- Wait for X number of Machines or be up.|
|Runtime Events  | * Register for Machine additions and removals events.|

{%anchor OperatingSystemLink%}

{: .table .table-bordered}
|Name            | [OperatingSystem](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/os/OperatingSystem.html)|
|Description     | The Operating System GigaSpaces components / services are running on. Associated with one Machine.|
|Main Operations | Get the details of the Operating System.{% wbr %}- Get the operating system statistics.|
|Runtime Events  | Register for statistics change events (if monitoring).|

{%anchor OperatingSystemsLink%}

{: .table .table-bordered}
|Name            |[OperatingSystems](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/os/OperatingSystems.html)|
|Description     |Holds all the currently discovered Operating Systems|
|Main Operations |Get all the current Operating Systems.{% wbr %}- Get the aggregated Operating Systems details.{% wbr %}- Get the aggregated Operating Systems statistics.|
|Runtime Events  | Register for aggregated Operating Systems statistics change events (if monitoring).{% wbr %}- Register for Operating System level statistics change events (across all Operating Systems, if monitoring).|

{%anchor TransportLink%}

{: .table .table-bordered}
|Name            |[Transport](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/transport/Transport.html)|
|Description     | The communication layer each GigaSpaces component / service uses|
|Main Operations | Get the Transport details (host, port).{% wbr %}- Get the Transport statistics.|
|Runtime Events  | Register for Transport statistics change events (if monitoring).|

{%anchor TransportsLink%}

{: .table .table-bordered}
|Name            | [Transports](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/org/openspaces/admin/transport/Transports.html)|
|Description     | Holds all the currently discovered Transports|
|Main Operations |  Get all the current Transports.{% wbr %}- Get the aggregated Transports details.{% wbr %}- Get the aggregated Transports statistics.|
|Runtime Events  |Register for aggregated Transports statistics change events (if monitoring).{% wbr %}- Register for Transport level statistics change events (across all Transports, if monitoring).|

# Accessing the Domain Model

There are two ways the Admin API can be used to access information the Admin API can provide.

- Call specific "getters" for the data and iterate over them (as shown in the example at the top of the page).
- Register for specific events using the Admin API. Events are handled by different components of the Admin API in similar manner. We will take one of them and use it as a reference example.

If we want to register, for example, for Grid Service Container additions, we can use the following code (note, removing the event listener is not shown here for clarity):

{% highlight java %}
admin.getGridServiceContainers().getGridServiceContainerAdded().add(new GridServiceContainerAddedEventListener() {
    public void gridServiceContainerAdded(GridServiceContainer gridServiceContainer) {
        // do something here
    }
});
{% endhighlight %}

Removals are done in similar manner:

{% highlight java %}
admin.getGridServiceContainers().getGridServiceContainerRemoved().add(new GridServiceContainerRemovedEventListener() {
    public void gridServiceContainerRemoved(GridServiceContainer gridServiceContainer) {
        // do something here
    }
});
{% endhighlight %}

Since both removals and additions are common events that we would like to register for in one go, we can use:

{% highlight java %}
admin.getGridServiceContainers().addLifecycleListener(new GridServiceContainerLifecycleEventListener() {
    public void gridServiceContainerAdded(GridServiceContainer gridServiceContainer) {
        // do something here
    }

    public void gridServiceContainerRemoved(GridServiceContainer gridServiceContainer) {
        // do something here
    }
});
{% endhighlight %}

All other data structures use similar API to register for events. Some might have specific events that goes beyond just additions and removals, but they still use the same model. For example, here is how we can register for Space Mode change events across all currently running Space topologies and Space Instances:

{% highlight java %}
admin.getSpaces().getSpaceModeChanged().add(new SpaceModeChangedEventListener() {
    public void spaceModeChanged(SpaceModeChangedEvent event) {
        System.out.println("Space [" + event.getSpaceInstance().getSpace().getName() + "] " +
		"Instance [" + event.getSpaceInstance().getInstanceId() + "/" +
                event.getSpaceInstance().getBackupId() + "] " +
		"changed mode from [" + event.getPreviousMode() + "] to [" + event.getNewMode() + "]");
    }
});
{% endhighlight %}

Of course, we can register the same listener on a specific `Space` topology or event on a specific `SpaceInstance`.

Last, the `Admin` interface provides a one stop method called `addEventListener` that accepts an `AdminListener`. Most events listener implement this interface. One can create a class that implements several chosen listener interfaces, call the `addEventListener` method, and they will automatically be added to their respective components. For example, if our listener implements `GridServiceContainerAddedEventListener` and `GridServiceManagerAddedEventListener`, the listener will automatically be added to the `GridServiceManagers` and `GridServiceContainers`.

# Details and Statistics

- Some components in the Admin API can provide statistics. For example, a `SpaceInstance` can provide statistics on how many times the read API was called on it. Statistics change over time, and in order to get them either the "getter" for the Statistics can be used, or a statistics listener can be registered for statistics change events.

- Details of a specific component provide information that does not change over time, but can be used to provide more information regarding the component, or to compute statistics. For example, the VirtualMachine provides in its details the minimum and maximum heap memory size, which the VirtualMachine statistics provide the currently used heap memory size. The detailed information is used to provide the percentage used in the Virtual Machine statistics.

- The Admin API also provide aggregated details and statistics. For example, the `Space` provides `SpaceStatistics` allowing to get the aggregated statistics of all the different Space Instances that belong to it.

- Each component in the Admin API that can provide statistics (either direct statistics, or aggregated statistics) implements the `StatisticsMonitor` interface. The statistics monitor allows to start to monitor statistics and stop to monitor statistics. Monitoring for statistics is required if one wishes to register for statistics change events. The interval that statistics will be polled is controlled using the statistics interval.

- The statistics interval is important event when the Admin API is not actively polling for statistics. Each call to a "getter" of statistics will only perform a remote call to the component if the last statistics fetch happened **before** the statistics interval. This behavior allows for users of the Admin API to not worry about "hammering" different components for statistics since the Admin will make sure that statistics calls are cached internally for the statistics interval period.

- A `SpaceInstance` implements the `StatisticsMonitor` interface. Calling `startMonitor` and `stopMonitor` on it will cause monitoring of statistics to be enabled or disabled on it.

- `Space` also implements the `StatisticsMonitor` interface. Calling `startMonitor` on it will cause it to start monitoring all its `SpaceInstance` s. If a `SpaceInstance` is discovered after the the call to `startMonitor` occurred, it will start monitoring itself automatically. This means that if the a `SpaceInstanceStatisticsChangedEventListener` was registered on the `Space`, it will automatically start to get Space Instance statistics change events for the newly discovered `SpaceInstance`.

- `Spaces` also implements the `StatisticsMonitor` interface. Calling `startMonitor` on it will cause it to start monitoring all the `Space` s it has (and as a result, also `SpaceInstance` s, see the paragraph above). A `SpaceInstanceStatisticsChangedEventListener` can also be registered on the `Spaces` level as well.

- The above Space level statistics behavior works in much the way with other components. For example, the `VirutalMachine` and `VirtualMachines`, `Transport` and `Transports`, `OperatingSystem` and `OperatingSystems`.

- The `Admin` interface also implements the `StatisticsMonitor` interface. Calling `startMonitor` on it will cause all holders to start monitoring. These include: `Spaces`, `VirtualMachines`, `Transports`, and `OperatingSystems`.

# Space Runtime Statistics

The space maintains statistics information about all the data types (e.g. space class types) it stores and the amount of space objects stored in memory for each data type. Below example how to retrieve this data. This approach avoiding the need to use the `GigaSpace.Count()` that is relatively expensive with spaces that store large number of objects.

If you are monitoring the space class instance count with some monitoring tool you should use the approach below rather calling the `GigaSpace.Count()`.

{% highlight java %}
public static void printAllClassInstanceCountForAllPartitions (Admin admin , String spaceName) throws Exception
{
	Space space = admin.getSpaces().waitFor(spaceName, 10 , TimeUnit.SECONDS);
	SpacePartition spacePartitions[] = space.getPartitions();
	System.out.println(spaceName + " have " +spacePartitions.length + " Partitions , Total " + space.getTotalNumberOfInstances() + " Instances");
	Arrays.sort(spacePartitions, new SpacePartitionsComperator ());

	for (int i = 0; i < spacePartitions.length; i++) {
		SpacePartition partition = spacePartitions [i];
		while (partition.getPrimary()==null)
		{
			Thread.sleep(1000);
		}

		SpaceInstance primaryInstance = partition.getPrimary();
		System.out.println ("Partition " + partition.getPartitionId() + " Primary:");
		Map<String, Integer> classInstanceCountsPrimary = primaryInstance.getRuntimeDetails().getCountPerClassName();
		Iterator<String> keys = classInstanceCountsPrimary.keySet().iterator();
		while (keys.hasNext())
		{
			String className = keys.next();
			System.out.println ("Class:" + className +" Instance count:" + classInstanceCountsPrimary.get(className));
		}

		SpaceInstance backupInstance = partition.getBackup();
		System.out.println ("Partition " + partition.getPartitionId() + " Backup:");

		Map<String, Integer> classInstanceCountsBackup = backupInstance .getRuntimeDetails().getCountPerClassName();
		keys = classInstanceCountsPrimary.keySet().iterator();
		while (keys.hasNext())
		{
			String className = keys.next();
			System.out.println ("Class:" + className +" Instance count:" + classInstanceCountsBackup.get(className));
		}

	}
}

static class SpacePartitionsComperator implements Comparator<SpacePartition>{
	public int compare(SpacePartition o1,SpacePartition o2) {
		if (o2.getPartitionId() > o1.getPartitionId())
			return 0;
		else
			return 1;
	}
}
{% endhighlight %}

# Monitoring the Mirror Service

You may monitor various aspects of the mirror service using the administration and monitoring API.
The mirror statistics are available using the `SpaceInstance` statistics. They can be used to monitor the state of the mirror space and whether or not it is functioning properly. These statistics are relevant only for a mirror space instance, and are not available for ordinary space instances. The code below traverses all the space instances and finds the mirror space by retrieving the mirror statistics object (if it isn't null this means it's a mirror space). It then prints out some of the available statistics.

{% highlight java %}
for (Space space : admin.getSpaces()) {
    System.out.println("Space [" + space.getUid() + "] numberOfInstances [" +
     space.getNumberOfInstances() + "] numberOfbackups [" +
     space.getNumberOfBackups() + "]");

    for (SpaceInstance spaceInstance : space) {
        System.out.println("   -> INSTANCE [" + spaceInstance.getUid() + "] instanceId [" + spaceInstance.getInstanceId() +
        "] backupId [" + spaceInstance.getBackupId() + "] Mode [" + spaceInstance.getMode() + "]");
        System.out.println("         -> Host: " + spaceInstance.getMachine().getHostAddress());

         MirrorStatistics mirrorStat = spaceInstance.getStatistics().getMirrorStatistics();
         // check if this instance is mirror
         if(mirrorStat != null)
         {

            System.out.println("Mirror Stats:");
            System.out.println("total operation count:" + mirrorStat.getOperationCount());
            System.out.println("successful operation count:" + mirrorStat.getSuccessfulOperationCount());
            System.out.println("failed operation count:" + mirrorStat.getFailedOperationCount());
         }
    }

}

{% endhighlight %}

For more information please refer to the API documentation: **[MirrorStatistics](http://www.gigaspaces.com/docs/JavaDoc{% currentversion %}/com/gigaspaces/cluster/replication/async/mirror/MirrorStatistics.html)**

# Monitoring the Remote Transport Activity

You may monitor the remote communication activity via the Administration and Monitoring API. You may receive information in real-time about every aspect of the communication and transport activity. See the [Monitoring LRMI via the Administration API]({%currentadmurl%}/tuning-communication-protocol.html#Monitoring LRMI via the Administration API) for details.

{%anchor servicemonitors%}

# Service Monitors

The admin API also allows you to monitor XAP services. The information is available through the [ProcessingUnitInstanceStatistics](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/admin/pu/ProcessingUnitInstanceStatistics.html).

{: .table .table-bordered .table-condensed}
| Service | Description |
|:--------|:------------|
|[WebRequestsServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/pu/container/jee/stats/WebRequestsServiceMonitors.html) |Statistics monitor information for JEE servlet requests.|
|[RemotingServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/remoting/RemotingServiceDetails.html) | Generic remoting service details.|
|[EventContainerServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/events/EventContainerServiceMonitors.html) | A generic event container service monitors.|
|[PollingEventContainerServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/events/polling/PollingEventContainerServiceMonitors.html) |Polling container service monitors.|
|[NotifyEventContainerServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/events/notify/NotifyEventContainerServiceMonitors.html) |Notify container service monitors.|
|[AsyncPollingEventContainerServiceMonitors](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/events/asyncpolling/AsyncPollingEventContainerServiceMonitors.html)  |Async Polling container service monitors.|

Here is an example how you can obtain this information:

{%highlight java%}
public void serviceMonitors() {
    Admin admin = new AdminFactory().createAdmin();

	for (ProcessingUnit processingUnit : admin.getProcessingUnits()) {

		for (ProcessingUnitInstance processingUnitInstance : processingUnit.getInstances()) {

			ProcessingUnitInstanceStatistics processingUnitInstanceStatistics = processingUnitInstance.getStatistics();

			if (processingUnitInstanceStatistics != null) {

				WebRequestsServiceMonitors webRequestsServiceMonitors = processingUnitInstanceStatistics.getWebRequests();

				RemotingServiceMonitors remoting = processingUnitInstanceStatistics.getRemoting();

				Map<String, EventContainerServiceMonitors> eventContainers = processingUnitInstanceStatistics.getEventContainers();

				Map<String, PollingEventContainerServiceMonitors> pollingEventContainers = processingUnitInstanceStatistics.getPollingEventContainers();

				Map<String, NotifyEventContainerServiceMonitors> notifyEventContainers = processingUnitInstanceStatistics.getNotifyEventContainers();

				Map<String, AsyncPollingEventContainerServiceMonitors> asyncPollingEventContainers = processingUnitInstanceStatistics.getAsyncPollingEventContainers();
			}
		}
	}
}
{%endhighlight%}

You can also attach a [ProcessingUnitInstanceStatisticsChangedEventListener](http://www.gigaspaces.com/docs/JavaDoc{%currentversion%}/index.html?org/openspaces/admin/pu/events/ProcessingUnitInstanceStatisticsChangedEventListener.html) to process units that will fire by default every 5 second.

{%highlight java%}
public void serviceMonitorsEventListeners() {
	Admin admin = new AdminFactory().createAdmin();

	admin.getProcessingUnits()
	    .getProcessingUnit("myProcessingUnit")
		.getProcessingUnitInstanceStatisticsChanged()
		.add(new ProcessingUnitInstanceStatisticsChangedEventListener() {

		@Override
		public void processingUnitInstanceStatisticsChanged(ProcessingUnitInstanceStatisticsChangedEvent event) {

		    ProcessingUnitInstanceStatistics statistics = event.getStatistics();

			Map<String, EventContainerServiceMonitors> eventContainers = statistics.getEventContainers();

			WebRequestsServiceMonitors webRequests = statistics.getWebRequests();

			// .....
		}
	});
}
{%endhighlight%}


text:
package me.aurous.ui.models;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import me.aurous.utils.ModelUtils;

public class ImageRendererModel extends DefaultTableCellRenderer {
	/**
	 *
	 */
	private static final long serialVersionUID = 3408189592723108040L;

	JLabel lbl = new JLabel();

	@Override
	public Component getTableCellRendererComponent(final JTable table,
			final Object value, final boolean isSelected,
			final boolean hasFocus, final int row, final int column) {
		final ImageIcon icon = me.aurous.utils.Utils.getSongIcon((String) table
				.getModel().getValueAt(row, ModelUtils.ART_INDEX));
		if (row == table.getSelectedRow()) {
			this.lbl.setForeground(new Color(213, 163, 0));

		} else {
			this.lbl.setForeground(Color.GRAY);
		}
		this.lbl.setFont(new Font("Calibri", Font.PLAIN, 14));
		this.lbl.setText((String) table.getModel().getValueAt(row, 0));
		this.lbl.setIcon(icon);

		return this.lbl;
	}
}


text:
function Get-DODropletKernel
{
<#
.Synopsis
   The Get-DOAction cmdlet pulls action information from the Digital Ocean cloud.
.DESCRIPTION
   The Get-DOAction cmdlet pulls action information from the Digital Ocean cloud.
   Results are limited to 25 by default, to override this specifiy a larger number
   to return with the Limit paramter.

   An API key is required to use this cmdlet.
.EXAMPLE
   Get-DOAction -ActionID 36804636

   ActionID     : 36804636
   Status       : completed
   Type         : create
   StartedAt    : 2014-11-14T16:29:21Z
   CompletedAt  : 2014-11-14T16:30:06Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   The example above returns the specfied action for the current API bearer.

.EXAMPLE
   PS C:\>Get-DOAction -ActionID 36804636, 36804637, 36804638

   ActionID     : 36804636
   Status       : completed
   Type         : create
   StartedAt    : 2014-11-14T16:29:21Z
   CompletedAt  : 2014-11-14T16:30:06Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   ActionID     : 36804637
   Status       : completed
   Type         : destroy
   StartedAt    : 2014-11-14T16:32:11Z
   CompletedAt  : 2014-11-14T16:34:16Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   ActionID     : 36804638
   Status       : completed
   Type         : transfer
   StartedAt    : 2014-11-14T16:37:51Z
   CompletedAt  : 2014-11-14T17:09:03Z
   ResourceID   : 3164445
   ResourceType : droplet
   Region       : nyc3

   The example above returns the specfied actions for the current API bearer if available.

.EXAMPLE
   PS C:\>Get-DOAction -Limit 3

   ActionID     : 36804636
   Status       : completed
   Type         : create
   StartedAt    : 2014-11-14T16:29:21Z
   CompletedAt  : 2014-11-14T16:30:06Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   ActionID     : 36804637
   Status       : completed
   Type         : destroy
   StartedAt    : 2014-11-14T16:32:11Z
   CompletedAt  : 2014-11-14T16:34:16Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   ActionID     : 36804638
   Status       : completed
   Type         : transfer
   StartedAt    : 2014-11-14T16:37:51Z
   CompletedAt  : 2014-11-14T17:09:03Z
   ResourceID   : 3164445
   ResourceType : droplet
   Region       : nyc3

   The example above returns the specfied actions for the current API bearer if available.

.EXAMPLE
   PS C:\>Get-DOAction -ActionID 36804636 -APIKey b7d03a6947b217efb6f3ec3bd3504582

   ActionID     : 36804636
   Status       : completed
   Type         : create
   StartedAt    : 2014-11-14T16:29:21Z
   CompletedAt  : 2014-11-14T16:30:06Z
   ResourceID   : 3164444
   ResourceType : droplet
   Region       : nyc3

   The example above returns all avaiable actions for the current API bearer without
   authenticating via Connect-DOCloud first.

.INPUTS
   System.String

       This cmdlet requires the API key to be passed as a string.

   System.UInt64

       This cmdlet requires the action ID to be passed as an unsigned, 16-bit interger.
.OUTPUTS
   PS.DigitalOcean.Kernel

       A PS.DigitalOcean.Kernel object holding the kernel info is returned.
.ROLE
   PS.DigitalOcean
.FUNCTIONALITY
   PS.DigitalOcean
#>
    [CmdletBinding(SupportsShouldProcess=$false,
                  PositionalBinding=$true)]
    [Alias('gdodk')]
    [OutputType('PS.DigitalOcean.Kernel')]
    Param
    (
        # Used to get a specific action with the action ID.
        [Parameter(Mandatory=$true,
                   Position=0)]
        [ValidateNotNull()]
        [ValidateNotNullOrEmpty()]
        [Alias('ID')]
        [UInt64]$DropletID,
        # Used to override the default limit of 20.
        [Parameter(Mandatory=$false,
                   Position=1)]
        [ValidateNotNull()]
        [ValidateNotNullOrEmpty()]
        [Alias('Total','Size')]
        [UInt64]$Limit = 20,
        # API key to access account.
        [Parameter(Mandatory=$false,
                   Position=2)]
        [ValidateNotNull()]
        [ValidateNotNullOrEmpty()]
        [Alias('Key','Token')]
        [String]$APIKey = $script:SavedDOAPIKey
    )

    Begin
    {
        if(-not $APIKey)
        {
            throw 'Use Connect-DOCloud to specifiy the API key.'
        }
        [Hashtable]$sessionHeaders = @{'Authorization'="Bearer $APIKey";'Content-Type'='application/json'}
        [Uri]$doApiUri = "https://api.digitalocean.com/v2/droplets/$DropletID/backups?per_page=$Limit"
    }
    Process
    {
        try
        {
            $doInfo = Invoke-RestMethod -Method GET -Uri $doApiUri -Headers $sessionHeaders -ErrorAction Stop
            foreach($info in $doInfo.kernels)
            {
                $doReturnInfo = [PSCustomObject]@{
                    'KernelID' = $info.id
                    'Name' = $info.name
                    'Version' = $info.version
                }
                # DoReturnInfo is returned after Add-ObjectDetail is processed.
                Add-ObjectDetail -InputObject $doReturnInfo -TypeName 'PS.DigitalOcean.Kernel'
            }
        }
        catch
        {
            $errorDetail = $_.Exception.Message
            Write-Warning "Could not find any action information.`n`r$errorDetail"
        }
    }
}


text:
function Get-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Collections.Hashtable])]
    param
    (
        [parameter(Mandatory = $true)]  [System.String] $WebAppUrl,
        [parameter(Mandatory = $true)]  [System.String] $SMTPServer,
        [parameter(Mandatory = $true)]  [System.String] $FromAddress,
        [parameter(Mandatory = $true)]  [System.String] $ReplyToAddress,
        [parameter(Mandatory = $true)]  [System.String] $CharacterSet,
        [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount

    )

    Write-Verbose -Message "Retrieving outgoing email settings configuration "

    $result = Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
        $params = $args[0]
        $webApp = Get-SPWebApplication $params.WebAppUrl -IncludeCentralAdministration -ErrorAction SilentlyContinue

        if ($null -eq $webApp) {
            return $null
        }

        $mailServer = $null
        if ($webApp.OutboundMailServiceInstance -ne $null) {
            $mailServer = $webApp.OutboundMailServiceInstance.Server.Name
        }

        return @{
            WebAppUrl = $webApp.Url
            SMTPServer= $mailServer
            FromAddress= $webApp.OutboundMailSenderAddress
            ReplyToAddress= $webApp.OutboundMailReplyToAddress
            CharacterSet = $webApp.OutboundMailCodePage
        }
    }
    return $result
}

function Set-TargetResource
{
    [CmdletBinding()]
    param
    (
        [parameter(Mandatory = $true)]  [System.String] $WebAppUrl,
        [parameter(Mandatory = $true)]  [System.String] $SMTPServer,
        [parameter(Mandatory = $true)]  [System.String] $FromAddress,
        [parameter(Mandatory = $true)]  [System.String] $ReplyToAddress,
        [parameter(Mandatory = $true)]  [System.String] $CharacterSet,
        [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
    )

    Write-Verbose -Message "Updating outgoing email settings configuration for $WebAppUrl"
    Invoke-SPDSCCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
        $params = $args[0]
        $webApp = $null
        Write-Verbose -Message "retrieving $($params.WebAppUrl)  settings"
        $webApp = Get-SPWebApplication $params.WebAppUrl -IncludeCentralAdministration
        if($null -eq $webApp)
        {
            throw "Web Application $webAppUrl not found"
        }
        $webApp.UpdateMailSettings($params.SMTPServer, $params.FromAddress, $params.ReplyToAddress, $params.CharacterSet)
    }
}

function Test-TargetResource
{
    [CmdletBinding()]
    [OutputType([System.Boolean])]
    param
    (
        [parameter(Mandatory = $true)]  [System.String] $WebAppUrl,
        [parameter(Mandatory = $true)]  [System.String] $SMTPServer,
        [parameter(Mandatory = $true)]  [System.String] $FromAddress,
        [parameter(Mandatory = $true)]  [System.String] $ReplyToAddress,
        [parameter(Mandatory = $true)]  [System.String] $CharacterSet,
        [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
    )

    $CurrentValues = Get-TargetResource @PSBoundParameters
    Write-Verbose -Message "Comparing Current and Target Outgoing email settings"
    if ($null -eq $CurrentValues) { return $false }

    return Test-SPDSCSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("SMTPServer","FromAddress","ReplyToAddress","CharacterSet")
}

Export-ModuleMember -Function *-TargetResource


text:
package at.jku.sea.cloud.navigator.implementation;

import at.jku.sea.cloud.Artifact;
import at.jku.sea.cloud.Owner;
import at.jku.sea.cloud.navigator.TerminalOperation;
import at.jku.sea.cloud.stream.Context;

public class IntermediateOwnerNavigator extends AbstractNavigator<Owner> {

  private TerminalOperation<? extends Artifact> upstream;

  public IntermediateOwnerNavigator(TerminalOperation<? extends Artifact> upstream) {
    this.upstream = upstream;
  }

  @Override
  public Owner get() {
    return upstream.get().getOwner();
  }

  @Override
  public Owner get(Context context) {
    return upstream.get(context).getOwner();
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#ffffff"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#ffffff"
            android:orientation="horizontal">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:text="내 랭킹"
                    android:textStyle="bold"
                    android:textSize="18sp"
                    android:textColor="@color/colorBlack"
                    android:gravity="center"
                    />

            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:orientation="horizontal"
        android:layout_marginTop="1dp"
        android:padding="10dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/my" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="Gasigogi0611"
                android:textColor="#000000"
                android:textSize="20sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="최성환 / seonghwan.choi@navercorp.com"
                android:textColor="#000000"
                android:textSize="12sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="We Run Club"
                android:textColor="#000000"
                android:textSize="12sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:text="내 순위: 1위 (야구)"
                android:textColor="#000000"
                android:textSize="12sp" />

        </LinearLayout>

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:orientation="horizontal"
        android:padding="10dp"
        android:background="#dddddd"
        >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="야구 순위"
            android:textColor="#333333"
            android:textSize="10sp" />
    </LinearLayout>
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginBottom="1dp"
        android:layout_marginTop="1dp"
        android:background="#e6e6e6">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="1등 : 최성환"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="2등 : 이희현"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="3등 : 이윤희"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="4등 : 황성욱"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="#ffffff"
                android:orientation="horizontal"
                android:padding="10dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Test - 회원"
                    android:textColor="#000000"
                    android:textSize="12sp" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>


text:
layout: feature
title: 'VerbType'
shortdef: 'verb type'
udver: '2'
---

  Values:
  Aux
  Cop
  Light

We already split auxiliary and non-auxiliary verbs at the level of UPOS tags.
The `VerbType` feature may be used to capture finer distinctions that some
tagsets make.

### `Aux`: auxiliary verb

Verb used to create periphrastic verb forms (tenses, passives etc.)

#### Examples
- _uːn uː= kaːm iraːnaj / fidig -a dʔi -jaː =b =u /_ "Gosh, this camel was let loose [and]"

### `Cop`: copula verb

Verb used to make nominal predicates.
We have treated copulas as auxiliaries, this feature is used to distinguish them from other auxiliaries.

#### Examples
- _hoː =b hoːsoː ʃʔag -aː =b =u uː= tak _ "The man was carrying on his shoulder a lamb"

### `Light`: light (support) verb

Light or support verb is used in verbo-nominal constructions where the main part of the meaning
is contributed by a noun complement but it is not just a nominal predicate with a copula.

#### Examples
- _ j= ʔar han hus i- kati -na /_ "The children also keep quiet"


text:
// Copyright 2022 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
//
//     https://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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

function main() {
  // [START cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async]
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  The project and location from which the function should be listed,
   *  specified in the format `projects/* /locations/*`
   *  If you want to list functions in all locations, use "-" in place of a
   *  location. When listing functions in all locations, if one or more
   *  location(s) are unreachable, the response will contain functions from all
   *  reachable locations along with the names of any unreachable locations.
   */
  // const parent = 'abc123'
  /**
   *  Maximum number of functions to return per call.
   */
  // const pageSize = 1234
  /**
   *  The value returned by the last
   *  `ListFunctionsResponse`; indicates that
   *  this is a continuation of a prior `ListFunctions` call, and that the
   *  system should return the next page of data.
   */
  // const pageToken = 'abc123'

  // Imports the Functions library
  const {CloudFunctionsServiceClient} = require('@google-cloud/functions').v1;

  // Instantiates a client
  const functionsClient = new CloudFunctionsServiceClient();

  async function callListFunctions() {
    // Construct request
    const request = {
    };

    // Run request
    const iterable = await functionsClient.listFunctionsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListFunctions();
  // [END cloudfunctions_v1_generated_CloudFunctionsService_ListFunctions_async]
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));


text:
package tr.com.serkanozal.mysafe.impl.util;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;

/**
 * Utility class to find URL entries in classpath.
 *
 * @author Serkan OZAL
 */
public final class ClasspathUtil {

    private ClasspathUtil() {

    }

    public static Set<URL> findClasspathUrls(ClassLoader classLoader) {
        Set<URL> urls = new HashSet<URL>();

        try {
            String[] classpathProperties =
                    System.getProperty("java.class.path").split(File.pathSeparator);
            for (String classpathProperty : classpathProperties) {
                urls.add(new File(classpathProperty).toURI().toURL());
            }
            urls.addAll(getExtURLs(getExtDirs()));
        } catch (IOException e) {
            e.printStackTrace();
        }

        String surefireProperty = System.getProperty("surefire.test.class.path");
        if (surefireProperty != null && surefireProperty.trim().length() > 0) {
            try {
                String[] surefireClasspathProperties =
                        surefireProperty.split(File.pathSeparator);
                for (String surefireClasspathProperty : surefireClasspathProperties) {
                    urls.add(new File(surefireClasspathProperty).toURI().toURL());
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }

        // Also start with this classes's loader, in some environment this can
        // be different than the current thread's one
        for (ClassLoader loader = classLoader; loader != null; loader = loader.getParent()) {
            urls.addAll(findClasspathsByLoader(loader));
            loader = loader.getParent();
        }

        Map<URL, URL> replaceURLs = new HashMap<URL, URL>();
        Set<URL> derivedUrls = new HashSet<URL>();
        for (URL url : urls) {
            if (url.getProtocol().startsWith("vfs")) {
                try {
                    URLConnection conn = url.openConnection();
                    Object virtualFile = conn.getContent();
                    if (virtualFile.getClass().getName()
                            .equals("org.jboss.vfs.VirtualFile")) {
                        File file =
                                (File) virtualFile.getClass()
                                        .getMethod("getPhysicalFile")
                                        .invoke(virtualFile);
                        String fileName = file.getCanonicalPath();
                        String name =
                                (String) virtualFile.getClass()
                                        .getMethod("getName")
                                        .invoke(virtualFile);
                        name = name.trim().toLowerCase();
                        if ((name.endsWith("jar") || name.endsWith("zip")
                                && fileName.endsWith("/contents"))) {
                            fileName = fileName.replace("contents", name);
                        }
                        URL repURL = new URL("file:/" + fileName);
                        replaceURLs.put(url, repURL);
                    }
                } catch (Exception e) {
                    // We don't expect to trapped here
                    e.printStackTrace();
                }
            }
            try {
                if (url.toExternalForm().endsWith("WEB-INF/classes")) {
                    derivedUrls.add(
                            new URL(url.toExternalForm()
                                    .replace("WEB-INF/classes", "WEB-INF/lib")));
                } else if (url.toExternalForm().endsWith("WEB-INF/classes/")) {
                    derivedUrls.add(
                            new URL(url.toExternalForm()
                                    .replace("WEB-INF/classes/", "WEB-INF/lib/")));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        urls.removeAll(replaceURLs.keySet());
        urls.addAll(replaceURLs.values());
        urls.addAll(derivedUrls);
        replaceURLs.clear();
        // Check contained urls
        for (URL url : urls) {
            for (URL rootUrl : urls) {
                if (url.equals(rootUrl)) {
                    continue;
                }
                if (url.toExternalForm().startsWith(rootUrl.toExternalForm())) {
                    if (replaceURLs.get(url) != null) {
                        URL settledUrl = replaceURLs.get(url);
                        if (settledUrl.toExternalForm()
                                .startsWith(rootUrl.toExternalForm())) {
                            replaceURLs.put(url, rootUrl);
                        }
                    } else {
                        replaceURLs.put(url, rootUrl);
                    }
                }
            }
        }
        urls.removeAll(replaceURLs.keySet());
        return urls;
    }

    private static Set<URL> findClasspathsByLoader(ClassLoader loader) {
        Set<URL> urls = new HashSet<URL>();
        if (loader instanceof URLClassLoader) {
            URLClassLoader urlLoader = (URLClassLoader) loader;
            urls.addAll(Arrays.asList(urlLoader.getURLs()));
        } else {
            Enumeration<URL> urlEnum;
            try {
                urlEnum = loader.getResources("");
                while (urlEnum.hasMoreElements()) {
                    URL url = urlEnum.nextElement();
                    if (url.getProtocol().startsWith("bundleresource")) {
                        continue;
                    }
                    urls.add(url);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return urls;
    }

    protected static File[] getExtDirs() {
        String extDirsProperty = System.getProperty("java.ext.dirs");
        File[] extDirs;
        if (extDirsProperty != null) {
            StringTokenizer st = new StringTokenizer(extDirsProperty, File.pathSeparator);
            int count = st.countTokens();
            extDirs = new File[count];
            for (int i = 0; i < count; i++) {
                extDirs[i] = new File(st.nextToken());
            }
        } else {
            extDirs = new File[0];
        }
        return extDirs;
    }

    protected static Set<URL> getExtURLs(File[] dirs) throws IOException {
        Set<URL> urls = new HashSet<URL>();
        for (int i = 0; i < dirs.length; i++) {
            String[] files = dirs[i].list();
            if (files != null) {
                for (int j = 0; j < files.length; j++) {
                    if (!files[j].equals("meta-index")) {
                        File f = new File(dirs[i], files[j]);
                        urls.add(f.toURI().toURL());
                    }
                }
            }
        }
        return urls;
    }

}