hexsha
stringlengths 40
40
| size
int64 8
1.04M
| content
stringlengths 8
1.04M
| avg_line_length
float64 2.24
100
| max_line_length
int64 4
1k
| alphanum_fraction
float64 0.25
0.97
|
---|---|---|---|---|---|
a8aea10b6f48a3fda9a96f0ec58cf9afd34803be | 1,248 | package cs451;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class BestEffortBroadcast implements Broadcast, Observer {
private PerfectLinks pl;
private Observer observer;
private Host self;
private List<Host> hosts;
public BestEffortBroadcast(List<Host> hosts, Host self, Observer observer){
this.pl = new PerfectLinks(this);
this.self = self;
this.observer = observer;
this.hosts = hosts;
}
@Override
public void broadcast(Message message){
// Says that the forwarder is itself.
Message message_fwd = message.updateForwardInfos(self.getId(), self.getIp(), self.getPort());
if(observer == null){
OutputWriter.writeBroadcast(message, true);
}
for(int i = 0; i < hosts.size(); i++){
Host dest = hosts.get(i);
Message message_dest = message_fwd.updateDestInfos(dest.getId(), dest.getIp(), dest.getPort());
pl.send(message_dest);
}
}
@Override
public void deliver(Message message){
if(observer == null){
OutputWriter.writeDeliver(message, true);
} else {
observer.deliver(message);
}
}
}
| 27.733333 | 107 | 0.617788 |
18c7c1ef6cf5c42e1a71ef336198aee96890dfb7 | 6,253 | /*******************************************************************************
* Copyright (c) 2004 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.birt.report.model.library;
import java.util.List;
import org.eclipse.birt.report.model.api.ColumnBandData;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.MultiViewsHandle;
import org.eclipse.birt.report.model.api.RowHandle;
import org.eclipse.birt.report.model.api.RowOperationParameters;
import org.eclipse.birt.report.model.api.SlotHandle;
import org.eclipse.birt.report.model.api.TableHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.core.IDesignElement;
import org.eclipse.birt.report.model.api.elements.SemanticError;
import org.eclipse.birt.report.model.util.BaseTestCase;
/**
* The test case of the method 'canDoAction' of table row/column.
*
* <p>
* <table border="1" cellpadding="2" cellspacing="2" style="border-collapse:
* collapse" bordercolor="#111111">
* <th width="20%">Method</th>
* <th width="40%">Test Case</th>
* <th width="40%">Expected</th>
*
* <tr>
* <td>update table row/column operation.</td>
* <td>Test canDo method which table has parent.</td>
* <td>canDo method return false.</td>
* </tr>
*
*
* </table>
*
*/
public class LibraryWithTableTest extends BaseTestCase
{
private String fileCanUpdate = "TableItemRowUpdateTest.xml";//$NON-NLS-1$
/*
* @see TestCase#setUp()
*/
protected void setUp( ) throws Exception
{
super.setUp( );
}
/**
* Test update table row or table column.
*
* @throws Exception
*/
public void testRowAndColumnUpdateAction( ) throws Exception
{
openDesign( fileCanUpdate );
TableHandle tableHandle = (TableHandle) designHandle
.findElement( "NewTable" ); //$NON-NLS-1$
ColumnBandData data = tableHandle.copyColumn( 1 );
assertFalse( tableHandle.canPasteColumn( data, 2, true ) );
try
{
tableHandle.pasteColumn( data, 2, true );
fail( "forbidden do action on column " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals(
SemanticError.DESIGN_EXCEPTION_COLUMN_PASTE_FORBIDDEN, e
.getErrorCode( ) );
}
assertFalse( tableHandle.canInsertAndPasteColumn( data, 1 ) );
try
{
tableHandle.insertAndPasteColumn( data, 1 );
fail( "forbidden do action on column " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals(
SemanticError.DESIGN_EXCEPTION_COLUMN_PASTE_FORBIDDEN, e
.getErrorCode( ) );
}
assertFalse( tableHandle.canShiftColumn( 1, 2 ) );
try
{
tableHandle.shiftColumn( 1, 2 );
fail( "forbidden do action on column " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals(
SemanticError.DESIGN_EXCEPTION_COLUMN_PASTE_FORBIDDEN, e
.getErrorCode( ) );
}
SlotHandle slotHandle = tableHandle.getSlot( 0 );
RowHandle rowHandle = (RowHandle) slotHandle.get( 0 );
IDesignElement row = rowHandle.copy( );
RowOperationParameters parameters = new RowOperationParameters( 0, -1,
0 );
assertFalse( tableHandle.canPasteRow( row, parameters ) );
try
{
tableHandle.pasteRow( row, parameters );
fail( "forbidden do action on row " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals( SemanticError.DESIGN_EXCEPTION_ROW_PASTE_FORBIDDEN, e
.getErrorCode( ) );
}
assertFalse( tableHandle.canInsertRow( parameters ) );
try
{
tableHandle.insertRow( parameters );
fail( "forbidden do action on row " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals( SemanticError.DESIGN_EXCEPTION_ROW_INSERT_FORBIDDEN,
e.getErrorCode( ) );
}
assertFalse( tableHandle.canInsertAndPasteRow( row, parameters ) );
try
{
tableHandle.insertAndPasteRow( row, parameters );
fail( "forbidden do action on row " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals(
SemanticError.DESIGN_EXCEPTION_ROW_INSERTANDPASTE_FORBIDDEN,
e.getErrorCode( ) );
}
parameters.setDestIndex( 2 );
parameters.setSourceIndex( 0 );
assertFalse( tableHandle.canShiftRow( parameters ) );
try
{
tableHandle.shiftRow( parameters );
fail( "forbidden do action on row " ); //$NON-NLS-1$
}
catch ( SemanticException e )
{
assertEquals( SemanticError.DESIGN_EXCEPTION_ROW_SHIFT_FORBIDDEN, e
.getErrorCode( ) );
}
}
/**
* Test extends a grid that contains table. see bugzilla 187761
*
* @throws Exception
*/
public void testGridContainTableInLib( ) throws Exception
{
openDesign( "LibraryWithTableTest_GridContainTable.xml" ); //$NON-NLS-1$
TableHandle tableHandle = (TableHandle) designHandle
.findElement( "NewTable" ); //$NON-NLS-1$
assertNotNull( tableHandle );
}
/**
* Test extends a multiple view in the table element.
*
* @throws Exception
*/
public void testMultiViewsExtends( ) throws Exception
{
openDesign( "DesignIncludeTableMultiView.xml" ); //$NON-NLS-1$
TableHandle tableHandle = (TableHandle) designHandle
.findElement( "MyTable1" ); //$NON-NLS-1$
MultiViewsHandle multiView = (MultiViewsHandle) tableHandle
.getProperty( TableHandle.MULTI_VIEWS_PROP );
assertEquals( MultiViewsHandle.HOST, multiView
.getIntProperty( MultiViewsHandle.INDEX_PROP ) );
List views = multiView.getListProperty( MultiViewsHandle.VIEWS_PROP );
assertEquals( 2, views.size( ) );
ExtendedItemHandle box1 = (ExtendedItemHandle) views.get( 0 );
assertEquals( "box1", box1.getName( ) ); //$NON-NLS-1$
assertEquals( "5in", box1.getWidth( ).getStringValue( ) ); //$NON-NLS-1$
tableHandle.setCurrentView( (ExtendedItemHandle) views.get( 1 ) );
box1.setWidth( 3 );
save( );
assertTrue( compareFile( "DesignIncludeTableMultiView_golden.xml" ) ); //$NON-NLS-1$
}
}
| 28.949074 | 86 | 0.68847 |
08afbe4191b4d2be810fb31960be5fcdbfb0d813 | 2,171 | /*
* Corona-Warn-App / cwa-verification
*
* (C) 2020, T-Systems International GmbH
*
* Deutsche Telekom AG and all other contributors /
* copyright owners license this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package app.coronawarn.verification.config;
import java.util.Arrays;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.firewall.HttpFirewall;
import org.springframework.security.web.firewall.StrictHttpFirewall;
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean
protected HttpFirewall strictFirewall() {
StrictHttpFirewall firewall = new StrictHttpFirewall();
firewall.setAllowedHttpMethods(Arrays.asList(
HttpMethod.GET.name(),
HttpMethod.POST.name(),
HttpMethod.HEAD.name()
));
return firewall;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.mvcMatchers("/api/**").permitAll().and().requiresChannel().mvcMatchers("/api/**").requiresSecure().and()
.authorizeRequests()
.mvcMatchers("/version/**").permitAll()
.mvcMatchers("/actuator/**").permitAll()
.anyRequest().denyAll()
.and().csrf().disable();
}
}
| 34.460317 | 111 | 0.75403 |
5d9372b084a2978cb814dac4e5ad27262dbf9d6e | 88 | package com.makefire.anonymous.domain.user.repository;
public class UserRepository {
}
| 17.6 | 54 | 0.818182 |
9a3c2c7721f9e6257d842976b044b968daeb0aba | 5,657 | /* Import1: A Maze-Solving Game */
package studio.ignitionigloogames.twistedtrek.import1.spells;
import studio.ignitionigloogames.twistedtrek.import1.Import1;
import studio.ignitionigloogames.twistedtrek.import1.Messager;
import studio.ignitionigloogames.twistedtrek.import1.PreferencesManager;
import studio.ignitionigloogames.twistedtrek.import1.creatures.Creature;
import studio.ignitionigloogames.twistedtrek.import1.creatures.PCManager;
import studio.ignitionigloogames.twistedtrek.import1.creatures.castes.CasteConstants;
import studio.ignitionigloogames.twistedtrek.import1.effects.Effect;
import studio.ignitionigloogames.twistedtrek.import1.resourcemanagers.SoundManager;
public class SpellBookManager {
// Fields
private static boolean NO_SPELLS_FLAG = false;
// Private Constructor
private SpellBookManager() {
// Do nothing
}
public static boolean selectAndCastSpell(final Creature caster) {
boolean result = false;
SpellBookManager.NO_SPELLS_FLAG = false;
final Spell s = SpellBookManager.selectSpell(caster);
if (s != null) {
result = SpellBookManager.castSpell(s, caster);
if (!result && !SpellBookManager.NO_SPELLS_FLAG) {
Messager.showErrorDialog("You try to cast a spell, but realize you don't have enough MP!",
"Select Spell");
}
}
return result;
}
private static Spell selectSpell(final Creature caster) {
final SpellBook book = caster.getSpellBook();
if (book != null) {
final String[] names = book.getAllSpellNames();
final String[] displayNames = book.getAllSpellNamesWithCosts();
if (names != null && displayNames != null) {
// Play casting spell sound
if (Import1.getApplication().getPrefsManager().getSoundEnabled(PreferencesManager.SOUNDS_BATTLE)) {
SoundManager.play("spell");
}
String dialogResult = null;
dialogResult = Messager.showInputDialog("Select a Spell to Cast", "Select Spell", displayNames,
displayNames[0]);
if (dialogResult != null) {
int index;
for (index = 0; index < displayNames.length; index++) {
if (dialogResult.equals(displayNames[index])) {
break;
}
}
final Spell s = book.getSpellByName(names[index]);
return s;
} else {
return null;
}
} else {
SpellBookManager.NO_SPELLS_FLAG = true;
Messager.showErrorDialog("You try to cast a spell, but realize you don't know any!", "Select Spell");
return null;
}
} else {
SpellBookManager.NO_SPELLS_FLAG = true;
Messager.showErrorDialog("You try to cast a spell, but realize you don't know any!", "Select Spell");
return null;
}
}
public static boolean castSpell(final Spell cast, final Creature caster) {
if (cast != null) {
final int casterMP = caster.getCurrentMP();
final int cost = cast.getCost();
if (casterMP >= cost) {
// Cast Spell
caster.drain(cost);
final Effect b = cast.getEffect();
// Play spell's associated sound effect, if it has one
final String snd = cast.getSound();
if (snd != null) {
if (Import1.getApplication().getPrefsManager().getSoundEnabled(PreferencesManager.SOUNDS_BATTLE)) {
SoundManager.play(snd);
}
}
b.resetEffect();
final Creature target = SpellBookManager.resolveTarget(cast);
if (target.isEffectActive(b)) {
target.extendEffect(b, b.getInitialRounds());
} else {
b.restoreEffect(target);
target.applyEffect(b);
}
return true;
} else {
// Not enough MP
return false;
}
} else {
return false;
}
}
private static Creature resolveTarget(final Spell cast) {
final char target = cast.getTarget();
switch (target) {
case 'P':
return PCManager.getPlayer();
case 'E':
return Import1.getApplication().getBattle().getEnemy();
default:
return null;
}
}
public static SpellBook getSpellBookByID(final int ID) {
switch (ID) {
case CasteConstants.CASTE_ASSASSIN:
return new AssassinSpellBook();
case CasteConstants.CASTE_BASHER:
return new BasherSpellBook();
case CasteConstants.CASTE_CURER:
return new CurerSpellBook();
case CasteConstants.CASTE_DESTROYER:
return new DestroyerSpellBook();
case CasteConstants.CASTE_ECLECTIC:
return new EclecticSpellBook();
case CasteConstants.CASTE_FOOL:
return new FoolSpellBook();
case CasteConstants.CASTE_GURU:
return new GuruSpellBook();
case CasteConstants.CASTE_HUNTER:
return new HunterSpellBook();
case CasteConstants.CASTE_JUMPER:
return new JumperSpellBook();
case CasteConstants.CASTE_KNIGHT:
return new KnightSpellBook();
case CasteConstants.CASTE_LOCKSMITH:
return new LocksmithSpellBook();
case CasteConstants.CASTE_MONK:
return new MonkSpellBook();
case CasteConstants.CASTE_NINJA:
return new NinjaSpellBook();
case CasteConstants.CASTE_OVERSEER:
return new OverseerSpellBook();
case CasteConstants.CASTE_PICKPOCKET:
return new PickpocketSpellBook();
case CasteConstants.CASTE_ROGUE:
return new RogueSpellBook();
case CasteConstants.CASTE_SPY:
return new SpySpellBook();
case CasteConstants.CASTE_TEACHER:
return new TeacherSpellBook();
case CasteConstants.CASTE_WARLOCK:
return new WarlockSpellBook();
case CasteConstants.CASTE_YELLER:
return new YellerSpellBook();
default:
return null;
}
}
public static SpellBook getEnemySpellBookByID(final int ID) {
switch (ID) {
case 0:
return null;
case 1:
return new LowLevelSpellBook();
case 2:
return new MidLevelSpellBook();
case 3:
return new HighLevelSpellBook();
case 4:
return new ToughLevelSpellBook();
default:
return null;
}
}
}
| 31.082418 | 106 | 0.718048 |
f37b13cbe32e2373c4e932cbee7ffed1075d4b9c | 1,762 | package us.slemjet.leetcode.easy.from_301_to_350;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import us.slemjet.leetcode.easy.from_301_to_350.PowerOfThree;
import java.util.stream.Stream;
class PowerOfThreeTest {
private static Stream<Arguments> parameters() {
return Stream.of(
Arguments.of(27, true),
Arguments.of(0, false),
Arguments.of(9, true),
Arguments.of(1, true),
Arguments.of(45, false),
Arguments.of(2147483647, false),
Arguments.of(243, true)
);
}
@ParameterizedTest
@MethodSource("parameters")
void testIsPowerOfThree(int n, boolean expected) {
// given
PowerOfThree solution = new PowerOfThree();
// when
boolean result = solution.isPowerOfThree(n);
// then
Assertions.assertThat(result).isEqualTo(expected);
}
@ParameterizedTest
@MethodSource("parameters")
void testIsPowerOfLog(int n, boolean expected) {
// given
PowerOfThree solution = new PowerOfThree();
// when
boolean result = solution.isPowerOfThreeLog(n);
// then
Assertions.assertThat(result).isEqualTo(expected);
}
@ParameterizedTest
@MethodSource("parameters")
void testIsPowerOfThreeCheat(int n, boolean expected) {
// given
PowerOfThree solution = new PowerOfThree();
// when
boolean result = solution.isPowerOfThreeCheat(n);
// then
Assertions.assertThat(result).isEqualTo(expected);
}
} | 27.968254 | 61 | 0.637911 |
e4885fa84e08cd59321d648702f9144dfa57358f | 1,513 | package com.twu.biblioteca;
import java.util.ArrayList;
import java.util.Iterator;
public class User {
String name;
String password;
String email;
String phoneNumber;
ArrayList<libraryItem> itemsCheckedOut;
public User(){}
public User(String name, String password, String email, String phoneNumber){
this.name = name;
this.password = password;
this.email = email;
this.phoneNumber = phoneNumber;
this.itemsCheckedOut = new ArrayList<libraryItem>();
}
public String getName() {
return name;
}
public String getPassword() {
return password;
}
//Add item to list of items checked out on this user acc
public void addToCheckedOut(libraryItem item){
itemsCheckedOut.add(item);
}
//Add item to list of items checked out on this user acc
public void removeFromCheckedOut(libraryItem item){
itemsCheckedOut.remove(item);
}
//Convert list of items checked out on this user account to string
public String itemsCheckedOutToString(){
String stringToReturn = "";
Iterator iter = itemsCheckedOut.iterator();
while (iter.hasNext()) {
stringToReturn += iter.next().toString();
stringToReturn += "\n";
}
return stringToReturn;
}
//Convert user profile info to string
public String toString(){
return "Name: " + name + "\nEmail: " + email + "\nPhone number: " + phoneNumber;
}
}
| 26.086207 | 88 | 0.635823 |
0d611307aa9c999722190cb31ec3807ff156d8c1 | 1,250 | package oasis.core;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Default exception type used by Oasis
*
* @author Nicholas Hamilton
*
*/
@SuppressWarnings("serial")
public class OasisException extends RuntimeException {
/**
* Constructor that takes a message
*
* @param string Exception message
*/
public OasisException(String string) {
super(string);
}
/**
* Constructor that takes an object
*
* @param obj Exception object
*/
public OasisException(Object obj) {
super(obj == null ? null : obj.toString());
}
/**
* Constructor that takes a throwable. Can
* be used to wrap around another exception
*
* @param thrw Exception throwable
*/
public OasisException(Throwable thrw) {
super(thrw);
}
/**
* Stringifies the stack trace of an exception\
*
* @param e The exception
* @return Stringified stack trace
*/
public static String getStackTrace(Exception e) {
StringWriter string = new StringWriter();
PrintWriter print = new PrintWriter(string);
e.printStackTrace(print);
return string.toString();
}
}
| 21.929825 | 54 | 0.608 |
bfc807bf6075af3af5eaffb8c819f3f8aa6f6e68 | 7,396 | /*------------------------------------------------------------------------------
Copyright (c) CovertJaguar, 2011-2019
http://railcraft.info
This code is the property of CovertJaguar
and may only be used with explicit written
permission unless otherwise specified on the
license page at http://railcraft.info/wiki/info:license.
-----------------------------------------------------------------------------*/
package mods.railcraft.common.blocks.aesthetics.materials.slab;
import mods.railcraft.common.blocks.aesthetics.materials.ItemMaterial;
import mods.railcraft.common.blocks.aesthetics.materials.Materials;
import mods.railcraft.common.plugins.forge.WorldPlugin;
import mods.railcraft.common.util.sounds.SoundHelper;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import static mods.railcraft.common.blocks.aesthetics.materials.Materials.MATERIAL_KEY;
import static mods.railcraft.common.util.inventory.InvTools.dec;
import static mods.railcraft.common.util.inventory.InvTools.isEmpty;
import static net.minecraft.util.EnumFacing.DOWN;
import static net.minecraft.util.EnumFacing.UP;
/**
* @author CovertJaguar <http://www.railcraft.info>
*/
public class ItemSlab extends ItemMaterial {
public ItemSlab(Block block) {
super(block);
setMaxDamage(0);
setHasSubtypes(false);
}
/**
* Callback for item usage. If the item does something special on right
* clicking, he will have one of those. Return True if something happen and
* false if it don't. This is for ITEMS, not BLOCKS
*/
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = playerIn.getHeldItem(hand);
if (isEmpty(stack)) {
return EnumActionResult.PASS;
}
if (!playerIn.canPlayerEdit(pos, facing, stack)) {
return EnumActionResult.PASS;
} else {
TileSlab tileSlab = BlockRailcraftSlab.getSlabTile(worldIn, pos);
if (canAddSlab(tileSlab, facing)) {
tryAddSlab(tileSlab, worldIn, pos, stack);
return EnumActionResult.SUCCESS;
}
tileSlab = BlockRailcraftSlab.getSlabTile(worldIn, pos.offset(facing));
if (isSingleSlab(tileSlab)) {
tryAddSlab(tileSlab, worldIn, pos.offset(facing), stack);
return EnumActionResult.SUCCESS;
}
return super.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
}
private Materials getMat(ItemStack stack) {
return Materials.from(stack, MATERIAL_KEY);
}
private boolean canAddSlab(@Nullable TileSlab tileSlab, EnumFacing side) {
if (tileSlab != null) {
boolean up = tileSlab.isTopSlab();
return (side == UP && !up || side == DOWN && up) && !tileSlab.isDoubleSlab();
}
return false;
}
private boolean isSingleSlab(@Nullable TileSlab tileSlab) {
return tileSlab != null && !tileSlab.isDoubleSlab();
}
private void tryAddSlab(TileSlab slab, World world, BlockPos pos, ItemStack stack) {
IBlockState state = WorldPlugin.getBlockState(world, pos);
AxisAlignedBB box = state.getCollisionBoundingBox(world, pos);
if ((box == null || world.checkNoEntityCollision(box)) && slab.addSlab(getMat(stack))) {
SoundType type = block.getSoundType(state, world, pos, null);
SoundHelper.playBlockSound(world, pos,
type.getPlaceSound(),
SoundCategory.BLOCKS,
(type.getVolume() + 1.0F) / 2.0F,
type.getPitch() * 0.8F, state);
dec(stack);
}
}
@SuppressWarnings("SimplifiableIfStatement")
@Override
public boolean canPlaceBlockOnSide(World world, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
TileSlab tileSlab = BlockRailcraftSlab.getSlabTile(world, pos);
if (canAddSlab(tileSlab, side)) {
return true;
}
tileSlab = BlockRailcraftSlab.getSlabTile(world, pos.offset(side));
if (isSingleSlab(tileSlab)) {
return true;
}
return super.canPlaceBlockOnSide(world, pos, side, player, stack);
}
/**
* Called to actually place the block, after the location is determined and
* all permission checks have been made.
*
* @param stack The item stack that was used to place the block. This can be
* changed inside the method.
* @param player The player who is placing the block. Can be null if the
* block is not being placed by a player.
* @param side The side the player (or machine) right-clicked on.
*/
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
AxisAlignedBB box = newState.getCollisionBoundingBox(world, pos);
if (box != null && !world.checkNoEntityCollision(box)) {
return false;
}
// boolean shifted = world.getBlockId(x, y, z) != blockID;
// EnumFacing s = EnumFacing.VALUES[side].getOpposite();
// int cx = shifted ? MiscTools.getXOnSide(x, s) : x;
// int cy = shifted ? MiscTools.getYOnSide(y, s) : y;
// int cz = shifted ? MiscTools.getZOnSide(z, s) : z;
// if (world.getBlockId(cx, cy, cz) == blockID) {
// int meta = world.getBlockMetadata(cx, cy, cz);
// if (!shifted && meta != DOUBLE_SLAB_META || meta == UP_SLAB_META && side == 0 || meta == DOWN_SLAB_META && side == 1) {
// world.setBlockMetadataWithNotify(cx, cy, cz, DOUBLE_SLAB_META, 3);
// world.playSoundEffect((double) ((float) cx + 0.5F), (double) ((float) cy + 0.5F), (double) ((float) cz + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
// --stack.stackSize;
// return false;
// }
// }
if (!world.setBlockState(pos, newState)) {
return false;
}
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == block) {
TileSlab slab = BlockRailcraftSlab.getSlabTile(world, pos);
if (slab != null) {
if (side != DOWN && (side == UP || (double) hitY <= 0.5D)) {
slab.setBottomSlab(getMat(stack));
} else {
slab.setTopSlab(getMat(stack));
}
}
setTileEntityNBT(world, player, pos, stack);
block.onBlockPlacedBy(world, pos, state, player, stack);
}
return true;
}
}
| 42.022727 | 243 | 0.626825 |
66eebefdc860eff1068b0d9384bad781b1c12544 | 6,797 | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.job.move;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import alluxio.AlluxioURI;
import alluxio.ClientContext;
import alluxio.ConfigurationTestUtils;
import alluxio.client.WriteType;
import alluxio.client.file.FileSystem;
import alluxio.client.file.FileSystemContext;
import alluxio.client.file.MockFileInStream;
import alluxio.client.file.MockFileOutStream;
import alluxio.client.file.URIStatus;
import alluxio.conf.AlluxioConfiguration;
import alluxio.grpc.CreateFilePOptions;
import alluxio.grpc.DeletePOptions;
import alluxio.grpc.WritePType;
import alluxio.job.JobWorkerContext;
import alluxio.underfs.UfsManager;
import alluxio.util.io.BufferUtils;
import alluxio.wire.FileInfo;
import com.google.common.collect.Lists;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
/**
* Unit tests for {@link MoveDefinition#runTask(MoveConfig, ArrayList, JobWorkerContext)}.
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({FileSystemContext.class})
public final class MoveDefinitionRunTaskTest {
private static final String TEST_DIR = "/DIR";
private static final String TEST_SOURCE = "/DIR/TEST_SOURCE";
private static final String TEST_DESTINATION = "/DIR/TEST_DESTINATION";
private static final byte[] TEST_SOURCE_CONTENTS = BufferUtils.getIncreasingByteArray(100);
private FileSystem mMockFileSystem;
private FileSystemContext mMockFileSystemContext;
private MockFileInStream mMockInStream;
private MockFileOutStream mMockOutStream;
private UfsManager mMockUfsManager;
@Before
public void before() throws Exception {
AlluxioConfiguration conf = ConfigurationTestUtils.defaults();
mMockFileSystem = Mockito.mock(FileSystem.class);
mMockFileSystemContext = PowerMockito.mock(FileSystemContext.class);
when(mMockFileSystemContext.getClientContext())
.thenReturn(ClientContext.create(conf));
when(mMockFileSystemContext.getConf())
.thenReturn(conf);
mMockInStream = new MockFileInStream(mMockFileSystemContext, TEST_SOURCE_CONTENTS, conf);
when(mMockFileSystem.openFile(new AlluxioURI(TEST_SOURCE))).thenReturn(mMockInStream);
mMockOutStream = new MockFileOutStream(mMockFileSystemContext);
when(mMockFileSystem.createFile(eq(new AlluxioURI(TEST_DESTINATION)),
any(CreateFilePOptions.class))).thenReturn(mMockOutStream);
mMockUfsManager = Mockito.mock(UfsManager.class);
}
/**
* Tests that the bytes of the file to move are written to the destination stream.
*/
@Test
public void basicMoveTest() throws Exception {
runTask(TEST_SOURCE, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH);
Assert.assertArrayEquals(TEST_SOURCE_CONTENTS, mMockOutStream.toByteArray());
verify(mMockFileSystem).delete(new AlluxioURI(TEST_SOURCE));
}
/**
* Tests that the worker will delete the source directory if the directory contains nothing.
*/
@Test
public void deleteEmptySourceDir() throws Exception {
when(mMockFileSystem.listStatus(new AlluxioURI(TEST_DIR)))
.thenReturn(Lists.<URIStatus>newArrayList());
runTask(TEST_DIR, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH);
verify(mMockFileSystem).delete(eq(new AlluxioURI(TEST_DIR)), any(DeletePOptions.class));
}
/**
* Tests that the worker will delete the source directory if the directory contains only
* directories.
*/
@Test
public void deleteDirsOnlySourceDir() throws Exception {
String inner = TEST_DIR + "/innerDir";
when(mMockFileSystem.listStatus(new AlluxioURI(TEST_DIR))).thenReturn(
Lists.newArrayList(new URIStatus(new FileInfo().setPath(inner).setFolder(true))));
when(mMockFileSystem.listStatus(new AlluxioURI(inner)))
.thenReturn(Lists.<URIStatus>newArrayList());
runTask(TEST_DIR, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH);
verify(mMockFileSystem).delete(eq(new AlluxioURI(TEST_DIR)), any(DeletePOptions.class));
}
/**
* Tests that the worker will not delete the source directory if the directory still contains
* files.
*/
@Test
public void dontDeleteNonEmptySourceTest() throws Exception {
when(mMockFileSystem.listStatus(new AlluxioURI(TEST_DIR)))
.thenReturn(Lists.newArrayList(new URIStatus(new FileInfo())));
runTask(TEST_DIR, TEST_SOURCE, TEST_DESTINATION, WriteType.THROUGH);
verify(mMockFileSystem, times(0)).delete(eq(new AlluxioURI(TEST_DIR)),
any(DeletePOptions.class));
}
/**
* Tests that the worker writes with the specified write type.
*/
@Test
@Ignore
// TODO(ggezer) Fix.
public void writeTypeTest() throws Exception {
runTask(TEST_SOURCE, TEST_SOURCE, TEST_DESTINATION, WriteType.CACHE_THROUGH);
verify(mMockFileSystem).createFile(eq(new AlluxioURI(TEST_DESTINATION)), Matchers
.eq(CreateFilePOptions.newBuilder().setWriteType(WritePType.CACHE_THROUGH)).build());
runTask(TEST_SOURCE, TEST_SOURCE, TEST_DESTINATION, WriteType.MUST_CACHE);
verify(mMockFileSystem).createFile(eq(new AlluxioURI(TEST_DESTINATION)), Matchers
.eq(CreateFilePOptions.newBuilder().setWriteType(WritePType.MUST_CACHE)).build());
}
/**
* Runs the task.
*
* @param configSource {@link MoveConfig} source
* @param commandSource {@link MoveCommand} source
* @param commandDestination {@link MoveCommand} destination
* @param writeType {@link MoveConfig} writeType
*/
private void runTask(String configSource, String commandSource, String commandDestination,
WriteType writeType) throws Exception {
new MoveDefinition(mMockFileSystemContext, mMockFileSystem).runTask(
new MoveConfig(configSource, "", writeType.toString(), false),
Lists.newArrayList(new MoveCommand(commandSource, commandDestination)),
new JobWorkerContext(1, 1, mMockUfsManager));
}
}
| 40.700599 | 98 | 0.770046 |
072ae4a4e922824f94543018f9cd519f56efa42a | 1,551 | package com.journaldev.parser.csv;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.csv.CSVRecord;
public class ApacheCommonsCSVParserExample {
public static void main(String[] args) throws FileNotFoundException, IOException {
//Create the CSVFormat object
CSVFormat format = CSVFormat.RFC4180.withHeader().withDelimiter(',');
//initialize the CSVParser object
CSVParser parser = new CSVParser(new FileReader("employees.csv"), format);
List<Employee> emps = new ArrayList<Employee>();
for(CSVRecord record : parser){
Employee emp = new Employee();
emp.setId(record.get("ID"));
emp.setName(record.get("Name"));
emp.setRole(record.get("Role"));
emp.setSalary(record.get("Salary"));
emps.add(emp);
}
//close the parser
parser.close();
System.out.println(emps);
//CSV Write Example using CSVPrinter
CSVPrinter printer = new CSVPrinter(System.out, format.withDelimiter('#'));
System.out.println("********");
printer.printRecord("ID","Name","Role","Salary");
for(Employee emp : emps){
List<String> empData = new ArrayList<String>();
empData.add(emp.getId());
empData.add(emp.getName());
empData.add(emp.getRole());
empData.add(emp.getSalary());
printer.printRecord(empData);
}
//close the printer
printer.close();
}
}
| 28.2 | 83 | 0.715023 |
80a498f4cb3c06e5fe69c7ad44e0a72770fe4cf5 | 458 | package edu.mines.model;
import com.amazonaws.auth.policy.Resource;
import org.apache.commons.collections4.Equator;
public class ResourceEquator implements Equator<Resource> {
@Override
//TODO regex match on resource name
public boolean equate(Resource resource, Resource t1) {
return resource.getId().equals(t1.getId());
}
@Override
public int hash(Resource resource) {
return resource.getId().hashCode();
}
} | 25.444444 | 59 | 0.709607 |
525f6c77b1652dbd1b32bf27d1c710a6c2cd53a7 | 228 | // BSD License (http://lemurproject.org/galago-license)
package org.lemurproject.galago.core.index.source;
/**
*
* @author jfoley
*/
public interface BooleanSource extends DiskSource {
public boolean indicator(long id);
}
| 20.727273 | 55 | 0.745614 |
09238925b3079e1b92ed73e93fc78f08ff72f9cb | 1,676 | package com.lickhunter.web.configs;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.sqlite.SQLiteConfig;
import org.sqlite.SQLiteOpenMode;
import javax.sql.DataSource;
@Configuration
public class DataSourceConfig {
@Value("${spring.datasource.driver-class-name}")
private String driverName;
@Value("${spring.datasource.url}")
private String url;
/**
*
* @return DataSource
*/
@Bean("masterDataSource")
@ConfigurationProperties("spring.datasource.master")
public DataSource masterDataSource() {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName(driverName);
hikariConfig.setJdbcUrl(url);
hikariConfig.setMaximumPoolSize(1);
hikariConfig.setConnectionTestQuery("SELECT 1");
SQLiteConfig config= new SQLiteConfig();
config.setOpenMode(SQLiteOpenMode.OPEN_URI);
config.setOpenMode(SQLiteOpenMode.FULLMUTEX);
config.setBusyTimeout("10000");
hikariConfig.setPoolName("springHikariCP");
hikariConfig.addDataSourceProperty(SQLiteConfig.Pragma.OPEN_MODE.pragmaName, config.getOpenModeFlags());
hikariConfig.addDataSourceProperty(SQLiteConfig.Pragma.JOURNAL_MODE.pragmaName, SQLiteConfig.JournalMode.WAL );
HikariDataSource dataSource = new HikariDataSource(hikariConfig);
return dataSource;
}
}
| 38.090909 | 119 | 0.754177 |
b06d55d101f091161898fd1b17d3d08236955ba4 | 20,406 | /*
* XML Type: CT_RadarSer
* Namespace: http://schemas.openxmlformats.org/drawingml/2006/chart
* Java type: org.openxmlformats.schemas.drawingml.x2006.chart.CTRadarSer
*
* Automatically generated - do not modify.
*/
package org.openxmlformats.schemas.drawingml.x2006.chart.impl;
import javax.xml.namespace.QName;
import org.apache.xmlbeans.QNameSet;
/**
* An XML CT_RadarSer(@http://schemas.openxmlformats.org/drawingml/2006/chart).
*
* This is a complex type.
*/
public class CTRadarSerImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.openxmlformats.schemas.drawingml.x2006.chart.CTRadarSer {
private static final long serialVersionUID = 1L;
public CTRadarSerImpl(org.apache.xmlbeans.SchemaType sType) {
super(sType);
}
private static final QName[] PROPERTY_QNAME = {
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "idx"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "order"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "tx"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "spPr"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "marker"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "dPt"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "dLbls"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "cat"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "val"),
new QName("http://schemas.openxmlformats.org/drawingml/2006/chart", "extLst"),
};
/**
* Gets the "idx" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt getIdx() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt)get_store().find_element_user(PROPERTY_QNAME[0], 0);
return (target == null) ? null : target;
}
}
/**
* Sets the "idx" element
*/
@Override
public void setIdx(org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt idx) {
generatedSetterHelperImpl(idx, PROPERTY_QNAME[0], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "idx" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt addNewIdx() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt)get_store().add_element_user(PROPERTY_QNAME[0]);
return target;
}
}
/**
* Gets the "order" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt getOrder() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt)get_store().find_element_user(PROPERTY_QNAME[1], 0);
return (target == null) ? null : target;
}
}
/**
* Sets the "order" element
*/
@Override
public void setOrder(org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt order) {
generatedSetterHelperImpl(order, PROPERTY_QNAME[1], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "order" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt addNewOrder() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt)get_store().add_element_user(PROPERTY_QNAME[1]);
return target;
}
}
/**
* Gets the "tx" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx getTx() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx)get_store().find_element_user(PROPERTY_QNAME[2], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "tx" element
*/
@Override
public boolean isSetTx() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[2]) != 0;
}
}
/**
* Sets the "tx" element
*/
@Override
public void setTx(org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx tx) {
generatedSetterHelperImpl(tx, PROPERTY_QNAME[2], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "tx" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx addNewTx() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx)get_store().add_element_user(PROPERTY_QNAME[2]);
return target;
}
}
/**
* Unsets the "tx" element
*/
@Override
public void unsetTx() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[2], 0);
}
}
/**
* Gets the "spPr" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getSpPr() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)get_store().find_element_user(PROPERTY_QNAME[3], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "spPr" element
*/
@Override
public boolean isSetSpPr() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[3]) != 0;
}
}
/**
* Sets the "spPr" element
*/
@Override
public void setSpPr(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties spPr) {
generatedSetterHelperImpl(spPr, PROPERTY_QNAME[3], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "spPr" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties addNewSpPr() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)get_store().add_element_user(PROPERTY_QNAME[3]);
return target;
}
}
/**
* Unsets the "spPr" element
*/
@Override
public void unsetSpPr() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[3], 0);
}
}
/**
* Gets the "marker" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker getMarker() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker)get_store().find_element_user(PROPERTY_QNAME[4], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "marker" element
*/
@Override
public boolean isSetMarker() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[4]) != 0;
}
}
/**
* Sets the "marker" element
*/
@Override
public void setMarker(org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker marker) {
generatedSetterHelperImpl(marker, PROPERTY_QNAME[4], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "marker" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker addNewMarker() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTMarker)get_store().add_element_user(PROPERTY_QNAME[4]);
return target;
}
}
/**
* Unsets the "marker" element
*/
@Override
public void unsetMarker() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[4], 0);
}
}
/**
* Gets a List of "dPt" elements
*/
@Override
public java.util.List<org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt> getDPtList() {
synchronized (monitor()) {
check_orphaned();
return new org.apache.xmlbeans.impl.values.JavaListXmlObject<>(
this::getDPtArray,
this::setDPtArray,
this::insertNewDPt,
this::removeDPt,
this::sizeOfDPtArray
);
}
}
/**
* Gets array of all "dPt" elements
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt[] getDPtArray() {
return getXmlObjectArray(PROPERTY_QNAME[5], new org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt[0]);
}
/**
* Gets ith "dPt" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt getDPtArray(int i) {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt)get_store().find_element_user(PROPERTY_QNAME[5], i);
if (target == null) {
throw new IndexOutOfBoundsException();
}
return target;
}
}
/**
* Returns number of "dPt" element
*/
@Override
public int sizeOfDPtArray() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[5]);
}
}
/**
* Sets array of all "dPt" element WARNING: This method is not atomicaly synchronized.
*/
@Override
public void setDPtArray(org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt[] dPtArray) {
check_orphaned();
arraySetterHelper(dPtArray, PROPERTY_QNAME[5]);
}
/**
* Sets ith "dPt" element
*/
@Override
public void setDPtArray(int i, org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt dPt) {
generatedSetterHelperImpl(dPt, PROPERTY_QNAME[5], i, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_ARRAYITEM);
}
/**
* Inserts and returns a new empty value (as xml) as the ith "dPt" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt insertNewDPt(int i) {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt)get_store().insert_element_user(PROPERTY_QNAME[5], i);
return target;
}
}
/**
* Appends and returns a new empty value (as xml) as the last "dPt" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt addNewDPt() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTDPt)get_store().add_element_user(PROPERTY_QNAME[5]);
return target;
}
}
/**
* Removes the ith "dPt" element
*/
@Override
public void removeDPt(int i) {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[5], i);
}
}
/**
* Gets the "dLbls" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls getDLbls() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls)get_store().find_element_user(PROPERTY_QNAME[6], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "dLbls" element
*/
@Override
public boolean isSetDLbls() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[6]) != 0;
}
}
/**
* Sets the "dLbls" element
*/
@Override
public void setDLbls(org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls dLbls) {
generatedSetterHelperImpl(dLbls, PROPERTY_QNAME[6], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "dLbls" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls addNewDLbls() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTDLbls)get_store().add_element_user(PROPERTY_QNAME[6]);
return target;
}
}
/**
* Unsets the "dLbls" element
*/
@Override
public void unsetDLbls() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[6], 0);
}
}
/**
* Gets the "cat" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource getCat() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)get_store().find_element_user(PROPERTY_QNAME[7], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "cat" element
*/
@Override
public boolean isSetCat() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[7]) != 0;
}
}
/**
* Sets the "cat" element
*/
@Override
public void setCat(org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource cat) {
generatedSetterHelperImpl(cat, PROPERTY_QNAME[7], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "cat" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource addNewCat() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource)get_store().add_element_user(PROPERTY_QNAME[7]);
return target;
}
}
/**
* Unsets the "cat" element
*/
@Override
public void unsetCat() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[7], 0);
}
}
/**
* Gets the "val" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource getVal() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource)get_store().find_element_user(PROPERTY_QNAME[8], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "val" element
*/
@Override
public boolean isSetVal() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[8]) != 0;
}
}
/**
* Sets the "val" element
*/
@Override
public void setVal(org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource val) {
generatedSetterHelperImpl(val, PROPERTY_QNAME[8], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "val" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource addNewVal() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource)get_store().add_element_user(PROPERTY_QNAME[8]);
return target;
}
}
/**
* Unsets the "val" element
*/
@Override
public void unsetVal() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[8], 0);
}
}
/**
* Gets the "extLst" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList getExtLst() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList)get_store().find_element_user(PROPERTY_QNAME[9], 0);
return (target == null) ? null : target;
}
}
/**
* True if has "extLst" element
*/
@Override
public boolean isSetExtLst() {
synchronized (monitor()) {
check_orphaned();
return get_store().count_elements(PROPERTY_QNAME[9]) != 0;
}
}
/**
* Sets the "extLst" element
*/
@Override
public void setExtLst(org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList extLst) {
generatedSetterHelperImpl(extLst, PROPERTY_QNAME[9], 0, org.apache.xmlbeans.impl.values.XmlObjectBase.KIND_SETTERHELPER_SINGLETON);
}
/**
* Appends and returns a new empty "extLst" element
*/
@Override
public org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList addNewExtLst() {
synchronized (monitor()) {
check_orphaned();
org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList target = null;
target = (org.openxmlformats.schemas.drawingml.x2006.chart.CTExtensionList)get_store().add_element_user(PROPERTY_QNAME[9]);
return target;
}
}
/**
* Unsets the "extLst" element
*/
@Override
public void unsetExtLst() {
synchronized (monitor()) {
check_orphaned();
get_store().remove_element(PROPERTY_QNAME[9], 0);
}
}
}
| 33.728926 | 162 | 0.629668 |
53b9ed0683076eda0f7480ed58534c5e06e9a0c1 | 6,387 | package org.enodeframework.eventing;
import org.enodeframework.common.function.Action1;
import org.enodeframework.common.io.Task;
import org.enodeframework.messaging.IMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
public class ProcessingEventMailBox {
private final static Logger logger = LoggerFactory.getLogger(ProcessingEventMailBox.class);
private final Object lockObj = new Object();
private String aggregateRootId;
private Date lastActiveTime;
private boolean running;
private int latestHandledEventVersion;
private ConcurrentHashMap<Integer, ProcessingEvent> waitingMessageDict = new ConcurrentHashMap<>();
private ConcurrentLinkedQueue<ProcessingEvent> messageQueue;
private Action1<ProcessingEvent> handleMessageAction;
public ProcessingEventMailBox(String aggregateRootId, int latestHandledEventVersion, Action1<ProcessingEvent> handleMessageAction) {
messageQueue = new ConcurrentLinkedQueue<>();
this.aggregateRootId = aggregateRootId;
this.latestHandledEventVersion = latestHandledEventVersion;
this.handleMessageAction = handleMessageAction;
lastActiveTime = new Date();
}
public String getAggregateRootId() {
return aggregateRootId;
}
public boolean isRunning() {
return running;
}
public long getTotalUnHandledMessageCount() {
return messageQueue.size();
}
public void enqueueMessage(ProcessingEvent message) {
synchronized (lockObj) {
DomainEventStreamMessage eventStream = message.getMessage();
if (eventStream.getVersion() == latestHandledEventVersion + 1) {
message.setMailbox(this);
messageQueue.add(message);
if (logger.isDebugEnabled()) {
logger.debug("{} enqueued new message, aggregateRootType: {}, aggregateRootId: {}, commandId: {}, eventVersion: {}, eventStreamId: {}, eventTypes: {}, eventIds: {}",
getClass().getName(),
eventStream.getAggregateRootTypeName(),
eventStream.getAggregateRootId(),
eventStream.getCommandId(),
eventStream.getVersion(),
eventStream.getId(),
eventStream.getEvents().stream().map(x -> x.getClass().getName()).collect(Collectors.joining("|")),
eventStream.getEvents().stream().map(IMessage::getId).collect(Collectors.joining("|"))
);
}
latestHandledEventVersion = eventStream.getVersion();
int nextVersion = eventStream.getVersion() + 1;
while (waitingMessageDict.containsKey(nextVersion)) {
ProcessingEvent nextMessage = waitingMessageDict.remove(nextVersion);
DomainEventStreamMessage nextEventStream = nextMessage.getMessage();
nextMessage.setMailbox(this);
messageQueue.add(nextMessage);
latestHandledEventVersion = nextEventStream.getVersion();
if (logger.isDebugEnabled()) {
logger.debug("{} enqueued new message, aggregateRootType: {}, aggregateRootId: {}, commandId: {}, eventVersion: {}, eventStreamId: {}, eventTypes: {}, eventIds: {}",
getClass().getName(),
eventStream.getAggregateRootTypeName(),
nextEventStream.getAggregateRootId(),
nextEventStream.getCommandId(),
nextEventStream.getVersion(),
nextEventStream.getId(),
eventStream.getEvents().stream().map(x -> x.getClass().getName()).collect(Collectors.joining("|")),
eventStream.getEvents().stream().map(IMessage::getId).collect(Collectors.joining("|")));
}
nextVersion++;
}
lastActiveTime = new Date();
tryRun();
} else if (eventStream.getVersion() > latestHandledEventVersion + 1) {
waitingMessageDict.put(eventStream.getVersion(), message);
}
}
}
/**
* 尝试运行一次MailBox,一次运行会处理一个消息或者一批消息,当前MailBox不能是运行中或者暂停中或者已暂停
*/
public void tryRun() {
synchronized (lockObj) {
if (isRunning()) {
return;
}
setAsRunning();
if (logger.isDebugEnabled()) {
logger.debug("{} start run, aggregateRootId: {}", getClass().getName(), aggregateRootId);
}
CompletableFuture.runAsync(this::processMessages);
}
}
/**
* 请求完成MailBox的单次运行,如果MailBox中还有剩余消息,则继续尝试运行下一次
*/
public void completeRun() {
lastActiveTime = new Date();
if (logger.isDebugEnabled()) {
logger.debug("{} complete run, aggregateRootId: {}", getClass().getName(), aggregateRootId);
}
setAsNotRunning();
if (getTotalUnHandledMessageCount() > 0) {
tryRun();
}
}
public boolean isInactive(int timeoutSeconds) {
return (System.currentTimeMillis() - lastActiveTime.getTime()) >= timeoutSeconds;
}
private void processMessages() {
ProcessingEvent message = messageQueue.poll();
if (message != null) {
lastActiveTime = new Date();
try {
handleMessageAction.apply(message);
} catch (Exception ex) {
logger.error("{} run has unknown exception, aggregateRootId: {}", getClass().getName(), aggregateRootId, ex);
Task.sleep(1);
completeRun();
}
} else {
completeRun();
}
}
private void setAsRunning() {
running = true;
}
private void setAsNotRunning() {
running = false;
}
public int getWaitingMessageCount() {
return waitingMessageDict.size();
}
}
| 40.942308 | 189 | 0.591044 |
9fe0825accc588a6de6b07e63ba17f038e55987e | 35,449 | /*
* Copyright [2013-2021], Alibaba Group Holding Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.polardbx.group.config;
import com.alibaba.polardbx.atom.TAtomDataSource;
import com.alibaba.polardbx.atom.TAtomDsStandard;
import com.alibaba.polardbx.atom.config.TAtomDsConfDO;
import com.alibaba.polardbx.atom.config.gms.TAtomDsGmsConfigHelper;
import com.alibaba.polardbx.common.exception.TddlException;
import com.alibaba.polardbx.common.exception.TddlNestableRuntimeException;
import com.alibaba.polardbx.common.exception.TddlRuntimeException;
import com.alibaba.polardbx.common.exception.code.ErrorCode;
import com.alibaba.polardbx.common.jdbc.MasterSlave;
import com.alibaba.polardbx.common.logger.LoggerInit;
import com.alibaba.polardbx.common.model.lifecycle.AbstractLifecycle;
import com.alibaba.polardbx.common.model.lifecycle.Lifecycle;
import com.alibaba.polardbx.common.utils.GeneralUtil;
import com.alibaba.polardbx.common.utils.Pair;
import com.alibaba.polardbx.common.utils.logger.Logger;
import com.alibaba.polardbx.common.utils.logger.LoggerFactory;
import com.alibaba.polardbx.config.ConfigDataListener;
import com.alibaba.polardbx.config.ConfigDataMode;
import com.alibaba.polardbx.gms.config.impl.ConnPoolConfig;
import com.alibaba.polardbx.gms.ha.HaSwitchParams;
import com.alibaba.polardbx.gms.ha.HaSwitcher;
import com.alibaba.polardbx.gms.ha.impl.StorageHaManager;
import com.alibaba.polardbx.gms.ha.impl.StorageNodeHaInfo;
import com.alibaba.polardbx.gms.ha.impl.StorageRole;
import com.alibaba.polardbx.gms.listener.ConfigListener;
import com.alibaba.polardbx.gms.listener.impl.MetaDbConfigManager;
import com.alibaba.polardbx.gms.listener.impl.MetaDbDataIdBuilder;
import com.alibaba.polardbx.gms.topology.ServerInstIdManager;
import com.alibaba.polardbx.gms.util.GroupInfoUtil;
import com.alibaba.polardbx.gms.util.InstIdUtil;
import com.alibaba.polardbx.gms.util.MetaDbLogUtil;
import com.alibaba.polardbx.group.jdbc.DataSourceFetcher;
import com.alibaba.polardbx.group.jdbc.DataSourceLazyInitWrapper;
import com.alibaba.polardbx.group.jdbc.DataSourceWrapper;
import com.alibaba.polardbx.group.jdbc.TGroupDataSource;
import com.alibaba.polardbx.optimizer.biv.MockUtils;
import com.alibaba.polardbx.stats.MatrixStatistics;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.alibaba.polardbx.gms.topology.StorageInfoRecord.INST_KIND_MASTER;
/**
* @author 梦实 2017年11月21日 上午10:48:24
* @since 5.0.0
*/
public class OptimizedGroupConfigManager extends AbstractLifecycle implements Lifecycle {
private static final Logger logger = LoggerFactory
.getLogger(OptimizedGroupConfigManager.class);
private final ConfigDataListener configReceiver;
private final TGroupDataSource groupDataSource;
private final HaSwitcher groupDsSwithcer;
/**
* 是否需要GroupConfigManager主动去初始化所有在它之下的atomDataSource
*/
private boolean createTAtomDataSource = true;
private volatile Map<String/* Atom dbIndex */, DataSourceWrapper/* Wrapper过的Atom DS */> dataSourceWrapperMap =
new HashMap<>();
private volatile GroupDataSourceHolder groupDataSourceHolder = null;
private volatile String stroageInstId = "";
public OptimizedGroupConfigManager(TGroupDataSource tGroupDataSource) {
this.groupDataSource = tGroupDataSource;
this.configReceiver = new ConfigReceiver();
this.groupDsSwithcer = new GroupDataSourceSwitcher(groupDataSource);
((ConfigReceiver) this.configReceiver).setConfigManager(this);
}
/**
* @param dsWeightCommaStr : 例如 db0:rwp1q1i0, db1:rwp0q0i1
*/
public static List<DataSourceWrapper> buildDataSourceWrapper(String dsWeightCommaStr, DataSourceFetcher fetcher) {
String[] dsWeightArray = dsWeightCommaStr.split(","); // 逗号分隔:db0:rwp1q1i0,
// db1:rwp0q0i1
List<DataSourceWrapper> dss = new ArrayList<DataSourceWrapper>(dsWeightArray.length);
for (int i = 0; i < dsWeightArray.length; i++) {
String[] dsAndWeight = dsWeightArray[i].split(":"); // 冒号分隔:db0:rwp1q1i0
String dsKey = dsAndWeight[0].trim();
String weightStr = dsAndWeight.length == 2 ? dsAndWeight[1] : null;
try {
DataSourceWrapper dsw = buildDataSourceWrapper(dsKey, weightStr, i, fetcher);
dss.add(dsw);
} catch (Throwable e) {
LoggerInit.TDDL_DYNAMIC_CONFIG.error(String
.format("[buildDataSourceWrapper] failed, dsKey is [%s], weightStr is [%s] ", dsKey, weightStr), e);
throw GeneralUtil.nestedException(String
.format("[buildDataSourceWrapper] failed, dsKey is [%s], weightStr is [%s] ", dsKey, weightStr), e);
}
}
return dss;
}
protected static DataSourceWrapper buildDataSourceWrapper(String dsKey, String weightStr, int index,
DataSourceFetcher fetcher) {
// 如果多个group复用一个真实dataSource,会造成所有group引用
// 这个dataSource的配置 会以最后一个dataSource的配置为准
TAtomDataSource dataSource = fetcher.getDataSource(dsKey);
DataSourceWrapper dsw = new DataSourceWrapper(dsKey, weightStr, dataSource, index);
return dsw;
}
/**
* 从Diamond配置中心提取信息,构造TAtomDataSource、构造有优先级信息的读写DBSelector ---add by
* mazhidan.pt
*/
@Override
public void doInit() {
if (ConfigDataMode.isFastMock()) {
// mock weight comma str
parse(MockUtils.mockDsWeightCommaStr(groupDataSource.getDbGroupKey()));
return;
}
// To be load by MetaDB
initGroupDataSourceByMetaDb();
}
protected void initGroupDataSourceByMetaDb() {
String instId = InstIdUtil.getInstId();
if (groupDataSource.isEnforceMaster()) {
/**
* If curr group Ds is a force-master datasource, its storage inst must be rw-dn, should
* its instId should use masterInstId
*/
instId = ServerInstIdManager.getInstance().getMasterInstId();
}
String dbName = groupDataSource.getSchemaName();
String groupName = groupDataSource.getDbGroupKey();
Throwable ex = null;
try {
loadGroupDataSourceByMetaDb();
registerHaSwitcher();
MetaDbConfigManager.getInstance()
.register(MetaDbDataIdBuilder.getGroupConfigDataId(instId, dbName, groupName), null);
MetaDbConfigManager.getInstance()
.bindListener(MetaDbDataIdBuilder.getGroupConfigDataId(instId, dbName, groupName),
new GroupDetailInfoListener(this));
} catch (Throwable e) {
ex = e;
throw e;
} finally {
if (ex != null) {
unregisterHaSwitcher();
}
}
}
/**
* the Listener to handle all the change of system 'group_detail_info'
*/
protected static class GroupDetailInfoListener implements ConfigListener {
protected final OptimizedGroupConfigManager groupConfigManager;
public GroupDetailInfoListener(OptimizedGroupConfigManager groupConfigManager) {
this.groupConfigManager = groupConfigManager;
}
@Override
public void onHandleConfig(String dataId, long newOpVersion) {
this.groupConfigManager.loadGroupDataSourceByMetaDb();
}
}
public void loadGroupDataSourceByMetaDb() {
Pair<List<DataSourceWrapper>, HaSwitchParams> initResult = buildDataSourceWrapperByGms();
List<DataSourceWrapper> dswList = initResult.getKey();
HaSwitchParams haSwitchParams = initResult.getValue();
resetByDataSourceWrapper(dswList);
unregisterHaSwitcher();
String oldStorageId = this.stroageInstId;
this.stroageInstId = haSwitchParams.storageInstId;
registerHaSwitcher();
LoggerInit.TDDL_DYNAMIC_CONFIG.info(String
.format(
"[GroupStorageChangeSucceed] Group storageInstId change from [%s] to [%s], and HaSwitcher has been updated.",
oldStorageId, this.stroageInstId));
}
protected void registerHaSwitcher() {
String dbName = groupDataSource.getSchemaName();
String groupName = groupDataSource.getDbGroupKey();
StorageHaManager.getInstance().registerHaSwitcher(this.stroageInstId, dbName, groupName, groupDsSwithcer);
}
protected void unregisterHaSwitcher() {
String groupName = groupDataSource.getDbGroupKey();
StorageHaManager.getInstance().unregisterHaSwitcher(this.stroageInstId, groupName, groupDsSwithcer);
}
protected void unbindGroupConfigListener() {
String instId = InstIdUtil.getInstId();
String dbName = groupDataSource.getSchemaName();
String groupName = groupDataSource.getDbGroupKey();
MetaDbConfigManager.getInstance()
.unbindListener(MetaDbDataIdBuilder.getGroupConfigDataId(instId, dbName, groupName));
}
protected List<DataSourceWrapper> switchGroupDs(HaSwitchParams haSwitchParams) {
String userName = haSwitchParams.userName;
String passwdEnc = haSwitchParams.passwdEnc;
String phyDbName = haSwitchParams.phyDbName;
ConnPoolConfig storageInstConfig = haSwitchParams.storageConnPoolConfig;
String curAvailableAddr = haSwitchParams.curAvailableAddr;
List<DataSourceWrapper> dswList = new ArrayList<>();
try {
String schemaName = groupDataSource.getSchemaName();
String appName = groupDataSource.getAppName();
String groupName = groupDataSource.getDbGroupKey();
String availableNodeAddr = curAvailableAddr;
boolean needDoSwitch = false;
if (availableNodeAddr != null) {
//只有leader是可利用的,才支持刷新GroupDs
Map<String, DataSourceWrapper> curDsWrappers = this.getDataSourceWrapperMap();
if (ConfigDataMode.enableSlaveReadForPolarDbX()) {
//leader
String weightStr = GroupInfoUtil.buildWeightStr(10, 10);
String leaderDsKey = GroupInfoUtil
.buildAtomKey(groupName, haSwitchParams.storageInstId, availableNodeAddr,
haSwitchParams.phyDbName);
DataSourceWrapper newLeaderVal = curDsWrappers.get(leaderDsKey);
if (curDsWrappers.containsKey(leaderDsKey) && newLeaderVal != null &&
newLeaderVal.getWeightStr().equalsIgnoreCase(weightStr)) {
dswList.add(curDsWrappers.get(leaderDsKey));
} else {
TAtomDsConfDO atomDsConf = TAtomDsGmsConfigHelper
.buildAtomDsConfByGms(availableNodeAddr, haSwitchParams.xport, userName, passwdEnc,
phyDbName,
storageInstConfig, schemaName);
TAtomDataSource atomDs = new TAtomDataSource(true);
atomDs.init(appName, groupName, leaderDsKey, "", atomDsConf);
DataSourceWrapper dsw =
new DataSourceWrapper(leaderDsKey, GroupInfoUtil.buildWeightStr(10, 10), atomDs, 0);
dswList.add(dsw);
needDoSwitch = true;
}
//salves
if (haSwitchParams.storageHaInfoMap != null) {
String slaveWeightStr = GroupInfoUtil.buildWeightStr(10, 0);
int dataSourceIndex = 1;
for (StorageNodeHaInfo haInfo : haSwitchParams.storageHaInfoMap.values()) {
if (haInfo.getRole() == StorageRole.FOLLOWER) {
String slaveKey =
GroupInfoUtil
.buildAtomKey(groupName, haSwitchParams.storageInstId, haInfo.getAddr(),
haSwitchParams.phyDbName);
DataSourceWrapper newSlaveVal = curDsWrappers.get(slaveKey);
if (curDsWrappers.containsKey(slaveKey) && newSlaveVal != null &&
newSlaveVal.getWeightStr().equalsIgnoreCase(slaveWeightStr)) {
dswList.add(curDsWrappers.get(slaveKey));
} else {
//只有leader节点开启xport后, slave节点才开启
int xport = -1;
if (haSwitchParams.xport > 0) {
xport = haInfo.getXPort();
}
TAtomDsConfDO slaveAtomDsConf = TAtomDsGmsConfigHelper
.buildAtomDsConfByGms(haInfo.getAddr(), xport,
haSwitchParams.userName,
haSwitchParams.passwdEnc, haSwitchParams.phyDbName,
haSwitchParams.storageConnPoolConfig, phyDbName);
TAtomDataSource slaveAtomDs = new TAtomDataSource(true);
slaveAtomDs.init(appName, groupName, slaveKey, "", slaveAtomDsConf);
DataSourceWrapper slave =
new DataSourceWrapper(slaveKey, slaveWeightStr, slaveAtomDs, dataSourceIndex++);
dswList.add(slave);
needDoSwitch = true;
}
}
}
}
} else {
needDoSwitch = true;
String leaderDsKey = GroupInfoUtil
.buildAtomKey(groupName, haSwitchParams.storageInstId, availableNodeAddr,
haSwitchParams.phyDbName);
String weightStr = GroupInfoUtil.buildWeightStr(10, 10);
if (curDsWrappers.size() == 1 && curDsWrappers.containsKey(leaderDsKey)) {
DataSourceWrapper curDsw = curDsWrappers.get(leaderDsKey);
if (curDsw.getWeightStr().equalsIgnoreCase(weightStr)) {
needDoSwitch = false;
}
}
if (needDoSwitch) {
TAtomDsConfDO atomDsConf = TAtomDsGmsConfigHelper
.buildAtomDsConfByGms(availableNodeAddr, haSwitchParams.xport, userName, passwdEnc,
phyDbName,
storageInstConfig, schemaName);
TAtomDataSource atomDs = new TAtomDataSource(true);
atomDs.init(appName, groupName, leaderDsKey, "", atomDsConf);
DataSourceWrapper dsw = new DataSourceWrapper(leaderDsKey, weightStr, atomDs);
dswList.add(dsw);
}
}
}
if (!dswList.isEmpty() && needDoSwitch) {
resetByDataSourceWrapper(dswList);
}
} catch (Throwable ex) {
throw GeneralUtil.nestedException(ex);
}
return dswList;
}
protected Pair<List<DataSourceWrapper>, HaSwitchParams> buildDataSourceWrapperByGms() {
List<DataSourceWrapper> dswList = new ArrayList<>();
HaSwitchParams haSwitchParams = null;
try {
String dbName = this.groupDataSource.getSchemaName();
String appName = this.groupDataSource.getAppName();
String groupName = this.groupDataSource.getDbGroupKey();
String instId = InstIdUtil.getInstId();
if (this.groupDataSource.isEnforceMaster() && !ConfigDataMode.isMasterMode()) {
instId = ServerInstIdManager.getInstance().getMasterInstId();
}
String unitName = "";
haSwitchParams =
StorageHaManager.getInstance().getStorageHaSwitchParamsForInitGroupDs(instId, dbName, groupName);
String availableAddr = haSwitchParams.curAvailableAddr;
if (availableAddr == null) {
throw new TddlRuntimeException(ErrorCode.ERR_GMS_GENERIC,
String.format("storageInst[%s] is NOT available", haSwitchParams.storageInstId));
}
String dsLeaderKey =
GroupInfoUtil.buildAtomKey(groupName, haSwitchParams.storageInstId, availableAddr,
haSwitchParams.phyDbName);
TAtomDsConfDO atomDsConf = TAtomDsGmsConfigHelper
.buildAtomDsConfByGms(availableAddr, haSwitchParams.xport, haSwitchParams.userName,
haSwitchParams.passwdEnc, haSwitchParams.phyDbName, haSwitchParams.storageConnPoolConfig, dbName);
String weightStr = GroupInfoUtil.buildWeightStr(10, 10);
TAtomDataSource atomDs = new TAtomDataSource(true);
atomDs.init(appName, groupName, dsLeaderKey, unitName, atomDsConf);
DataSourceWrapper dsw = new DataSourceWrapper(dsLeaderKey, weightStr, atomDs, 0);
dswList.add(dsw);
if (ConfigDataMode.enableSlaveReadForPolarDbX() && haSwitchParams.storageKind == INST_KIND_MASTER) {
//在PolarDb-X下如果curAvailableAddr 节点为空,那么备库也不会启用
if (haSwitchParams.storageHaInfoMap != null) {
for (StorageNodeHaInfo haInfo : haSwitchParams.storageHaInfoMap.values()) {
if (haInfo.getRole() == StorageRole.FOLLOWER) {
String slaveKey =
GroupInfoUtil.buildAtomKey(groupName, haSwitchParams.storageInstId, haInfo.getAddr(),
haSwitchParams.phyDbName);
//只有leader节点开启xport后, slave节点才开启
int xport = -1;
if (haSwitchParams.xport > 0) {
xport = haInfo.getXPort();
}
TAtomDsConfDO slaveAtomDsConf = TAtomDsGmsConfigHelper
.buildAtomDsConfByGms(haInfo.getAddr(), xport, haSwitchParams.userName,
haSwitchParams.passwdEnc, haSwitchParams.phyDbName,
haSwitchParams.storageConnPoolConfig, dbName);
String slaveWeightStr = GroupInfoUtil.buildWeightStr(10, 0);
TAtomDataSource slaveAtomDs = new TAtomDataSource(true);
slaveAtomDs.init(appName, groupName, slaveKey, unitName, slaveAtomDsConf);
DataSourceWrapper slave = new DataSourceWrapper(slaveKey, slaveWeightStr, slaveAtomDs, 0);
dswList.add(slave);
}
}
}
}
} catch (Throwable ex) {
throw GeneralUtil.nestedException(ex);
}
Pair<List<DataSourceWrapper>, HaSwitchParams> result = new Pair<>(dswList, haSwitchParams);
return result;
}
/**
* 根据普通的DataSource构造读写DBSelector
*/
public void init(List<DataSourceWrapper> dataSourceWrappers) {
if ((dataSourceWrappers == null) || dataSourceWrappers.size() < 1) {
throw new TddlRuntimeException(ErrorCode.ERR_CONFIG, "dataSourceWrappers is empty");
}
createTAtomDataSource = false;
resetByDataSourceWrapper(dataSourceWrappers);
isInited = true;
}
;
private TAtomDataSource initAtomDataSource(String appName, String groupKey, String dsKey, String unitName,
Weight weight) {
try {
TAtomDataSource atomDataSource = new TAtomDataSource(weight.w > 0);
atomDataSource.init(appName, groupKey, dsKey, unitName);
atomDataSource.setLogWriter(groupDataSource.getLogWriter());
atomDataSource.setLoginTimeout(groupDataSource.getLoginTimeout());
return atomDataSource;
} catch (TddlException e) {
throw GeneralUtil.nestedException(e);
} catch (SQLException e) {
throw GeneralUtil.nestedException("TAtomDataSource init failed: dsKey=" + dsKey, e);
}
}
;
public String getStroageInstId() {
return stroageInstId;
}
// configInfo样例: db1:rw, db2:r, db3:r
private synchronized void parse(String dsWeightCommaStr) {
// 首先,根据配置信息(样例: db1:rw, db2:r, db3:),获取新的数据源列表
List<DataSourceWrapper> dswList = parse2DataSourceWrapperList(dsWeightCommaStr);
// 更新内存的数据源列表
resetByDataSourceWrapper(dswList);
}
/**
* 警告: 逗号的位置很重要,要是有连续的两个逗号也不要人为的省略掉, 数据库的个数 =
* 逗号的个数+1,用0、1、2...编号,比如"db1,,db3",实际上有3个数据库,
* 业务层通过传一个ThreadLocal进来,ThreadLocal中就是这种索引编号。
*/
private List<DataSourceWrapper> parse2DataSourceWrapperList(String dsWeightCommaStr) {
logger.info("[parse2DataSourceWrapperList]dsWeightCommaStr=" + dsWeightCommaStr);
LoggerInit.TDDL_DYNAMIC_CONFIG.info("[parse2DataSourceWrapperList]dsWeightCommaStr=" + dsWeightCommaStr);
this.groupDataSource.setDsKeyAndWeightCommaArray(dsWeightCommaStr);
if ((dsWeightCommaStr == null) || (dsWeightCommaStr = dsWeightCommaStr.trim()).length() == 0) {
throw new TddlRuntimeException(ErrorCode.ERR_MISS_GROUPKEY,
groupDataSource.getDbGroupKey(),
null,
groupDataSource.getAppName(),
groupDataSource.getUnitName());
}
return buildDataSourceWrapperSequential(dsWeightCommaStr);
}
/**
* 将封装好的AtomDataSource的列表,进一步封装为可以根据权重优先级随机选择模板库的DBSelector ---add by
* mazhidan.pt
*/
private synchronized void resetByDataSourceWrapper(List<DataSourceWrapper> dswList) {
// 删掉已经不存在的DataSourceWrapper
Map<String, DataSourceWrapper> newDataSourceWrapperMap = new HashMap<String, DataSourceWrapper>(dswList.size());
for (DataSourceWrapper dsw : dswList) {
newDataSourceWrapperMap.put(dsw.getDataSourceKey(), dsw);
}
Map<String, DataSourceWrapper> old = this.dataSourceWrapperMap;
this.dataSourceWrapperMap = newDataSourceWrapperMap;
/**
* 清除一下atomDelayMap , 但并发情况下不加锁仍然无法完全保证这里面全是新的atom
*/
if (dswList.size() == 1) {
/**
* 只存在主库的情况
*/
this.groupDataSourceHolder = new MasterOnlyGroupDataSourceHolder(
dswList.iterator().next().getWrappedDataSource());
} else {
TAtomDataSource masterDataSource = null;
List<TAtomDataSource> slaveDataSources = new ArrayList<TAtomDataSource>();
List<Pair<Object, Integer>> readWeightsWithMaster = new ArrayList<Pair<Object, Integer>>();
List<Pair<Object, Integer>> readWeightsSlaveOnly = new ArrayList<Pair<Object, Integer>>();
for (DataSourceWrapper dataSourceWrapper : dswList) {
if (dataSourceWrapper.hasWriteWeight()) {
masterDataSource = dataSourceWrapper.getWrappedDataSource();
if (dataSourceWrapper.hasReadWeight()) {
readWeightsWithMaster
.add(Pair.of(dataSourceWrapper.getWrappedDataSource(), dataSourceWrapper.getWeight().r));
}
} else {
slaveDataSources.add(dataSourceWrapper.getWrappedDataSource());
if (dataSourceWrapper.hasReadWeight()) {
readWeightsSlaveOnly
.add(Pair.of(dataSourceWrapper.getWrappedDataSource(), dataSourceWrapper.getWeight().r));
readWeightsWithMaster
.add(Pair.of(dataSourceWrapper.getWrappedDataSource(), dataSourceWrapper.getWeight().r));
}
}
}
if (GeneralUtil.isEmpty(readWeightsSlaveOnly)) {
/**
* 备库没有任何读权重
*/
this.groupDataSourceHolder = new MasterOnlyGroupDataSourceHolder(masterDataSource);
} else {
//FIXME PolarDb-X模式下,主实例暂不支持权重,严格按照Hint来区分主备库流量;且目前主实例CN不能访问只读实例DN
this.groupDataSourceHolder = new MasterSlaveGroupDataSourceHolder(
masterDataSource,
slaveDataSources);
}
}
// 需要考虑关闭老的DataSource对象
for (String dbKey : old.keySet()) {
if (!dataSourceWrapperMap.containsKey(dbKey)) {// 新的列表中没有dbKey,说明已经删除了,执行一下关闭
DataSourceWrapper dsw = old.get(dbKey);
try {
DataSource ds = dsw.getWrappedDataSource();
if (ds instanceof TAtomDsStandard) {
TAtomDsStandard tads = (TAtomDsStandard) ds;
tads.destroyDataSource();
MatrixStatistics.removeAtom(groupDataSource.getAppName(),
groupDataSource.getDbGroupKey(),
dbKey);// 清除掉该GROUP下面的该TAOM
} else {
logger.error("target datasource is not a TAtom Data Source");
}
} catch (Throwable e) {
logger.error("we got exception when close datasource : " + dsw.getDataSourceKey(), e);
}
}
}
old.clear();
}
/**
* 专用于主备更换时获取数据源
*/
protected DataSourceWrapper buildDataSourceWrapper(String dsKey, String weightStr, int index) {
DataSourceWrapper dsw = null;
Weight weight = new Weight(weightStr);
// fetcher 由原本的大家共用改为各个dsw单独使用
// 这样各个dsw的dbType不会有并发冲突, by chengbi
DataSourceFetcher fetcher = null;
try {
fetcher = new MyDataSourceFetcher(weight);
// 如果多个group复用一个真实dataSource,会造成所有group引用
// 这个dataSource的配置 会以最后一个dataSource的配置为准
TAtomDataSource dataSource = fetcher.getDataSource(dsKey);
dsw = new DataSourceWrapper(dsKey, weightStr, dataSource, index);
return dsw;
} catch (Throwable e) {
String msg = String.format(
"[buildDataSourceWrapper] Failed to initialize atom datasource and changed to use lazyInit mode for atom datasource, dsKey is [%s], weightStr is [%s] ",
dsKey,
weightStr);
Throwable ex = new TddlNestableRuntimeException(msg, e);
logger.warn(ex);
LoggerInit.TDDL_DYNAMIC_CONFIG.warn(ex);
fetcher = new MyDataSourceLazyInitFetcher(weight);
/**
* 这里是主备切换即使在新数据失败后也能生效的关键一步:
*
* <pre>
* 因为当新数据源初始化失败时,原来的逻辑直接对上层逻辑报错,导致无法更新内存的主备配置, 进而影响了主备切换结果;
* 而这里通过将数据源改为LazyInit(就是下一次请求过来时再初始化数据源),可以让主备切换的
* 流程继续往下走而不会被中断,进而保证主备切换的操作肯定生效。
* </pre>
*/
// 这里要注意:当数据初始化失败后,
// 改用LazyInit的dsw, 等真正在使用数据源时,再来初始化
// 之所以这样设计, 是因为当 DBA 做主备切换后,
// 新的数据库有可能在初始化就出现问题(如需要prefill=true)或出现超时,
// 因此,这里LazyInitDataSourceWrapper使用
dsw = new DataSourceLazyInitWrapper(dsKey, weightStr, fetcher, index);
}
return dsw;
}
public List<DataSourceWrapper> buildDataSourceWrapperSequential(String dsWeightCommaStr) {
final String[] dsWeightArray = dsWeightCommaStr.split(","); // 逗号分隔:db0:rwp1q1i0,
// db1:rwp0q0i1
List<DataSourceWrapper> dss = new ArrayList<DataSourceWrapper>(dsWeightArray.length);
for (int i = 0; i < dsWeightArray.length; i++) {
final int j = i;
final String[] dsAndWeight = dsWeightArray[j].split(":"); // 冒号分隔:db0:rwp1q1i0
final String dsKey = dsAndWeight[0].trim();
String weightStr = dsAndWeight.length == 2 ? dsAndWeight[1] : null;
try {
DataSourceWrapper newDsw = buildDataSourceWrapper(dsKey, weightStr, j);
dss.add(newDsw);
} catch (Throwable e) {
throw GeneralUtil.nestedException(e);
}
}
return dss;
}
// 仅用于测试
public void receiveConfigInfo(String configInfo) {
configReceiver.onDataReceived(null, configInfo);
}
// 仅用于测试
public void resetDbGroup(String configInfo) {
try {
parse(configInfo);
} catch (Throwable t) {
logger.error("resetDbGroup failed:" + configInfo, t);
}
}
@Override
protected void doDestroy() {
// 关闭下层DataSource
if (dataSourceWrapperMap != null) {
for (DataSourceWrapper dsw : dataSourceWrapperMap.values()) {
try {
DataSource ds = dsw.getWrappedDataSource();
if (ds instanceof TAtomDsStandard) {
TAtomDsStandard tads = (TAtomDsStandard) ds;
tads.destroyDataSource();
} else {
logger.error("target datasource is not a TAtom Data Source");
LoggerInit.TDDL_DYNAMIC_CONFIG.error("target datasource is not a TAtom Data Source");
}
} catch (Exception e) {
logger.error("we got exception when close datasource : " + dsw.getDataSourceKey(), e);
LoggerInit.TDDL_DYNAMIC_CONFIG
.error("we got exception when close datasource : " + dsw.getDataSourceKey(), e);
}
}
}
try {
unregisterHaSwitcher();
unbindGroupConfigListener();
} catch (Exception e) {
logger.error("we got exception when close datasource .", e);
}
}
public void destroyDataSource() {
destroy();
}
public Map<String/* Atom dbIndex */, DataSourceWrapper/* Wrapper过的Atom DS */> getDataSourceWrapperMap() {
return this.dataSourceWrapperMap;
}
public TAtomDataSource getDataSource(MasterSlave masterSlave) {
return this.groupDataSourceHolder.getDataSource(masterSlave);
}
public GroupDataSourceHolder getGroupDataSourceHolder() {
return groupDataSourceHolder;
}
protected String getServerInstIdForGroupDataSource() {
return null;
}
protected class GroupDataSourceSwitcher implements HaSwitcher {
TGroupDataSource groupDs = null;
public GroupDataSourceSwitcher(TGroupDataSource groupDs) {
this.groupDs = groupDs;
}
@Override
public void doHaSwitch(HaSwitchParams haSwitchParams) {
String groupName = groupDs.getDbGroupKey();
String dbName = groupDs.getSchemaName();
try {
switchGroupDs(haSwitchParams);
} catch (Throwable ex) {
MetaDbLogUtil.META_DB_DYNAMIC_CONFIG
.error(String.format("Failed to do switch ds for [%s/%s]", groupName, dbName),
ex);
throw GeneralUtil.nestedException(ex);
}
}
}
protected class MyDataSourceFetcher implements DataSourceFetcher {
private Weight weight;
public MyDataSourceFetcher(Weight weight) {
this.weight = weight;
}
@Override
public TAtomDataSource getDataSource(String dsKey) {
DataSourceWrapper dsw = dataSourceWrapperMap.get(dsKey);
if (dsw != null) {
// 当dsw的值不为null时,则直接返回数据源
return dsw.getWrappedDataSource();
} else {
// 当dsw的值为null时,则重新初始化数据源
if (createTAtomDataSource) {
TAtomDataSource atomDs = initAtomDataSource(groupDataSource.getAppName(),
groupDataSource.getDbGroupKey(),
dsKey,
groupDataSource.getUnitName(),
weight);
return atomDs;
} else {
throw new IllegalArgumentException(dsKey + " not exist!");
}
}
}
}
/**
* <pre>
* 专用于atom数据源lazy init 的dataSoureFetcher
*
* 目前只用于主备切换过程,出现新库初始化失败后,将失败的新库转化为lazyInit的这一过程
* </pre>
*
* @author chenghui.lch 2017年1月21日 下午5:12:55
* @since 5.0.0
*/
protected class MyDataSourceLazyInitFetcher implements DataSourceFetcher {
private Weight weight;
public MyDataSourceLazyInitFetcher(Weight weight) {
this.weight = weight;
}
@Override
public TAtomDataSource getDataSource(String dsKey) {
TAtomDataSource atomDs = null;
try {
// 当dsw的值为null时,则重新初始化数据源
atomDs = initAtomDataSource(groupDataSource.getAppName(),
groupDataSource.getDbGroupKey(),
dsKey,
groupDataSource.getUnitName(),
weight);
return atomDs;
} catch (Throwable e) {
String msg = "Failed to initialize atom datasource in lazyInit mode ! dbKey is " + dsKey;
throw GeneralUtil.nestedException(msg, e);
}
}
}
private class ConfigReceiver implements ConfigDataListener {
private OptimizedGroupConfigManager configManager;
public void setConfigManager(OptimizedGroupConfigManager configManager) {
this.configManager = configManager;
}
@Override
public void onDataReceived(String dataId, String data) {
try {
String oldData = this.configManager.groupDataSource.getDsKeyAndWeightCommaArray();
LoggerInit.TDDL_DYNAMIC_CONFIG.info("[Data Recieved] [group datasource] dataId:" + dataId
+ ", new data:" + data + ", old data:" + oldData);
parse(data);
} catch (Throwable t) {
logger.error("error occurred during parsing group dynamic configs : " + data, t);
LoggerInit.TDDL_DYNAMIC_CONFIG.error("error occurred during parsing group dynamic configs : " + data,
t);
}
}
}
}
| 42.658243 | 168 | 0.602781 |
fb0b50371ebcc5e5cba668f5dc45991dd8c65ef3 | 3,061 | /*
* DISCLAIMER
*
* Copyright 2016 ArangoDB GmbH, Cologne, Germany
*
* 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.
*
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/
package com.arangodb.entity;
import com.arangodb.entity.DocumentField.Type;
import java.util.Map;
/**
* @author Mark Vollmary
*
*/
public class BaseEdgeDocument extends BaseDocument {
private static final long serialVersionUID = 6904923804449368783L;
@DocumentField(Type.FROM)
private String from;
@DocumentField(Type.TO)
private String to;
public BaseEdgeDocument() {
super();
}
public BaseEdgeDocument(final String from, final String to) {
super();
this.from = from;
this.to = to;
}
public BaseEdgeDocument(final String key, final String from, final String to) {
super(key);
this.from = from;
this.to = to;
}
public BaseEdgeDocument(final Map<String, Object> properties) {
super(properties);
final Object tmpFrom = properties.remove(DocumentField.Type.FROM.getSerializeName());
if (tmpFrom != null) {
from = tmpFrom.toString();
}
final Object tmpTo = properties.remove(DocumentField.Type.TO.getSerializeName());
if (tmpTo != null) {
to = tmpTo.toString();
}
}
public String getFrom() {
return from;
}
public void setFrom(final String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(final String to) {
this.to = to;
}
@Override
public String toString() {
return "BaseDocument [documentRevision=" +
revision +
", documentHandle=" +
id +
", documentKey=" +
key +
", from=" +
from +
", to=" +
to +
", properties=" +
properties +
"]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((from == null) ? 0 : from.hashCode());
result = prime * result + ((to == null) ? 0 : to.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final BaseEdgeDocument other = (BaseEdgeDocument) obj;
if (from == null) {
if (other.from != null) {
return false;
}
} else if (!from.equals(other.from)) {
return false;
}
if (to == null) {
return other.to == null;
} else return to.equals(other.to);
}
}
| 22.674074 | 88 | 0.633126 |
de22c5a1cfe66f484fd807fb79b428be727c1c81 | 4,422 | package es.upv.indigodc.location;
import alien4cloud.deployment.matching.services.nodes.MatchingConfigurations;
import alien4cloud.deployment.matching.services.nodes.MatchingConfigurationsParser;
import alien4cloud.model.deployment.matching.MatchingConfiguration;
import alien4cloud.model.orchestrators.locations.LocationResourceTemplate;
import alien4cloud.orchestrators.plugin.ILocationConfiguratorPlugin;
import alien4cloud.orchestrators.plugin.ILocationResourceAccessor;
import alien4cloud.orchestrators.plugin.model.PluginArchive;
import alien4cloud.plugin.model.ManagedPlugin;
import alien4cloud.tosca.parser.ParsingException;
import alien4cloud.tosca.parser.ParsingResult;
import com.google.common.collect.Lists;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* This class contains the configuration setup for a plugin location. We support only one location.
*
* @author asalic
*/
@Component
@Scope("prototype")
public class LocationConfigurator implements ILocationConfiguratorPlugin {
/** The name of the location. */
public static final String LOCATION_TYPE = "Deep Orchestrator Location";
@Inject protected ManagedPlugin selfContext;
// @Inject private ArchiveParser archiveParser;
@Inject protected MatchingConfigurationsParser matchingConfigurationsParser;
protected List<PluginArchive> archives;
protected Map<String, MatchingConfiguration> matchingConfigurations;
@Override
public List<PluginArchive> pluginArchives() {
if (archives == null) {
archives = Lists.newArrayList();
// try {
// addToArchive(archives, "provider/common/configuration");
// } catch (ParsingException e) {
// log.error(e.getMessage());
// throw new PluginParseException(e.getMessage());
// }
}
return archives;
}
@Override
public List<String> getResourcesTypes() {
return getAllResourcesTypes();
}
@Override
public List<LocationResourceTemplate> instances(
ILocationResourceAccessor locationResourceAccessor) {
return Lists.newArrayList();
}
@Override
public Map<String, MatchingConfiguration> getMatchingConfigurations() {
return getMatchingConfigurations(getMatchingConfigurationsPath());
}
/**
* Returns the matching nodes provided by a location.
*
* @param matchingConfigRelativePath file containing the the rules used to match the nodes of the
* location
* @return A list of locations resources templates that users can define or null if the plugin
* doesn't support auto-configuration of resources..
*/
protected Map<String, MatchingConfiguration> getMatchingConfigurations(
String matchingConfigRelativePath) {
if (matchingConfigurations == null) {
try {
Path matchingConfigPath = selfContext.getPluginPath().resolve(matchingConfigRelativePath);
if (Files.exists(matchingConfigPath)) {
ParsingResult<MatchingConfigurations> pr =
matchingConfigurationsParser.parseFile(matchingConfigPath);
this.matchingConfigurations = pr.getResult().getMatchingConfigurations();
} else {
return null;
}
} catch (InvalidPathException | ParsingException er) {
er.printStackTrace();
return null;
}
}
return matchingConfigurations;
}
protected String getMatchingConfigurationsPath() {
return "provider/common/matching/config.yml";
}
protected List<String> getAllResourcesTypes() {
List<String> resourcesTypes = Lists.newArrayList();
for (PluginArchive pluginArchive : this.pluginArchives()) {
for (String nodeType : pluginArchive.getArchive().getNodeTypes().keySet()) {
resourcesTypes.add(nodeType);
}
}
return resourcesTypes;
}
//
// private void addToArchive(List<PluginArchive> archives, String path) throws ParsingException {
// Path archivePath = selfContext.getPluginPath().resolve(path);
// // Parse the archives
// ParsingResult<ArchiveRoot> result =
// archiveParser.parseDir(archivePath, AlienConstants.GLOBAL_WORKSPACE_ID);
// PluginArchive pluginArchive = new PluginArchive(result.getResult(), archivePath);
// archives.add(pluginArchive);
// }
}
| 35.376 | 99 | 0.749435 |
2c0bf10ee588025dcf0fc2f0eec37ab960ec410f | 291 | package com.it666.jdbc.domain;
public class User {
String name1;
String pwd;
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
}
| 14.55 | 37 | 0.67354 |
4d12f07d21efb675dbe81a8e6919dde671f3933c | 3,944 | package io.swagger.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Objects;
import java.util.UUID;
/**
* GrantInfo
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.SpringCodegen", date = "2019-07-12T09:08:16.977Z[GMT]")
public class GrantInfo {
@JsonProperty("appToken")
private UUID appToken = null;
@JsonProperty("userToken")
private UUID userToken = null;
@JsonProperty("grantRole")
private String grantRole = null;
@JsonProperty("expiresIn")
private String expiresIn = null;
public GrantInfo appToken(UUID appToken) {
this.appToken = appToken;
return this;
}
/**
* 应用授权id,从管理平台获取
*
* @return appToken
**/
@ApiModelProperty(required = true, value = "应用授权id,从管理平台获取")
@NotNull
@Valid
public UUID getAppToken() {
return appToken;
}
public void setAppToken(UUID appToken) {
this.appToken = appToken;
}
public GrantInfo userToken(UUID userToken) {
this.userToken = userToken;
return this;
}
/**
* 待授权的用户授权码,可本地自行生成,或者不传,服务器生成
*
* @return userToken
**/
@ApiModelProperty(value = "待授权的用户授权码,可本地自行生成,或者不传,服务器生成")
@Valid
public UUID getUserToken() {
return userToken;
}
public void setUserToken(UUID userToken) {
this.userToken = userToken;
}
public GrantInfo grantRole(String grantRole) {
this.grantRole = grantRole;
return this;
}
/**
* 权限角色
*
* @return grantRole
**/
@ApiModelProperty(required = true, value = "权限角色")
@NotNull
public String getGrantRole() {
return grantRole;
}
public void setGrantRole(String grantRole) {
this.grantRole = grantRole;
}
public GrantInfo expiresIn(String expiresIn) {
this.expiresIn = expiresIn;
return this;
}
/**
* 时效,默认300s
*
* @return expiresIn
**/
@ApiModelProperty(example = "300", value = "时效,默认300s")
public String getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(String expiresIn) {
this.expiresIn = expiresIn;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GrantInfo grantInfo = (GrantInfo) o;
return Objects.equals(this.appToken, grantInfo.appToken) &&
Objects.equals(this.userToken, grantInfo.userToken) &&
Objects.equals(this.grantRole, grantInfo.grantRole) &&
Objects.equals(this.expiresIn, grantInfo.expiresIn);
}
@Override
public int hashCode() {
return Objects.hash(appToken, userToken, grantRole, expiresIn);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class GrantInfo {\n");
sb.append(" appToken: ").append(toIndentedString(appToken)).append("\n");
sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n");
sb.append(" grantRole: ").append(toIndentedString(grantRole)).append("\n");
sb.append(" expiresIn: ").append(toIndentedString(expiresIn)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 24.805031 | 130 | 0.610041 |
0dc0070d4f153364ced76c89bd55ab0ab97f9509 | 1,149 | package ru.hh.oauth.subscribe.apis.service;
import ru.hh.oauth.subscribe.core.builder.api.DefaultApi20;
import ru.hh.oauth.subscribe.core.model.AbstractRequest;
import ru.hh.oauth.subscribe.core.model.OAuthConfig;
import ru.hh.oauth.subscribe.core.model.OAuthConstants;
import ru.hh.oauth.subscribe.core.model.Token;
import ru.hh.oauth.subscribe.core.model.Verifier;
import ru.hh.oauth.subscribe.core.oauth.OAuth20ServiceImpl;
public class LinkedIn20ServiceImpl extends OAuth20ServiceImpl {
public LinkedIn20ServiceImpl(final DefaultApi20 api, final OAuthConfig config) {
super(api, config);
}
@Override
public void signRequest(Token accessToken, AbstractRequest request) {
request.addQuerystringParameter("oauth2_access_token", accessToken.getToken());
}
@Override
protected <T extends AbstractRequest> T createAccessTokenRequest(final Verifier verifier, T request) {
super.createAccessTokenRequest(verifier, request);
if (!getConfig().hasGrantType()) {
request.addParameter(OAuthConstants.GRANT_TYPE, "authorization_code");
}
return (T) request;
}
}
| 37.064516 | 106 | 0.753699 |
17f7af62f757cc065fffe1a0face40931f1d5981 | 1,769 | /*-
* #%L
* FXFileChooser
* %%
* Copyright (C) 2017 - 2019 Oliver Loeffler, Raumzeitfalle.net
* %%
* 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.
* #L%
*/
package net.raumzeitfalle.fx.filechooser;
import java.time.Duration;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;
import javafx.application.Platform;
class Invoke {
private Invoke() {
}
static void later(Runnable r) {
Platform.runLater(r);
}
static void laterWithDelay(Duration duration, Runnable r) {
Platform.runLater(()->{
try {
Thread.sleep(duration.toMillis());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
r.run();
});
}
static void andWaitWithoutException(Runnable r) {
try {
andWait(r);
} catch (InterruptedException | ExecutionException e) {
Thread.currentThread().interrupt();
}
}
static void andWait(Runnable r) throws InterruptedException, ExecutionException {
FutureTask<?> task = new FutureTask<>(r, null);
Platform.runLater(task);
task.get();
}
}
| 27.215385 | 85 | 0.630865 |
cc36566e1ed0fb51c6bd8316ff37c5d7c6329d18 | 518 | package org.opencb.opencga.storage.core.variant.adaptors.iterators;
import org.opencb.biodata.models.variant.Variant;
import java.util.function.UnaryOperator;
public class MapperVariantDBIterator extends DelegatedVariantDBIterator {
private final UnaryOperator<Variant> map;
MapperVariantDBIterator(VariantDBIterator delegated, UnaryOperator<Variant> map) {
super(delegated);
this.map = map;
}
@Override
public Variant next() {
return map.apply(super.next());
}
}
| 24.666667 | 86 | 0.735521 |
6330fae78c16c60d45aed22f721a2b8952ad9276 | 898 | package pl.edu.utp;
import java.sql.Timestamp;
public class Cars {
private String marka;
private String model;
private int cena;
private String typNadwozia;
private String kolor;
private Timestamp czas;
private int id;
public Cars(int Id, String Marka, String Model, int Cena, String TypNadwozia, String Kolor,Timestamp Czas) {
this.marka = Marka;
this.model = Model;
this.cena = Cena;
this.typNadwozia = TypNadwozia;
this.kolor = Kolor;
this.czas = Czas;
this.id = Id;
}
public Timestamp getCzas() {
return czas;
}
public String getMarka() {
return marka;
}
public String getModel() {
return model;
}
public int getCena() {
return cena;
}
public String getTypNadwozia() {
return typNadwozia;
}
public String getKolor() {
return kolor;
}
public int getId() {
return id;
}
}
| 16.035714 | 110 | 0.642539 |
b342867424ed00d9a9570ed297ec1b184f35880c | 626 | package io.bootique.job.runnable;
import java.util.Map;
import io.bootique.job.Job;
public interface RunnableJobFactory {
/**
* Creates a {@link RunnableJob} object that combines job instance with a
* set of parameters.
*
* @param job
* A job instance to run when the returned {@link RunnableJob} is
* executed.
* @param parameters
* A set of parameters to apply to the job when the returned
* {@link RunnableJob} is executed.
* @return a wrapper around a job and a set of parameters.
*/
RunnableJob runnable(Job job, Map<String, Object> parameters);
}
| 27.217391 | 77 | 0.664537 |
3856c5385aab539ac02f7b2eb44926eb3bc9eaea | 21,245 | /*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cdep.cdep.utils;
import io.cdep.annotations.NotNull;
import io.cdep.cdep.ResolvedManifests;
import io.cdep.cdep.yml.cdepmanifest.CDepManifestYml;
import io.cdep.cdep.yml.cdepmanifest.MergeCDepManifestYmls;
import junit.framework.TestCase;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
public class TestCDepManifestYmlUtils {
@Test
public void coverConstructor() {
// Call constructor of tested class to cover that code.
new CoverConstructor();
}
@Test
public void empty() {
try {
check("");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Manifest was empty");
}
}
@Test
public void missingCoordinate() {
try {
check("coordinate:\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Manifest was missing coordinate");
}
}
@Test
public void noArtifactId() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Manifest was missing coordinate.artifactId");
}
}
@Test
public void noVersion() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Manifest was missing coordinate.version");
}
}
@Test
public void noGroupId() {
try {
check("coordinate:\n" + " artifactId: boost\n" + " version: 1.0.63-rev10");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Manifest was missing coordinate.groupId");
}
}
@Test
public void noTargets() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' does not contain any files");
}
}
@Test
public void malformedVersion() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0' has malformed version, " + "expected major.minor" +
".point[-tweak] but there was only one " + "dot");
}
}
@Test
public void duplicateAndroidZips() {
// try {
// check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
// "android:\n" + " archives:\n" + " -" + " file: bob.zip\n" + " size: 99\n" + " sha256: " +
// "97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + " - file: bob.zip\n" + " size: 99\n"
// + " " + " sha256: 97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
// fail("Expected an exception");
// } catch (Exception e) {
// assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' contains multiple references " + "to the
// same " +
// "archive file 'bob.zip'");
// }
}
@Test
public void duplicateiOSZips() {
// try {
// check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
// "iOS:\n" + " archives:\n" + " - " + "file: bob.zip\n" + " size: 99\n" + " platform: iPhoneSimulator\n"
// + " " +
// "" + " sdk: 10.2\n" + " architecture: i386\n" + " sha256: " +
// "97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + " - file: bob.zip\n" + " size: 99\n"
// + " " +
// "" + " platform: iPhoneSimulator\n" + " sdk: 10.2\n" + " architecture: i386\n" + " sha256: " +
// "97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
// fail("Expected an exception");
// } catch (Exception e) {
// assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' contains multiple references " + "to the
// same " +
// "archive file 'bob.zip'");
// }
}
@Test
public void duplicateZipsBetweenAndroidAndiOS() {
// try {
// check("coordinate:\n" +
// " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
// "android:\n" + " archives:\n" + " -" + " file: bob.zip\n" + " size: 99\n" + " sha256: " +
// "97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + "iOS:\n" + " " + "archives:\n" + " - file: " +
// "bob.zip\n" + " size: 99\n" + " platform: iPhoneSimulator\n" + " sdk: 10.2\n" + " architecture: i386\n" + "
// " + " sha256: 97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
// fail("Expected an exception");
// } catch (Exception e) {
// assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' contains multiple references " + "to the
// same " +
// "archive file 'bob.zip'");
// }
}
@Test
public void emptyiOSArchive() {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"android:\n" + " archives:\n" + " - " + "file: bob.zip\n" + " size: 99\n" + " sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + "iOS:\n" + " archives:\n");
}
@Test
public void emptyAndroidArchive() {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" + "iOS:\n"
+ " archives:\n" + " - file:" + " bob.zip\n" + " size: 99\n" + " sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + " platform: " + "iPhoneSimulator\n" + " "
+ "sdk: 10.2\n" + " architecture: i386\n" + "android:\n" + " archives:\n");
}
@Test
public void missingAndroidSha() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"android:\n" + " archives:\n" + " " + " - file: bob.zip\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing android.archive.sha256 for 'bob.zip'");
}
}
@Test
public void missingiOSSha() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"iOS:\n" + " archives:\n" + " - " + "file: bob.zip\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing ios.archive.sha256 for 'bob.zip'");
}
}
@Test
public void missingAndroidFile() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"android:\n" + " archives:\n" + " " + " - sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b" + "\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing android.archive.file");
}
}
@Test
public void missingiOSFile() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"iOS:\n" + " archives:\n" + " - " + "sha256: 97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing ios.archive.file");
}
}
@Test
public void missingAndroidSize() {
try {
check("coordinate:\n"
+ " groupId: com.github.jomof\n"
+ " artifactId: boost\n"
+ " version: 1.0.63-rev10\n"
+ "android:\n"
+ " archives:\n"
+ " - file: bob.zip\n"
+ " sha256: 97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing or zero android.archive.size for 'bob.zip'");
}
}
@Test
public void missingiOSSize() {
try {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"iOS:\n" + " archives:\n" + " - " + "file: bob.zip\n" + " sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n");
fail("Expected an exception");
} catch (Exception e) {
assertThat(e).hasMessage("Package 'com.github.jomof:boost:1.0.63-rev10' has missing ios.archive.size for 'bob.zip'");
}
}
@Test
public void checkAndroidSuccess() {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"android:\n" + " archives:\n" + " -" + " file: bob.zip\n" + " sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + " size: 192\n");
}
@Test
public void checkiOSSuccess() {
check("coordinate:\n" + " groupId: com.github.jomof\n" + " artifactId: boost\n" + " version: 1.0.63-rev10\n" +
"android:\n" + " archives:\n" + " -" + " file: bob.zip\n" + " sha256: " +
"97ce6635df1f44653a597343cd5757bb8b6b992beb3720f5fc761e3644bcbe7b\n" + " size: 192\n");
}
private void check(@NotNull String content) {
CDepManifestYml manifest = CDepManifestYmlUtils.convertStringToManifest("test.yml", content);
CDepManifestYmlUtils.checkManifestSanity(manifest);
}
@Test
public void testAllResolvedManifests() throws Exception {
Map<String, String> expected = new LinkedHashMap<>();
expected.put("admob", "Archive com.github.jomof:firebase/admob:2.1.3-rev8 is missing include");
expected.put("archiveMissingSha256", "Archive com.github.jomof:vectorial:0.0.0 is missing sha256");
expected.put("sqliteLinuxMultiple",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("archiveMissingSize", "Archive com.github.jomof:vectorial:0.0.0 is missing size or it is zero");
expected.put("archiveMissingFile", "Archive com.github.jomof:vectorial:0.0.0 is missing file");
expected.put("templateWithNullArchives", "Package 'com.github.jomof:firebase/app:${version}' "
+ "has malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("templateWithOnlyFile", "Package 'com.github.jomof:firebase/app:${version}' has "
+ "malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("indistinguishableAndroidArchives", "Android archive com.github.jomof:firebase/app:0.0.0 file archive2.zip is indistinguishable at build time from archive1.zip given the information in the manifest");
expected.put("fuzz1", "Manifest was missing coordinate");
expected.put("fuzz2", "Manifest was missing coordinate");
boolean unexpectedFailure = false;
for (ResolvedManifests.NamedManifest manifest : ResolvedManifests.all()) {
String key = manifest.name;
String expectedFailure = expected.get(key);
try {
CDepManifestYmlUtils.checkManifestSanity(manifest.resolved.cdepManifestYml);
if (expectedFailure != null) {
fail("Expected failure");
}
} catch (RuntimeException e) {
if (!e.getMessage().equals(expectedFailure)) {
//e.printStackTrace();
System.out.printf("expected.put(\"%s\", \"%s\");\n", key, e.getMessage());
unexpectedFailure = true;
}
}
}
if (unexpectedFailure) {
throw new RuntimeException("Unexpected failures. See console.");
}
}
@Test
public void testTwoWayMergeSanity() throws Exception {
Map<String, String> expected = new LinkedHashMap<>();
expected.put("archiveMissingFile-archiveMissingFile", "Archive com.github.jomof:vectorial:0.0.0 is missing file");
expected.put("archiveMissingSha256-archiveMissingSha256", "Archive com.github.jomof:vectorial:0.0.0 is missing sha256");
expected.put("sqliteLinuxMultiple-sqliteLinuxMultiple",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("sqliteLinuxMultiple-sqlite",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("sqliteLinuxMultiple-singleABI",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("sqliteLinuxMultiple-sqliteLinux",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("archiveMissingSize-archiveMissingSize",
"Archive com.github.jomof:vectorial:0.0.0 is missing size or it is zero");
expected.put("admob-admob", "Archive com.github.jomof:firebase/admob:2.1.3-rev8 is missing include");
expected.put("sqlite-sqliteLinuxMultiple",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("singleABISqlite-singleABISqlite",
"Package 'com.github.jomof:sqlite:3.16.2-rev45' contains multiple references to the same archive file " +
"'sqlite-android-cxx-platform-12-armeabi.zip'");
expected.put("singleABI-sqliteLinuxMultiple",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("singleABI-singleABI",
"Package 'com.github.jomof:sqlite:0.0.0' contains multiple references to the same archive file " +
"'sqlite-android-cxx-platform-12-armeabi.zip'");
expected.put("sqliteLinux-sqliteLinuxMultiple",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("sqliteLinux-sqliteLinux",
"Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed.");
expected.put("sqliteiOS-sqliteiOS",
"Package 'com.github.jomof:sqlite:3.16.2-rev33' contains multiple references to the same archive file " +
"'sqlite-ios-platform-iPhoneOS-architecture-armv7-sdk-9.3.zip'");
expected.put("templateWithNullArchives-templateWithNullArchives", "Package 'com.github.jomof:firebase/"
+ "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("templateWithNullArchives-templateWithOnlyFile", "Package 'com.github.jomof:"
+ "firebase/app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("templateWithOnlyFile-templateWithNullArchives", "Package 'com.github.jomof:firebase/"
+ "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("templateWithOnlyFile-templateWithOnlyFile", "Package 'com.github.jomof:firebase/"
+ "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots");
expected.put("sqlite-sqlite", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest");
expected.put("sqlite-singleABI", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest");
expected.put("sqliteAndroid-sqliteAndroid", "Android archive com.github.jomof:sqlite:3.16.2-rev33 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest");
expected.put("singleABI-sqlite", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest");
expected.put("singleABI-singleABI", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest");
expected.put("indistinguishableAndroidArchives-indistinguishableAndroidArchives", "Android archive com.github.jomof:firebase/app:0.0.0 file archive2.zip is indistinguishable at build time from archive1.zip given the information in the manifest");
expected.put("singleABISqlite-singleABISqlite", "Android archive com.github.jomof:sqlite:3.16.2-rev45 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest");
expected.put("re2-re2", "Android archive com.github.jomof:re2:17.3.1-rev13 file re2-21-armeabi.zip is indistinguishable at build time from re2-21-armeabi.zip given the information in the manifest");
expected.put("fuzz1-fuzz1", "Manifest was missing coordinate");
expected.put("fuzz2-fuzz2", "Manifest was missing coordinate");
expected.put("openssl-openssl", "Android archive com.github.jomof:openssl:1.0.1-e-rev6 file openssl-android-stlport-21-armeabi.zip is indistinguishable at build time from openssl-android-stlport-21-armeabi.zip given the information in the manifest");
expected.put("opencv-opencv", "Android archive com.github.jomof:opencv:3.2.0-rev2 file opencv-android-12-arm64-v8a.zip is indistinguishable at build time from opencv-android-12-arm64-v8a.zip given the information in the manifest");
expected.put("boringSSLAndroid-boringSSLAndroid", "Android archive com.github.gpx1000:boringssl:0.0.0 file boringssl-armeabi.zip is indistinguishable at build time from boringssl-armeabi.zip given the information in the manifest");
expected.put("zlibAndroid-zlibAndroid", "Android archive com.github.gpx1000:zlib:1.2.11 file zlib-armeabi.zip is indistinguishable at build time from zlib-armeabi.zip given the information in the manifest");
boolean somethingUnexpected = false;
for (ResolvedManifests.NamedManifest manifest1 : ResolvedManifests.all()) {
for (ResolvedManifests.NamedManifest manifest2 : ResolvedManifests.all()) {
if(Objects.equals(manifest1.name, "curlAndroid") || Objects.equals(manifest2.name, "curlAndroid"))
continue;
String key = manifest1.name + "-" + manifest2.name;
String expectedFailure = expected.get(key);
CDepManifestYml manifest;
try {
manifest = MergeCDepManifestYmls.merge(manifest1.resolved.cdepManifestYml, manifest2.resolved.cdepManifestYml);
} catch (RuntimeException e) {
continue;
}
try {
CDepManifestYmlUtils.checkManifestSanity(manifest);
if (expectedFailure != null) {
TestCase.fail("Expected a failure.");
}
} catch (RuntimeException e) {
String actual = e.getMessage();
if (!actual.equals(expectedFailure)) {
// e.printStackTrace();
System.out.printf("expected.put(\"%s\", \"%s\");\n", key, actual);
somethingUnexpected = true;
}
}
}
}
if (somethingUnexpected) {
throw new RuntimeException("Saw unexpected results. See console.");
}
}
@Test
public void readPartial() throws IOException {
// Make sure we can read an incomplete specification for 'fullfill' scenario
File file = new File("../third_party/stb/cdep/cdep-manifest-divide.yml");
CDepManifestYml partial = CDepManifestYmlUtils.convertStringToManifest(file.getAbsolutePath(), FileUtils.readAllText(file));
}
private static class CoverConstructor extends CDepManifestYmlUtils {
}
}
| 51.440678 | 277 | 0.662132 |
8803c20c93b1adf9ccc9347d5c915d19dea87598 | 18,174 | /*
* Copyright 2015-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.cxx;
import static org.junit.Assert.assertThat;
import com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.parser.NoSuchBuildTargetException;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.BuildTargetSourcePath;
import com.facebook.buck.rules.FakeBuildRuleParamsBuilder;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.args.Arg;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.hamcrest.Matchers;
import org.junit.Test;
import java.util.Map;
public class OmnibusTest {
@Test
public void includedDeps() throws NoSuchBuildTargetException {
NativeLinkable a = new OmnibusNode("//:a");
NativeLinkable b = new OmnibusNode("//:b");
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a, b));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of());
assertThat(
spec.getGraph().getNodes(),
Matchers.containsInAnyOrder(a.getBuildTarget(), b.getBuildTarget()));
assertThat(
spec.getBody().keySet(),
Matchers.containsInAnyOrder(a.getBuildTarget(), b.getBuildTarget()));
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.empty());
assertThat(
spec.getExcluded().keySet(),
Matchers.empty());
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of()));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget().toString(), "libomnibus.so"));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get("libomnibus.so")),
a.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC),
b.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
}
@Test
public void excludedAndIncludedDeps() throws NoSuchBuildTargetException {
NativeLinkable a = new OmnibusNode("//:a");
NativeLinkable b = new OmnibusSharedOnlyNode("//:b");
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a, b));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of());
assertThat(
spec.getGraph().getNodes(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getBody().keySet(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.containsInAnyOrder(b.getBuildTarget()));
assertThat(
spec.getExcluded().keySet(),
Matchers.containsInAnyOrder(b.getBuildTarget()));
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of()));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(
root.getBuildTarget().toString(),
b.getBuildTarget().toString(),
"libomnibus.so"));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM),
b.getNativeLinkableInput(CxxPlatformUtils.DEFAULT_PLATFORM, Linker.LinkableDepType.SHARED));
assertThat(
libs.get(b.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get("libomnibus.so")),
a.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
}
@Test
public void excludedDepExcludesTransitiveDep() throws NoSuchBuildTargetException {
NativeLinkable a = new OmnibusNode("//:a");
NativeLinkable b = new OmnibusNode("//:b");
NativeLinkable c = new OmnibusSharedOnlyNode("//:c", ImmutableList.of(b));
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a, c));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of());
assertThat(
spec.getGraph().getNodes(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getBody().keySet(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.containsInAnyOrder(c.getBuildTarget()));
assertThat(
spec.getExcluded().keySet(),
Matchers.containsInAnyOrder(b.getBuildTarget(), c.getBuildTarget()));
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of()));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(
root.getBuildTarget().toString(),
b.getBuildTarget().toString(),
c.getBuildTarget().toString(),
"libomnibus.so"));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM),
c.getNativeLinkableInput(CxxPlatformUtils.DEFAULT_PLATFORM, Linker.LinkableDepType.SHARED));
assertThat(
libs.get(b.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertThat(
libs.get(c.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get("libomnibus.so")),
a.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
}
@Test
public void depOfExcludedRoot() throws NoSuchBuildTargetException {
NativeLinkable a = new OmnibusNode("//:a");
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a));
NativeLinkable b = new OmnibusNode("//:b");
NativeLinkable excludedRoot = new OmnibusNode("//:excluded_root", ImmutableList.of(b));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of(excludedRoot));
assertThat(
spec.getGraph().getNodes(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getBody().keySet(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.empty());
assertThat(
spec.getExcluded().keySet(),
Matchers.containsInAnyOrder(excludedRoot.getBuildTarget(), b.getBuildTarget()));
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of(excludedRoot)));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(
root.getBuildTarget().toString(),
excludedRoot.getBuildTarget().toString(),
b.getBuildTarget().toString(),
"libomnibus.so"));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM));
assertThat(
libs.get(excludedRoot.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertThat(
libs.get(b.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get("libomnibus.so")),
a.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
}
@Test
public void commondDepOfIncludedAndExcludedRoots() throws NoSuchBuildTargetException {
NativeLinkable a = new OmnibusNode("//:a");
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a));
NativeLinkable excludedRoot = new OmnibusNode("//:excluded_root", ImmutableList.of(a));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of(excludedRoot));
assertThat(
spec.getGraph().getNodes(),
Matchers.empty());
assertThat(
spec.getBody().keySet(),
Matchers.empty());
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.containsInAnyOrder(a.getBuildTarget()));
assertThat(
spec.getExcluded().keySet(),
Matchers.containsInAnyOrder(excludedRoot.getBuildTarget(), a.getBuildTarget()));
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of(excludedRoot)));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(
root.getBuildTarget().toString(),
excludedRoot.getBuildTarget().toString(),
a.getBuildTarget().toString()));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM));
assertThat(
libs.get(excludedRoot.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
assertThat(
libs.get(a.getBuildTarget().toString()),
Matchers.not(Matchers.instanceOf(BuildTargetSourcePath.class)));
}
@Test
public void unusedStaticDepsAreNotIncludedInBody() throws NoSuchBuildTargetException {
NativeLinkable a =
new OmnibusNode(
"//:a",
ImmutableList.of(),
ImmutableList.of(),
NativeLinkable.Linkage.STATIC);
NativeLinkable b = new OmnibusNode("//:b");
NativeLinkTarget root = new OmnibusRootNode("//:root", ImmutableList.of(a, b));
// Verify the spec.
Omnibus.OmnibusSpec spec =
Omnibus.buildSpec(
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(root),
ImmutableList.of());
assertThat(
spec.getGraph().getNodes(),
Matchers.containsInAnyOrder(b.getBuildTarget()));
assertThat(
spec.getBody().keySet(),
Matchers.containsInAnyOrder(b.getBuildTarget()));
assertThat(
spec.getRoots().keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget()));
assertThat(
spec.getDeps().keySet(),
Matchers.empty());
assertThat(
spec.getExcluded().keySet(),
Matchers.empty());
// Verify the libs.
BuildRuleResolver resolver =
new BuildRuleResolver(
TargetGraph.EMPTY,
new DefaultTargetNodeToBuildRuleTransformer());
SourcePathResolver pathResolver = new SourcePathResolver(resolver);
ImmutableMap<String, SourcePath> libs =
toSonameMap(
Omnibus.getSharedLibraries(
new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:rule")).build(),
resolver,
pathResolver,
CxxPlatformUtils.DEFAULT_CONFIG,
CxxPlatformUtils.DEFAULT_PLATFORM,
ImmutableList.of(),
ImmutableList.of(root),
ImmutableList.of()));
assertThat(
libs.keySet(),
Matchers.containsInAnyOrder(root.getBuildTarget().toString(), "libomnibus.so"));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get(root.getBuildTarget().toString())),
root.getNativeLinkTargetInput(CxxPlatformUtils.DEFAULT_PLATFORM),
a.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
assertCxxLinkContainsNativeLinkableInput(
getCxxLinkRule(pathResolver, libs.get("libomnibus.so")),
b.getNativeLinkableInput(
CxxPlatformUtils.DEFAULT_PLATFORM,
Linker.LinkableDepType.STATIC_PIC));
}
private CxxLink getCxxLinkRule(SourcePathResolver resolver, SourcePath path) {
return ((CxxLink) resolver.getRule(path).get());
}
private void assertCxxLinkContainsNativeLinkableInput(
CxxLink link,
NativeLinkableInput... inputs) {
for (NativeLinkableInput input : inputs) {
assertThat(
Arg.stringify(link.getArgs()),
Matchers.hasItems(Arg.stringify(input.getArgs()).toArray(new String[1])));
}
}
private ImmutableMap<String, SourcePath> toSonameMap(OmnibusLibraries libraries) {
ImmutableMap.Builder<String, SourcePath> map = ImmutableMap.builder();
for (Map.Entry<BuildTarget, OmnibusRoot> root : libraries.getRoots().entrySet()) {
map.put(root.getKey().toString(), root.getValue().getPath());
}
for (OmnibusLibrary library : libraries.getLibraries()) {
map.put(library.getSoname(), library.getPath());
}
return map.build();
}
}
| 39.422993 | 100 | 0.665126 |
703c05e28446587926c850d045beaed688c99581 | 1,094 | package com.emc.mongoose.api.model.item;
import com.github.akurilov.commons.io.Input;
import com.github.akurilov.commons.system.SizeInBytes;
import java.io.IOException;
import java.util.List;
public final class NewDataItemInput<D extends DataItem>
extends NewItemInput<D>
implements Input<D> {
private final SizeInBytes dataSize;
public NewDataItemInput(
final ItemFactory<D> itemFactory, final IdStringInput idInput, final SizeInBytes dataSize
) {
super(itemFactory, idInput);
this.dataSize = dataSize;
}
public SizeInBytes getDataSizeInfo() {
return dataSize;
}
@Override
public final D get()
throws IOException {
return itemFactory.getItem(idInput.get(), idInput.getAsLong(), dataSize.get());
}
@Override
public final int get(final List<D> buffer, final int maxCount)
throws IOException {
for(int i = 0; i < maxCount; i ++) {
buffer.add(itemFactory.getItem(idInput.get(), idInput.getAsLong(), dataSize.get()));
}
return maxCount;
}
@Override
public final String toString() {
return super.toString() + "(" + dataSize.toString() + ")";
}
}
| 23.782609 | 91 | 0.731261 |
ca4980823d14ee54a487f7c339f566f495f7ad61 | 542 | /*
* Copyright (c) 2021 Mohit Saini, Under MIT License. Use is subject to license terms.
*
*/
package mscalculator.style;
import java.awt.Font;
import java.awt.Dimension;
/**
* Style interface help program to set the Style and Scale
* of the frame, buttons and their fonts used in this Calculator.
*/
public interface Style {
Dimension getFrameSize();
Dimension getButtonSize();
Font getNumButtonFont();
Font getOprButtonFont();
Font getMainFieldFont();
Font getSubFieldFont();
Font getSignButtonFont();
} | 24.636364 | 86 | 0.714022 |
9be38c0325bb1320e531799943c7b40e1f71730a | 1,503 | import support.Prime;
import support.Problem;
import java.math.BigInteger;
/**
* Created by Mark on 7/21/16.
*
* https://projecteuler.net/problem=26
*/
public class Problem026 extends Problem {
@Override
public long solveProblem() {
long longestRecurringSequenceLength = -1;
long longestRecurringSequenceNumber = -1;
for (int i = 2; i < 1000; i++) {
// Optimization because primes will produce the longest repeating sequences
// https://en.wikipedia.org/wiki/Repeating_decimal#Fractions_with_prime_denominators
if (!Prime.isPrime(i)) {
continue;
}
int remainderValue = 10 % i;
int moduloCounter = 0;
// Loop until we get a 1 (which means we reach the end of the cycle and the beginning of the next cycle)
// or our modulo operation count exceeds the number itself.
while (remainderValue != 1 && moduloCounter < i) {
remainderValue = remainderValue * 10 % i; // Moving over to the right so multiply by 10
moduloCounter++;
}
if (moduloCounter < i && moduloCounter > longestRecurringSequenceLength) {
longestRecurringSequenceLength = moduloCounter;
longestRecurringSequenceNumber = i;
}
}
return longestRecurringSequenceNumber;
}
@Override
public String base64EncodedAnswer() {
return "OTgz";
}
}
| 30.673469 | 116 | 0.606786 |
3faa964929d41b5caf71ff5041fba691de20208c | 9,981 | package ca.edchipman.silverstripedt.ss_2_3.project;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.dltk.internal.ui.util.CoreUtility;
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.php.internal.ui.preferences.PHPTemplateStore;
import org.osgi.framework.Bundle;
import ca.edchipman.silverstripepdt.SilverStripePDTPlugin;
import ca.edchipman.silverstripepdt.versioninterfaces.ISilverStripeNewProjectCreator;
import ca.edchipman.silverstripepdt.wizards.SilverStripeProjectWizardSecondPage.SilverStripeFileCreator;
@SuppressWarnings("restriction")
public class NewSilverStripeProjectCreator implements ISilverStripeNewProjectCreator {
/**
* Performs the SilverStripe version specific tasks when creating new project layout project
* @param project Destination project
* @param monitor Monitor to update when creating the layout
* @param templateRegistry Template registry to look through
* @param isFrameworkLayout If the project is a framework only project this is set to true
* @throws CoreException
*/
public void createProjectLayout(Wizard wizard, IProject project, IProgressMonitor monitor, ContextTypeRegistry templateRegistry, TemplateStore templateStore, boolean isFrameworkLayout) throws CoreException {
//Generate the Page.php file
Template pageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.defaultpage");
PHPTemplateStore.CompiledTemplate pageTemplate=PHPTemplateStore.compileTemplate(templateRegistry, pageTemplateToCompile, project.getName()+"/code", "Page.php");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/code", "Page.php", monitor, pageTemplate.string, pageTemplate.offset);
//Generate the _config.php file
Template configTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newssproject.ss23.config");
PHPTemplateStore.CompiledTemplate configTemplate=PHPTemplateStore.compileTemplate(templateRegistry, configTemplateToCompile, project.getName(), "_config.php");
new SilverStripeFileCreator().createFile(wizard, project.getName(), "_config.php", monitor, configTemplate.string, configTemplate.offset, true);
}
/**
* Performs the SilverStripe version specific tasks when creating new module layout project
* @param project Destination project
* @param monitor Monitor to update when creating the layout
* @param templateRegistry Template registry to look through
* @param isFrameworkLayout If the project is a framework only project this is set to true
* @throws CoreException
*/
public void createModuleLayout(Wizard wizard, IProject project, IProgressMonitor monitor, ContextTypeRegistry templateRegistry, TemplateStore templateStore, boolean isFrameworkLayout) throws CoreException {
//Do nothing
}
/**
* Performs the SilverStripe version specific tasks when creating new theme layout project
* @param project Destination project
* @param monitor Monitor to update when creating the layout
* @param templateRegistry Template registry to look through
* @param isFrameworkLayout If the project is a framework only project this is set to true
* @throws CoreException
*/
public void createThemeLayout(Wizard wizard, IProject project, IProgressMonitor monitor, ContextTypeRegistry templateRegistry, TemplateStore templateStore, boolean isFrameworkLayout) throws CoreException {
//Generate the editor.css file
Template editorTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.editor");
PHPTemplateStore.CompiledTemplate editorTemplate=PHPTemplateStore.compileTemplate(templateRegistry, editorTemplateToCompile, project.getName()+"/css", "editor.css");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/css", "editor.css", monitor, editorTemplate.string, editorTemplate.offset);
//Generate the form.css file
Template formTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.form");
PHPTemplateStore.CompiledTemplate formTemplate=PHPTemplateStore.compileTemplate(templateRegistry, formTemplateToCompile, project.getName()+"/css", "form.css");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/css", "form.css", monitor, formTemplate.string, formTemplate.offset);
//Generate the layout.css file
Template layoutTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.layout");
PHPTemplateStore.CompiledTemplate layoutTemplate=PHPTemplateStore.compileTemplate(templateRegistry, layoutTemplateToCompile, project.getName()+"/css", "layout.css");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/css", "layout.css", monitor, layoutTemplate.string, layoutTemplate.offset);
//Generate the typography.css file
Template typographyTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.typography");
PHPTemplateStore.CompiledTemplate typographyTemplate=PHPTemplateStore.compileTemplate(templateRegistry, typographyTemplateToCompile, project.getName()+"/css", "typography.css");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/css", "typography.css", monitor, typographyTemplate.string, typographyTemplate.offset);
//Generate the top level Page.ss file
Template tlPageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newss.toplevel");
PHPTemplateStore.CompiledTemplate tlPageTemplate=PHPTemplateStore.compileTemplate(templateRegistry, tlPageTemplateToCompile, project.getName()+"/templates", "Page.ss");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/templates", "Page.ss", monitor, tlPageTemplate.string, tlPageTemplate.offset);
//Generate the Page.ss file
Template pageTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newss.template");
PHPTemplateStore.CompiledTemplate pageTemplate=PHPTemplateStore.compileTemplate(templateRegistry, pageTemplateToCompile, project.getName()+"/templates/Layout", "Page.ss");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/templates/Layout", "Page.ss", monitor, pageTemplate.string, pageTemplate.offset);
//Generate the Page_results.ss file
Template pageResultsTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.pageresults");
PHPTemplateStore.CompiledTemplate pageResultsTemplate=PHPTemplateStore.compileTemplate(templateRegistry, pageResultsTemplateToCompile, project.getName()+"/templates/Layout", "Page_results.ss");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/templates/Layout", "Page_results.ss", monitor, pageResultsTemplate.string, pageResultsTemplate.offset);
//Generate the Navigation.ss file
Template navigationTemplateToCompile=templateStore.findTemplateById("ca.edchipman.silverstripepdt.SilverStripe.templates.newsstheme.navigation");
PHPTemplateStore.CompiledTemplate navigationTemplate=PHPTemplateStore.compileTemplate(templateRegistry, navigationTemplateToCompile, project.getName()+"/templates/Includes", "Navigation.ss");
new SilverStripeFileCreator().createFile(wizard, project.getName()+"/templates/Includes", "Navigation.ss", monitor, navigationTemplate.string, navigationTemplate.offset);
IPath treeIconsPath = new Path("images/treeicons");
if (treeIconsPath.segmentCount() > 0) {
IFolder folder = project.getFolder(treeIconsPath);
CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 10));
} else {
monitor.worked(10);
}
//Copy the Home Icon
try {
Bundle bundle = Platform.getBundle(SilverStripePDTPlugin.PLUGIN_ID);
InputStream stream;
stream = FileLocator.openStream(bundle, new Path("resources/theme/images/treeicons/home-file.gif"), false);
IFile file = project.getFile("images/treeicons/home-file.gif");
file.create(stream, true, null);
} catch (IOException e) {
e.printStackTrace();
}
//Copy the News Icon
try {
Bundle bundle = Platform.getBundle(SilverStripePDTPlugin.PLUGIN_ID);
InputStream stream;
stream = FileLocator.openStream(bundle, new Path("resources/theme/images/treeicons/news-file.gif"), false);
IFile file = project.getFile("images/treeicons/news-file.gif");
file.create(stream, true, null);
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 63.573248 | 211 | 0.753432 |
d0b3c5cae989b43867bef5af6e3fd3e3d18d0d01 | 1,733 | package CodingNinjas.LanguageToolsAndTimeComplexity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
class solution {
public static ArrayList<Integer> longestSubsequence(int[] arr) {
Map<Integer, Boolean> isVisited = new HashMap<>();
int currentStart = arr[0], currentLength = 0, globalStartElement = Integer.MIN_VALUE, maxLength = 0;
// Add all elements in map
for (int el : arr) {
isVisited.put(el, false);
}
for (int i = 0; i < arr.length; i++) {
currentLength = 1;
currentStart = arr[i];
isVisited.put(currentStart, true);
while (isVisited.containsKey(currentStart + 1) && !isVisited.get(currentStart + 1)) {
isVisited.put(currentStart + 1, true);
currentStart++;
currentLength++;
}
currentStart = arr[i];
while (isVisited.containsKey(currentStart - 1) && !isVisited.get(currentStart - 1)) {
isVisited.put(currentStart - 1, true);
currentStart--;
currentLength++;
}
if (maxLength < currentLength) {
globalStartElement = currentStart;
maxLength = currentLength;
} else if (maxLength == currentLength) {
int globalStartElementIndex = Math.min(search(arr, globalStartElement), search(arr, currentStart));
globalStartElement = arr[globalStartElementIndex];
}
}
ArrayList<Integer> result = new ArrayList<>();
int temp = globalStartElement;
while (maxLength-- > 0) {
result.add(temp);
temp++;
}
return result;
}
private static int search(int[] arr, int key) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == key) {
return i;
}
}
return -1;
}
}
| 29.372881 | 107 | 0.61858 |
09269446219d0e4ce09b7c5000c5fecbe739f625 | 1,774 | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.dto;
import java.util.Set;
public class OpenGrayReleaseRuleDTO extends BaseDTO{
private String appId;
private String clusterName;
private String namespaceName;
private String branchName;
private Set<OpenGrayReleaseRuleItemDTO> ruleItems;
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public String getBranchName() {
return branchName;
}
public void setBranchName(String branchName) {
this.branchName = branchName;
}
public Set<OpenGrayReleaseRuleItemDTO> getRuleItems() {
return ruleItems;
}
public void setRuleItems(Set<OpenGrayReleaseRuleItemDTO> ruleItems) {
this.ruleItems = ruleItems;
}
}
| 24.638889 | 75 | 0.696731 |
6d1a62b683aa151dddfd663b5297ed5df8a8d49c | 2,936 | package com.github.vladislavgoltjajev.personalcode.locale.latvia;
import com.github.vladislavgoltjajev.personalcode.exception.PersonalCodeException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.time.LocalDate;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
class LatvianPersonalCodeGeneratorTest {
private LatvianPersonalCodeGenerator generator;
private LatvianPersonalCodeValidator validator;
@BeforeEach
void setUp() {
generator = new LatvianPersonalCodeGenerator();
validator = new LatvianPersonalCodeValidator();
}
@Test
void generateRandomPersonalCode() {
for (int i = 0; i < 1000; i++) {
String personalCode = generator.generateRandomPersonalCode();
assertThat(validator.isValid(personalCode)).isTrue();
}
}
@Test
void generateRandomUpdatedPersonalCode() {
for (int i = 0; i < 1000; i++) {
String personalCode = generator.generateRandomUpdatedPersonalCode();
assertThat(validator.isValid(personalCode)).isTrue();
}
}
@Test
void generateRandomLegacyPersonalCode() {
for (int i = 0; i < 1000; i++) {
String personalCode = generator.generateRandomLegacyPersonalCode();
assertThat(validator.isValidLegacyFormat(personalCode)).isTrue();
assertThat(validator.isValid(personalCode)).isTrue();
}
}
@Test
void generateLegacyPersonalCode() throws PersonalCodeException {
for (int i = 0; i < 1000; i++) {
LocalDate dateOfBirth = LatvianPersonalCodeUtils.getRandomDateOfBirth();
String personalCode = generator.generateLegacyPersonalCode(dateOfBirth);
assertThat(validator.isValid(personalCode)).isTrue();
}
}
@Test
void generateLegacyPersonalCodeWithBirthOrderNumber() throws PersonalCodeException {
for (int i = 0; i < 1000; i++) {
LocalDate dateOfBirth = LatvianPersonalCodeUtils.getRandomDateOfBirth();
int birthOrderNumber = LatvianPersonalCodeUtils.getRandomBirthOrderNumber();
String personalCode = generator.generateLegacyPersonalCode(dateOfBirth, birthOrderNumber);
assertThat(validator.isValid(personalCode)).isTrue();
}
}
@Test
void generatePersonalCodeWithInvalidParameters() {
assertThatThrownBy(() -> generator.generateLegacyPersonalCode(null))
.isInstanceOf(PersonalCodeException.class);
assertThatThrownBy(() -> generator.generateLegacyPersonalCode(LocalDate.of(2000, 1, 1), -1))
.isInstanceOf(PersonalCodeException.class);
assertThatThrownBy(() -> generator.generateLegacyPersonalCode(LocalDate.of(2000, 1, 1), 1000))
.isInstanceOf(PersonalCodeException.class);
}
} | 38.631579 | 102 | 0.690736 |
2ef4db39a7981cad0c994f2ddfa4b99c26b717b4 | 4,806 | /*
* @author Gabriel Oexle
* 2015.
*/
package peanutencryption.peanutencryption.SQL;
import java.io.Serializable;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.ArrayList;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class SQLiteHelper extends SQLiteOpenHelper implements Serializable {
private static final int DATABASE_VERSION = 1;
private String _databaseName;
private String LOG_str = "peanutencryption";
public SQLiteHelper(Context context, String databaseName) {
super(context, databaseName, null, DATABASE_VERSION);
this._databaseName = databaseName;
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(this.createDataTable());
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public long insertIntoDataTable(
String CodeName,
String Code) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(DataTable.CreationDate, new java.util.Date().getTime());
values.put(DataTable.CodeName, CodeName);
values.put(DataTable.Code, Code);
long id = db.insert(DataTable.DataTable, null, values);
db.close();
if (id != -1) {
Log.d(LOG_str, "Data Successful added");
return id;
} else {
Log.e(LOG_str, "Error. Failed to write to DataTable");
return -1;
}
}
public boolean deleteItemFromDatabase(long id) {
SQLiteDatabase db = this.getWritableDatabase();
return db.delete(DataTable.DataTable, DataTable.DataIDIntern + "=" + id, null) > 0;
}
public ArrayList<CodeObject> getAllCodes() {
SQLiteDatabase db = this.getReadableDatabase();
String[] attributes = new String[]{
DataTable.DataIDIntern,
DataTable.CreationDate,
DataTable.CodeName,
DataTable.Code
};
Cursor cursor = db.query(
DataTable.DataTable,
attributes,
null, null, null, null, null, null);
ArrayList<CodeObject> returnObject = new ArrayList<CodeObject>();
if (cursor != null && cursor.moveToFirst()) {
} else {
Log.i(LOG_str, "No Data was found in the database");
return returnObject;
}
do {
long longDataID = cursor.getLong((cursor.getColumnIndex(DataTable.DataIDIntern)));
long longCreationDate = cursor.getLong(cursor.getColumnIndex(DataTable.CreationDate));
Timestamp sqlCreationTime = new Timestamp(longCreationDate);
String sqlCodeName = cursor.getString(cursor.getColumnIndex(DataTable.CodeName));
String sqlCode = cursor.getString(cursor.getColumnIndex(DataTable.Code));
returnObject.add(new CodeObject(sqlCodeName, sqlCode, sqlCreationTime, longDataID));
}
while (cursor.moveToNext());
cursor.close();
return returnObject;
}
public SQLiteDatabase updateCodes(ArrayList<CodeObject> codeList) {
SQLiteDatabase db = this.getWritableDatabase();
db.beginTransaction();
for (CodeObject codeItem : codeList) {
ContentValues values = new ContentValues();
values.put(DataTable.Code, codeItem.getCode());
int returnValue = db.update(DataTable.DataTable, values, DataTable.DataIDIntern + "=?", new String[]{Long.toString(codeItem.getDataID())});
if (returnValue != 1) {
db.endTransaction();
return null;
}
}
return db;
}
private String createDataTable() {
return MessageFormat.format("CREATE TABLE IF NOT EXISTS {0} " +
"({1} INTEGER PRIMARY KEY AUTOINCREMENT," +
" {2} INTEGER NOT NULL," +
" {3} TEXT NOT NULL," +
" {4} TEXT NOT NULL)",
DataTable.DataTable,
DataTable.DataIDIntern,
DataTable.CreationDate,
DataTable.CodeName,
DataTable.Code);
}
final class DataTable {
public static final String DataTable = "DataTable";
public static final String DataIDIntern = "DataIDIntern";
public static final String CreationDate = "CreationDate";
public static final String CodeName = "CodeName";
public static final String Code = "Code";
}
}
| 29.850932 | 151 | 0.616729 |
bed6a1c59b80c4f1b14e3dcfe2f096f96d9823d8 | 189 | package models;
import javax.persistence.*;
@Entity
public class ExistingPerson {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public String email;
public String password;
}
| 18.9 | 49 | 0.767196 |
6c98d48e93e3f856d3c44b855e58c25bab7b181e | 1,830 |
package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DrawDiscardControllerEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.target.TargetPlayer;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/**
* @author fireshoes
*/
public final class Probe extends CardImpl {
public Probe(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
// Kicker {1}{B}
this.addAbility(new KickerAbility("{1}{B}"));
// Draw three cards, then discard two cards.
this.getSpellAbility().addEffect(new DrawDiscardControllerEffect(3, 2));
// If Probe was kicked, target player discards two cards.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DiscardTargetEffect(2),
KickedCondition.instance,
"<br><br>if this spell was kicked, target player discards two cards"));
this.getSpellAbility().setTargetAdjuster(ProbeAdjuster.instance);
}
public Probe(final Probe card) {
super(card);
}
@Override
public Probe copy() {
return new Probe(this);
}
}
enum ProbeAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
if (KickedCondition.instance.apply(game, ability)) {
ability.addTarget(new TargetPlayer());
}
}
} | 31.016949 | 87 | 0.700546 |
dfead7cb76dea0c17e829329f66a1f152e47094f | 651 | package dev.victorbrugnolo.webcrawler;
import dev.victorbrugnolo.webcrawler.configuration.BeanConfiguration;
import dev.victorbrugnolo.webcrawler.configuration.EnvironmentAccessor;
import dev.victorbrugnolo.webcrawler.services.impl.HttpServiceImpl;
import dev.victorbrugnolo.webcrawler.utils.Logger;
public class Main {
public static void main(String[] args) {
var httpService = HttpServiceImpl.getInstance();
var environment = EnvironmentAccessor.getInstance();
var webCrawler = new BeanConfiguration().getWebCrawler(httpService, environment);
var logger = Logger.getInstance();
logger.logResults(webCrawler.crawl());
}
}
| 34.263158 | 85 | 0.798771 |
6d323f15102aa5bb14ac3ce748f442e3694216a8 | 3,486 | package net.conjur.api;
import net.conjur.util.Args;
import java.io.Serializable;
import java.net.URI;
/**
* An <code>Endpoints</code> instance provides endpoint URIs for the various conjur services.
*/
public class Endpoints implements Serializable {
<<<<<<< HEAD
=======
>>>>>>> upstream/master
private final URI authnUri;
private final URI secretsUri;
private final URI resourcesUri;
private final URI batchSecretsUri;
public Endpoints(final URI authnUri, final URI secretsUri, final URI resourcesUri, final URI batchSecretsUri){
this.authnUri = Args.notNull(authnUri, "authnUri");
this.secretsUri = Args.notNull(secretsUri, "secretsUri");
this.resourcesUri = Args.notNull(resourcesUri, "resourcesUri");
this.batchSecretsUri = Args.notNull(batchSecretsUri, "batchSecretsUri");
}
public Endpoints(String authnUri, String secretsUri, String resourcesUri, String batchSecretsUri){
this(URI.create(authnUri), URI.create(secretsUri), URI.create(resourcesUri), URI.create(batchSecretsUri));
}
public URI getAuthnUri(){
return authnUri;
}
public URI getSecretsUri() {
return secretsUri;
}
<<<<<<< HEAD
public URI getBatchSecretsUri() {
return batchSecretsUri;
}
=======
public static Endpoints fromSystemProperties(){
String account = Properties.getMandatoryProperty(Constants.CONJUR_ACCOUNT_PROPERTY);
String applianceUrl = Properties.getMandatoryProperty(Constants.CONJUR_APPLIANCE_URL_PROPERTY);
String authnUrl = Properties.getMandatoryProperty(Constants.CONJUR_AUTHN_URL_PROPERTY, applianceUrl + "/authn");
>>>>>>> upstream/master
public URI getResourcesUri() {
return resourcesUri;
}
<<<<<<< HEAD
public static Endpoints fromConfig(Config config){
=======
public static Endpoints fromCredentials(Credentials credentials){
String account = Properties.getMandatoryProperty(Constants.CONJUR_ACCOUNT_PROPERTY);
>>>>>>> upstream/master
return new Endpoints(
getAuthnServiceUri(config.getCredentials().getAuthnUrl(), config.getAccount()),
getServiceUri(config.getApplianceUrl(), "secrets", config.getAccount(), "variable"),
getServiceUri(config.getApplianceUrl(), "resources", config.getAccount()),
URI.create(config.getApplianceUrl() + "/secrets")
);
}
private static URI getAuthnServiceUri(String authnUrl, String accountName) {
return URI.create(String.format("%s/%s", authnUrl, accountName));
}
<<<<<<< HEAD
private static URI getServiceUri(String applianceUrl, String service, String accountName){
return URI.create(String.format("%s/%s/%s/%s", applianceUrl, service, accountName, ""));
}
private static URI getServiceUri(String applianceUrl, String service, String accountName, String path){
return URI.create(String.format("%s/%s/%s/%s", applianceUrl, service, accountName, path));
=======
private static URI getServiceUri(String service, String accountName, String path){
return URI.create(String.format("%s/%s/%s/%s", Properties.getMandatoryProperty(Constants.CONJUR_APPLIANCE_URL_PROPERTY), service, accountName, path));
>>>>>>> upstream/master
}
@Override
public String toString() {
return "Endpoints{" +
"authnUri=" + authnUri +
"secretsUri=" + secretsUri +
'}';
}
}
| 37.085106 | 158 | 0.683305 |
e9cc5118016623a322f980f0051c99372a64c038 | 7,696 | package com.skcc.cloudz.zcp.portal.alert.alerts.service;
import java.util.Arrays;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.AlertCountVo;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.AlertHistoryVo;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.AlertVo;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.ApiServerVo;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.NodeDownVo;
import com.skcc.cloudz.zcp.portal.alert.alerts.vo.NodeNotReadyVo;
@Service
public class AlertService {
private static Logger logger = Logger.getLogger(AlertService.class);
@Value("${props.alertmanager.baseUrl}")
private String baseUrl;
public AlertCountVo getActiveCount() {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/alertList").build().toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<AlertVo[]> entity = new HttpEntity<AlertVo[]>(headers);
RestTemplate restTemplate = new RestTemplate();
AlertVo[] alertVo = null;
AlertCountVo alertCountVo = new AlertCountVo();
try {
ResponseEntity<AlertVo[]> response = restTemplate.exchange(url, HttpMethod.GET, entity, AlertVo[].class);
HttpStatus statusCode = response.getStatusCode();
if (statusCode == HttpStatus.OK) {
alertVo = response.getBody();
alertCountVo.setCount(alertVo.length + "");
} else {
alertCountVo.setCount(null);
}
} catch(Exception e) {
e.printStackTrace();
alertCountVo.setCount(null);
}
return alertCountVo;
/*
* String url =
* UriComponentsBuilder.fromUriString(baseUrl).path("/activeCount").build().
* toString(); logger.info(url);
*
* HttpHeaders headers = new HttpHeaders();
*
* headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON
* })); headers.setContentType(MediaType.APPLICATION_JSON);
*
* HttpEntity<AlertCountVo> entity = new HttpEntity<AlertCountVo>(headers);
*
* RestTemplate restTemplate = new RestTemplate(); ResponseEntity<AlertCountVo>
* response = restTemplate.exchange(url, HttpMethod.GET, entity,
* AlertCountVo.class);
*
* HttpStatus statusCode = response.getStatusCode();
*
* AlertCountVo alertCountVo = new AlertCountVo(); if (statusCode ==
* HttpStatus.OK) { alertCountVo = response.getBody(); }
*
* return alertCountVo;
*/
}
public ApiServerVo getApiServer() {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/apiServer").build().toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<ApiServerVo> entity = new HttpEntity<ApiServerVo>(headers);
RestTemplate restTemplate = new RestTemplate();
ApiServerVo apiServerVo = new ApiServerVo();
try {
ResponseEntity<ApiServerVo> response = restTemplate.exchange(url, HttpMethod.GET, entity, ApiServerVo.class);
HttpStatus statusCode = response.getStatusCode();
if (statusCode == HttpStatus.OK) {
apiServerVo = response.getBody();
if (apiServerVo.getCode() != null) {
apiServerVo.setStatus(null);
}
} else {
apiServerVo.setStatus(null);
}
} catch(Exception e) {
e.printStackTrace();
apiServerVo.setStatus(null);
}
return apiServerVo;
}
public NodeNotReadyVo getNodeNotReady() {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/nodeNotReady").build().toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<NodeNotReadyVo> entity = new HttpEntity<NodeNotReadyVo>(headers);
RestTemplate restTemplate = new RestTemplate();
NodeNotReadyVo nodeNotReadyVo = new NodeNotReadyVo();
try {
ResponseEntity<NodeNotReadyVo> response = restTemplate.exchange(url, HttpMethod.GET, entity,
NodeNotReadyVo.class);
HttpStatus statusCode = response.getStatusCode();
if (statusCode == HttpStatus.OK) {
nodeNotReadyVo = response.getBody();
if (nodeNotReadyVo.getCode() != null) {
nodeNotReadyVo.setCount(null);
}
} else {
nodeNotReadyVo.setCount(null);
}
} catch(Exception e) {
e.printStackTrace();
nodeNotReadyVo.setCount(null);
}
return nodeNotReadyVo;
}
public NodeDownVo getNodeDown() {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/nodeDown").build().toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<NodeDownVo> entity = new HttpEntity<NodeDownVo>(headers);
RestTemplate restTemplate = new RestTemplate();
NodeDownVo nodeDownVo = new NodeDownVo();
try {
ResponseEntity<NodeDownVo> response = restTemplate.exchange(url, HttpMethod.GET, entity, NodeDownVo.class);
HttpStatus statusCode = response.getStatusCode();
if (statusCode == HttpStatus.OK) {
nodeDownVo = response.getBody();
if (nodeDownVo.getCode() != null) {
nodeDownVo.setCount(null);
}
} else {
nodeDownVo.setCount(null);
}
} catch(Exception e) {
e.printStackTrace();
nodeDownVo.setCount(null);
}
return nodeDownVo;
}
public AlertVo[] getAlertList() throws Exception {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/alertList").build().toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<AlertVo[]> entity = new HttpEntity<AlertVo[]>(headers);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<AlertVo[]> response = restTemplate.exchange(url, HttpMethod.GET, entity, AlertVo[].class);
HttpStatus statusCode = response.getStatusCode();
AlertVo[] alertVo = null;
if (statusCode == HttpStatus.OK) {
alertVo = response.getBody();
}
return alertVo;
}
public AlertHistoryVo[] getAlertHistoryList(String time) throws Exception {
String url = UriComponentsBuilder.fromUriString(baseUrl).path("/alertHistory/{time}").buildAndExpand(time)
.toString();
logger.info(url);
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<AlertHistoryVo[]> entity = new HttpEntity<AlertHistoryVo[]>(headers);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<AlertHistoryVo[]> response = restTemplate.exchange(url, HttpMethod.GET, entity,
AlertHistoryVo[].class);
HttpStatus statusCode = response.getStatusCode();
AlertHistoryVo[] alertHistoryVo = null;
if (statusCode == HttpStatus.OK) {
alertHistoryVo = response.getBody();
}
return alertHistoryVo;
}
}
| 30.784 | 112 | 0.737916 |
9318dea4479d6acac4e1469229c7e6c7f8c1a60a | 14,669 | /*
Copyright 2016 Goldman Sachs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.gs.reladomo.serial.json;
import com.gs.fw.common.mithra.attribute.AsOfAttribute;
import com.gs.fw.common.mithra.attribute.TimestampAttribute;
import com.gs.fw.common.mithra.util.serializer.ReladomoDeserializer;
import com.gs.fw.common.mithra.util.serializer.ReladomoSerializationContext;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.Date;
public abstract class JsonDeserializerState
{
public JsonDeserializerState startObject(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call startObject in "+this.getClass().getSimpleName());
}
public JsonDeserializerState endObject(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call endObject in "+this.getClass().getSimpleName());
}
public JsonDeserializerState startArray(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call startArray in "+this.getClass().getSimpleName());
}
public JsonDeserializerState endArray(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call endArray in "+this.getClass().getSimpleName());
}
public JsonDeserializerState fieldName(String fieldName, ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call fieldName in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueEmbeddedObject(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueEmbeddedObject in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueTrue(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueTrue in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueFalse(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueFalse in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueNull(ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueNull in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueString in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueTimestamp(Timestamp value, ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueString in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueNumberInt(String value, ReladomoDeserializer deserializer, IntDateParser intDateParser) throws IOException
{
throw new RuntimeException("Shouldn't call valueNumberInt in "+this.getClass().getSimpleName());
}
public JsonDeserializerState valueNumberFloat(String value, ReladomoDeserializer deserializer) throws IOException
{
throw new RuntimeException("Shouldn't call valueNumberFloat in "+this.getClass().getSimpleName());
}
public static class NormalParserState extends JsonDeserializerState
{
public static NormalParserState INSTANCE = new NormalParserState();
@Override
public JsonDeserializerState startObject(ReladomoDeserializer deserializer) throws IOException
{
deserializer.startObject();
return this;
}
@Override
public JsonDeserializerState endObject(ReladomoDeserializer deserializer) throws IOException
{
deserializer.endObjectOrList();
return this;
}
@Override
public JsonDeserializerState fieldName(String fieldName, ReladomoDeserializer deserializer) throws IOException
{
if (fieldName.equals(ReladomoSerializationContext.RELADOMO_CLASS_NAME))
{
return ClassNameState.INSTANCE;
}
else if (fieldName.equals(ReladomoSerializationContext.RELADOMO_STATE))
{
return ObjectStateState.INSTANCE;
}
else
{
ReladomoDeserializer.FieldOrRelation fieldOrRelation = deserializer.startFieldOrRelationship(fieldName);
if (ReladomoDeserializer.FieldOrRelation.Unknown.equals(fieldOrRelation))
{
return this;
}
else if (ReladomoDeserializer.FieldOrRelation.ToManyRelationship.equals(fieldOrRelation))
{
return new ToManyState(this);
}
}
return this;
}
@Override
public JsonDeserializerState endArray(ReladomoDeserializer deserializer) throws IOException
{
deserializer.endListElements();
return this;
}
@Override
public JsonDeserializerState valueTrue(ReladomoDeserializer deserializer) throws IOException
{
deserializer.setBooleanField(true);
return this;
}
@Override
public JsonDeserializerState valueFalse(ReladomoDeserializer deserializer) throws IOException
{
deserializer.setBooleanField(false);
return this;
}
@Override
public JsonDeserializerState valueNull(ReladomoDeserializer deserializer) throws IOException
{
deserializer.setFieldOrRelationshipNull();
return this;
}
@Override
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
deserializer.parseFieldFromString(value);
return this;
}
@Override
public JsonDeserializerState valueTimestamp(Timestamp value, ReladomoDeserializer deserializer) throws IOException
{
deserializer.setTimestampField(value);
return this;
}
@Override
public JsonDeserializerState valueNumberInt(String value, ReladomoDeserializer deserializer, IntDateParser intDateParser) throws IOException
{
if (deserializer.getCurrentAttribute() instanceof TimestampAttribute || deserializer.getCurrentAttribute() instanceof AsOfAttribute)
{
Date date = intDateParser.parseIntAsDate(value);
deserializer.setTimestampField(new Timestamp(date.getTime()));
}
else
{
deserializer.parseFieldFromString(value);
}
return this;
}
@Override
public JsonDeserializerState valueNumberFloat(String value, ReladomoDeserializer deserializer) throws IOException
{
deserializer.parseFieldFromString(value);
return this;
}
}
public static class ListStartState extends IgnoreState
{
public static ListStartState INSTANCE = new ListStartState();
public ListStartState()
{
super(NormalParserState.INSTANCE);
}
@Override
public JsonDeserializerState startObject(ReladomoDeserializer deserializer) throws IOException
{
deserializer.startList();
return this;
}
@Override
public JsonDeserializerState fieldName(String fieldName, ReladomoDeserializer deserializer) throws IOException
{
if (fieldName.equals(ReladomoSerializationContext.RELADOMO_CLASS_NAME))
{
return new ClassNameStateWithPrevious(this);
}
else if (fieldName.equals("elements"))
{
return new InListState(this);
}
return this;
}
}
public static class ClassNameStateWithPrevious extends JsonDeserializerState
{
private JsonDeserializerState previous;
public ClassNameStateWithPrevious (JsonDeserializerState previous)
{
this.previous = previous;
}
@Override
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
deserializer.storeReladomoClassName(value);
return previous;
}
}
public static class ClassNameState extends JsonDeserializerState
{
public static ClassNameState INSTANCE = new ClassNameState();
@Override
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
deserializer.storeReladomoClassName(value);
return NormalParserState.INSTANCE;
}
}
public static class ObjectStateState extends JsonDeserializerState
{
public static ObjectStateState INSTANCE = new ObjectStateState();
@Override
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
return valueNumberInt(value, deserializer, null);
}
@Override
public JsonDeserializerState valueNumberInt(String value, ReladomoDeserializer deserializer, IntDateParser intDateParser) throws IOException
{
deserializer.setReladomoObjectState(Integer.parseInt(value));
return NormalParserState.INSTANCE;
}
}
public static class IgnoreState extends JsonDeserializerState
{
protected JsonDeserializerState previous;
public IgnoreState (JsonDeserializerState previous)
{
this.previous = previous;
}
@Override
public JsonDeserializerState startObject(ReladomoDeserializer deserializer) throws IOException
{
return new IgnoreState(this);
}
@Override
public JsonDeserializerState endObject(ReladomoDeserializer deserializer) throws IOException
{
return previous;
}
@Override
public JsonDeserializerState startArray(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState endArray(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState fieldName(String fieldName, ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueEmbeddedObject(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueTrue(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueFalse(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueNull(ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueTimestamp(Timestamp value, ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueString(String value, ReladomoDeserializer deserializer) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueNumberInt(String value, ReladomoDeserializer deserializer, IntDateParser intDateParser) throws IOException
{
return this;
}
@Override
public JsonDeserializerState valueNumberFloat(String value, ReladomoDeserializer deserializer) throws IOException
{
return this;
}
}
public static class ToManyState extends IgnoreState
{
public ToManyState (JsonDeserializerState previous)
{
super(previous);
}
@Override
public JsonDeserializerState startObject(ReladomoDeserializer deserializer) throws IOException
{
deserializer.startList();
return new WaitForElementsState(previous);
}
}
public static class WaitForElementsState extends IgnoreState
{
public WaitForElementsState (JsonDeserializerState previous)
{
super(previous);
}
@Override
public JsonDeserializerState fieldName(String fieldName, ReladomoDeserializer deserializer) throws IOException
{
if ("elements".equals(fieldName))
{
return new InListState(previous);
}
return this;
}
}
public static class InListState extends JsonDeserializerState
{
public JsonDeserializerState previous;
public InListState (JsonDeserializerState previous)
{
this.previous = previous;
}
@Override
public JsonDeserializerState startArray(ReladomoDeserializer deserializer) throws IOException
{
deserializer.startListElements();
return new InArrayState(previous);
}
}
public static class InArrayState extends NormalParserState
{
public JsonDeserializerState previous;
public InArrayState (JsonDeserializerState previous)
{
this.previous = previous;
}
@Override
public JsonDeserializerState endArray(ReladomoDeserializer deserializer) throws IOException
{
deserializer.endListElements();
return previous;
}
}
}
| 34.273364 | 148 | 0.668007 |
b331bb68e3e48539f2764a1376ca6bf2ef1f3494 | 1,941 | /**
* Copyright 2008-2014 Jordi Hernández Sellés, Ibrahim Chaehoi
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package net.jawr.web.resource.bundle.iterator;
import java.util.Map;
/**
* Abstract implementation of ResourceBundlePathsIterator that holds a
* reference to a ConditionalCommentCallbackHandler to signal the need
* to start or end wrapping the paths with a conditional comment for internet
* explorer.
*
* @author Jordi Hernández Sellés
* @author Ibrahim Chaehoi
*/
public abstract class AbstractPathsIterator implements
ResourceBundlePathsIterator {
/** The comment callback handler */
protected ConditionalCommentCallbackHandler commentCallbackHandler;
/** The current variants */
protected Map<String, String> variants;
/**
* Creates the iterator passing the reference to the ConditionalCommentCallbackHandler.
* @param handler
*/
public AbstractPathsIterator(ConditionalCommentCallbackHandler handler,Map<String, String> variants) {
super();
commentCallbackHandler = handler;
this.variants = variants;
}
/**
* Unsupported method from the Iterator interface, will throw UnsupportedOperationException
* if called.
*/
public void remove() {
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
public BundlePath next() {
return nextPath();
}
}
| 30.809524 | 104 | 0.72849 |
aa646d9f770531be3823d7c91e606e5bdb9d80bc | 1,117 | package com.qjx.qmall.order.web;
import com.alipay.api.AlipayApiException;
import com.qjx.qmall.order.config.AlipayTemplate;
import com.qjx.qmall.order.service.OrderService;
import com.qjx.qmall.order.vo.PayVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* Ryan
* 2021-12-02-19:43
*/
@Controller
public class PayWebController {
@Resource
AlipayTemplate alipayTemplate;
@Resource
OrderService orderService;
@ResponseBody
@GetMapping(value = "/payOrder", produces = "text/html")
public String payOrder(@RequestParam("orderSn") String orderSn) throws AlipayApiException {
PayVo payVo = orderService.getOrderPay(orderSn);
// PayVo payVo = new PayVo();
// payVo.setOut_trade_no(orderSn);
// payVo.setBody();//订单备注
// payVo.setSubject();//订单主题
// payVo.setTotal_amount();//订单金额
String pay = alipayTemplate.pay(payVo);
System.out.println(pay);
return "hello";
}
}
| 24.282609 | 92 | 0.767234 |
03e71cff044d88e81ff05b37624f1e2a7f36bfce | 1,002 | package mcjty.rftools;
import net.minecraft.util.math.BlockPos;
/**
* This class holds information on client-side only which are global to the mod.
*/
public class ClientInfo {
private BlockPos selectedTE = null;
private BlockPos destinationTE = null;
private BlockPos hilightedBlock = null;
private long expireHilight = 0;
public void hilightBlock(BlockPos c, long expireHilight) {
hilightedBlock = c;
this.expireHilight = expireHilight;
}
public BlockPos getHilightedBlock() {
return hilightedBlock;
}
public long getExpireHilight() {
return expireHilight;
}
public BlockPos getSelectedTE() {
return selectedTE;
}
public void setSelectedTE(BlockPos selectedTE) {
this.selectedTE = selectedTE;
}
public BlockPos getDestinationTE() {
return destinationTE;
}
public void setDestinationTE(BlockPos destinationTE) {
this.destinationTE = destinationTE;
}
}
| 22.266667 | 80 | 0.677645 |
478be922f8bdf948df8b4aa52f5abe2b9e5edd07 | 689 | package com.jikezhiji.domain;
import org.springframework.data.domain.Persistable;
import java.io.Serializable;
/**
* Created by E355 on 2016/8/25.
*/
public class AggregateRoot<ID extends Serializable> implements Persistable<ID> {
public static final String VERSION = "version";
private ID id;
private int version;
public void setId(ID id) {
this.id = id;
}
@Override
public ID getId() {
return id;
}
public int getVersion() {
return this.version;
}
public void setVersion(int version){
this.version = version;
}
@Override
public boolean isNew() {
return getVersion() == 0;
}
}
| 18.131579 | 80 | 0.626996 |
e156ed863d6a0ad43205c207bf89e74335a60e5e | 924 | package org.myrobotlab.service.interfaces;
import org.myrobotlab.framework.interfaces.ServiceInterface;
public interface VideoProcessor extends ServiceInterface {
default boolean publishCapturing(Boolean b){
return b;
}
/**
* This is where video is processed.
* In OpenCV a frame is grabbed and sent through a series of filters
*/
public void processVideo();
default public void startVideoProcessing(){
VideoProcessWorker vpw = getWorker();
vpw.start();
invoke("publishCapturing", true);
}
default public void stopVideoProcessing(){
VideoProcessWorker vpw = getWorker();
vpw.stop();
invoke("publishCapturing", false);
}
default public boolean isProcessing(){
VideoProcessWorker vpw = getWorker();
return vpw.isProcessing();
}
public VideoProcessWorker getWorker();
public boolean isCapturing();
}
| 24.315789 | 71 | 0.6829 |
d699cc5a11bdbd9cc6dc3a8cbc65871b031d18ff | 500 | package T13DesignPatterns.lab.Singleton;
public class Main {
public static void main(String[] args) {
SingletonDataContainer instance = SingletonDataContainer.getInstance();
instance.addPopulation("Sofia", 120000);
instance.addPopulation("Varna", 90000);
System.out.println(instance.getPopulation("Sofia"));
SingletonDataContainer instance1 = SingletonDataContainer.getInstance();
System.out.println(instance1.getPopulation("Varna"));
}
}
| 29.411765 | 80 | 0.712 |
9279b2b4f483558a1aae66cad8e420d374e011de | 2,394 | package com.mariosangiorgio.ratemyapp;
import android.content.Context;
import android.content.SharedPreferences;
public class SharedPreferencesManager implements PreferencesManager{
private final static String SHARED_PREFERENCES_ID = "RateMyApp";
private final static String ALERT_ENABLED = "alertEnabled";
private final static String LAUNCH_COUNTER = "launchCounter";
private final static String FIRST_LAUNCH_TIMESTAMP = "firstLaunchTimestamp";
private final static int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
private final SharedPreferences sharedPreferences;
private SharedPreferencesManager(Context context) {
sharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_ID, 0);
if (!sharedPreferences.contains(FIRST_LAUNCH_TIMESTAMP)) {
resetFirstLaunchTimestamp();
}
}
public static SharedPreferencesManager buildFromContext(Context context) {
if (context == null) {
throw new IllegalArgumentException("context should not be null");
}
return new SharedPreferencesManager(context);
}
public boolean alertEnabled() {
return sharedPreferences.getBoolean(ALERT_ENABLED, true);
}
public int launchCounter() {
return sharedPreferences.getInt(LAUNCH_COUNTER, 0);
}
public long firstLaunchTimestamp() {
return sharedPreferences.getLong(FIRST_LAUNCH_TIMESTAMP, 0);
}
public void incrementLaunchCounter() {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(LAUNCH_COUNTER, launchCounter() + 1);
editor.commit();
}
public int daysFromFirstLaunch() {
return (int) (System.currentTimeMillis() - firstLaunchTimestamp()) / MILLIS_IN_DAY;
}
public void setAlertEnabled(boolean enable) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(ALERT_ENABLED, enable);
editor.commit();
}
public void resetFirstLaunchTimestamp() {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putLong(FIRST_LAUNCH_TIMESTAMP, System.currentTimeMillis());
editor.commit();
}
@Override
public void resetLaunchCount() {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(LAUNCH_COUNTER, 0);
editor.commit();
}
}
| 34.2 | 91 | 0.707185 |
8f5ae991d0f68edee1f66241895d1970793edd08 | 9,143 | //import io.ipfs.api.Pair;
import io.ipfs.api.Peer;
import io.ipfs.multihash.Multihash;
import org.javatuples.Pair;
import org.javatuples.Quartet;
import org.javatuples.Quintet;
import org.javatuples.Triplet;
import org.nd4j.linalg.api.ops.custom.Tri;
import org.web3j.abi.datatypes.Int;
import javax.crypto.SecretKey;
import javax.naming.InsufficientResourcesException;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
public class PeerData {
public static Download_Scheduler aggregation_download_scheduler;
public static Download_Scheduler updates_download_scheduler;
public static Semaphore InitSem = new Semaphore(0);
public static Semaphore mtx = new Semaphore(1);
public static Semaphore com_mtx = new Semaphore(1);
public static Semaphore SendMtx = new Semaphore(1);
public static Semaphore weightsMtx = new Semaphore(1);
public static Map<Integer,List<String>> workers = new HashMap<>();
public static Map<Integer,List<String>> Replica_workers = new HashMap<>();
public static Map<Integer, Double> previous_iter_active_workers = new HashMap<>();
// The number of partitions that we partition the model
public static int _PARTITIONS;
//The minimum number of responsibilities a peer must have
public static int _MIN_PARTITIONS;
// The number of parameters of the model
public static long _MODEL_SIZE;
// Boolean value inficating if the system is on the initialization phase. Becomes false when it proceed on training phase
public static boolean First_Iter = true;
// Boolean value indicating if the system is using SGD or Asynchronous GD
public static boolean isSynchronous = true;
public static boolean Relaxed_SGD = true;
public static boolean isBootsraper;
public static boolean training_finished = false;
public static int _Iter_Clock = 0;
public static String _ID = null;
public static String Schedule_Hash = null;
public static String MyPublic_Multiaddr = null;
public static int Index = 0;
public static int used_commitments = 0;
public static int is_alive_counter = 0;
// The global logical clock of the system indicating the global iteration. This is used only in SGD
public static int middleware_iteration = 0;
public static List<String> Members = new ArrayList<>();
public static int Min_Members;
public static boolean training_phase = false;
public static boolean IPNS_Enable = false;
volatile public static int STATE = 0;
public static List<Integer> current_schedule = new ArrayList<>();
//These variables are used for analyzing the system
public static Semaphore Test_mtx = new Semaphore(1);
public static List<Integer> RecvList = new ArrayList<>();
public static int DataRecv = 0;
//Blocking Queue, for any task given to the updater
public static BlockingQueue<Quintet<String,Integer,Integer, Boolean ,List<Double>>> queue = new LinkedBlockingQueue<Quintet<String,Integer,Integer,Boolean, List<Double>>>();
//Blocking Queue, for Global Gradients Pool
public static BlockingQueue<String> GGP_queue = new LinkedBlockingQueue<>();
//Blocking Queue, for Global Gradients Authority updates
public static BlockingQueue<Pair<Integer,Integer>> UpdateQueue = new LinkedBlockingQueue<>();
//This data structure is used so that the peers can get the data of the
// partitions that they become responsible for
public static Map<Integer,String> Hash_Partitions = new HashMap<>();
public static Map<String,String> Downloaded_Hashes = new HashMap<>();
public static Map<String, SecretKey> Hash_Keys = new HashMap<>();
public static Map<Integer,List<Triplet<String,String,Integer>>> Committed_Hashes = new HashMap<>();
public static Map<Integer,Pair<String,SecretKey>> key_dir = new HashMap<>();
public static Map<Integer,List<Double>> GradientPartitions = new HashMap<>();
//public static List<Double> Gradients = new ArrayList<Double>();
//The gradients received from replica peers
public static Map<Integer,List<Double>> Replicas_Gradients = new HashMap<>();
// This data structure is used in order to store the extra gradients an aggregator downloaded
// in the aggregation phase
public static Map<Pair<Integer,String>,List<Double>> Other_Replica_Gradients = new HashMap<>();
public static Map<Pair<Integer,String>,Integer> Other_Replica_Gradients_Received = new HashMap<>();
public static List<Pair<Integer,String>> Received_Replicas = new ArrayList<>();
// The gradients received from my clients (peers that are not responsible for my partitions so i am a dealer of them)
public static Map<Integer,List<Double>> Aggregated_Gradients = new HashMap<>();
// There is a very very small and almost impossible for realsitic systems chance that a client has finished the next iteration while i am in the previous (just before end the updateGradientMethod)
// This Structure aggregate those gradients from fututre
public static Map<Integer,List<Double>> Aggregated_Gradients_from_future = new HashMap<>();
public static Map<Integer,List<Double>> Aggregated_Weights = new HashMap<>();
public static Map<Integer,List<Double>> Stored_Gradients = new HashMap<>();
public static Map<Integer,List<Double>> Weights = new HashMap<Integer, List<Double>>();
public static boolean sendingGradients = false;
//List that shows for the peers that have not yet replied
public static List<Triplet<String,Integer,Integer>> Wait_Ack = new ArrayList<Triplet<String,Integer,Integer>>();
public static List<Triplet<String,Integer,Integer>> Wait_Ack_from_future = new ArrayList<Triplet<String,Integer,Integer>>();
//List that shows the clients that have not yet sent gradients. I must wait until Client_Wait_Ack size is 0
public static List<Triplet<String,Integer,Integer>> Client_Wait_Ack = new ArrayList<>();
// The same somehow with the Aggregated_Gradients_from_future
public static List<Triplet<String,Integer,Integer>> Client_Wait_Ack_from_future = new ArrayList<>();
// The same as Client_Wait_Ack but for the replicas synchronization
public static List<Triplet<String,Integer,Integer>> Replica_Wait_Ack = new ArrayList<>();
public static List<Triplet<String,Integer,Integer>> Replica_Wait_Ack_from_future = new ArrayList<>();
//Hash that give us the latest update of each partition
public static Map<Integer, Integer> Participants = new HashMap<>();
public static String Path;
//List of partitions that a peer is responsible for
public static List<Integer> Auth_List = new ArrayList<Integer>();
//List of string with the unique ids of peers
public static List<String> Existing_peers = new ArrayList<String>();
//Peers that left must also be removed from data structures
public static List<String> Leaving_peers = new ArrayList<String>();
public static List<String> Bootstrapers = new ArrayList<>();
public static List<Peer> peers = new ArrayList<Peer>();
//Hash table in the form : [Authority_id,[Selected_Peers]]
public static Map<Integer,List<String>> Partition_Availability = new HashMap<Integer,List<String>>();
// Hash table showing the peers that the daemo communicates
public static Map<Integer,String> Dealers = new HashMap<Integer, String>();
//Hash table in the form : [Swarm_Peer,[His Authority]]
public static Map<String,List<Integer>> Swarm_Peer_Auth = new HashMap<String,List<Integer>>();
//Hash table that contains that contains the hash value of the file, with key based on partition
public static Map<Integer,List<Double>> Weight_Address = new HashMap<Integer, List<Double>>();
//Hash table that contains the clients of a peer, aka those who
// send to him the gradients. This data structure is been used
// only in Synchronous SGD
public static Map<Integer,List<String>> Clients = new HashMap<>();
//This is a hash table that keeps into account the new clients joined in the
// system in order to make them officially acceptable after the iteration
// is finished
public static Map<Integer,List<String>> New_Clients = new HashMap<>();
public static Map<Integer,List<String>> New_Replicas = new HashMap<>();
public static Map<Integer,List<String>> New_Members = new HashMap<>();
public static Map<Integer,List<String>> Replica_holders = new HashMap<>();
public static Map<String,Integer> Servers_Iteration = new HashMap<>();
public static Map<String,Integer> Clients_Iteration = new HashMap<>();
//For testings
public static int num;
// This structure maintains a log that contains important debugging and other data
public static Map<String,List<Object>> _LOG = new HashMap<>();
public static Map<String,Integer> _PEER_DOWNLOAD_TIME = new HashMap<>();
public static int commited_hashes = 0;
public static int downloaded_hashes = 0;
public static int downloaded_updates = 0;
}
| 55.412121 | 200 | 0.745707 |
2949a0c6ec1f03c279493ef74f6d5c25271435a6 | 1,060 | package com.ack.adventureandconquer.game.creature.npc.swimmer;
import com.ack.adventureandconquer.game.creature.npc.IsNpcType;
import com.ack.adventureandconquer.game.creature.npc.Npc;
import com.ack.adventureandconquer.game.creature.npc.NpcFactory;
import java.util.List;
/**
* Created by saskyrar on 18/01/15.
*/
public class SturgeonFishType extends NpcFactory<SturgeonFish> implements IsNpcType {
@Override
public boolean isLair(int number) {
return false;
}
@Override
protected SturgeonFish createMonster() {
SturgeonFish monster = new SturgeonFish();
monster.roleHitPoints();
return monster;
}
@Override
public List<Npc> getNormalWildnessEncounter() {
return getMonsterList( 1 );
}
@Override
public String getNormalWildnessEncounterName() {
return "Solitary";
}
@Override
public List<Npc> getLairWildnessEncounter() {
return null;
}
@Override
public String getLairWildnessEncounterName() {
return null;
}
}
| 23.043478 | 85 | 0.691509 |
861c9d16f8037f34087eceedb6b0d7b0fb30c208 | 598 | package com.test.cglib.jdk;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class InvocationHandlerImpl implements InvocationHandler {
private final Object subject;
public InvocationHandlerImpl(Object subject) {
this.subject = subject;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
try {
System.out.println("before invoke");
return method.invoke(subject, args);
} finally {
System.out.println("after invoke");
}
}
}
| 26 | 87 | 0.66388 |
213775ae5d2348fd16b709ac7a1a83fb9abd53d1 | 282 | package io.seata.sample.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.seata.sample.entity.AccountTbl;
/**
* <p>
* Mapper 接口
* </p>
*
* @author jsonyao
* @since 2021-04-27
*/
public interface AccountTblMapper extends BaseMapper<AccountTbl> {
}
| 16.588235 | 66 | 0.719858 |
6a097417cc5cb21b94668c03bea49f85824ea1a6 | 4,585 | package one.empty3.feature.selection;
import one.empty3.feature.PixM;
import one.empty3.io.ProcessFile;
import one.empty3.library.ITexture;
import one.empty3.library.Lumiere;
import one.empty3.library.Point3D;
import one.empty3.library.Scene;
import one.empty3.library.core.nurbs.ParametricCurve;
import one.empty3.feature.app.replace.javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class HighlightFeatures extends ProcessFile {
/*
*
* @param points Sélection de points
* @param img Image sur laquelle dessiner
* @param col Couleur ou texture de dessin
*/
public void pasteList(List<Point3D> points, PixM img, ITexture col) {
for (int i = 0; i < points.size(); i++) {
int x = (int) (double) points.get(i).getX();
int y = (int) (double) points.get(i).getY();
int rgb = col.getColorAt(
points.get(i).getX() / img.getColumns(),
points.get(i).getY() / img.getLines());
double[] rgbD = Lumiere.getDoubles(rgb);
for (int i1 = 0; i1 < 3; i1++) {
img.setCompNo(i1);
img.set(x, y, rgbD[i1]);
}
}
}
/*
*
* @param points Sélection de points
* @param img Image sur laquelle dessiner
* @param objets Objets à dessiner sur l'image (3d-2d)
*/
public void pasteList(List<Point3D> points, PixM img, Scene objets) {
for (int i = 0; i < points.size(); i++) {
int x = (int) (double) points.get(i).getX();
int y = (int) (double) points.get(i).getY();
objets.getObjets().getData1d().forEach(representable -> {
if (representable instanceof ParametricCurve)
img.plotCurve((ParametricCurve) representable, representable.texture());///Clip curve for moving, rotating, scaling
else if (representable instanceof Point3D) {
img.setValues((int) (double) ((Point3D) representable).getX(),
(int) (double) ((Point3D) representable).getY(),
Lumiere.getDoubles(representable.texture().getColorAt(0.5, 0.5)));
}
});
}
}
public void openCsv() {
}
public void writeCsv(String filename, int xPercent, int yPercent, double... vector) {
/*
Misérables oeufs mignolet
Te voilà jeté en freestyle
Comme un steak à l 'ail
J'aime les vaches
et les viandes
J'aime les femmes
Et les comptes
En banques que
Je découpe tous
à la hache
Ma kekette
Et mes boulets
Au bouquet
Des bollets
Dans l'bosquet
Des balais
Déblayent
Les lendemains
De la fête
A saints de putains
Qui mont'ses hein
Dans le purin
Police politik
Potiche pissin'
Ca c'est drôle
Drole de drame
Dans l'émoi
Des piques
De Véronique
La putain du diable
Ses vérolaises
Ah que
Hackerdôme
Dos au mur
Eh c'est sûr
Et sertis
De pistolet
Un anchois
En chocolat
*/
}
public void closenCsv() {
}
@Override
public boolean process(File in, File out) {
try {
BufferedImage read = ImageIO.read(in);
PixM pixM = PixM.getPixM(read, maxRes);
File stackItem = getStackItem(1);
PixM original = new PixM(ImageIO.read(stackItem));
int cadre = (int) Math.min((pixM.getColumns() + pixM.getLines()) / 2., 10.);
for (int i = 0; i < pixM.getColumns(); i++)
for (int j = 0; j < pixM.getLines(); j++) {
double luminance = pixM.luminance(i, j);
if (luminance > 0.1) {
for (int x = i - cadre; x < i + cadre; x++)
for (int y = j - cadre; y < j + cadre; y++) {
if ((x == i - cadre) || (y == j - cadre) || x == i + cadre - 1 || y == j + cadre - 1)
original.setValues(x, y, 1, 1, 0);
}
}
}
ImageIO.write(original.normalize(0., 1., 0., 1.).getImage(), "jpg", out);
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
}
| 29.772727 | 135 | 0.521483 |
9c09cbd6b30d69634f8f3ae4accebb5c9ea72057 | 4,057 | package com.orientechnologies.orient.client.remote.message;
import com.orientechnologies.common.exception.OErrorCode;
import com.orientechnologies.orient.client.remote.ORemotePushHandler;
import com.orientechnologies.orient.client.remote.message.live.OLiveQueryResult;
import com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerNetworkV37;
import com.orientechnologies.orient.core.sql.executor.OResult;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryProtocol;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataInput;
import com.orientechnologies.orient.enterprise.channel.binary.OChannelDataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/** Created by tglman on 17/05/17. */
public class OLiveQueryPushRequest implements OBinaryPushRequest {
public static final byte HAS_MORE = 1;
public static final byte END = 2;
public static final byte ERROR = 3;
private int monitorId;
private byte status;
private int errorIdentifier;
private OErrorCode errorCode;
private String errorMessage;
private List<OLiveQueryResult> events;
public OLiveQueryPushRequest(
int monitorId, int errorIdentifier, OErrorCode errorCode, String errorMessage) {
this.monitorId = monitorId;
this.status = ERROR;
this.errorIdentifier = errorIdentifier;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
}
public OLiveQueryPushRequest(int monitorId, byte status, List<OLiveQueryResult> events) {
this.monitorId = monitorId;
this.status = status;
this.events = events;
}
public OLiveQueryPushRequest() {}
@Override
public void write(OChannelDataOutput channel) throws IOException {
channel.writeInt(monitorId);
channel.writeByte(status);
if (status == ERROR) {
channel.writeInt(errorIdentifier);
channel.writeInt(errorCode.getCode());
channel.writeString(errorMessage);
} else {
channel.writeInt(events.size());
for (OLiveQueryResult event : events) {
channel.writeByte(event.getEventType());
OMessageHelper.writeResult(
event.getCurrentValue(), channel, ORecordSerializerNetworkV37.INSTANCE);
if (event.getEventType() == OLiveQueryResult.UPDATE_EVENT) {
OMessageHelper.writeResult(
event.getOldValue(), channel, ORecordSerializerNetworkV37.INSTANCE);
}
}
}
}
@Override
public void read(OChannelDataInput network) throws IOException {
monitorId = network.readInt();
status = network.readByte();
if (status == ERROR) {
errorIdentifier = network.readInt();
errorCode = OErrorCode.getErrorCode(network.readInt());
errorMessage = network.readString();
} else {
int eventSize = network.readInt();
events = new ArrayList<>(eventSize);
while (eventSize-- > 0) {
byte type = network.readByte();
OResult currentValue = OMessageHelper.readResult(network);
OResult oldValue = null;
if (type == OLiveQueryResult.UPDATE_EVENT) {
oldValue = OMessageHelper.readResult(network);
}
events.add(new OLiveQueryResult(type, currentValue, oldValue));
}
}
}
@Override
public OBinaryPushResponse execute(ORemotePushHandler remote) {
remote.executeLiveQueryPush(this);
return null;
}
@Override
public OBinaryPushResponse createResponse() {
return null;
}
@Override
public byte getPushCommand() {
return OChannelBinaryProtocol.REQUEST_PUSH_LIVE_QUERY;
}
public int getMonitorId() {
return monitorId;
}
public List<OLiveQueryResult> getEvents() {
return events;
}
public byte getStatus() {
return status;
}
public void setStatus(byte status) {
this.status = status;
}
public int getErrorIdentifier() {
return errorIdentifier;
}
public String getErrorMessage() {
return errorMessage;
}
public OErrorCode getErrorCode() {
return errorCode;
}
}
| 30.051852 | 108 | 0.722209 |
b2d698dc54734c7bdb11bee6061caeaa4b5ee212 | 255 | package com.socrata.datasync.config.userpreferences;
public class UserPreferencesUtil {
static String prefixDomain(String s) {
if(s.contains("//")) {
return s;
} else {
return "https://" + s;
}
}
}
| 21.25 | 52 | 0.552941 |
4f3711b913daa0f8e9e174c377f6999e97d4332a | 1,643 | package com.google.musicanalysis.site;
import com.google.musicanalysis.util.Secrets;
import java.io.IOException;
import java.net.URI;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.musicanalysis.util.Constants;
import javax.servlet.annotation.WebServlet;
@WebServlet("/api/oauth/callback/youtube")
public class YouTubeCallbackServlet extends OAuthCallbackServlet {
private static final Logger LOGGER = Logger.getLogger(YouTubeCallbackServlet.class.getName());
@Override
protected String getServiceName() {
return "youtube";
}
@Override
protected String getClientId() {
return Constants.YOUTUBE_CLIENT_ID;
}
@Override
protected String getClientSecret() {
try {
return Secrets.getSecretString("YOUTUBE_CLIENT_SECRET");
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e, () -> "Could not get YouTube client secret");
return null;
}
}
@Override
protected String getTokenUri() {
return "https://oauth2.googleapis.com/token";
}
@Override
protected String getRedirectUri() {
// URI that user should be redirected to after logging in
try {
var domainUri = URI.create(System.getenv().get("DOMAIN"));
return domainUri.resolve("/api/oauth/callback/youtube").toString();
} catch (NullPointerException e) {
LOGGER.severe("The DOMAIN environment variable is not set.");
throw e;
}
}
@Override
protected String getSessionServiceKey() {
return Constants.YOUTUBE_SESSION_KEY;
}
@Override
protected String getSessionTokenKey() {
return Constants.YOUTUBE_SESSION_TOKEN_KEY;
}
}
| 26.5 | 96 | 0.72185 |
6cc959946ad5c98c63c898fbe5f7dde8ada54723 | 451,857 |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is autogenerated by:
// mojo/public/tools/bindings/mojom_bindings_generator.py
// For:
// services/network/public/mojom/network_context.mojom
//
package org.chromium.network.mojom;
import org.chromium.mojo.bindings.DeserializationException;
class NetworkContext_Internal {
public static final org.chromium.mojo.bindings.Interface.Manager<NetworkContext, NetworkContext.Proxy> MANAGER =
new org.chromium.mojo.bindings.Interface.Manager<NetworkContext, NetworkContext.Proxy>() {
@Override
public String getName() {
return "network.mojom.NetworkContext";
}
@Override
public int getVersion() {
return 0;
}
@Override
public Proxy buildProxy(org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) {
return new Proxy(core, messageReceiver);
}
@Override
public Stub buildStub(org.chromium.mojo.system.Core core, NetworkContext impl) {
return new Stub(core, impl);
}
@Override
public NetworkContext[] buildArray(int size) {
return new NetworkContext[size];
}
};
private static final int SET_CLIENT_ORDINAL = 0;
private static final int CREATE_URL_LOADER_FACTORY_ORDINAL = 1;
private static final int RESET_URL_LOADER_FACTORIES_ORDINAL = 2;
private static final int GET_COOKIE_MANAGER_ORDINAL = 3;
private static final int GET_RESTRICTED_COOKIE_MANAGER_ORDINAL = 4;
private static final int CLEAR_NETWORKING_HISTORY_SINCE_ORDINAL = 5;
private static final int CLEAR_HTTP_CACHE_ORDINAL = 6;
private static final int COMPUTE_HTTP_CACHE_SIZE_ORDINAL = 7;
private static final int NOTIFY_EXTERNAL_CACHE_HIT_ORDINAL = 8;
private static final int WRITE_CACHE_METADATA_ORDINAL = 9;
private static final int CLEAR_CHANNEL_IDS_ORDINAL = 10;
private static final int CLEAR_HOST_CACHE_ORDINAL = 11;
private static final int CLEAR_HTTP_AUTH_CACHE_ORDINAL = 12;
private static final int CLEAR_REPORTING_CACHE_REPORTS_ORDINAL = 13;
private static final int CLEAR_REPORTING_CACHE_CLIENTS_ORDINAL = 14;
private static final int CLEAR_NETWORK_ERROR_LOGGING_ORDINAL = 15;
private static final int CLEAR_DOMAIN_RELIABILITY_ORDINAL = 16;
private static final int GET_DOMAIN_RELIABILITY_JSON_ORDINAL = 17;
private static final int QUEUE_REPORT_ORDINAL = 18;
private static final int CLOSE_ALL_CONNECTIONS_ORDINAL = 19;
private static final int CLOSE_IDLE_CONNECTIONS_ORDINAL = 20;
private static final int SET_NETWORK_CONDITIONS_ORDINAL = 21;
private static final int SET_ACCEPT_LANGUAGE_ORDINAL = 22;
private static final int SET_ENABLE_REFERRERS_ORDINAL = 23;
private static final int SET_CT_POLICY_ORDINAL = 24;
private static final int ADD_EXPECT_CT_ORDINAL = 25;
private static final int SET_EXPECT_CT_TEST_REPORT_ORDINAL = 26;
private static final int GET_EXPECT_CT_STATE_ORDINAL = 27;
private static final int CREATE_UDP_SOCKET_ORDINAL = 28;
private static final int CREATE_TCP_SERVER_SOCKET_ORDINAL = 29;
private static final int CREATE_TCP_CONNECTED_SOCKET_ORDINAL = 30;
private static final int CREATE_TCP_BOUND_SOCKET_ORDINAL = 31;
private static final int CREATE_PROXY_RESOLVING_SOCKET_FACTORY_ORDINAL = 32;
private static final int LOOK_UP_PROXY_FOR_URL_ORDINAL = 33;
private static final int FORCE_RELOAD_PROXY_CONFIG_ORDINAL = 34;
private static final int CLEAR_BAD_PROXIES_CACHE_ORDINAL = 35;
private static final int CREATE_WEB_SOCKET_ORDINAL = 36;
private static final int CREATE_NET_LOG_EXPORTER_ORDINAL = 37;
private static final int PRECONNECT_SOCKETS_ORDINAL = 38;
private static final int CREATE_P2P_SOCKET_MANAGER_ORDINAL = 39;
private static final int CREATE_MDNS_RESPONDER_ORDINAL = 40;
private static final int RESOLVE_HOST_ORDINAL = 41;
private static final int CREATE_HOST_RESOLVER_ORDINAL = 42;
private static final int VERIFY_CERT_FOR_SIGNED_EXCHANGE_ORDINAL = 43;
private static final int ADD_HSTS_ORDINAL = 44;
private static final int IS_HSTS_ACTIVE_FOR_HOST_ORDINAL = 45;
private static final int GET_HSTS_STATE_ORDINAL = 46;
private static final int SET_CORS_ORIGIN_ACCESS_LISTS_FOR_ORIGIN_ORDINAL = 47;
private static final int DELETE_DYNAMIC_DATA_FOR_HOST_ORDINAL = 48;
private static final int SAVE_HTTP_AUTH_CACHE_ORDINAL = 49;
private static final int LOAD_HTTP_AUTH_CACHE_ORDINAL = 50;
private static final int LOOKUP_BASIC_AUTH_CREDENTIALS_ORDINAL = 51;
private static final int ENABLE_STATIC_KEY_PINNING_FOR_TESTING_ORDINAL = 52;
private static final int SET_FAILING_HTTP_TRANSACTION_FOR_TESTING_ORDINAL = 53;
private static final int VERIFY_CERTIFICATE_FOR_TESTING_ORDINAL = 54;
private static final int ADD_DOMAIN_RELIABILITY_CONTEXT_FOR_TESTING_ORDINAL = 55;
private static final int FORCE_DOMAIN_RELIABILITY_UPLOADS_FOR_TESTING_ORDINAL = 56;
static final class Proxy extends org.chromium.mojo.bindings.Interface.AbstractProxy implements NetworkContext.Proxy {
Proxy(org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiverWithResponder messageReceiver) {
super(core, messageReceiver);
}
@Override
public void setClient(
NetworkContextClient client) {
NetworkContextSetClientParams _message = new NetworkContextSetClientParams();
_message.client = client;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(SET_CLIENT_ORDINAL)));
}
@Override
public void createUrlLoaderFactory(
org.chromium.mojo.bindings.InterfaceRequest<UrlLoaderFactory> urlLoaderFactory, UrlLoaderFactoryParams params) {
NetworkContextCreateUrlLoaderFactoryParams _message = new NetworkContextCreateUrlLoaderFactoryParams();
_message.urlLoaderFactory = urlLoaderFactory;
_message.params = params;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_URL_LOADER_FACTORY_ORDINAL)));
}
@Override
public void resetUrlLoaderFactories(
) {
NetworkContextResetUrlLoaderFactoriesParams _message = new NetworkContextResetUrlLoaderFactoriesParams();
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(RESET_URL_LOADER_FACTORIES_ORDINAL)));
}
@Override
public void getCookieManager(
org.chromium.mojo.bindings.InterfaceRequest<CookieManager> cookieManager) {
NetworkContextGetCookieManagerParams _message = new NetworkContextGetCookieManagerParams();
_message.cookieManager = cookieManager;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(GET_COOKIE_MANAGER_ORDINAL)));
}
@Override
public void getRestrictedCookieManager(
org.chromium.mojo.bindings.InterfaceRequest<RestrictedCookieManager> restrictedCookieManager, org.chromium.url.mojom.Origin origin) {
NetworkContextGetRestrictedCookieManagerParams _message = new NetworkContextGetRestrictedCookieManagerParams();
_message.restrictedCookieManager = restrictedCookieManager;
_message.origin = origin;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(GET_RESTRICTED_COOKIE_MANAGER_ORDINAL)));
}
@Override
public void clearNetworkingHistorySince(
org.chromium.mojo_base.mojom.Time startTime,
ClearNetworkingHistorySinceResponse callback) {
NetworkContextClearNetworkingHistorySinceParams _message = new NetworkContextClearNetworkingHistorySinceParams();
_message.startTime = startTime;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_NETWORKING_HISTORY_SINCE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearNetworkingHistorySinceResponseParamsForwardToCallback(callback));
}
@Override
public void clearHttpCache(
org.chromium.mojo_base.mojom.Time startTime, org.chromium.mojo_base.mojom.Time endTime, ClearDataFilter filter,
ClearHttpCacheResponse callback) {
NetworkContextClearHttpCacheParams _message = new NetworkContextClearHttpCacheParams();
_message.startTime = startTime;
_message.endTime = endTime;
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HTTP_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearHttpCacheResponseParamsForwardToCallback(callback));
}
@Override
public void computeHttpCacheSize(
org.chromium.mojo_base.mojom.Time startTime, org.chromium.mojo_base.mojom.Time endTime,
ComputeHttpCacheSizeResponse callback) {
NetworkContextComputeHttpCacheSizeParams _message = new NetworkContextComputeHttpCacheSizeParams();
_message.startTime = startTime;
_message.endTime = endTime;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
COMPUTE_HTTP_CACHE_SIZE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextComputeHttpCacheSizeResponseParamsForwardToCallback(callback));
}
@Override
public void notifyExternalCacheHit(
org.chromium.url.mojom.Url url, String httpMethod, org.chromium.url.mojom.Origin topFrameOrigin) {
NetworkContextNotifyExternalCacheHitParams _message = new NetworkContextNotifyExternalCacheHitParams();
_message.url = url;
_message.httpMethod = httpMethod;
_message.topFrameOrigin = topFrameOrigin;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(NOTIFY_EXTERNAL_CACHE_HIT_ORDINAL)));
}
@Override
public void writeCacheMetadata(
org.chromium.url.mojom.Url url, int priority, org.chromium.mojo_base.mojom.Time expectedResponseTime, byte[] data) {
NetworkContextWriteCacheMetadataParams _message = new NetworkContextWriteCacheMetadataParams();
_message.url = url;
_message.priority = priority;
_message.expectedResponseTime = expectedResponseTime;
_message.data = data;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(WRITE_CACHE_METADATA_ORDINAL)));
}
@Override
public void clearChannelIds(
org.chromium.mojo_base.mojom.Time startTime, org.chromium.mojo_base.mojom.Time endTime, ClearDataFilter filter,
ClearChannelIdsResponse callback) {
NetworkContextClearChannelIdsParams _message = new NetworkContextClearChannelIdsParams();
_message.startTime = startTime;
_message.endTime = endTime;
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_CHANNEL_IDS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearChannelIdsResponseParamsForwardToCallback(callback));
}
@Override
public void clearHostCache(
ClearDataFilter filter,
ClearHostCacheResponse callback) {
NetworkContextClearHostCacheParams _message = new NetworkContextClearHostCacheParams();
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HOST_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearHostCacheResponseParamsForwardToCallback(callback));
}
@Override
public void clearHttpAuthCache(
org.chromium.mojo_base.mojom.Time startTime,
ClearHttpAuthCacheResponse callback) {
NetworkContextClearHttpAuthCacheParams _message = new NetworkContextClearHttpAuthCacheParams();
_message.startTime = startTime;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearHttpAuthCacheResponseParamsForwardToCallback(callback));
}
@Override
public void clearReportingCacheReports(
ClearDataFilter filter,
ClearReportingCacheReportsResponse callback) {
NetworkContextClearReportingCacheReportsParams _message = new NetworkContextClearReportingCacheReportsParams();
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_REPORTING_CACHE_REPORTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearReportingCacheReportsResponseParamsForwardToCallback(callback));
}
@Override
public void clearReportingCacheClients(
ClearDataFilter filter,
ClearReportingCacheClientsResponse callback) {
NetworkContextClearReportingCacheClientsParams _message = new NetworkContextClearReportingCacheClientsParams();
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_REPORTING_CACHE_CLIENTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearReportingCacheClientsResponseParamsForwardToCallback(callback));
}
@Override
public void clearNetworkErrorLogging(
ClearDataFilter filter,
ClearNetworkErrorLoggingResponse callback) {
NetworkContextClearNetworkErrorLoggingParams _message = new NetworkContextClearNetworkErrorLoggingParams();
_message.filter = filter;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_NETWORK_ERROR_LOGGING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearNetworkErrorLoggingResponseParamsForwardToCallback(callback));
}
@Override
public void clearDomainReliability(
ClearDataFilter filter, int mode,
ClearDomainReliabilityResponse callback) {
NetworkContextClearDomainReliabilityParams _message = new NetworkContextClearDomainReliabilityParams();
_message.filter = filter;
_message.mode = mode;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_DOMAIN_RELIABILITY_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearDomainReliabilityResponseParamsForwardToCallback(callback));
}
@Override
public void getDomainReliabilityJson(
GetDomainReliabilityJsonResponse callback) {
NetworkContextGetDomainReliabilityJsonParams _message = new NetworkContextGetDomainReliabilityJsonParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
GET_DOMAIN_RELIABILITY_JSON_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextGetDomainReliabilityJsonResponseParamsForwardToCallback(callback));
}
@Override
public void queueReport(
String type, String group, org.chromium.url.mojom.Url url, String userAgent, org.chromium.mojo_base.mojom.DictionaryValue body) {
NetworkContextQueueReportParams _message = new NetworkContextQueueReportParams();
_message.type = type;
_message.group = group;
_message.url = url;
_message.userAgent = userAgent;
_message.body = body;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(QUEUE_REPORT_ORDINAL)));
}
@Override
public void closeAllConnections(
CloseAllConnectionsResponse callback) {
NetworkContextCloseAllConnectionsParams _message = new NetworkContextCloseAllConnectionsParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLOSE_ALL_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextCloseAllConnectionsResponseParamsForwardToCallback(callback));
}
@Override
public void closeIdleConnections(
CloseIdleConnectionsResponse callback) {
NetworkContextCloseIdleConnectionsParams _message = new NetworkContextCloseIdleConnectionsParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLOSE_IDLE_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextCloseIdleConnectionsResponseParamsForwardToCallback(callback));
}
@Override
public void setNetworkConditions(
org.chromium.mojo_base.mojom.UnguessableToken throttlingProfileId, NetworkConditions conditions) {
NetworkContextSetNetworkConditionsParams _message = new NetworkContextSetNetworkConditionsParams();
_message.throttlingProfileId = throttlingProfileId;
_message.conditions = conditions;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(SET_NETWORK_CONDITIONS_ORDINAL)));
}
@Override
public void setAcceptLanguage(
String newAcceptLanguage) {
NetworkContextSetAcceptLanguageParams _message = new NetworkContextSetAcceptLanguageParams();
_message.newAcceptLanguage = newAcceptLanguage;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(SET_ACCEPT_LANGUAGE_ORDINAL)));
}
@Override
public void setEnableReferrers(
boolean enableReferrers) {
NetworkContextSetEnableReferrersParams _message = new NetworkContextSetEnableReferrersParams();
_message.enableReferrers = enableReferrers;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(SET_ENABLE_REFERRERS_ORDINAL)));
}
@Override
public void setCtPolicy(
String[] requiredHosts, String[] excludedHosts, String[] excludedSpkis, String[] excludedLegacySpkis) {
NetworkContextSetCtPolicyParams _message = new NetworkContextSetCtPolicyParams();
_message.requiredHosts = requiredHosts;
_message.excludedHosts = excludedHosts;
_message.excludedSpkis = excludedSpkis;
_message.excludedLegacySpkis = excludedLegacySpkis;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(SET_CT_POLICY_ORDINAL)));
}
@Override
public void addExpectCt(
String host, org.chromium.mojo_base.mojom.Time expiry, boolean enforce, org.chromium.url.mojom.Url reportUri,
AddExpectCtResponse callback) {
NetworkContextAddExpectCtParams _message = new NetworkContextAddExpectCtParams();
_message.host = host;
_message.expiry = expiry;
_message.enforce = enforce;
_message.reportUri = reportUri;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
ADD_EXPECT_CT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextAddExpectCtResponseParamsForwardToCallback(callback));
}
@Override
public void setExpectCtTestReport(
org.chromium.url.mojom.Url reportUri,
SetExpectCtTestReportResponse callback) {
NetworkContextSetExpectCtTestReportParams _message = new NetworkContextSetExpectCtTestReportParams();
_message.reportUri = reportUri;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
SET_EXPECT_CT_TEST_REPORT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextSetExpectCtTestReportResponseParamsForwardToCallback(callback));
}
@Override
public void getExpectCtState(
String domain,
GetExpectCtStateResponse callback) {
NetworkContextGetExpectCtStateParams _message = new NetworkContextGetExpectCtStateParams();
_message.domain = domain;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
GET_EXPECT_CT_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextGetExpectCtStateResponseParamsForwardToCallback(callback));
}
@Override
public void createUdpSocket(
org.chromium.mojo.bindings.InterfaceRequest<UdpSocket> request, UdpSocketReceiver receiver) {
NetworkContextCreateUdpSocketParams _message = new NetworkContextCreateUdpSocketParams();
_message.request = request;
_message.receiver = receiver;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_UDP_SOCKET_ORDINAL)));
}
@Override
public void createTcpServerSocket(
IpEndPoint localAddr, int backlog, MutableNetworkTrafficAnnotationTag trafficAnnotation, org.chromium.mojo.bindings.InterfaceRequest<TcpServerSocket> socket,
CreateTcpServerSocketResponse callback) {
NetworkContextCreateTcpServerSocketParams _message = new NetworkContextCreateTcpServerSocketParams();
_message.localAddr = localAddr;
_message.backlog = backlog;
_message.trafficAnnotation = trafficAnnotation;
_message.socket = socket;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_SERVER_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextCreateTcpServerSocketResponseParamsForwardToCallback(callback));
}
@Override
public void createTcpConnectedSocket(
IpEndPoint localAddr, AddressList remoteAddrList, TcpConnectedSocketOptions tcpConnectedSocketOptions, MutableNetworkTrafficAnnotationTag trafficAnnotation, org.chromium.mojo.bindings.InterfaceRequest<TcpConnectedSocket> socket, SocketObserver observer,
CreateTcpConnectedSocketResponse callback) {
NetworkContextCreateTcpConnectedSocketParams _message = new NetworkContextCreateTcpConnectedSocketParams();
_message.localAddr = localAddr;
_message.remoteAddrList = remoteAddrList;
_message.tcpConnectedSocketOptions = tcpConnectedSocketOptions;
_message.trafficAnnotation = trafficAnnotation;
_message.socket = socket;
_message.observer = observer;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_CONNECTED_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextCreateTcpConnectedSocketResponseParamsForwardToCallback(callback));
}
@Override
public void createTcpBoundSocket(
IpEndPoint localAddr, MutableNetworkTrafficAnnotationTag trafficAnnotation, org.chromium.mojo.bindings.InterfaceRequest<TcpBoundSocket> socket,
CreateTcpBoundSocketResponse callback) {
NetworkContextCreateTcpBoundSocketParams _message = new NetworkContextCreateTcpBoundSocketParams();
_message.localAddr = localAddr;
_message.trafficAnnotation = trafficAnnotation;
_message.socket = socket;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_BOUND_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextCreateTcpBoundSocketResponseParamsForwardToCallback(callback));
}
@Override
public void createProxyResolvingSocketFactory(
org.chromium.mojo.bindings.InterfaceRequest<ProxyResolvingSocketFactory> factory) {
NetworkContextCreateProxyResolvingSocketFactoryParams _message = new NetworkContextCreateProxyResolvingSocketFactoryParams();
_message.factory = factory;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_PROXY_RESOLVING_SOCKET_FACTORY_ORDINAL)));
}
@Override
public void lookUpProxyForUrl(
org.chromium.url.mojom.Url url, ProxyLookupClient proxyLookupClient) {
NetworkContextLookUpProxyForUrlParams _message = new NetworkContextLookUpProxyForUrlParams();
_message.url = url;
_message.proxyLookupClient = proxyLookupClient;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(LOOK_UP_PROXY_FOR_URL_ORDINAL)));
}
@Override
public void forceReloadProxyConfig(
ForceReloadProxyConfigResponse callback) {
NetworkContextForceReloadProxyConfigParams _message = new NetworkContextForceReloadProxyConfigParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
FORCE_RELOAD_PROXY_CONFIG_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextForceReloadProxyConfigResponseParamsForwardToCallback(callback));
}
@Override
public void clearBadProxiesCache(
ClearBadProxiesCacheResponse callback) {
NetworkContextClearBadProxiesCacheParams _message = new NetworkContextClearBadProxiesCacheParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_BAD_PROXIES_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextClearBadProxiesCacheResponseParamsForwardToCallback(callback));
}
@Override
public void createWebSocket(
org.chromium.mojo.bindings.InterfaceRequest<WebSocket> request, int processId, int renderFrameId, org.chromium.url.mojom.Origin origin, AuthenticationHandler authHandler) {
NetworkContextCreateWebSocketParams _message = new NetworkContextCreateWebSocketParams();
_message.request = request;
_message.processId = processId;
_message.renderFrameId = renderFrameId;
_message.origin = origin;
_message.authHandler = authHandler;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_WEB_SOCKET_ORDINAL)));
}
@Override
public void createNetLogExporter(
org.chromium.mojo.bindings.InterfaceRequest<NetLogExporter> exporter) {
NetworkContextCreateNetLogExporterParams _message = new NetworkContextCreateNetLogExporterParams();
_message.exporter = exporter;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_NET_LOG_EXPORTER_ORDINAL)));
}
@Override
public void preconnectSockets(
int numStreams, org.chromium.url.mojom.Url url, int loadFlags, boolean privacyModeEnabled) {
NetworkContextPreconnectSocketsParams _message = new NetworkContextPreconnectSocketsParams();
_message.numStreams = numStreams;
_message.url = url;
_message.loadFlags = loadFlags;
_message.privacyModeEnabled = privacyModeEnabled;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(PRECONNECT_SOCKETS_ORDINAL)));
}
@Override
public void createP2pSocketManager(
P2pTrustedSocketManagerClient client, org.chromium.mojo.bindings.InterfaceRequest<P2pTrustedSocketManager> trustedSocketManager, org.chromium.mojo.bindings.InterfaceRequest<P2pSocketManager> socketManager) {
NetworkContextCreateP2pSocketManagerParams _message = new NetworkContextCreateP2pSocketManagerParams();
_message.client = client;
_message.trustedSocketManager = trustedSocketManager;
_message.socketManager = socketManager;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_P2P_SOCKET_MANAGER_ORDINAL)));
}
@Override
public void createMdnsResponder(
org.chromium.mojo.bindings.InterfaceRequest<MdnsResponder> responderRequest) {
NetworkContextCreateMdnsResponderParams _message = new NetworkContextCreateMdnsResponderParams();
_message.responderRequest = responderRequest;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_MDNS_RESPONDER_ORDINAL)));
}
@Override
public void resolveHost(
HostPortPair host, ResolveHostParameters optionalParameters, ResolveHostClient responseClient) {
NetworkContextResolveHostParams _message = new NetworkContextResolveHostParams();
_message.host = host;
_message.optionalParameters = optionalParameters;
_message.responseClient = responseClient;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(RESOLVE_HOST_ORDINAL)));
}
@Override
public void createHostResolver(
DnsConfigOverrides configOverrides, org.chromium.mojo.bindings.InterfaceRequest<HostResolver> hostResolver) {
NetworkContextCreateHostResolverParams _message = new NetworkContextCreateHostResolverParams();
_message.configOverrides = configOverrides;
_message.hostResolver = hostResolver;
getProxyHandler().getMessageReceiver().accept(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(CREATE_HOST_RESOLVER_ORDINAL)));
}
@Override
public void verifyCertForSignedExchange(
X509Certificate certificate, org.chromium.url.mojom.Url url, String ocspResponse, String sctList,
VerifyCertForSignedExchangeResponse callback) {
NetworkContextVerifyCertForSignedExchangeParams _message = new NetworkContextVerifyCertForSignedExchangeParams();
_message.certificate = certificate;
_message.url = url;
_message.ocspResponse = ocspResponse;
_message.sctList = sctList;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
VERIFY_CERT_FOR_SIGNED_EXCHANGE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextVerifyCertForSignedExchangeResponseParamsForwardToCallback(callback));
}
@Override
public void addHsts(
String host, org.chromium.mojo_base.mojom.Time expiry, boolean includeSubdomains,
AddHstsResponse callback) {
NetworkContextAddHstsParams _message = new NetworkContextAddHstsParams();
_message.host = host;
_message.expiry = expiry;
_message.includeSubdomains = includeSubdomains;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
ADD_HSTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextAddHstsResponseParamsForwardToCallback(callback));
}
@Override
public void isHstsActiveForHost(
String host,
IsHstsActiveForHostResponse callback) {
NetworkContextIsHstsActiveForHostParams _message = new NetworkContextIsHstsActiveForHostParams();
_message.host = host;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
IS_HSTS_ACTIVE_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextIsHstsActiveForHostResponseParamsForwardToCallback(callback));
}
@Override
public void getHstsState(
String domain,
GetHstsStateResponse callback) {
NetworkContextGetHstsStateParams _message = new NetworkContextGetHstsStateParams();
_message.domain = domain;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
GET_HSTS_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextGetHstsStateResponseParamsForwardToCallback(callback));
}
@Override
public void setCorsOriginAccessListsForOrigin(
org.chromium.url.mojom.Origin sourceOrigin, CorsOriginPattern[] allowPatterns, CorsOriginPattern[] blockPatterns,
SetCorsOriginAccessListsForOriginResponse callback) {
NetworkContextSetCorsOriginAccessListsForOriginParams _message = new NetworkContextSetCorsOriginAccessListsForOriginParams();
_message.sourceOrigin = sourceOrigin;
_message.allowPatterns = allowPatterns;
_message.blockPatterns = blockPatterns;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
SET_CORS_ORIGIN_ACCESS_LISTS_FOR_ORIGIN_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextSetCorsOriginAccessListsForOriginResponseParamsForwardToCallback(callback));
}
@Override
public void deleteDynamicDataForHost(
String host,
DeleteDynamicDataForHostResponse callback) {
NetworkContextDeleteDynamicDataForHostParams _message = new NetworkContextDeleteDynamicDataForHostParams();
_message.host = host;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
DELETE_DYNAMIC_DATA_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextDeleteDynamicDataForHostResponseParamsForwardToCallback(callback));
}
@Override
public void saveHttpAuthCache(
SaveHttpAuthCacheResponse callback) {
NetworkContextSaveHttpAuthCacheParams _message = new NetworkContextSaveHttpAuthCacheParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
SAVE_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextSaveHttpAuthCacheResponseParamsForwardToCallback(callback));
}
@Override
public void loadHttpAuthCache(
org.chromium.mojo_base.mojom.UnguessableToken cacheKey,
LoadHttpAuthCacheResponse callback) {
NetworkContextLoadHttpAuthCacheParams _message = new NetworkContextLoadHttpAuthCacheParams();
_message.cacheKey = cacheKey;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
LOAD_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextLoadHttpAuthCacheResponseParamsForwardToCallback(callback));
}
@Override
public void lookupBasicAuthCredentials(
org.chromium.url.mojom.Url url,
LookupBasicAuthCredentialsResponse callback) {
NetworkContextLookupBasicAuthCredentialsParams _message = new NetworkContextLookupBasicAuthCredentialsParams();
_message.url = url;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
LOOKUP_BASIC_AUTH_CREDENTIALS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextLookupBasicAuthCredentialsResponseParamsForwardToCallback(callback));
}
@Override
public void enableStaticKeyPinningForTesting(
EnableStaticKeyPinningForTestingResponse callback) {
NetworkContextEnableStaticKeyPinningForTestingParams _message = new NetworkContextEnableStaticKeyPinningForTestingParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
ENABLE_STATIC_KEY_PINNING_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextEnableStaticKeyPinningForTestingResponseParamsForwardToCallback(callback));
}
@Override
public void setFailingHttpTransactionForTesting(
int rv,
SetFailingHttpTransactionForTestingResponse callback) {
NetworkContextSetFailingHttpTransactionForTestingParams _message = new NetworkContextSetFailingHttpTransactionForTestingParams();
_message.rv = rv;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
SET_FAILING_HTTP_TRANSACTION_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextSetFailingHttpTransactionForTestingResponseParamsForwardToCallback(callback));
}
@Override
public void verifyCertificateForTesting(
X509Certificate certificate, String hostname, String ocspResponse,
VerifyCertificateForTestingResponse callback) {
NetworkContextVerifyCertificateForTestingParams _message = new NetworkContextVerifyCertificateForTestingParams();
_message.certificate = certificate;
_message.hostname = hostname;
_message.ocspResponse = ocspResponse;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
VERIFY_CERTIFICATE_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextVerifyCertificateForTestingResponseParamsForwardToCallback(callback));
}
@Override
public void addDomainReliabilityContextForTesting(
org.chromium.url.mojom.Url origin, org.chromium.url.mojom.Url uploadUrl,
AddDomainReliabilityContextForTestingResponse callback) {
NetworkContextAddDomainReliabilityContextForTestingParams _message = new NetworkContextAddDomainReliabilityContextForTestingParams();
_message.origin = origin;
_message.uploadUrl = uploadUrl;
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
ADD_DOMAIN_RELIABILITY_CONTEXT_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextAddDomainReliabilityContextForTestingResponseParamsForwardToCallback(callback));
}
@Override
public void forceDomainReliabilityUploadsForTesting(
ForceDomainReliabilityUploadsForTestingResponse callback) {
NetworkContextForceDomainReliabilityUploadsForTestingParams _message = new NetworkContextForceDomainReliabilityUploadsForTestingParams();
getProxyHandler().getMessageReceiver().acceptWithResponder(
_message.serializeWithHeader(
getProxyHandler().getCore(),
new org.chromium.mojo.bindings.MessageHeader(
FORCE_DOMAIN_RELIABILITY_UPLOADS_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG,
0)),
new NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsForwardToCallback(callback));
}
}
static final class Stub extends org.chromium.mojo.bindings.Interface.Stub<NetworkContext> {
Stub(org.chromium.mojo.system.Core core, NetworkContext impl) {
super(core, impl);
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.NO_FLAG)) {
return false;
}
switch(header.getType()) {
case org.chromium.mojo.bindings.interfacecontrol.InterfaceControlMessagesConstants.RUN_OR_CLOSE_PIPE_MESSAGE_ID:
return org.chromium.mojo.bindings.InterfaceControlMessagesHelper.handleRunOrClosePipe(
NetworkContext_Internal.MANAGER, messageWithHeader);
case SET_CLIENT_ORDINAL: {
NetworkContextSetClientParams data =
NetworkContextSetClientParams.deserialize(messageWithHeader.getPayload());
getImpl().setClient(data.client);
return true;
}
case CREATE_URL_LOADER_FACTORY_ORDINAL: {
NetworkContextCreateUrlLoaderFactoryParams data =
NetworkContextCreateUrlLoaderFactoryParams.deserialize(messageWithHeader.getPayload());
getImpl().createUrlLoaderFactory(data.urlLoaderFactory, data.params);
return true;
}
case RESET_URL_LOADER_FACTORIES_ORDINAL: {
NetworkContextResetUrlLoaderFactoriesParams.deserialize(messageWithHeader.getPayload());
getImpl().resetUrlLoaderFactories();
return true;
}
case GET_COOKIE_MANAGER_ORDINAL: {
NetworkContextGetCookieManagerParams data =
NetworkContextGetCookieManagerParams.deserialize(messageWithHeader.getPayload());
getImpl().getCookieManager(data.cookieManager);
return true;
}
case GET_RESTRICTED_COOKIE_MANAGER_ORDINAL: {
NetworkContextGetRestrictedCookieManagerParams data =
NetworkContextGetRestrictedCookieManagerParams.deserialize(messageWithHeader.getPayload());
getImpl().getRestrictedCookieManager(data.restrictedCookieManager, data.origin);
return true;
}
case NOTIFY_EXTERNAL_CACHE_HIT_ORDINAL: {
NetworkContextNotifyExternalCacheHitParams data =
NetworkContextNotifyExternalCacheHitParams.deserialize(messageWithHeader.getPayload());
getImpl().notifyExternalCacheHit(data.url, data.httpMethod, data.topFrameOrigin);
return true;
}
case WRITE_CACHE_METADATA_ORDINAL: {
NetworkContextWriteCacheMetadataParams data =
NetworkContextWriteCacheMetadataParams.deserialize(messageWithHeader.getPayload());
getImpl().writeCacheMetadata(data.url, data.priority, data.expectedResponseTime, data.data);
return true;
}
case QUEUE_REPORT_ORDINAL: {
NetworkContextQueueReportParams data =
NetworkContextQueueReportParams.deserialize(messageWithHeader.getPayload());
getImpl().queueReport(data.type, data.group, data.url, data.userAgent, data.body);
return true;
}
case SET_NETWORK_CONDITIONS_ORDINAL: {
NetworkContextSetNetworkConditionsParams data =
NetworkContextSetNetworkConditionsParams.deserialize(messageWithHeader.getPayload());
getImpl().setNetworkConditions(data.throttlingProfileId, data.conditions);
return true;
}
case SET_ACCEPT_LANGUAGE_ORDINAL: {
NetworkContextSetAcceptLanguageParams data =
NetworkContextSetAcceptLanguageParams.deserialize(messageWithHeader.getPayload());
getImpl().setAcceptLanguage(data.newAcceptLanguage);
return true;
}
case SET_ENABLE_REFERRERS_ORDINAL: {
NetworkContextSetEnableReferrersParams data =
NetworkContextSetEnableReferrersParams.deserialize(messageWithHeader.getPayload());
getImpl().setEnableReferrers(data.enableReferrers);
return true;
}
case SET_CT_POLICY_ORDINAL: {
NetworkContextSetCtPolicyParams data =
NetworkContextSetCtPolicyParams.deserialize(messageWithHeader.getPayload());
getImpl().setCtPolicy(data.requiredHosts, data.excludedHosts, data.excludedSpkis, data.excludedLegacySpkis);
return true;
}
case CREATE_UDP_SOCKET_ORDINAL: {
NetworkContextCreateUdpSocketParams data =
NetworkContextCreateUdpSocketParams.deserialize(messageWithHeader.getPayload());
getImpl().createUdpSocket(data.request, data.receiver);
return true;
}
case CREATE_PROXY_RESOLVING_SOCKET_FACTORY_ORDINAL: {
NetworkContextCreateProxyResolvingSocketFactoryParams data =
NetworkContextCreateProxyResolvingSocketFactoryParams.deserialize(messageWithHeader.getPayload());
getImpl().createProxyResolvingSocketFactory(data.factory);
return true;
}
case LOOK_UP_PROXY_FOR_URL_ORDINAL: {
NetworkContextLookUpProxyForUrlParams data =
NetworkContextLookUpProxyForUrlParams.deserialize(messageWithHeader.getPayload());
getImpl().lookUpProxyForUrl(data.url, data.proxyLookupClient);
return true;
}
case CREATE_WEB_SOCKET_ORDINAL: {
NetworkContextCreateWebSocketParams data =
NetworkContextCreateWebSocketParams.deserialize(messageWithHeader.getPayload());
getImpl().createWebSocket(data.request, data.processId, data.renderFrameId, data.origin, data.authHandler);
return true;
}
case CREATE_NET_LOG_EXPORTER_ORDINAL: {
NetworkContextCreateNetLogExporterParams data =
NetworkContextCreateNetLogExporterParams.deserialize(messageWithHeader.getPayload());
getImpl().createNetLogExporter(data.exporter);
return true;
}
case PRECONNECT_SOCKETS_ORDINAL: {
NetworkContextPreconnectSocketsParams data =
NetworkContextPreconnectSocketsParams.deserialize(messageWithHeader.getPayload());
getImpl().preconnectSockets(data.numStreams, data.url, data.loadFlags, data.privacyModeEnabled);
return true;
}
case CREATE_P2P_SOCKET_MANAGER_ORDINAL: {
NetworkContextCreateP2pSocketManagerParams data =
NetworkContextCreateP2pSocketManagerParams.deserialize(messageWithHeader.getPayload());
getImpl().createP2pSocketManager(data.client, data.trustedSocketManager, data.socketManager);
return true;
}
case CREATE_MDNS_RESPONDER_ORDINAL: {
NetworkContextCreateMdnsResponderParams data =
NetworkContextCreateMdnsResponderParams.deserialize(messageWithHeader.getPayload());
getImpl().createMdnsResponder(data.responderRequest);
return true;
}
case RESOLVE_HOST_ORDINAL: {
NetworkContextResolveHostParams data =
NetworkContextResolveHostParams.deserialize(messageWithHeader.getPayload());
getImpl().resolveHost(data.host, data.optionalParameters, data.responseClient);
return true;
}
case CREATE_HOST_RESOLVER_ORDINAL: {
NetworkContextCreateHostResolverParams data =
NetworkContextCreateHostResolverParams.deserialize(messageWithHeader.getPayload());
getImpl().createHostResolver(data.configOverrides, data.hostResolver);
return true;
}
default:
return false;
}
} catch (org.chromium.mojo.bindings.DeserializationException e) {
System.err.println(e.toString());
return false;
}
}
@Override
public boolean acceptWithResponder(org.chromium.mojo.bindings.Message message, org.chromium.mojo.bindings.MessageReceiver receiver) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(org.chromium.mojo.bindings.MessageHeader.MESSAGE_EXPECTS_RESPONSE_FLAG)) {
return false;
}
switch(header.getType()) {
case org.chromium.mojo.bindings.interfacecontrol.InterfaceControlMessagesConstants.RUN_MESSAGE_ID:
return org.chromium.mojo.bindings.InterfaceControlMessagesHelper.handleRun(
getCore(), NetworkContext_Internal.MANAGER, messageWithHeader, receiver);
case CLEAR_NETWORKING_HISTORY_SINCE_ORDINAL: {
NetworkContextClearNetworkingHistorySinceParams data =
NetworkContextClearNetworkingHistorySinceParams.deserialize(messageWithHeader.getPayload());
getImpl().clearNetworkingHistorySince(data.startTime, new NetworkContextClearNetworkingHistorySinceResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_HTTP_CACHE_ORDINAL: {
NetworkContextClearHttpCacheParams data =
NetworkContextClearHttpCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().clearHttpCache(data.startTime, data.endTime, data.filter, new NetworkContextClearHttpCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case COMPUTE_HTTP_CACHE_SIZE_ORDINAL: {
NetworkContextComputeHttpCacheSizeParams data =
NetworkContextComputeHttpCacheSizeParams.deserialize(messageWithHeader.getPayload());
getImpl().computeHttpCacheSize(data.startTime, data.endTime, new NetworkContextComputeHttpCacheSizeResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_CHANNEL_IDS_ORDINAL: {
NetworkContextClearChannelIdsParams data =
NetworkContextClearChannelIdsParams.deserialize(messageWithHeader.getPayload());
getImpl().clearChannelIds(data.startTime, data.endTime, data.filter, new NetworkContextClearChannelIdsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_HOST_CACHE_ORDINAL: {
NetworkContextClearHostCacheParams data =
NetworkContextClearHostCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().clearHostCache(data.filter, new NetworkContextClearHostCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_HTTP_AUTH_CACHE_ORDINAL: {
NetworkContextClearHttpAuthCacheParams data =
NetworkContextClearHttpAuthCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().clearHttpAuthCache(data.startTime, new NetworkContextClearHttpAuthCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_REPORTING_CACHE_REPORTS_ORDINAL: {
NetworkContextClearReportingCacheReportsParams data =
NetworkContextClearReportingCacheReportsParams.deserialize(messageWithHeader.getPayload());
getImpl().clearReportingCacheReports(data.filter, new NetworkContextClearReportingCacheReportsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_REPORTING_CACHE_CLIENTS_ORDINAL: {
NetworkContextClearReportingCacheClientsParams data =
NetworkContextClearReportingCacheClientsParams.deserialize(messageWithHeader.getPayload());
getImpl().clearReportingCacheClients(data.filter, new NetworkContextClearReportingCacheClientsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_NETWORK_ERROR_LOGGING_ORDINAL: {
NetworkContextClearNetworkErrorLoggingParams data =
NetworkContextClearNetworkErrorLoggingParams.deserialize(messageWithHeader.getPayload());
getImpl().clearNetworkErrorLogging(data.filter, new NetworkContextClearNetworkErrorLoggingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_DOMAIN_RELIABILITY_ORDINAL: {
NetworkContextClearDomainReliabilityParams data =
NetworkContextClearDomainReliabilityParams.deserialize(messageWithHeader.getPayload());
getImpl().clearDomainReliability(data.filter, data.mode, new NetworkContextClearDomainReliabilityResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case GET_DOMAIN_RELIABILITY_JSON_ORDINAL: {
NetworkContextGetDomainReliabilityJsonParams.deserialize(messageWithHeader.getPayload());
getImpl().getDomainReliabilityJson(new NetworkContextGetDomainReliabilityJsonResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLOSE_ALL_CONNECTIONS_ORDINAL: {
NetworkContextCloseAllConnectionsParams.deserialize(messageWithHeader.getPayload());
getImpl().closeAllConnections(new NetworkContextCloseAllConnectionsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLOSE_IDLE_CONNECTIONS_ORDINAL: {
NetworkContextCloseIdleConnectionsParams.deserialize(messageWithHeader.getPayload());
getImpl().closeIdleConnections(new NetworkContextCloseIdleConnectionsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case ADD_EXPECT_CT_ORDINAL: {
NetworkContextAddExpectCtParams data =
NetworkContextAddExpectCtParams.deserialize(messageWithHeader.getPayload());
getImpl().addExpectCt(data.host, data.expiry, data.enforce, data.reportUri, new NetworkContextAddExpectCtResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case SET_EXPECT_CT_TEST_REPORT_ORDINAL: {
NetworkContextSetExpectCtTestReportParams data =
NetworkContextSetExpectCtTestReportParams.deserialize(messageWithHeader.getPayload());
getImpl().setExpectCtTestReport(data.reportUri, new NetworkContextSetExpectCtTestReportResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case GET_EXPECT_CT_STATE_ORDINAL: {
NetworkContextGetExpectCtStateParams data =
NetworkContextGetExpectCtStateParams.deserialize(messageWithHeader.getPayload());
getImpl().getExpectCtState(data.domain, new NetworkContextGetExpectCtStateResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CREATE_TCP_SERVER_SOCKET_ORDINAL: {
NetworkContextCreateTcpServerSocketParams data =
NetworkContextCreateTcpServerSocketParams.deserialize(messageWithHeader.getPayload());
getImpl().createTcpServerSocket(data.localAddr, data.backlog, data.trafficAnnotation, data.socket, new NetworkContextCreateTcpServerSocketResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CREATE_TCP_CONNECTED_SOCKET_ORDINAL: {
NetworkContextCreateTcpConnectedSocketParams data =
NetworkContextCreateTcpConnectedSocketParams.deserialize(messageWithHeader.getPayload());
getImpl().createTcpConnectedSocket(data.localAddr, data.remoteAddrList, data.tcpConnectedSocketOptions, data.trafficAnnotation, data.socket, data.observer, new NetworkContextCreateTcpConnectedSocketResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CREATE_TCP_BOUND_SOCKET_ORDINAL: {
NetworkContextCreateTcpBoundSocketParams data =
NetworkContextCreateTcpBoundSocketParams.deserialize(messageWithHeader.getPayload());
getImpl().createTcpBoundSocket(data.localAddr, data.trafficAnnotation, data.socket, new NetworkContextCreateTcpBoundSocketResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case FORCE_RELOAD_PROXY_CONFIG_ORDINAL: {
NetworkContextForceReloadProxyConfigParams.deserialize(messageWithHeader.getPayload());
getImpl().forceReloadProxyConfig(new NetworkContextForceReloadProxyConfigResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case CLEAR_BAD_PROXIES_CACHE_ORDINAL: {
NetworkContextClearBadProxiesCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().clearBadProxiesCache(new NetworkContextClearBadProxiesCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case VERIFY_CERT_FOR_SIGNED_EXCHANGE_ORDINAL: {
NetworkContextVerifyCertForSignedExchangeParams data =
NetworkContextVerifyCertForSignedExchangeParams.deserialize(messageWithHeader.getPayload());
getImpl().verifyCertForSignedExchange(data.certificate, data.url, data.ocspResponse, data.sctList, new NetworkContextVerifyCertForSignedExchangeResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case ADD_HSTS_ORDINAL: {
NetworkContextAddHstsParams data =
NetworkContextAddHstsParams.deserialize(messageWithHeader.getPayload());
getImpl().addHsts(data.host, data.expiry, data.includeSubdomains, new NetworkContextAddHstsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case IS_HSTS_ACTIVE_FOR_HOST_ORDINAL: {
NetworkContextIsHstsActiveForHostParams data =
NetworkContextIsHstsActiveForHostParams.deserialize(messageWithHeader.getPayload());
getImpl().isHstsActiveForHost(data.host, new NetworkContextIsHstsActiveForHostResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case GET_HSTS_STATE_ORDINAL: {
NetworkContextGetHstsStateParams data =
NetworkContextGetHstsStateParams.deserialize(messageWithHeader.getPayload());
getImpl().getHstsState(data.domain, new NetworkContextGetHstsStateResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case SET_CORS_ORIGIN_ACCESS_LISTS_FOR_ORIGIN_ORDINAL: {
NetworkContextSetCorsOriginAccessListsForOriginParams data =
NetworkContextSetCorsOriginAccessListsForOriginParams.deserialize(messageWithHeader.getPayload());
getImpl().setCorsOriginAccessListsForOrigin(data.sourceOrigin, data.allowPatterns, data.blockPatterns, new NetworkContextSetCorsOriginAccessListsForOriginResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case DELETE_DYNAMIC_DATA_FOR_HOST_ORDINAL: {
NetworkContextDeleteDynamicDataForHostParams data =
NetworkContextDeleteDynamicDataForHostParams.deserialize(messageWithHeader.getPayload());
getImpl().deleteDynamicDataForHost(data.host, new NetworkContextDeleteDynamicDataForHostResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case SAVE_HTTP_AUTH_CACHE_ORDINAL: {
NetworkContextSaveHttpAuthCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().saveHttpAuthCache(new NetworkContextSaveHttpAuthCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case LOAD_HTTP_AUTH_CACHE_ORDINAL: {
NetworkContextLoadHttpAuthCacheParams data =
NetworkContextLoadHttpAuthCacheParams.deserialize(messageWithHeader.getPayload());
getImpl().loadHttpAuthCache(data.cacheKey, new NetworkContextLoadHttpAuthCacheResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case LOOKUP_BASIC_AUTH_CREDENTIALS_ORDINAL: {
NetworkContextLookupBasicAuthCredentialsParams data =
NetworkContextLookupBasicAuthCredentialsParams.deserialize(messageWithHeader.getPayload());
getImpl().lookupBasicAuthCredentials(data.url, new NetworkContextLookupBasicAuthCredentialsResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case ENABLE_STATIC_KEY_PINNING_FOR_TESTING_ORDINAL: {
NetworkContextEnableStaticKeyPinningForTestingParams.deserialize(messageWithHeader.getPayload());
getImpl().enableStaticKeyPinningForTesting(new NetworkContextEnableStaticKeyPinningForTestingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case SET_FAILING_HTTP_TRANSACTION_FOR_TESTING_ORDINAL: {
NetworkContextSetFailingHttpTransactionForTestingParams data =
NetworkContextSetFailingHttpTransactionForTestingParams.deserialize(messageWithHeader.getPayload());
getImpl().setFailingHttpTransactionForTesting(data.rv, new NetworkContextSetFailingHttpTransactionForTestingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case VERIFY_CERTIFICATE_FOR_TESTING_ORDINAL: {
NetworkContextVerifyCertificateForTestingParams data =
NetworkContextVerifyCertificateForTestingParams.deserialize(messageWithHeader.getPayload());
getImpl().verifyCertificateForTesting(data.certificate, data.hostname, data.ocspResponse, new NetworkContextVerifyCertificateForTestingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case ADD_DOMAIN_RELIABILITY_CONTEXT_FOR_TESTING_ORDINAL: {
NetworkContextAddDomainReliabilityContextForTestingParams data =
NetworkContextAddDomainReliabilityContextForTestingParams.deserialize(messageWithHeader.getPayload());
getImpl().addDomainReliabilityContextForTesting(data.origin, data.uploadUrl, new NetworkContextAddDomainReliabilityContextForTestingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
case FORCE_DOMAIN_RELIABILITY_UPLOADS_FOR_TESTING_ORDINAL: {
NetworkContextForceDomainReliabilityUploadsForTestingParams.deserialize(messageWithHeader.getPayload());
getImpl().forceDomainReliabilityUploadsForTesting(new NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsProxyToResponder(getCore(), receiver, header.getRequestId()));
return true;
}
default:
return false;
}
} catch (org.chromium.mojo.bindings.DeserializationException e) {
System.err.println(e.toString());
return false;
}
}
}
static final class NetworkContextSetClientParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public NetworkContextClient client;
private NetworkContextSetClientParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetClientParams() {
this(0);
}
public static NetworkContextSetClientParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetClientParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetClientParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetClientParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetClientParams(elementsOrVersion);
{
result.client = decoder0.readServiceInterface(8, false, NetworkContextClient.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.client, 8, false, NetworkContextClient.MANAGER);
}
}
static final class NetworkContextCreateUrlLoaderFactoryParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<UrlLoaderFactory> urlLoaderFactory;
public UrlLoaderFactoryParams params;
private NetworkContextCreateUrlLoaderFactoryParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateUrlLoaderFactoryParams() {
this(0);
}
public static NetworkContextCreateUrlLoaderFactoryParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateUrlLoaderFactoryParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateUrlLoaderFactoryParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateUrlLoaderFactoryParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateUrlLoaderFactoryParams(elementsOrVersion);
{
result.urlLoaderFactory = decoder0.readInterfaceRequest(8, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.params = UrlLoaderFactoryParams.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.urlLoaderFactory, 8, false);
encoder0.encode(this.params, 16, false);
}
}
static final class NetworkContextResetUrlLoaderFactoriesParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextResetUrlLoaderFactoriesParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextResetUrlLoaderFactoriesParams() {
this(0);
}
public static NetworkContextResetUrlLoaderFactoriesParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextResetUrlLoaderFactoriesParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextResetUrlLoaderFactoriesParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextResetUrlLoaderFactoriesParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextResetUrlLoaderFactoriesParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextGetCookieManagerParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<CookieManager> cookieManager;
private NetworkContextGetCookieManagerParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetCookieManagerParams() {
this(0);
}
public static NetworkContextGetCookieManagerParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetCookieManagerParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetCookieManagerParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetCookieManagerParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetCookieManagerParams(elementsOrVersion);
{
result.cookieManager = decoder0.readInterfaceRequest(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.cookieManager, 8, false);
}
}
static final class NetworkContextGetRestrictedCookieManagerParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<RestrictedCookieManager> restrictedCookieManager;
public org.chromium.url.mojom.Origin origin;
private NetworkContextGetRestrictedCookieManagerParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetRestrictedCookieManagerParams() {
this(0);
}
public static NetworkContextGetRestrictedCookieManagerParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetRestrictedCookieManagerParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetRestrictedCookieManagerParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetRestrictedCookieManagerParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetRestrictedCookieManagerParams(elementsOrVersion);
{
result.restrictedCookieManager = decoder0.readInterfaceRequest(8, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.origin = org.chromium.url.mojom.Origin.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.restrictedCookieManager, 8, false);
encoder0.encode(this.origin, 16, false);
}
}
static final class NetworkContextClearNetworkingHistorySinceParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Time startTime;
private NetworkContextClearNetworkingHistorySinceParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearNetworkingHistorySinceParams() {
this(0);
}
public static NetworkContextClearNetworkingHistorySinceParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearNetworkingHistorySinceParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearNetworkingHistorySinceParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearNetworkingHistorySinceParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearNetworkingHistorySinceParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.startTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.startTime, 8, false);
}
}
static final class NetworkContextClearNetworkingHistorySinceResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearNetworkingHistorySinceResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearNetworkingHistorySinceResponseParams() {
this(0);
}
public static NetworkContextClearNetworkingHistorySinceResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearNetworkingHistorySinceResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearNetworkingHistorySinceResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearNetworkingHistorySinceResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearNetworkingHistorySinceResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearNetworkingHistorySinceResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearNetworkingHistorySinceResponse mCallback;
NetworkContextClearNetworkingHistorySinceResponseParamsForwardToCallback(NetworkContext.ClearNetworkingHistorySinceResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_NETWORKING_HISTORY_SINCE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearNetworkingHistorySinceResponseParamsProxyToResponder implements NetworkContext.ClearNetworkingHistorySinceResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearNetworkingHistorySinceResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearNetworkingHistorySinceResponseParams _response = new NetworkContextClearNetworkingHistorySinceResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_NETWORKING_HISTORY_SINCE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearHttpCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Time startTime;
public org.chromium.mojo_base.mojom.Time endTime;
public ClearDataFilter filter;
private NetworkContextClearHttpCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHttpCacheParams() {
this(0);
}
public static NetworkContextClearHttpCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHttpCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHttpCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHttpCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHttpCacheParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.startTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.endTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.startTime, 8, false);
encoder0.encode(this.endTime, 16, false);
encoder0.encode(this.filter, 24, true);
}
}
static final class NetworkContextClearHttpCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearHttpCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHttpCacheResponseParams() {
this(0);
}
public static NetworkContextClearHttpCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHttpCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHttpCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHttpCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHttpCacheResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearHttpCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearHttpCacheResponse mCallback;
NetworkContextClearHttpCacheResponseParamsForwardToCallback(NetworkContext.ClearHttpCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_HTTP_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearHttpCacheResponseParamsProxyToResponder implements NetworkContext.ClearHttpCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearHttpCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearHttpCacheResponseParams _response = new NetworkContextClearHttpCacheResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HTTP_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextComputeHttpCacheSizeParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Time startTime;
public org.chromium.mojo_base.mojom.Time endTime;
private NetworkContextComputeHttpCacheSizeParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextComputeHttpCacheSizeParams() {
this(0);
}
public static NetworkContextComputeHttpCacheSizeParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextComputeHttpCacheSizeParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextComputeHttpCacheSizeParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextComputeHttpCacheSizeParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextComputeHttpCacheSizeParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.startTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.endTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.startTime, 8, false);
encoder0.encode(this.endTime, 16, false);
}
}
static final class NetworkContextComputeHttpCacheSizeResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean isUpperBound;
public long sizeOrError;
private NetworkContextComputeHttpCacheSizeResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextComputeHttpCacheSizeResponseParams() {
this(0);
}
public static NetworkContextComputeHttpCacheSizeResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextComputeHttpCacheSizeResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextComputeHttpCacheSizeResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextComputeHttpCacheSizeResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextComputeHttpCacheSizeResponseParams(elementsOrVersion);
{
result.isUpperBound = decoder0.readBoolean(8, 0);
}
{
result.sizeOrError = decoder0.readLong(16);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.isUpperBound, 8, 0);
encoder0.encode(this.sizeOrError, 16);
}
}
static class NetworkContextComputeHttpCacheSizeResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ComputeHttpCacheSizeResponse mCallback;
NetworkContextComputeHttpCacheSizeResponseParamsForwardToCallback(NetworkContext.ComputeHttpCacheSizeResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(COMPUTE_HTTP_CACHE_SIZE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextComputeHttpCacheSizeResponseParams response = NetworkContextComputeHttpCacheSizeResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.isUpperBound, response.sizeOrError);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextComputeHttpCacheSizeResponseParamsProxyToResponder implements NetworkContext.ComputeHttpCacheSizeResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextComputeHttpCacheSizeResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Boolean isUpperBound, Long sizeOrError) {
NetworkContextComputeHttpCacheSizeResponseParams _response = new NetworkContextComputeHttpCacheSizeResponseParams();
_response.isUpperBound = isUpperBound;
_response.sizeOrError = sizeOrError;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
COMPUTE_HTTP_CACHE_SIZE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextNotifyExternalCacheHitParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url url;
public String httpMethod;
public org.chromium.url.mojom.Origin topFrameOrigin;
private NetworkContextNotifyExternalCacheHitParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextNotifyExternalCacheHitParams() {
this(0);
}
public static NetworkContextNotifyExternalCacheHitParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextNotifyExternalCacheHitParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextNotifyExternalCacheHitParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextNotifyExternalCacheHitParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextNotifyExternalCacheHitParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.httpMethod = decoder0.readString(16, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, true);
result.topFrameOrigin = org.chromium.url.mojom.Origin.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.url, 8, false);
encoder0.encode(this.httpMethod, 16, false);
encoder0.encode(this.topFrameOrigin, 24, true);
}
}
static final class NetworkContextWriteCacheMetadataParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url url;
public int priority;
public org.chromium.mojo_base.mojom.Time expectedResponseTime;
public byte[] data;
private NetworkContextWriteCacheMetadataParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextWriteCacheMetadataParams() {
this(0);
}
public static NetworkContextWriteCacheMetadataParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextWriteCacheMetadataParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextWriteCacheMetadataParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextWriteCacheMetadataParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextWriteCacheMetadataParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.priority = decoder0.readInt(16);
RequestPriority.validate(result.priority);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
result.expectedResponseTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
result.data = decoder0.readBytes(32, org.chromium.mojo.bindings.BindingsHelper.NOTHING_NULLABLE, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.url, 8, false);
encoder0.encode(this.priority, 16);
encoder0.encode(this.expectedResponseTime, 24, false);
encoder0.encode(this.data, 32, org.chromium.mojo.bindings.BindingsHelper.NOTHING_NULLABLE, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
}
}
static final class NetworkContextClearChannelIdsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Time startTime;
public org.chromium.mojo_base.mojom.Time endTime;
public ClearDataFilter filter;
private NetworkContextClearChannelIdsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearChannelIdsParams() {
this(0);
}
public static NetworkContextClearChannelIdsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearChannelIdsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearChannelIdsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearChannelIdsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearChannelIdsParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.startTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.endTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.startTime, 8, false);
encoder0.encode(this.endTime, 16, false);
encoder0.encode(this.filter, 24, true);
}
}
static final class NetworkContextClearChannelIdsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearChannelIdsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearChannelIdsResponseParams() {
this(0);
}
public static NetworkContextClearChannelIdsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearChannelIdsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearChannelIdsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearChannelIdsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearChannelIdsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearChannelIdsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearChannelIdsResponse mCallback;
NetworkContextClearChannelIdsResponseParamsForwardToCallback(NetworkContext.ClearChannelIdsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_CHANNEL_IDS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearChannelIdsResponseParamsProxyToResponder implements NetworkContext.ClearChannelIdsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearChannelIdsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearChannelIdsResponseParams _response = new NetworkContextClearChannelIdsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_CHANNEL_IDS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearHostCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public ClearDataFilter filter;
private NetworkContextClearHostCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHostCacheParams() {
this(0);
}
public static NetworkContextClearHostCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHostCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHostCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHostCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHostCacheParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.filter, 8, true);
}
}
static final class NetworkContextClearHostCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearHostCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHostCacheResponseParams() {
this(0);
}
public static NetworkContextClearHostCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHostCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHostCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHostCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHostCacheResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearHostCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearHostCacheResponse mCallback;
NetworkContextClearHostCacheResponseParamsForwardToCallback(NetworkContext.ClearHostCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_HOST_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearHostCacheResponseParamsProxyToResponder implements NetworkContext.ClearHostCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearHostCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearHostCacheResponseParams _response = new NetworkContextClearHostCacheResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HOST_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearHttpAuthCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Time startTime;
private NetworkContextClearHttpAuthCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHttpAuthCacheParams() {
this(0);
}
public static NetworkContextClearHttpAuthCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHttpAuthCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHttpAuthCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHttpAuthCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHttpAuthCacheParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.startTime = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.startTime, 8, false);
}
}
static final class NetworkContextClearHttpAuthCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearHttpAuthCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearHttpAuthCacheResponseParams() {
this(0);
}
public static NetworkContextClearHttpAuthCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearHttpAuthCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearHttpAuthCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearHttpAuthCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearHttpAuthCacheResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearHttpAuthCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearHttpAuthCacheResponse mCallback;
NetworkContextClearHttpAuthCacheResponseParamsForwardToCallback(NetworkContext.ClearHttpAuthCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearHttpAuthCacheResponseParamsProxyToResponder implements NetworkContext.ClearHttpAuthCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearHttpAuthCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearHttpAuthCacheResponseParams _response = new NetworkContextClearHttpAuthCacheResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearReportingCacheReportsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public ClearDataFilter filter;
private NetworkContextClearReportingCacheReportsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearReportingCacheReportsParams() {
this(0);
}
public static NetworkContextClearReportingCacheReportsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearReportingCacheReportsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearReportingCacheReportsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearReportingCacheReportsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearReportingCacheReportsParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.filter, 8, true);
}
}
static final class NetworkContextClearReportingCacheReportsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearReportingCacheReportsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearReportingCacheReportsResponseParams() {
this(0);
}
public static NetworkContextClearReportingCacheReportsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearReportingCacheReportsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearReportingCacheReportsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearReportingCacheReportsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearReportingCacheReportsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearReportingCacheReportsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearReportingCacheReportsResponse mCallback;
NetworkContextClearReportingCacheReportsResponseParamsForwardToCallback(NetworkContext.ClearReportingCacheReportsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_REPORTING_CACHE_REPORTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearReportingCacheReportsResponseParamsProxyToResponder implements NetworkContext.ClearReportingCacheReportsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearReportingCacheReportsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearReportingCacheReportsResponseParams _response = new NetworkContextClearReportingCacheReportsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_REPORTING_CACHE_REPORTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearReportingCacheClientsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public ClearDataFilter filter;
private NetworkContextClearReportingCacheClientsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearReportingCacheClientsParams() {
this(0);
}
public static NetworkContextClearReportingCacheClientsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearReportingCacheClientsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearReportingCacheClientsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearReportingCacheClientsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearReportingCacheClientsParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.filter, 8, true);
}
}
static final class NetworkContextClearReportingCacheClientsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearReportingCacheClientsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearReportingCacheClientsResponseParams() {
this(0);
}
public static NetworkContextClearReportingCacheClientsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearReportingCacheClientsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearReportingCacheClientsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearReportingCacheClientsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearReportingCacheClientsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearReportingCacheClientsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearReportingCacheClientsResponse mCallback;
NetworkContextClearReportingCacheClientsResponseParamsForwardToCallback(NetworkContext.ClearReportingCacheClientsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_REPORTING_CACHE_CLIENTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearReportingCacheClientsResponseParamsProxyToResponder implements NetworkContext.ClearReportingCacheClientsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearReportingCacheClientsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearReportingCacheClientsResponseParams _response = new NetworkContextClearReportingCacheClientsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_REPORTING_CACHE_CLIENTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearNetworkErrorLoggingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public ClearDataFilter filter;
private NetworkContextClearNetworkErrorLoggingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearNetworkErrorLoggingParams() {
this(0);
}
public static NetworkContextClearNetworkErrorLoggingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearNetworkErrorLoggingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearNetworkErrorLoggingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearNetworkErrorLoggingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearNetworkErrorLoggingParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.filter = ClearDataFilter.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.filter, 8, true);
}
}
static final class NetworkContextClearNetworkErrorLoggingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearNetworkErrorLoggingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearNetworkErrorLoggingResponseParams() {
this(0);
}
public static NetworkContextClearNetworkErrorLoggingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearNetworkErrorLoggingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearNetworkErrorLoggingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearNetworkErrorLoggingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearNetworkErrorLoggingResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearNetworkErrorLoggingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearNetworkErrorLoggingResponse mCallback;
NetworkContextClearNetworkErrorLoggingResponseParamsForwardToCallback(NetworkContext.ClearNetworkErrorLoggingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_NETWORK_ERROR_LOGGING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearNetworkErrorLoggingResponseParamsProxyToResponder implements NetworkContext.ClearNetworkErrorLoggingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearNetworkErrorLoggingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearNetworkErrorLoggingResponseParams _response = new NetworkContextClearNetworkErrorLoggingResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_NETWORK_ERROR_LOGGING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearDomainReliabilityParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public ClearDataFilter filter;
public int mode;
private NetworkContextClearDomainReliabilityParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearDomainReliabilityParams() {
this(0);
}
public static NetworkContextClearDomainReliabilityParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearDomainReliabilityParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearDomainReliabilityParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearDomainReliabilityParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearDomainReliabilityParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.filter = ClearDataFilter.decode(decoder1);
}
{
result.mode = decoder0.readInt(16);
NetworkContext.DomainReliabilityClearMode.validate(result.mode);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.filter, 8, true);
encoder0.encode(this.mode, 16);
}
}
static final class NetworkContextClearDomainReliabilityResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearDomainReliabilityResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearDomainReliabilityResponseParams() {
this(0);
}
public static NetworkContextClearDomainReliabilityResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearDomainReliabilityResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearDomainReliabilityResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearDomainReliabilityResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearDomainReliabilityResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearDomainReliabilityResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearDomainReliabilityResponse mCallback;
NetworkContextClearDomainReliabilityResponseParamsForwardToCallback(NetworkContext.ClearDomainReliabilityResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_DOMAIN_RELIABILITY_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearDomainReliabilityResponseParamsProxyToResponder implements NetworkContext.ClearDomainReliabilityResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearDomainReliabilityResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearDomainReliabilityResponseParams _response = new NetworkContextClearDomainReliabilityResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_DOMAIN_RELIABILITY_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextGetDomainReliabilityJsonParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextGetDomainReliabilityJsonParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetDomainReliabilityJsonParams() {
this(0);
}
public static NetworkContextGetDomainReliabilityJsonParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetDomainReliabilityJsonParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetDomainReliabilityJsonParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetDomainReliabilityJsonParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetDomainReliabilityJsonParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextGetDomainReliabilityJsonResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.Value data;
private NetworkContextGetDomainReliabilityJsonResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetDomainReliabilityJsonResponseParams() {
this(0);
}
public static NetworkContextGetDomainReliabilityJsonResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetDomainReliabilityJsonResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetDomainReliabilityJsonResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetDomainReliabilityJsonResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetDomainReliabilityJsonResponseParams(elementsOrVersion);
{
result.data = org.chromium.mojo_base.mojom.Value.decode(decoder0, 8);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.data, 8, false);
}
}
static class NetworkContextGetDomainReliabilityJsonResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.GetDomainReliabilityJsonResponse mCallback;
NetworkContextGetDomainReliabilityJsonResponseParamsForwardToCallback(NetworkContext.GetDomainReliabilityJsonResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(GET_DOMAIN_RELIABILITY_JSON_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextGetDomainReliabilityJsonResponseParams response = NetworkContextGetDomainReliabilityJsonResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.data);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextGetDomainReliabilityJsonResponseParamsProxyToResponder implements NetworkContext.GetDomainReliabilityJsonResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextGetDomainReliabilityJsonResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(org.chromium.mojo_base.mojom.Value data) {
NetworkContextGetDomainReliabilityJsonResponseParams _response = new NetworkContextGetDomainReliabilityJsonResponseParams();
_response.data = data;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
GET_DOMAIN_RELIABILITY_JSON_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextQueueReportParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 48;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(48, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String type;
public String group;
public org.chromium.url.mojom.Url url;
public String userAgent;
public org.chromium.mojo_base.mojom.DictionaryValue body;
private NetworkContextQueueReportParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextQueueReportParams() {
this(0);
}
public static NetworkContextQueueReportParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextQueueReportParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextQueueReportParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextQueueReportParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextQueueReportParams(elementsOrVersion);
{
result.type = decoder0.readString(8, false);
}
{
result.group = decoder0.readString(16, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.userAgent = decoder0.readString(32, true);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(40, false);
result.body = org.chromium.mojo_base.mojom.DictionaryValue.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.type, 8, false);
encoder0.encode(this.group, 16, false);
encoder0.encode(this.url, 24, false);
encoder0.encode(this.userAgent, 32, true);
encoder0.encode(this.body, 40, false);
}
}
static final class NetworkContextCloseAllConnectionsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextCloseAllConnectionsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCloseAllConnectionsParams() {
this(0);
}
public static NetworkContextCloseAllConnectionsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCloseAllConnectionsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCloseAllConnectionsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCloseAllConnectionsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCloseAllConnectionsParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextCloseAllConnectionsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextCloseAllConnectionsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCloseAllConnectionsResponseParams() {
this(0);
}
public static NetworkContextCloseAllConnectionsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCloseAllConnectionsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCloseAllConnectionsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCloseAllConnectionsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCloseAllConnectionsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextCloseAllConnectionsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.CloseAllConnectionsResponse mCallback;
NetworkContextCloseAllConnectionsResponseParamsForwardToCallback(NetworkContext.CloseAllConnectionsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLOSE_ALL_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextCloseAllConnectionsResponseParamsProxyToResponder implements NetworkContext.CloseAllConnectionsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextCloseAllConnectionsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextCloseAllConnectionsResponseParams _response = new NetworkContextCloseAllConnectionsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLOSE_ALL_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCloseIdleConnectionsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextCloseIdleConnectionsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCloseIdleConnectionsParams() {
this(0);
}
public static NetworkContextCloseIdleConnectionsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCloseIdleConnectionsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCloseIdleConnectionsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCloseIdleConnectionsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCloseIdleConnectionsParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextCloseIdleConnectionsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextCloseIdleConnectionsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCloseIdleConnectionsResponseParams() {
this(0);
}
public static NetworkContextCloseIdleConnectionsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCloseIdleConnectionsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCloseIdleConnectionsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCloseIdleConnectionsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCloseIdleConnectionsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextCloseIdleConnectionsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.CloseIdleConnectionsResponse mCallback;
NetworkContextCloseIdleConnectionsResponseParamsForwardToCallback(NetworkContext.CloseIdleConnectionsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLOSE_IDLE_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextCloseIdleConnectionsResponseParamsProxyToResponder implements NetworkContext.CloseIdleConnectionsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextCloseIdleConnectionsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextCloseIdleConnectionsResponseParams _response = new NetworkContextCloseIdleConnectionsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLOSE_IDLE_CONNECTIONS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextSetNetworkConditionsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.UnguessableToken throttlingProfileId;
public NetworkConditions conditions;
private NetworkContextSetNetworkConditionsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetNetworkConditionsParams() {
this(0);
}
public static NetworkContextSetNetworkConditionsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetNetworkConditionsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetNetworkConditionsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetNetworkConditionsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetNetworkConditionsParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.throttlingProfileId = org.chromium.mojo_base.mojom.UnguessableToken.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, true);
result.conditions = NetworkConditions.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.throttlingProfileId, 8, false);
encoder0.encode(this.conditions, 16, true);
}
}
static final class NetworkContextSetAcceptLanguageParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String newAcceptLanguage;
private NetworkContextSetAcceptLanguageParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetAcceptLanguageParams() {
this(0);
}
public static NetworkContextSetAcceptLanguageParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetAcceptLanguageParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetAcceptLanguageParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetAcceptLanguageParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetAcceptLanguageParams(elementsOrVersion);
{
result.newAcceptLanguage = decoder0.readString(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.newAcceptLanguage, 8, false);
}
}
static final class NetworkContextSetEnableReferrersParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean enableReferrers;
private NetworkContextSetEnableReferrersParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetEnableReferrersParams() {
this(0);
}
public static NetworkContextSetEnableReferrersParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetEnableReferrersParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetEnableReferrersParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetEnableReferrersParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetEnableReferrersParams(elementsOrVersion);
{
result.enableReferrers = decoder0.readBoolean(8, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.enableReferrers, 8, 0);
}
}
static final class NetworkContextSetCtPolicyParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String[] requiredHosts;
public String[] excludedHosts;
public String[] excludedSpkis;
public String[] excludedLegacySpkis;
private NetworkContextSetCtPolicyParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetCtPolicyParams() {
this(0);
}
public static NetworkContextSetCtPolicyParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetCtPolicyParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetCtPolicyParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetCtPolicyParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetCtPolicyParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.requiredHosts = new String[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
result.requiredHosts[i1] = decoder1.readString(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
}
}
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.excludedHosts = new String[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
result.excludedHosts[i1] = decoder1.readString(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
}
}
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.excludedSpkis = new String[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
result.excludedSpkis[i1] = decoder1.readString(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
}
}
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(32, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.excludedLegacySpkis = new String[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
result.excludedLegacySpkis[i1] = decoder1.readString(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
}
}
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
if (this.requiredHosts == null) {
encoder0.encodeNullPointer(8, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.requiredHosts.length, 8, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.requiredHosts.length; ++i0) {
encoder1.encode(this.requiredHosts[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
if (this.excludedHosts == null) {
encoder0.encodeNullPointer(16, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.excludedHosts.length, 16, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.excludedHosts.length; ++i0) {
encoder1.encode(this.excludedHosts[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
if (this.excludedSpkis == null) {
encoder0.encodeNullPointer(24, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.excludedSpkis.length, 24, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.excludedSpkis.length; ++i0) {
encoder1.encode(this.excludedSpkis[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
if (this.excludedLegacySpkis == null) {
encoder0.encodeNullPointer(32, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.excludedLegacySpkis.length, 32, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.excludedLegacySpkis.length; ++i0) {
encoder1.encode(this.excludedLegacySpkis[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
}
}
static final class NetworkContextAddExpectCtParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String host;
public org.chromium.mojo_base.mojom.Time expiry;
public boolean enforce;
public org.chromium.url.mojom.Url reportUri;
private NetworkContextAddExpectCtParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddExpectCtParams() {
this(0);
}
public static NetworkContextAddExpectCtParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddExpectCtParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddExpectCtParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddExpectCtParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddExpectCtParams(elementsOrVersion);
{
result.host = decoder0.readString(8, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.expiry = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
result.enforce = decoder0.readBoolean(24, 0);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(32, false);
result.reportUri = org.chromium.url.mojom.Url.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.host, 8, false);
encoder0.encode(this.expiry, 16, false);
encoder0.encode(this.enforce, 24, 0);
encoder0.encode(this.reportUri, 32, false);
}
}
static final class NetworkContextAddExpectCtResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean success;
private NetworkContextAddExpectCtResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddExpectCtResponseParams() {
this(0);
}
public static NetworkContextAddExpectCtResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddExpectCtResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddExpectCtResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddExpectCtResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddExpectCtResponseParams(elementsOrVersion);
{
result.success = decoder0.readBoolean(8, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.success, 8, 0);
}
}
static class NetworkContextAddExpectCtResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.AddExpectCtResponse mCallback;
NetworkContextAddExpectCtResponseParamsForwardToCallback(NetworkContext.AddExpectCtResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(ADD_EXPECT_CT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextAddExpectCtResponseParams response = NetworkContextAddExpectCtResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.success);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextAddExpectCtResponseParamsProxyToResponder implements NetworkContext.AddExpectCtResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextAddExpectCtResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Boolean success) {
NetworkContextAddExpectCtResponseParams _response = new NetworkContextAddExpectCtResponseParams();
_response.success = success;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
ADD_EXPECT_CT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextSetExpectCtTestReportParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url reportUri;
private NetworkContextSetExpectCtTestReportParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetExpectCtTestReportParams() {
this(0);
}
public static NetworkContextSetExpectCtTestReportParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetExpectCtTestReportParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetExpectCtTestReportParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetExpectCtTestReportParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetExpectCtTestReportParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.reportUri = org.chromium.url.mojom.Url.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.reportUri, 8, false);
}
}
static final class NetworkContextSetExpectCtTestReportResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean success;
private NetworkContextSetExpectCtTestReportResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetExpectCtTestReportResponseParams() {
this(0);
}
public static NetworkContextSetExpectCtTestReportResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetExpectCtTestReportResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetExpectCtTestReportResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetExpectCtTestReportResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetExpectCtTestReportResponseParams(elementsOrVersion);
{
result.success = decoder0.readBoolean(8, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.success, 8, 0);
}
}
static class NetworkContextSetExpectCtTestReportResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.SetExpectCtTestReportResponse mCallback;
NetworkContextSetExpectCtTestReportResponseParamsForwardToCallback(NetworkContext.SetExpectCtTestReportResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(SET_EXPECT_CT_TEST_REPORT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextSetExpectCtTestReportResponseParams response = NetworkContextSetExpectCtTestReportResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.success);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextSetExpectCtTestReportResponseParamsProxyToResponder implements NetworkContext.SetExpectCtTestReportResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextSetExpectCtTestReportResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Boolean success) {
NetworkContextSetExpectCtTestReportResponseParams _response = new NetworkContextSetExpectCtTestReportResponseParams();
_response.success = success;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
SET_EXPECT_CT_TEST_REPORT_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextGetExpectCtStateParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String domain;
private NetworkContextGetExpectCtStateParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetExpectCtStateParams() {
this(0);
}
public static NetworkContextGetExpectCtStateParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetExpectCtStateParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetExpectCtStateParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetExpectCtStateParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetExpectCtStateParams(elementsOrVersion);
{
result.domain = decoder0.readString(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.domain, 8, false);
}
}
static final class NetworkContextGetExpectCtStateResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.DictionaryValue state;
private NetworkContextGetExpectCtStateResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetExpectCtStateResponseParams() {
this(0);
}
public static NetworkContextGetExpectCtStateResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetExpectCtStateResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetExpectCtStateResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetExpectCtStateResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetExpectCtStateResponseParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.state = org.chromium.mojo_base.mojom.DictionaryValue.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.state, 8, false);
}
}
static class NetworkContextGetExpectCtStateResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.GetExpectCtStateResponse mCallback;
NetworkContextGetExpectCtStateResponseParamsForwardToCallback(NetworkContext.GetExpectCtStateResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(GET_EXPECT_CT_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextGetExpectCtStateResponseParams response = NetworkContextGetExpectCtStateResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.state);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextGetExpectCtStateResponseParamsProxyToResponder implements NetworkContext.GetExpectCtStateResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextGetExpectCtStateResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(org.chromium.mojo_base.mojom.DictionaryValue state) {
NetworkContextGetExpectCtStateResponseParams _response = new NetworkContextGetExpectCtStateResponseParams();
_response.state = state;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
GET_EXPECT_CT_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCreateUdpSocketParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<UdpSocket> request;
public UdpSocketReceiver receiver;
private NetworkContextCreateUdpSocketParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateUdpSocketParams() {
this(0);
}
public static NetworkContextCreateUdpSocketParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateUdpSocketParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateUdpSocketParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateUdpSocketParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateUdpSocketParams(elementsOrVersion);
{
result.request = decoder0.readInterfaceRequest(8, false);
}
{
result.receiver = decoder0.readServiceInterface(12, true, UdpSocketReceiver.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.request, 8, false);
encoder0.encode(this.receiver, 12, true, UdpSocketReceiver.MANAGER);
}
}
static final class NetworkContextCreateTcpServerSocketParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public IpEndPoint localAddr;
public int backlog;
public MutableNetworkTrafficAnnotationTag trafficAnnotation;
public org.chromium.mojo.bindings.InterfaceRequest<TcpServerSocket> socket;
private NetworkContextCreateTcpServerSocketParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateTcpServerSocketParams() {
this(0);
}
public static NetworkContextCreateTcpServerSocketParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpServerSocketParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpServerSocketParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpServerSocketParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpServerSocketParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.localAddr = IpEndPoint.decode(decoder1);
}
{
result.backlog = decoder0.readInt(16);
}
{
result.socket = decoder0.readInterfaceRequest(20, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
result.trafficAnnotation = MutableNetworkTrafficAnnotationTag.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.localAddr, 8, false);
encoder0.encode(this.backlog, 16);
encoder0.encode(this.socket, 20, false);
encoder0.encode(this.trafficAnnotation, 24, false);
}
}
static final class NetworkContextCreateTcpServerSocketResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int result;
public IpEndPoint localAddrOut;
private NetworkContextCreateTcpServerSocketResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateTcpServerSocketResponseParams() {
this(0);
}
public static NetworkContextCreateTcpServerSocketResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpServerSocketResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpServerSocketResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpServerSocketResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpServerSocketResponseParams(elementsOrVersion);
{
result.result = decoder0.readInt(8);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, true);
result.localAddrOut = IpEndPoint.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.result, 8);
encoder0.encode(this.localAddrOut, 16, true);
}
}
static class NetworkContextCreateTcpServerSocketResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.CreateTcpServerSocketResponse mCallback;
NetworkContextCreateTcpServerSocketResponseParamsForwardToCallback(NetworkContext.CreateTcpServerSocketResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CREATE_TCP_SERVER_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextCreateTcpServerSocketResponseParams response = NetworkContextCreateTcpServerSocketResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.result, response.localAddrOut);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextCreateTcpServerSocketResponseParamsProxyToResponder implements NetworkContext.CreateTcpServerSocketResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextCreateTcpServerSocketResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Integer result, IpEndPoint localAddrOut) {
NetworkContextCreateTcpServerSocketResponseParams _response = new NetworkContextCreateTcpServerSocketResponseParams();
_response.result = result;
_response.localAddrOut = localAddrOut;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_SERVER_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCreateTcpConnectedSocketParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 56;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(56, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public IpEndPoint localAddr;
public AddressList remoteAddrList;
public TcpConnectedSocketOptions tcpConnectedSocketOptions;
public MutableNetworkTrafficAnnotationTag trafficAnnotation;
public org.chromium.mojo.bindings.InterfaceRequest<TcpConnectedSocket> socket;
public SocketObserver observer;
private NetworkContextCreateTcpConnectedSocketParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateTcpConnectedSocketParams() {
this(0);
}
public static NetworkContextCreateTcpConnectedSocketParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpConnectedSocketParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpConnectedSocketParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpConnectedSocketParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpConnectedSocketParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.localAddr = IpEndPoint.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.remoteAddrList = AddressList.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, true);
result.tcpConnectedSocketOptions = TcpConnectedSocketOptions.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(32, false);
result.trafficAnnotation = MutableNetworkTrafficAnnotationTag.decode(decoder1);
}
{
result.socket = decoder0.readInterfaceRequest(40, false);
}
{
result.observer = decoder0.readServiceInterface(44, true, SocketObserver.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.localAddr, 8, true);
encoder0.encode(this.remoteAddrList, 16, false);
encoder0.encode(this.tcpConnectedSocketOptions, 24, true);
encoder0.encode(this.trafficAnnotation, 32, false);
encoder0.encode(this.socket, 40, false);
encoder0.encode(this.observer, 44, true, SocketObserver.MANAGER);
}
}
static final class NetworkContextCreateTcpConnectedSocketResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int result;
public IpEndPoint localAddr;
public IpEndPoint peerAddr;
public org.chromium.mojo.system.DataPipe.ConsumerHandle receiveStream;
public org.chromium.mojo.system.DataPipe.ProducerHandle sendStream;
private NetworkContextCreateTcpConnectedSocketResponseParams(int version) {
super(STRUCT_SIZE, version);
this.receiveStream = org.chromium.mojo.system.InvalidHandle.INSTANCE;
this.sendStream = org.chromium.mojo.system.InvalidHandle.INSTANCE;
}
public NetworkContextCreateTcpConnectedSocketResponseParams() {
this(0);
}
public static NetworkContextCreateTcpConnectedSocketResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpConnectedSocketResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpConnectedSocketResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpConnectedSocketResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpConnectedSocketResponseParams(elementsOrVersion);
{
result.result = decoder0.readInt(8);
}
{
result.receiveStream = decoder0.readConsumerHandle(12, true);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, true);
result.localAddr = IpEndPoint.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, true);
result.peerAddr = IpEndPoint.decode(decoder1);
}
{
result.sendStream = decoder0.readProducerHandle(32, true);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.result, 8);
encoder0.encode(this.receiveStream, 12, true);
encoder0.encode(this.localAddr, 16, true);
encoder0.encode(this.peerAddr, 24, true);
encoder0.encode(this.sendStream, 32, true);
}
}
static class NetworkContextCreateTcpConnectedSocketResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.CreateTcpConnectedSocketResponse mCallback;
NetworkContextCreateTcpConnectedSocketResponseParamsForwardToCallback(NetworkContext.CreateTcpConnectedSocketResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CREATE_TCP_CONNECTED_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextCreateTcpConnectedSocketResponseParams response = NetworkContextCreateTcpConnectedSocketResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.result, response.localAddr, response.peerAddr, response.receiveStream, response.sendStream);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextCreateTcpConnectedSocketResponseParamsProxyToResponder implements NetworkContext.CreateTcpConnectedSocketResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextCreateTcpConnectedSocketResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Integer result, IpEndPoint localAddr, IpEndPoint peerAddr, org.chromium.mojo.system.DataPipe.ConsumerHandle receiveStream, org.chromium.mojo.system.DataPipe.ProducerHandle sendStream) {
NetworkContextCreateTcpConnectedSocketResponseParams _response = new NetworkContextCreateTcpConnectedSocketResponseParams();
_response.result = result;
_response.localAddr = localAddr;
_response.peerAddr = peerAddr;
_response.receiveStream = receiveStream;
_response.sendStream = sendStream;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_CONNECTED_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCreateTcpBoundSocketParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public IpEndPoint localAddr;
public MutableNetworkTrafficAnnotationTag trafficAnnotation;
public org.chromium.mojo.bindings.InterfaceRequest<TcpBoundSocket> socket;
private NetworkContextCreateTcpBoundSocketParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateTcpBoundSocketParams() {
this(0);
}
public static NetworkContextCreateTcpBoundSocketParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpBoundSocketParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpBoundSocketParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpBoundSocketParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpBoundSocketParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.localAddr = IpEndPoint.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.trafficAnnotation = MutableNetworkTrafficAnnotationTag.decode(decoder1);
}
{
result.socket = decoder0.readInterfaceRequest(24, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.localAddr, 8, false);
encoder0.encode(this.trafficAnnotation, 16, false);
encoder0.encode(this.socket, 24, false);
}
}
static final class NetworkContextCreateTcpBoundSocketResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int result;
public IpEndPoint localAddr;
private NetworkContextCreateTcpBoundSocketResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateTcpBoundSocketResponseParams() {
this(0);
}
public static NetworkContextCreateTcpBoundSocketResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateTcpBoundSocketResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateTcpBoundSocketResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateTcpBoundSocketResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateTcpBoundSocketResponseParams(elementsOrVersion);
{
result.result = decoder0.readInt(8);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, true);
result.localAddr = IpEndPoint.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.result, 8);
encoder0.encode(this.localAddr, 16, true);
}
}
static class NetworkContextCreateTcpBoundSocketResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.CreateTcpBoundSocketResponse mCallback;
NetworkContextCreateTcpBoundSocketResponseParamsForwardToCallback(NetworkContext.CreateTcpBoundSocketResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CREATE_TCP_BOUND_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextCreateTcpBoundSocketResponseParams response = NetworkContextCreateTcpBoundSocketResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.result, response.localAddr);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextCreateTcpBoundSocketResponseParamsProxyToResponder implements NetworkContext.CreateTcpBoundSocketResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextCreateTcpBoundSocketResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Integer result, IpEndPoint localAddr) {
NetworkContextCreateTcpBoundSocketResponseParams _response = new NetworkContextCreateTcpBoundSocketResponseParams();
_response.result = result;
_response.localAddr = localAddr;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CREATE_TCP_BOUND_SOCKET_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCreateProxyResolvingSocketFactoryParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<ProxyResolvingSocketFactory> factory;
private NetworkContextCreateProxyResolvingSocketFactoryParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateProxyResolvingSocketFactoryParams() {
this(0);
}
public static NetworkContextCreateProxyResolvingSocketFactoryParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateProxyResolvingSocketFactoryParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateProxyResolvingSocketFactoryParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateProxyResolvingSocketFactoryParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateProxyResolvingSocketFactoryParams(elementsOrVersion);
{
result.factory = decoder0.readInterfaceRequest(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.factory, 8, false);
}
}
static final class NetworkContextLookUpProxyForUrlParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url url;
public ProxyLookupClient proxyLookupClient;
private NetworkContextLookUpProxyForUrlParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextLookUpProxyForUrlParams() {
this(0);
}
public static NetworkContextLookUpProxyForUrlParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextLookUpProxyForUrlParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextLookUpProxyForUrlParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextLookUpProxyForUrlParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextLookUpProxyForUrlParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.proxyLookupClient = decoder0.readServiceInterface(16, false, ProxyLookupClient.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.url, 8, false);
encoder0.encode(this.proxyLookupClient, 16, false, ProxyLookupClient.MANAGER);
}
}
static final class NetworkContextForceReloadProxyConfigParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextForceReloadProxyConfigParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextForceReloadProxyConfigParams() {
this(0);
}
public static NetworkContextForceReloadProxyConfigParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextForceReloadProxyConfigParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextForceReloadProxyConfigParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextForceReloadProxyConfigParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextForceReloadProxyConfigParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextForceReloadProxyConfigResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextForceReloadProxyConfigResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextForceReloadProxyConfigResponseParams() {
this(0);
}
public static NetworkContextForceReloadProxyConfigResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextForceReloadProxyConfigResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextForceReloadProxyConfigResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextForceReloadProxyConfigResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextForceReloadProxyConfigResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextForceReloadProxyConfigResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ForceReloadProxyConfigResponse mCallback;
NetworkContextForceReloadProxyConfigResponseParamsForwardToCallback(NetworkContext.ForceReloadProxyConfigResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(FORCE_RELOAD_PROXY_CONFIG_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextForceReloadProxyConfigResponseParamsProxyToResponder implements NetworkContext.ForceReloadProxyConfigResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextForceReloadProxyConfigResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextForceReloadProxyConfigResponseParams _response = new NetworkContextForceReloadProxyConfigResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
FORCE_RELOAD_PROXY_CONFIG_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextClearBadProxiesCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearBadProxiesCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearBadProxiesCacheParams() {
this(0);
}
public static NetworkContextClearBadProxiesCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearBadProxiesCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearBadProxiesCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearBadProxiesCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearBadProxiesCacheParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextClearBadProxiesCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextClearBadProxiesCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextClearBadProxiesCacheResponseParams() {
this(0);
}
public static NetworkContextClearBadProxiesCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextClearBadProxiesCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextClearBadProxiesCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextClearBadProxiesCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextClearBadProxiesCacheResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextClearBadProxiesCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ClearBadProxiesCacheResponse mCallback;
NetworkContextClearBadProxiesCacheResponseParamsForwardToCallback(NetworkContext.ClearBadProxiesCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(CLEAR_BAD_PROXIES_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextClearBadProxiesCacheResponseParamsProxyToResponder implements NetworkContext.ClearBadProxiesCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextClearBadProxiesCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextClearBadProxiesCacheResponseParams _response = new NetworkContextClearBadProxiesCacheResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
CLEAR_BAD_PROXIES_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextCreateWebSocketParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<WebSocket> request;
public int processId;
public int renderFrameId;
public org.chromium.url.mojom.Origin origin;
public AuthenticationHandler authHandler;
private NetworkContextCreateWebSocketParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateWebSocketParams() {
this(0);
}
public static NetworkContextCreateWebSocketParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateWebSocketParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateWebSocketParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateWebSocketParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateWebSocketParams(elementsOrVersion);
{
result.request = decoder0.readInterfaceRequest(8, false);
}
{
result.processId = decoder0.readInt(12);
}
{
result.renderFrameId = decoder0.readInt(16);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
result.origin = org.chromium.url.mojom.Origin.decode(decoder1);
}
{
result.authHandler = decoder0.readServiceInterface(32, true, AuthenticationHandler.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.request, 8, false);
encoder0.encode(this.processId, 12);
encoder0.encode(this.renderFrameId, 16);
encoder0.encode(this.origin, 24, false);
encoder0.encode(this.authHandler, 32, true, AuthenticationHandler.MANAGER);
}
}
static final class NetworkContextCreateNetLogExporterParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<NetLogExporter> exporter;
private NetworkContextCreateNetLogExporterParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateNetLogExporterParams() {
this(0);
}
public static NetworkContextCreateNetLogExporterParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateNetLogExporterParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateNetLogExporterParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateNetLogExporterParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateNetLogExporterParams(elementsOrVersion);
{
result.exporter = decoder0.readInterfaceRequest(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.exporter, 8, false);
}
}
static final class NetworkContextPreconnectSocketsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int numStreams;
public org.chromium.url.mojom.Url url;
public int loadFlags;
public boolean privacyModeEnabled;
private NetworkContextPreconnectSocketsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextPreconnectSocketsParams() {
this(0);
}
public static NetworkContextPreconnectSocketsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextPreconnectSocketsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextPreconnectSocketsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextPreconnectSocketsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextPreconnectSocketsParams(elementsOrVersion);
{
result.numStreams = decoder0.readInt(8);
}
{
result.loadFlags = decoder0.readInt(12);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.privacyModeEnabled = decoder0.readBoolean(24, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.numStreams, 8);
encoder0.encode(this.loadFlags, 12);
encoder0.encode(this.url, 16, false);
encoder0.encode(this.privacyModeEnabled, 24, 0);
}
}
static final class NetworkContextCreateP2pSocketManagerParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public P2pTrustedSocketManagerClient client;
public org.chromium.mojo.bindings.InterfaceRequest<P2pTrustedSocketManager> trustedSocketManager;
public org.chromium.mojo.bindings.InterfaceRequest<P2pSocketManager> socketManager;
private NetworkContextCreateP2pSocketManagerParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateP2pSocketManagerParams() {
this(0);
}
public static NetworkContextCreateP2pSocketManagerParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateP2pSocketManagerParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateP2pSocketManagerParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateP2pSocketManagerParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateP2pSocketManagerParams(elementsOrVersion);
{
result.client = decoder0.readServiceInterface(8, false, P2pTrustedSocketManagerClient.MANAGER);
}
{
result.trustedSocketManager = decoder0.readInterfaceRequest(16, false);
}
{
result.socketManager = decoder0.readInterfaceRequest(20, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.client, 8, false, P2pTrustedSocketManagerClient.MANAGER);
encoder0.encode(this.trustedSocketManager, 16, false);
encoder0.encode(this.socketManager, 20, false);
}
}
static final class NetworkContextCreateMdnsResponderParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo.bindings.InterfaceRequest<MdnsResponder> responderRequest;
private NetworkContextCreateMdnsResponderParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateMdnsResponderParams() {
this(0);
}
public static NetworkContextCreateMdnsResponderParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateMdnsResponderParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateMdnsResponderParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateMdnsResponderParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateMdnsResponderParams(elementsOrVersion);
{
result.responderRequest = decoder0.readInterfaceRequest(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.responderRequest, 8, false);
}
}
static final class NetworkContextResolveHostParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public HostPortPair host;
public ResolveHostParameters optionalParameters;
public ResolveHostClient responseClient;
private NetworkContextResolveHostParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextResolveHostParams() {
this(0);
}
public static NetworkContextResolveHostParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextResolveHostParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextResolveHostParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextResolveHostParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextResolveHostParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.host = HostPortPair.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, true);
result.optionalParameters = ResolveHostParameters.decode(decoder1);
}
{
result.responseClient = decoder0.readServiceInterface(24, false, ResolveHostClient.MANAGER);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.host, 8, false);
encoder0.encode(this.optionalParameters, 16, true);
encoder0.encode(this.responseClient, 24, false, ResolveHostClient.MANAGER);
}
}
static final class NetworkContextCreateHostResolverParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public DnsConfigOverrides configOverrides;
public org.chromium.mojo.bindings.InterfaceRequest<HostResolver> hostResolver;
private NetworkContextCreateHostResolverParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextCreateHostResolverParams() {
this(0);
}
public static NetworkContextCreateHostResolverParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextCreateHostResolverParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextCreateHostResolverParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextCreateHostResolverParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextCreateHostResolverParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.configOverrides = DnsConfigOverrides.decode(decoder1);
}
{
result.hostResolver = decoder0.readInterfaceRequest(16, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.configOverrides, 8, true);
encoder0.encode(this.hostResolver, 16, false);
}
}
static final class NetworkContextVerifyCertForSignedExchangeParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 40;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(40, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public X509Certificate certificate;
public org.chromium.url.mojom.Url url;
public String ocspResponse;
public String sctList;
private NetworkContextVerifyCertForSignedExchangeParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextVerifyCertForSignedExchangeParams() {
this(0);
}
public static NetworkContextVerifyCertForSignedExchangeParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextVerifyCertForSignedExchangeParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextVerifyCertForSignedExchangeParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextVerifyCertForSignedExchangeParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextVerifyCertForSignedExchangeParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.certificate = X509Certificate.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
{
result.ocspResponse = decoder0.readString(24, false);
}
{
result.sctList = decoder0.readString(32, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.certificate, 8, false);
encoder0.encode(this.url, 16, false);
encoder0.encode(this.ocspResponse, 24, false);
encoder0.encode(this.sctList, 32, false);
}
}
static final class NetworkContextVerifyCertForSignedExchangeResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int errorCode;
public CertVerifyResult cvResult;
public CtVerifyResult ctResult;
private NetworkContextVerifyCertForSignedExchangeResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextVerifyCertForSignedExchangeResponseParams() {
this(0);
}
public static NetworkContextVerifyCertForSignedExchangeResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextVerifyCertForSignedExchangeResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextVerifyCertForSignedExchangeResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextVerifyCertForSignedExchangeResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextVerifyCertForSignedExchangeResponseParams(elementsOrVersion);
{
result.errorCode = decoder0.readInt(8);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.cvResult = CertVerifyResult.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
result.ctResult = CtVerifyResult.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.errorCode, 8);
encoder0.encode(this.cvResult, 16, false);
encoder0.encode(this.ctResult, 24, false);
}
}
static class NetworkContextVerifyCertForSignedExchangeResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.VerifyCertForSignedExchangeResponse mCallback;
NetworkContextVerifyCertForSignedExchangeResponseParamsForwardToCallback(NetworkContext.VerifyCertForSignedExchangeResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(VERIFY_CERT_FOR_SIGNED_EXCHANGE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextVerifyCertForSignedExchangeResponseParams response = NetworkContextVerifyCertForSignedExchangeResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.errorCode, response.cvResult, response.ctResult);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextVerifyCertForSignedExchangeResponseParamsProxyToResponder implements NetworkContext.VerifyCertForSignedExchangeResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextVerifyCertForSignedExchangeResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Integer errorCode, CertVerifyResult cvResult, CtVerifyResult ctResult) {
NetworkContextVerifyCertForSignedExchangeResponseParams _response = new NetworkContextVerifyCertForSignedExchangeResponseParams();
_response.errorCode = errorCode;
_response.cvResult = cvResult;
_response.ctResult = ctResult;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
VERIFY_CERT_FOR_SIGNED_EXCHANGE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextAddHstsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String host;
public org.chromium.mojo_base.mojom.Time expiry;
public boolean includeSubdomains;
private NetworkContextAddHstsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddHstsParams() {
this(0);
}
public static NetworkContextAddHstsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddHstsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddHstsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddHstsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddHstsParams(elementsOrVersion);
{
result.host = decoder0.readString(8, false);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.expiry = org.chromium.mojo_base.mojom.Time.decode(decoder1);
}
{
result.includeSubdomains = decoder0.readBoolean(24, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.host, 8, false);
encoder0.encode(this.expiry, 16, false);
encoder0.encode(this.includeSubdomains, 24, 0);
}
}
static final class NetworkContextAddHstsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextAddHstsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddHstsResponseParams() {
this(0);
}
public static NetworkContextAddHstsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddHstsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddHstsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddHstsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddHstsResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextAddHstsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.AddHstsResponse mCallback;
NetworkContextAddHstsResponseParamsForwardToCallback(NetworkContext.AddHstsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(ADD_HSTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextAddHstsResponseParamsProxyToResponder implements NetworkContext.AddHstsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextAddHstsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextAddHstsResponseParams _response = new NetworkContextAddHstsResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
ADD_HSTS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextIsHstsActiveForHostParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String host;
private NetworkContextIsHstsActiveForHostParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextIsHstsActiveForHostParams() {
this(0);
}
public static NetworkContextIsHstsActiveForHostParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextIsHstsActiveForHostParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextIsHstsActiveForHostParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextIsHstsActiveForHostParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextIsHstsActiveForHostParams(elementsOrVersion);
{
result.host = decoder0.readString(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.host, 8, false);
}
}
static final class NetworkContextIsHstsActiveForHostResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean result;
private NetworkContextIsHstsActiveForHostResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextIsHstsActiveForHostResponseParams() {
this(0);
}
public static NetworkContextIsHstsActiveForHostResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextIsHstsActiveForHostResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextIsHstsActiveForHostResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextIsHstsActiveForHostResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextIsHstsActiveForHostResponseParams(elementsOrVersion);
{
result.result = decoder0.readBoolean(8, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.result, 8, 0);
}
}
static class NetworkContextIsHstsActiveForHostResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.IsHstsActiveForHostResponse mCallback;
NetworkContextIsHstsActiveForHostResponseParamsForwardToCallback(NetworkContext.IsHstsActiveForHostResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(IS_HSTS_ACTIVE_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextIsHstsActiveForHostResponseParams response = NetworkContextIsHstsActiveForHostResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.result);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextIsHstsActiveForHostResponseParamsProxyToResponder implements NetworkContext.IsHstsActiveForHostResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextIsHstsActiveForHostResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Boolean result) {
NetworkContextIsHstsActiveForHostResponseParams _response = new NetworkContextIsHstsActiveForHostResponseParams();
_response.result = result;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
IS_HSTS_ACTIVE_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextGetHstsStateParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String domain;
private NetworkContextGetHstsStateParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetHstsStateParams() {
this(0);
}
public static NetworkContextGetHstsStateParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetHstsStateParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetHstsStateParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetHstsStateParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetHstsStateParams(elementsOrVersion);
{
result.domain = decoder0.readString(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.domain, 8, false);
}
}
static final class NetworkContextGetHstsStateResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.DictionaryValue state;
private NetworkContextGetHstsStateResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextGetHstsStateResponseParams() {
this(0);
}
public static NetworkContextGetHstsStateResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextGetHstsStateResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextGetHstsStateResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextGetHstsStateResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextGetHstsStateResponseParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.state = org.chromium.mojo_base.mojom.DictionaryValue.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.state, 8, false);
}
}
static class NetworkContextGetHstsStateResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.GetHstsStateResponse mCallback;
NetworkContextGetHstsStateResponseParamsForwardToCallback(NetworkContext.GetHstsStateResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(GET_HSTS_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextGetHstsStateResponseParams response = NetworkContextGetHstsStateResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.state);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextGetHstsStateResponseParamsProxyToResponder implements NetworkContext.GetHstsStateResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextGetHstsStateResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(org.chromium.mojo_base.mojom.DictionaryValue state) {
NetworkContextGetHstsStateResponseParams _response = new NetworkContextGetHstsStateResponseParams();
_response.state = state;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
GET_HSTS_STATE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextSetCorsOriginAccessListsForOriginParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Origin sourceOrigin;
public CorsOriginPattern[] allowPatterns;
public CorsOriginPattern[] blockPatterns;
private NetworkContextSetCorsOriginAccessListsForOriginParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetCorsOriginAccessListsForOriginParams() {
this(0);
}
public static NetworkContextSetCorsOriginAccessListsForOriginParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetCorsOriginAccessListsForOriginParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetCorsOriginAccessListsForOriginParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetCorsOriginAccessListsForOriginParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetCorsOriginAccessListsForOriginParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.sourceOrigin = org.chromium.url.mojom.Origin.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.allowPatterns = new CorsOriginPattern[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
org.chromium.mojo.bindings.Decoder decoder2 = decoder1.readPointer(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
result.allowPatterns[i1] = CorsOriginPattern.decode(decoder2);
}
}
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(24, false);
{
org.chromium.mojo.bindings.DataHeader si1 = decoder1.readDataHeaderForPointerArray(org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
result.blockPatterns = new CorsOriginPattern[si1.elementsOrVersion];
for (int i1 = 0; i1 < si1.elementsOrVersion; ++i1) {
org.chromium.mojo.bindings.Decoder decoder2 = decoder1.readPointer(org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i1, false);
result.blockPatterns[i1] = CorsOriginPattern.decode(decoder2);
}
}
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.sourceOrigin, 8, false);
if (this.allowPatterns == null) {
encoder0.encodeNullPointer(16, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.allowPatterns.length, 16, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.allowPatterns.length; ++i0) {
encoder1.encode(this.allowPatterns[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
if (this.blockPatterns == null) {
encoder0.encodeNullPointer(24, false);
} else {
org.chromium.mojo.bindings.Encoder encoder1 = encoder0.encodePointerArray(this.blockPatterns.length, 24, org.chromium.mojo.bindings.BindingsHelper.UNSPECIFIED_ARRAY_LENGTH);
for (int i0 = 0; i0 < this.blockPatterns.length; ++i0) {
encoder1.encode(this.blockPatterns[i0], org.chromium.mojo.bindings.DataHeader.HEADER_SIZE + org.chromium.mojo.bindings.BindingsHelper.POINTER_SIZE * i0, false);
}
}
}
}
static final class NetworkContextSetCorsOriginAccessListsForOriginResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextSetCorsOriginAccessListsForOriginResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetCorsOriginAccessListsForOriginResponseParams() {
this(0);
}
public static NetworkContextSetCorsOriginAccessListsForOriginResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetCorsOriginAccessListsForOriginResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetCorsOriginAccessListsForOriginResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetCorsOriginAccessListsForOriginResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetCorsOriginAccessListsForOriginResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextSetCorsOriginAccessListsForOriginResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.SetCorsOriginAccessListsForOriginResponse mCallback;
NetworkContextSetCorsOriginAccessListsForOriginResponseParamsForwardToCallback(NetworkContext.SetCorsOriginAccessListsForOriginResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(SET_CORS_ORIGIN_ACCESS_LISTS_FOR_ORIGIN_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextSetCorsOriginAccessListsForOriginResponseParamsProxyToResponder implements NetworkContext.SetCorsOriginAccessListsForOriginResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextSetCorsOriginAccessListsForOriginResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextSetCorsOriginAccessListsForOriginResponseParams _response = new NetworkContextSetCorsOriginAccessListsForOriginResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
SET_CORS_ORIGIN_ACCESS_LISTS_FOR_ORIGIN_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextDeleteDynamicDataForHostParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public String host;
private NetworkContextDeleteDynamicDataForHostParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextDeleteDynamicDataForHostParams() {
this(0);
}
public static NetworkContextDeleteDynamicDataForHostParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextDeleteDynamicDataForHostParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextDeleteDynamicDataForHostParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextDeleteDynamicDataForHostParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextDeleteDynamicDataForHostParams(elementsOrVersion);
{
result.host = decoder0.readString(8, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.host, 8, false);
}
}
static final class NetworkContextDeleteDynamicDataForHostResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public boolean result;
private NetworkContextDeleteDynamicDataForHostResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextDeleteDynamicDataForHostResponseParams() {
this(0);
}
public static NetworkContextDeleteDynamicDataForHostResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextDeleteDynamicDataForHostResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextDeleteDynamicDataForHostResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextDeleteDynamicDataForHostResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextDeleteDynamicDataForHostResponseParams(elementsOrVersion);
{
result.result = decoder0.readBoolean(8, 0);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.result, 8, 0);
}
}
static class NetworkContextDeleteDynamicDataForHostResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.DeleteDynamicDataForHostResponse mCallback;
NetworkContextDeleteDynamicDataForHostResponseParamsForwardToCallback(NetworkContext.DeleteDynamicDataForHostResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(DELETE_DYNAMIC_DATA_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextDeleteDynamicDataForHostResponseParams response = NetworkContextDeleteDynamicDataForHostResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.result);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextDeleteDynamicDataForHostResponseParamsProxyToResponder implements NetworkContext.DeleteDynamicDataForHostResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextDeleteDynamicDataForHostResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Boolean result) {
NetworkContextDeleteDynamicDataForHostResponseParams _response = new NetworkContextDeleteDynamicDataForHostResponseParams();
_response.result = result;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
DELETE_DYNAMIC_DATA_FOR_HOST_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextSaveHttpAuthCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextSaveHttpAuthCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSaveHttpAuthCacheParams() {
this(0);
}
public static NetworkContextSaveHttpAuthCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSaveHttpAuthCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSaveHttpAuthCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSaveHttpAuthCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSaveHttpAuthCacheParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextSaveHttpAuthCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.UnguessableToken cacheKey;
private NetworkContextSaveHttpAuthCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSaveHttpAuthCacheResponseParams() {
this(0);
}
public static NetworkContextSaveHttpAuthCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSaveHttpAuthCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSaveHttpAuthCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSaveHttpAuthCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSaveHttpAuthCacheResponseParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.cacheKey = org.chromium.mojo_base.mojom.UnguessableToken.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.cacheKey, 8, false);
}
}
static class NetworkContextSaveHttpAuthCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.SaveHttpAuthCacheResponse mCallback;
NetworkContextSaveHttpAuthCacheResponseParamsForwardToCallback(NetworkContext.SaveHttpAuthCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(SAVE_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextSaveHttpAuthCacheResponseParams response = NetworkContextSaveHttpAuthCacheResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.cacheKey);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextSaveHttpAuthCacheResponseParamsProxyToResponder implements NetworkContext.SaveHttpAuthCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextSaveHttpAuthCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(org.chromium.mojo_base.mojom.UnguessableToken cacheKey) {
NetworkContextSaveHttpAuthCacheResponseParams _response = new NetworkContextSaveHttpAuthCacheResponseParams();
_response.cacheKey = cacheKey;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
SAVE_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextLoadHttpAuthCacheParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.mojo_base.mojom.UnguessableToken cacheKey;
private NetworkContextLoadHttpAuthCacheParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextLoadHttpAuthCacheParams() {
this(0);
}
public static NetworkContextLoadHttpAuthCacheParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextLoadHttpAuthCacheParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextLoadHttpAuthCacheParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextLoadHttpAuthCacheParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextLoadHttpAuthCacheParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.cacheKey = org.chromium.mojo_base.mojom.UnguessableToken.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.cacheKey, 8, false);
}
}
static final class NetworkContextLoadHttpAuthCacheResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextLoadHttpAuthCacheResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextLoadHttpAuthCacheResponseParams() {
this(0);
}
public static NetworkContextLoadHttpAuthCacheResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextLoadHttpAuthCacheResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextLoadHttpAuthCacheResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextLoadHttpAuthCacheResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextLoadHttpAuthCacheResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextLoadHttpAuthCacheResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.LoadHttpAuthCacheResponse mCallback;
NetworkContextLoadHttpAuthCacheResponseParamsForwardToCallback(NetworkContext.LoadHttpAuthCacheResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(LOAD_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextLoadHttpAuthCacheResponseParamsProxyToResponder implements NetworkContext.LoadHttpAuthCacheResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextLoadHttpAuthCacheResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextLoadHttpAuthCacheResponseParams _response = new NetworkContextLoadHttpAuthCacheResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
LOAD_HTTP_AUTH_CACHE_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextLookupBasicAuthCredentialsParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url url;
private NetworkContextLookupBasicAuthCredentialsParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextLookupBasicAuthCredentialsParams() {
this(0);
}
public static NetworkContextLookupBasicAuthCredentialsParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextLookupBasicAuthCredentialsParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextLookupBasicAuthCredentialsParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextLookupBasicAuthCredentialsParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextLookupBasicAuthCredentialsParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.url = org.chromium.url.mojom.Url.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.url, 8, false);
}
}
static final class NetworkContextLookupBasicAuthCredentialsResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public AuthCredentials credentials;
private NetworkContextLookupBasicAuthCredentialsResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextLookupBasicAuthCredentialsResponseParams() {
this(0);
}
public static NetworkContextLookupBasicAuthCredentialsResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextLookupBasicAuthCredentialsResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextLookupBasicAuthCredentialsResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextLookupBasicAuthCredentialsResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextLookupBasicAuthCredentialsResponseParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, true);
result.credentials = AuthCredentials.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.credentials, 8, true);
}
}
static class NetworkContextLookupBasicAuthCredentialsResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.LookupBasicAuthCredentialsResponse mCallback;
NetworkContextLookupBasicAuthCredentialsResponseParamsForwardToCallback(NetworkContext.LookupBasicAuthCredentialsResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(LOOKUP_BASIC_AUTH_CREDENTIALS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextLookupBasicAuthCredentialsResponseParams response = NetworkContextLookupBasicAuthCredentialsResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.credentials);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextLookupBasicAuthCredentialsResponseParamsProxyToResponder implements NetworkContext.LookupBasicAuthCredentialsResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextLookupBasicAuthCredentialsResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(AuthCredentials credentials) {
NetworkContextLookupBasicAuthCredentialsResponseParams _response = new NetworkContextLookupBasicAuthCredentialsResponseParams();
_response.credentials = credentials;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
LOOKUP_BASIC_AUTH_CREDENTIALS_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextEnableStaticKeyPinningForTestingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextEnableStaticKeyPinningForTestingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextEnableStaticKeyPinningForTestingParams() {
this(0);
}
public static NetworkContextEnableStaticKeyPinningForTestingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextEnableStaticKeyPinningForTestingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextEnableStaticKeyPinningForTestingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextEnableStaticKeyPinningForTestingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextEnableStaticKeyPinningForTestingParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextEnableStaticKeyPinningForTestingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextEnableStaticKeyPinningForTestingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextEnableStaticKeyPinningForTestingResponseParams() {
this(0);
}
public static NetworkContextEnableStaticKeyPinningForTestingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextEnableStaticKeyPinningForTestingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextEnableStaticKeyPinningForTestingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextEnableStaticKeyPinningForTestingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextEnableStaticKeyPinningForTestingResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextEnableStaticKeyPinningForTestingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.EnableStaticKeyPinningForTestingResponse mCallback;
NetworkContextEnableStaticKeyPinningForTestingResponseParamsForwardToCallback(NetworkContext.EnableStaticKeyPinningForTestingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(ENABLE_STATIC_KEY_PINNING_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextEnableStaticKeyPinningForTestingResponseParamsProxyToResponder implements NetworkContext.EnableStaticKeyPinningForTestingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextEnableStaticKeyPinningForTestingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextEnableStaticKeyPinningForTestingResponseParams _response = new NetworkContextEnableStaticKeyPinningForTestingResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
ENABLE_STATIC_KEY_PINNING_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextSetFailingHttpTransactionForTestingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int rv;
private NetworkContextSetFailingHttpTransactionForTestingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetFailingHttpTransactionForTestingParams() {
this(0);
}
public static NetworkContextSetFailingHttpTransactionForTestingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetFailingHttpTransactionForTestingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetFailingHttpTransactionForTestingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetFailingHttpTransactionForTestingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetFailingHttpTransactionForTestingParams(elementsOrVersion);
{
result.rv = decoder0.readInt(8);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.rv, 8);
}
}
static final class NetworkContextSetFailingHttpTransactionForTestingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextSetFailingHttpTransactionForTestingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextSetFailingHttpTransactionForTestingResponseParams() {
this(0);
}
public static NetworkContextSetFailingHttpTransactionForTestingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextSetFailingHttpTransactionForTestingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextSetFailingHttpTransactionForTestingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextSetFailingHttpTransactionForTestingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextSetFailingHttpTransactionForTestingResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextSetFailingHttpTransactionForTestingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.SetFailingHttpTransactionForTestingResponse mCallback;
NetworkContextSetFailingHttpTransactionForTestingResponseParamsForwardToCallback(NetworkContext.SetFailingHttpTransactionForTestingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(SET_FAILING_HTTP_TRANSACTION_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextSetFailingHttpTransactionForTestingResponseParamsProxyToResponder implements NetworkContext.SetFailingHttpTransactionForTestingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextSetFailingHttpTransactionForTestingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextSetFailingHttpTransactionForTestingResponseParams _response = new NetworkContextSetFailingHttpTransactionForTestingResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
SET_FAILING_HTTP_TRANSACTION_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextVerifyCertificateForTestingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 32;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(32, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public X509Certificate certificate;
public String hostname;
public String ocspResponse;
private NetworkContextVerifyCertificateForTestingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextVerifyCertificateForTestingParams() {
this(0);
}
public static NetworkContextVerifyCertificateForTestingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextVerifyCertificateForTestingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextVerifyCertificateForTestingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextVerifyCertificateForTestingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextVerifyCertificateForTestingParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.certificate = X509Certificate.decode(decoder1);
}
{
result.hostname = decoder0.readString(16, false);
}
{
result.ocspResponse = decoder0.readString(24, false);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.certificate, 8, false);
encoder0.encode(this.hostname, 16, false);
encoder0.encode(this.ocspResponse, 24, false);
}
}
static final class NetworkContextVerifyCertificateForTestingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 16;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(16, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public int errorCode;
private NetworkContextVerifyCertificateForTestingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextVerifyCertificateForTestingResponseParams() {
this(0);
}
public static NetworkContextVerifyCertificateForTestingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextVerifyCertificateForTestingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextVerifyCertificateForTestingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextVerifyCertificateForTestingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextVerifyCertificateForTestingResponseParams(elementsOrVersion);
{
result.errorCode = decoder0.readInt(8);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.errorCode, 8);
}
}
static class NetworkContextVerifyCertificateForTestingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.VerifyCertificateForTestingResponse mCallback;
NetworkContextVerifyCertificateForTestingResponseParamsForwardToCallback(NetworkContext.VerifyCertificateForTestingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(VERIFY_CERTIFICATE_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
NetworkContextVerifyCertificateForTestingResponseParams response = NetworkContextVerifyCertificateForTestingResponseParams.deserialize(messageWithHeader.getPayload());
mCallback.call(response.errorCode);
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextVerifyCertificateForTestingResponseParamsProxyToResponder implements NetworkContext.VerifyCertificateForTestingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextVerifyCertificateForTestingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call(Integer errorCode) {
NetworkContextVerifyCertificateForTestingResponseParams _response = new NetworkContextVerifyCertificateForTestingResponseParams();
_response.errorCode = errorCode;
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
VERIFY_CERTIFICATE_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextAddDomainReliabilityContextForTestingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 24;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(24, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
public org.chromium.url.mojom.Url origin;
public org.chromium.url.mojom.Url uploadUrl;
private NetworkContextAddDomainReliabilityContextForTestingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddDomainReliabilityContextForTestingParams() {
this(0);
}
public static NetworkContextAddDomainReliabilityContextForTestingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddDomainReliabilityContextForTestingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddDomainReliabilityContextForTestingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddDomainReliabilityContextForTestingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddDomainReliabilityContextForTestingParams(elementsOrVersion);
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(8, false);
result.origin = org.chromium.url.mojom.Url.decode(decoder1);
}
{
org.chromium.mojo.bindings.Decoder decoder1 = decoder0.readPointer(16, false);
result.uploadUrl = org.chromium.url.mojom.Url.decode(decoder1);
}
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
org.chromium.mojo.bindings.Encoder encoder0 = encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
encoder0.encode(this.origin, 8, false);
encoder0.encode(this.uploadUrl, 16, false);
}
}
static final class NetworkContextAddDomainReliabilityContextForTestingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextAddDomainReliabilityContextForTestingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextAddDomainReliabilityContextForTestingResponseParams() {
this(0);
}
public static NetworkContextAddDomainReliabilityContextForTestingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextAddDomainReliabilityContextForTestingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextAddDomainReliabilityContextForTestingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextAddDomainReliabilityContextForTestingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextAddDomainReliabilityContextForTestingResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextAddDomainReliabilityContextForTestingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.AddDomainReliabilityContextForTestingResponse mCallback;
NetworkContextAddDomainReliabilityContextForTestingResponseParamsForwardToCallback(NetworkContext.AddDomainReliabilityContextForTestingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(ADD_DOMAIN_RELIABILITY_CONTEXT_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextAddDomainReliabilityContextForTestingResponseParamsProxyToResponder implements NetworkContext.AddDomainReliabilityContextForTestingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextAddDomainReliabilityContextForTestingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextAddDomainReliabilityContextForTestingResponseParams _response = new NetworkContextAddDomainReliabilityContextForTestingResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
ADD_DOMAIN_RELIABILITY_CONTEXT_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
static final class NetworkContextForceDomainReliabilityUploadsForTestingParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextForceDomainReliabilityUploadsForTestingParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextForceDomainReliabilityUploadsForTestingParams() {
this(0);
}
public static NetworkContextForceDomainReliabilityUploadsForTestingParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextForceDomainReliabilityUploadsForTestingParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextForceDomainReliabilityUploadsForTestingParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextForceDomainReliabilityUploadsForTestingParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextForceDomainReliabilityUploadsForTestingParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static final class NetworkContextForceDomainReliabilityUploadsForTestingResponseParams extends org.chromium.mojo.bindings.Struct {
private static final int STRUCT_SIZE = 8;
private static final org.chromium.mojo.bindings.DataHeader[] VERSION_ARRAY = new org.chromium.mojo.bindings.DataHeader[] {new org.chromium.mojo.bindings.DataHeader(8, 0)};
private static final org.chromium.mojo.bindings.DataHeader DEFAULT_STRUCT_INFO = VERSION_ARRAY[0];
private NetworkContextForceDomainReliabilityUploadsForTestingResponseParams(int version) {
super(STRUCT_SIZE, version);
}
public NetworkContextForceDomainReliabilityUploadsForTestingResponseParams() {
this(0);
}
public static NetworkContextForceDomainReliabilityUploadsForTestingResponseParams deserialize(org.chromium.mojo.bindings.Message message) {
return decode(new org.chromium.mojo.bindings.Decoder(message));
}
/**
* Similar to the method above, but deserializes from a |ByteBuffer| instance.
*
* @throws org.chromium.mojo.bindings.DeserializationException on deserialization failure.
*/
public static NetworkContextForceDomainReliabilityUploadsForTestingResponseParams deserialize(java.nio.ByteBuffer data) {
return deserialize(new org.chromium.mojo.bindings.Message(
data, new java.util.ArrayList<org.chromium.mojo.system.Handle>()));
}
@SuppressWarnings("unchecked")
public static NetworkContextForceDomainReliabilityUploadsForTestingResponseParams decode(org.chromium.mojo.bindings.Decoder decoder0) {
if (decoder0 == null) {
return null;
}
decoder0.increaseStackDepth();
NetworkContextForceDomainReliabilityUploadsForTestingResponseParams result;
try {
org.chromium.mojo.bindings.DataHeader mainDataHeader = decoder0.readAndValidateDataHeader(VERSION_ARRAY);
final int elementsOrVersion = mainDataHeader.elementsOrVersion;
result = new NetworkContextForceDomainReliabilityUploadsForTestingResponseParams(elementsOrVersion);
} finally {
decoder0.decreaseStackDepth();
}
return result;
}
@SuppressWarnings("unchecked")
@Override
protected final void encode(org.chromium.mojo.bindings.Encoder encoder) {
encoder.getEncoderAtDataOffset(DEFAULT_STRUCT_INFO);
}
}
static class NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsForwardToCallback extends org.chromium.mojo.bindings.SideEffectFreeCloseable
implements org.chromium.mojo.bindings.MessageReceiver {
private final NetworkContext.ForceDomainReliabilityUploadsForTestingResponse mCallback;
NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsForwardToCallback(NetworkContext.ForceDomainReliabilityUploadsForTestingResponse callback) {
this.mCallback = callback;
}
@Override
public boolean accept(org.chromium.mojo.bindings.Message message) {
try {
org.chromium.mojo.bindings.ServiceMessage messageWithHeader =
message.asServiceMessage();
org.chromium.mojo.bindings.MessageHeader header = messageWithHeader.getHeader();
if (!header.validateHeader(FORCE_DOMAIN_RELIABILITY_UPLOADS_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG)) {
return false;
}
mCallback.call();
return true;
} catch (org.chromium.mojo.bindings.DeserializationException e) {
return false;
}
}
}
static class NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsProxyToResponder implements NetworkContext.ForceDomainReliabilityUploadsForTestingResponse {
private final org.chromium.mojo.system.Core mCore;
private final org.chromium.mojo.bindings.MessageReceiver mMessageReceiver;
private final long mRequestId;
NetworkContextForceDomainReliabilityUploadsForTestingResponseParamsProxyToResponder(
org.chromium.mojo.system.Core core,
org.chromium.mojo.bindings.MessageReceiver messageReceiver,
long requestId) {
mCore = core;
mMessageReceiver = messageReceiver;
mRequestId = requestId;
}
@Override
public void call() {
NetworkContextForceDomainReliabilityUploadsForTestingResponseParams _response = new NetworkContextForceDomainReliabilityUploadsForTestingResponseParams();
org.chromium.mojo.bindings.ServiceMessage _message =
_response.serializeWithHeader(
mCore,
new org.chromium.mojo.bindings.MessageHeader(
FORCE_DOMAIN_RELIABILITY_UPLOADS_FOR_TESTING_ORDINAL,
org.chromium.mojo.bindings.MessageHeader.MESSAGE_IS_RESPONSE_FLAG,
mRequestId));
mMessageReceiver.accept(_message);
}
}
}
| 42.26913 | 298 | 0.637633 |
3d0ea586eab213d4a3deea6080575fa73e80d1d0 | 12,722 | /*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.common.mixin.core.world;
import com.flowpowered.math.vector.Vector3d;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.SpawnerAnimals;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraft.world.biome.BiomeGenBase;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.entity.EntityType;
import org.spongepowered.api.entity.Transform;
import org.spongepowered.api.event.SpongeEventFactory;
import org.spongepowered.api.event.cause.Cause;
import org.spongepowered.api.event.cause.NamedCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause;
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes;
import org.spongepowered.api.event.entity.ConstructEntityEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.common.SpongeImpl;
import org.spongepowered.common.event.CauseTracker;
import org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayer;
import org.spongepowered.common.interfaces.world.IMixinWorld;
import org.spongepowered.common.registry.type.entity.EntityTypeRegistryModule;
import java.util.Collection;
import java.util.Optional;
import java.util.Random;
@Mixin(SpawnerAnimals.class)
public abstract class MixinSpawnerAnimals {
private static final String WORLD_CAN_SPAWN_CREATURE = "Lnet/minecraft/world/WorldServer;canCreatureTypeSpawnHere("
+ "Lnet/minecraft/entity/EnumCreatureType;Lnet/minecraft/world/biome/BiomeGenBase$SpawnListEntry;Lnet/minecraft/util/BlockPos;)Z";
private static final String BIOME_CAN_SPAWN_ANIMAL =
"Lnet/minecraft/world/SpawnerAnimals;canCreatureTypeSpawnAtLocation(Lnet/minecraft/entity/EntityLiving$SpawnPlacementType;"
+ "Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;)Z";
private static final String WEIGHTED_RANDOM_GET = "Lnet/minecraft/util/WeightedRandom;getRandomItem(Ljava/util/Random;Ljava/util/Collection;)"
+ "Lnet/minecraft/util/WeightedRandom$Item;";
private static final String WORLD_SERVER_SPAWN_ENTITY = "Lnet/minecraft/world/WorldServer;spawnEntityInWorld(Lnet/minecraft/entity/Entity;)Z";
private static final String WORLD_SPAWN_ENTITY = "Lnet/minecraft/world/World;spawnEntityInWorld(Lnet/minecraft/entity/Entity;)Z";
private static boolean spawnerStart;
private static EntityType spawnerEntityType;
private static Class<? extends Entity> spawnerEntityClass;
@ModifyConstant(method = "findChunksForSpawning", constant = @Constant(intValue = 8))
public int adjustCheckRadiusForServerView(int originalValue, WorldServer worldServerIn, boolean spawnHostileMobs, boolean spawnPeacefulMobs,
boolean p_77192_4_) {
// TODO Adjust for when per-world view distances are a thing
return Math.min(((IMixinWorld) worldServerIn).getActiveConfig().getConfig().getWorld().getMobSpawnRange(), MinecraftServer
.getServer()
.getConfigurationManager().getViewDistance());
}
@Inject(method = "findChunksForSpawning", at = @At(value = "HEAD"))
public void onFindChunksForSpawningHead(WorldServer worldServer, boolean spawnHostileMobs, boolean spawnPeacefulMobs, boolean spawnedOnSetTickRate, CallbackInfoReturnable<Integer> ci) {
IMixinWorld spongeWorld = ((IMixinWorld) worldServer);
CauseTracker causeTracker = spongeWorld.getCauseTracker();
causeTracker.addCause(Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.WORLD_SPAWNER).build())));
causeTracker.setWorldSpawnerRunning(true);
causeTracker.setCaptureSpawnedEntities(true);
spawnerStart = true;
}
@Inject(method = "findChunksForSpawning", at = @At(value = "RETURN"))
public void onFindChunksForSpawningReturn(WorldServer worldServer, boolean spawnHostileMobs, boolean spawnPeacefulMobs, boolean spawnedOnSetTickRate, CallbackInfoReturnable<Integer> ci) {
IMixinWorld spongeWorld = ((IMixinWorld) worldServer);
CauseTracker causeTracker = spongeWorld.getCauseTracker();
causeTracker.handleSpawnedEntities();
causeTracker.setWorldSpawnerRunning(false);
causeTracker.setCaptureSpawnedEntities(false);
causeTracker.removeCurrentCause();
if (spawnerStart) {
spawnerStart = false;
spawnerEntityClass = null;
spawnerEntityType = null;
}
}
@Inject(method = "performWorldGenSpawning", at = @At(value = "HEAD"))
private static void onPerformWorldGenSpawningHead(World worldServer, BiomeGenBase biome, int j, int k, int l, int m, Random rand, CallbackInfo ci) {
IMixinWorld spongeWorld = ((IMixinWorld) worldServer);
final CauseTracker causeTracker = spongeWorld.getCauseTracker();
causeTracker.addCause(Cause.of(NamedCause.source(SpawnCause.builder().type(SpawnTypes.WORLD_SPAWNER).build()), NamedCause.of("Biome", biome)));
causeTracker.setChunkSpawnerRunning(true);
causeTracker.setCaptureSpawnedEntities(true);
spawnerStart = true;
}
@Inject(method = "performWorldGenSpawning", at = @At(value = "RETURN"))
private static void onPerformWorldGenSpawningReturn(World worldServer, BiomeGenBase biome, int j, int k, int l, int m, Random rand, CallbackInfo ci) {
IMixinWorld spongeWorld = (IMixinWorld) worldServer;
final CauseTracker causeTracker = spongeWorld.getCauseTracker();
causeTracker.handleSpawnedEntities();
causeTracker.setChunkSpawnerRunning(false);
causeTracker.setCaptureSpawnedEntities(false);
causeTracker.removeCurrentCause();
if (spawnerStart) {
spawnerStart = false;
spawnerEntityClass = null;
spawnerEntityType = null;
}
}
@Redirect(method = "findChunksForSpawning", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;isSpectator()Z"))
public boolean onFindChunksForSpawningEligiblePlayer(EntityPlayer player) {
// We treat players who do not affect spawning as "spectators"
return !((IMixinEntityPlayer) player).affectsSpawning() || player.isSpectator();
}
/**
* Basically, this is redirecting the boolean check to where the worldserver is checked first, then
* our event is thrown. Note that the {@link #setEntityType(Class)} needs to be called first to
* actively set the entity type being used.
*
* @param worldServer The world server
* @param creatureType The creature type
* @param spawnListEntry The spawner list entry containing the entity class
* @param pos The position
* @return True if the worldserver check was valid and if our event wasn't cancelled
*/
@Redirect(method = "findChunksForSpawning", at = @At(value = "INVOKE", target = WORLD_CAN_SPAWN_CREATURE))
public boolean onCanSpawn(WorldServer worldServer, EnumCreatureType creatureType, BiomeGenBase.SpawnListEntry spawnListEntry, BlockPos pos) {
setEntityType(spawnListEntry.entityClass);
return worldServer.canCreatureTypeSpawnHere(creatureType, spawnListEntry, pos) && check(pos, worldServer);
}
/**
* Redirects the canCreatureTypeSpawnAtLocation to add our event check after. This requires that the {@link #onGetRandom(Random, Collection)}
* is called before this to actively set the proper entity class.
* @param type
* @param worldIn
* @param pos
* @return
*/
@Redirect(method = "performWorldGenSpawning", at = @At(value = "INVOKE", target = BIOME_CAN_SPAWN_ANIMAL))
private static boolean onCanGenerate(EntityLiving.SpawnPlacementType type, World worldIn, BlockPos pos) {
return SpawnerAnimals.canCreatureTypeSpawnAtLocation(type, worldIn, pos) && check(pos, worldIn);
}
/**
* Redirects the method call to get the spawn list entry for world gen spawning so that we can
* "capture" the {@link net.minecraft.entity.Entity} class that is about to attempt to be spawned.
*
* @param random
* @param collection
* @return
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@Redirect(method = "performWorldGenSpawning", at = @At(value = "INVOKE", target = WEIGHTED_RANDOM_GET))
private static WeightedRandom.Item onGetRandom(Random random, Collection collection) {
BiomeGenBase.SpawnListEntry entry = (BiomeGenBase.SpawnListEntry) WeightedRandom.getRandomItem(random, collection);
setEntityType(entry.entityClass);
return entry;
}
@SuppressWarnings({"unchecked", "rawtypes"})
private static void setEntityType(Class entityclass) {
spawnerEntityClass = entityclass;
Optional<EntityType> entityType = EntityTypeRegistryModule.getInstance().getEntity(spawnerEntityClass);
if (!entityType.isPresent()) {
SpongeImpl.getLogger().warn("There's an unknown Entity class that isn't registered with Sponge!" + spawnerEntityClass);
} else {
spawnerEntityType = entityType.get();
}
}
private static boolean check(BlockPos pos, World world) {
EntityType entityType = spawnerEntityType;
if (entityType == null) {
return true; // Basically, we can't throw our own event.
}
Vector3d vector3d = new Vector3d(pos.getX(), pos.getY(), pos.getZ());
Transform<org.spongepowered.api.world.World> transform = new Transform<>((org.spongepowered.api.world.World) world, vector3d);
ConstructEntityEvent.Pre event = SpongeEventFactory.createConstructEntityEventPre(Cause.of(NamedCause.source(world)), entityType, transform);
SpongeImpl.postEvent(event);
return !event.isCancelled();
}
/**
* @author gabizou - January 30th, 2016
*
* Redirects the spawning here to note that it's from the world spawner.
*
* @param worldServer The world server coming in
* @param nmsEntity The nms entity
* @return True if the world spawn was successful
*/
@Redirect(method = "findChunksForSpawning", at = @At(value = "INVOKE", target = WORLD_SERVER_SPAWN_ENTITY))
private boolean onSpawnEntityInWorld(WorldServer worldServer, net.minecraft.entity.Entity nmsEntity) {
return ((org.spongepowered.api.world.World) worldServer).spawnEntity(((Entity) nmsEntity),
((IMixinWorld) worldServer).getCauseTracker().getCurrentCause());
}
@Redirect(method = "performWorldGenSpawning", at = @At(value = "INVOKE", target = WORLD_SPAWN_ENTITY))
private static boolean onSpawnEntityInWorldGen(World world, net.minecraft.entity.Entity entity) {
return ((org.spongepowered.api.world.World) world).spawnEntity((Entity) entity,
((IMixinWorld) world).getCauseTracker().getCurrentCause());
}
}
| 52.570248 | 191 | 0.741157 |
05badeeeb482449e74b8c2d507a86e96dccf61dc | 1,029 | package com.loopperfect.buckaroo.serialization;
import com.google.common.base.Preconditions;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.loopperfect.buckaroo.Identifier;
import java.lang.reflect.Type;
public final class IdentifierDeserializer implements JsonDeserializer<Identifier> {
@Override
public Identifier deserialize(final JsonElement jsonElement, final Type type, JsonDeserializationContext context) throws JsonParseException {
Preconditions.checkNotNull(jsonElement);
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(context);
if (!jsonElement.isJsonPrimitive()) {
throw new JsonParseException("Expected a string");
}
return Identifier.parse(jsonElement.getAsString())
.orElseThrow(() -> new JsonParseException("\"" + jsonElement.getAsString() + "\" is not a valid name"));
}
}
| 35.482759 | 145 | 0.752187 |
c612671e8ee236f710876be1a5989b65089c62d4 | 5,886 | package com.flkoliv.subtitles.beans;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import com.flkoliv.subtitles.dao.DaoFactory;
import com.flkoliv.subtitles.dao.FilmDao;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;;
public class Film {
private int id;
private String nom;
private String langueOriginale;
private int idLangueOriginale;
private String langueTraduction;
private int idLangueTraduction;
private String cheminFichier;
private ArrayList<Phrase> phrases = new ArrayList<Phrase>();
private FilmDao filmDao;
public int getIdLangueOriginale() {
return idLangueOriginale;
}
public void setIdLangueOriginale(int idLangueOriginale) {
this.idLangueOriginale = idLangueOriginale;
}
public Film(HttpServletRequest request, String cheminFichier) {
this.nom = request.getParameter("nomFilm");
this.langueOriginale = request.getParameter("langue");
this.cheminFichier = cheminFichier;
creerPhrases();
DaoFactory daoFactory = DaoFactory.getInstance();
this.filmDao = daoFactory.getFilmDao();
if (!this.filmDao.existe(this)) {
this.filmDao.ajouter(this);
request.setAttribute("message", "Le nouveau fichier a été chargé.");
} else {
request.setAttribute("message", "Le film existe déjà !");
}
}
public Film(HttpServletRequest request) {
DaoFactory daoFactory = DaoFactory.getInstance();
this.filmDao = daoFactory.getFilmDao();
this.nom = request.getParameter("film");
this.langueTraduction = request.getParameter("langueDestination");
if (this.filmDao.existe(this)) {
this.filmDao.charger(this);
} else {
request.setAttribute("message", "Le film n'existe pas !");
}
}
public Film() {
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNom() {
return nom;
}
public void setNom(String nom) {
this.nom = nom;
}
public String getLangueOriginale() {
return langueOriginale;
}
public void setLangueOriginale(String langueOriginale) {
this.langueOriginale = langueOriginale;
}
public String getLangueTraduction() {
return langueTraduction;
}
public void setLangueTraduction(String langueTraduction) {
this.langueTraduction = langueTraduction;
}
public int getIdLangueTraduction() {
return idLangueTraduction;
}
public void setIdLangueTraduction(int idLangueTraduction) {
this.idLangueTraduction = idLangueTraduction;
}
public String getNomFichier() {
return cheminFichier;
}
public void setNomFichier(String nomFichier) {
this.cheminFichier = nomFichier;
}
public ArrayList<Phrase> getPhrases() {
return phrases;
}
public void setPhrases(ArrayList<Phrase> phrases) {
this.phrases = phrases;
}
public String getCheminFichier() {
return cheminFichier;
}
public void setCheminFichier(String cheminFichier) {
this.cheminFichier = cheminFichier;
}
private void creerPhrases() {
try {
File f = new File(cheminFichier);
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
try {
String line = br.readLine();
Phrase phrase = new Phrase();
int compteur = 1;
while (line != null) {
System.out.println(line);
if (compteur == 1) {
line = line.replaceAll("[\\W]", "");
if (line.length()==0) {
compteur--;
} else {
phrase = new Phrase();
System.out.println("+"+line+"+");
phrase.setNumero(Integer.parseInt(line.trim()));
}
} else if (compteur == 2) {
String[] t = line.split(" --> ");
phrase.setMinutageDebut(t[0]);
phrase.setMinutageFin(t[1]);
} else if (compteur == 3) {
phrase.setTexteOriginal(line);
} else if (compteur == 4) {
if (!line.equals("")) {
String ph = phrase.getTexteOriginal();
phrase.setTexteOriginal(ph + "\n" + line);
compteur--;
}else {
compteur = 0;
phrases.add(phrase);
}
}
compteur++;
line = br.readLine();
}
br.close();
fr.close();
} catch (IOException exception) {
System.out.println("Erreur lors de la lecture : " + exception.getMessage());
}
} catch (FileNotFoundException exception) {
System.out.println("Le fichier n'a pas été trouvé");
}
}
public void sauvegarder(HttpServletRequest request) {
DaoFactory daoFactory = DaoFactory.getInstance();
this.filmDao = daoFactory.getFilmDao();
for (int i = 0; i < phrases.size(); i++) {
int j = phrases.get(i).getNumero();
phrases.get(i).setTexteTraduit(request.getParameter("txtTraduit" + j));
System.out.println(phrases.get(i).getTexteOriginal());
System.out.println(phrases.get(i).getTexteTraduit());
}
filmDao.sauvegarder(this);
}
public File creerFichier(String chemin) {
final File fichier = new File(chemin);
System.out.println(cheminFichier);
try {
// Creation du fichier
fichier.createNewFile();
// creation d'un writer (un écrivain)
final FileWriter writer = new FileWriter(fichier);
try {
int j = 1;
for (int i = 0; i < phrases.size(); i++) {
if (!phrases.get(i).getTexteTraduit().equals("")) {
writer.write(j + "\r\n");
writer.write(
phrases.get(i).getMinutageDebut() + " --> " + phrases.get(i).getMinutageFin() + "\r\n");
writer.write(phrases.get(i).getTexteTraduit() + "\r\n" + "\r\n");
j++;
}
}
} finally {
writer.close();
}
} catch (Exception e) {
System.out.println("Impossible de creer le fichier");
return null;
}
return fichier;
}
}
| 25.703057 | 97 | 0.648488 |
a5dc7e7b199a800b0834d3763c40a1cf24690ca2 | 651 | package org.jojo.flow.model.api;
import java.util.List;
/**
* This interface represents a data bundle, i.e. a constant-sized array of {@link IData} with possibly
* different types.
*
* @author Jonathan Schenkenberger
* @version 1.0
*/
public interface IDataBundle extends IRecursiveCheckable {
/**
* Gets the default implementation.
*
* @param data - the data array as a list
* @return the default implementation
*/
public static IDataBundle getDefaultImplementation(final List<IData> data) {
return (IDataBundle) IAPI.defaultImplementationOfThisApi(new Class<?>[] {List.class}, data);
}
}
| 27.125 | 103 | 0.688172 |
a32bc36cae602170dcc2082558be9487324346ec | 2,843 | /*
* Copyright (c) 2020, Fraunhofer AISEC. 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.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
package de.fraunhofer.aisec.cpg.graph.statements.expressions;
import static de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge.unwrap;
import de.fraunhofer.aisec.cpg.graph.Node;
import de.fraunhofer.aisec.cpg.graph.SubGraph;
import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge;
import java.util.List;
import java.util.Objects;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.neo4j.ogm.annotation.Relationship;
public class DesignatedInitializerExpression extends Expression {
@SubGraph("AST")
private Expression rhs;
@Relationship(value = "LHS", direction = "OUTGOING")
@SubGraph("AST")
private List<PropertyEdge<Expression>> lhs;
public Expression getRhs() {
return rhs;
}
public void setRhs(Expression rhs) {
this.rhs = rhs;
}
public List<Expression> getLhs() {
return unwrap(this.lhs);
}
public List<PropertyEdge<Expression>> getLhsPropertyEdge() {
return this.lhs;
}
public void setLhs(List<Expression> lhs) {
this.lhs = PropertyEdge.transformIntoOutgoingPropertyEdgeList(lhs, this);
}
@Override
public String toString() {
return new ToStringBuilder(this, Node.TO_STRING_STYLE)
.appendSuper(super.toString())
.append("lhr", lhs)
.append("rhs", rhs)
.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof DesignatedInitializerExpression)) {
return false;
}
DesignatedInitializerExpression that = (DesignatedInitializerExpression) o;
return super.equals(that)
&& Objects.equals(rhs, that.rhs)
&& Objects.equals(lhs, that.lhs)
&& Objects.equals(this.getLhs(), that.getLhs());
}
@Override
public int hashCode() {
return super.hashCode();
}
}
| 29.614583 | 79 | 0.614492 |
97803b82d64fd5d64fa35b987fbe94029a153392 | 528 | package com.loxmeetsbagel.api.user.repository;
import com.loxmeetsbagel.api.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.Optional;
public interface UserRepository extends JpaRepository<User, Long> {
@Query("select u from User u left join fetch u.roles r where u.username=:username")
public Optional<User> findByUsername(@Param("username") String username);
}
| 35.2 | 87 | 0.80303 |
16fc6f03e93a6d77be0d08b9621ea565ffdeacdc | 6,899 | package benchmark.rdfsreasoning.dataset;
import benchmark.eldlreasoning.compression.CompressionTests;
import org.apache.jena.graph.Node;
import org.apache.jena.graph.Node_Literal;
import org.apache.jena.sparql.util.NodeUtils;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
import org.eclipse.collections.impl.set.mutable.UnifiedSet;
import org.rdfhdt.hdt.dictionary.impl.section.HashDictionarySection;
import org.rdfhdt.hdt.enums.RDFNotation;
import org.rdfhdt.hdt.exceptions.ParserException;
import org.rdfhdt.hdt.rdf.parsers.RDFParserRIOT;
import org.rdfhdt.hdt.triples.TripleID;
import util.ConsoleUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
public class RDFDatasetGenerator {
Logger log = ConsoleUtils.getLogger();
List<TripleID> tempTripleIDList = new ArrayList<>();
String rdfDumpPath;
File rdfDumpFile;
Set<Long> propertyIDs = new UnifiedSet<>();
Set<Long> rdfClassIDs = new UnifiedSet<>();
HashDictionarySection resourcesDictionarySection = new HashDictionarySection();
HashDictionarySection literalsDictionarySection = new HashDictionarySection();
long rdfTypeID = -1L;
long subClassOfID = -1L;
long subPropertyOfID = -1L;
long rdfsDatatypeID = -1L;
long domainID = -1L;
long rangeID = -1L;
long rdfPropertyID = -1L;
public RDFDatasetGenerator(String rdfDumpPath) {
this.rdfDumpPath = rdfDumpPath;
this.rdfDumpFile = new File(rdfDumpPath);
}
public static void main(String[] args) {
File f = new File(CompressionTests.class.getClassLoader().getResource("pizza.ttl").getFile());
RDFDatasetGenerator generator = new RDFDatasetGenerator(f.toString());
generator.generate();
}
public RDFDataset generate() {
insertAxiomaticTriples();
processDataset(rdfDumpFile.toString());
initVocabularyIDs();
findPropertyIDsAndRDFClassIDs();
substituteTempIDsByFinalIDs();
RDFSReasoningDictionary dictionary = new RDFSReasoningDictionary(
resourcesDictionarySection, literalsDictionarySection, rdfClassIDs, propertyIDs
);
RDFSReasoningTriples triples = new RDFSReasoningTriples(domainID, rangeID, rdfTypeID, subPropertyOfID, subClassOfID);
tempTripleIDList.forEach(triples::add);
return new RDFDataset(triples, dictionary);
}
private void substituteTempIDsByFinalIDs() {
// ID of literals are shifted 32 bits to the left - substitute by final value
tempTripleIDList.forEach(tID -> {
if (tID.getObject() > Integer.MAX_VALUE) {
// is literal - substitute by final ID
long idWithoutOffset = tID.getObject() >> 32;
tID.setObject(idWithoutOffset + resourcesDictionarySection.getNumberOfElements());
}
});
}
private void removeDuplicateTriples() {
// TODO required?
}
private void initVocabularyIDs() {
rdfsDatatypeID = resourcesDictionarySection.locate(RDFS.Datatype.toString());
rdfTypeID = resourcesDictionarySection.locate(RDF.type.toString());
subClassOfID = resourcesDictionarySection.locate(RDFS.subClassOf.toString());
subPropertyOfID = resourcesDictionarySection.locate(RDFS.subPropertyOf.toString());
rangeID = resourcesDictionarySection.locate(RDFS.range.toString());
domainID = resourcesDictionarySection.locate(RDFS.domain.toString());
rdfPropertyID = resourcesDictionarySection.locate(RDF.Property.toString());
}
private void findPropertyIDsAndRDFClassIDs() {
// find property IDs and RDF class IDs
tempTripleIDList.forEach(tID -> {
long predID = tID.getPredicate();
propertyIDs.add(predID);
if (predID == subPropertyOfID) {
propertyIDs.add(tID.getSubject());
propertyIDs.add(tID.getObject());
} else if (predID == subClassOfID) {
rdfClassIDs.add(tID.getSubject());
rdfClassIDs.add(tID.getObject());
} else if (predID == rdfTypeID) {
rdfClassIDs.add(tID.getObject());
} else if (predID == domainID || predID == rangeID) {
rdfClassIDs.add(tID.getObject());
} else if (predID == rdfTypeID && tID.getObject() == rdfPropertyID) {
propertyIDs.add(tID.getSubject());
}
}
);
}
public long processObject(CharSequence object) {
Node node = NodeUtils.asNode(object.toString());
if (node.isLiteral()) {
Node_Literal literal = (Node_Literal) node;
log.info("Literal: " + literal.getLiteral().toString());
long literalID = literalsDictionarySection.add(literal.getLiteral().toString()) << 32;
// insert: triple("s"^^d, rdf:type, d)
// TODO: literal at subject position ???
// insert: triple(d, rdf:type, rdfs:Datatype)
log.info("Literal datatype: " + literal.getLiteralDatatypeURI());
long datatypeID = resourcesDictionarySection.add(literal.getLiteralDatatypeURI());
tempTripleIDList.add(new TripleID(datatypeID, rdfTypeID, rdfsDatatypeID));
return literalID;
} else {
return resourcesDictionarySection.add(node.getURI());
}
}
private void processDataset(String rdfDumpPath) {
RDFParserRIOT parser = new RDFParserRIOT();
RDFNotation rdfNotation = RDFNotation.guess(rdfDumpPath);
log.info(rdfDumpPath);
try {
parser.doParse(rdfDumpPath, "", rdfNotation, (tripleString, count) -> {
log.info(tripleString.toString());
long sbjID = resourcesDictionarySection.add(tripleString.getSubject());
long predID = resourcesDictionarySection.add(tripleString.getPredicate());
long objID = processObject(tripleString.getObject());
tempTripleIDList.add(new TripleID(sbjID, predID, objID));
});
} catch (ParserException e) {
e.printStackTrace();
}
}
public void insertAxiomaticTriples() {
// RDF
File axiomaticRDFTriples = new File(
RDFDatasetGenerator.class.getClassLoader().getResource("axiomaticTriples_RDF.ttl").getFile());
processDataset(axiomaticRDFTriples.toString());
// RDFS
File axiomaticRDFSTriples = new File(
RDFDatasetGenerator.class.getClassLoader().getResource("axiomaticTriples_RDFS.ttl").getFile());
processDataset(axiomaticRDFSTriples.toString());
}
}
| 40.822485 | 125 | 0.649804 |
82424b8db75907d9182c3f525930efec6afabba0 | 1,422 | package com.github.artfultom.spacex.request;
import com.github.artfultom.spacex.SpaceXClient;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.util.stream.Collectors;
public class GetRequest extends GenericRequest {
public GetRequest(SpaceXClient client) {
super(client);
}
@Override
public GetResponse execute() throws IOException {
HttpGet httpGet = new HttpGet(this.getEntireUrl());
CloseableHttpResponse response = this.client.getHttpClient().execute(httpGet);
HttpEntity entity = response.getEntity();
int code = response.getStatusLine().getStatusCode();
String body = EntityUtils.toString(entity);
return new GetResponse(code, body);
}
public String getEntireUrl() {
String result = this.requestUrl;
if (this.parameters.size() > 0) {
String parametersStr = String.join(
"&",
this.parameters.values().stream()
.map(parameter -> parameter.getName() + "=" + parameter.getValue())
.collect(Collectors.toList())
);
result = result.concat("?").concat(parametersStr);
}
return result;
}
}
| 30.255319 | 95 | 0.639944 |
684a5e2d224d616590a64a4d79ca3d5175d3ce1e | 1,248 | package com.mapper;
import com.model.Uxinxi;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@Mapper
public interface UxinxiMapper {
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table t_uxinxi
* @mbggenerated
*/
int deleteByPrimaryKey(Integer uxinxiId);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table t_uxinxi
* @mbggenerated
*/
int insert(Uxinxi record);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table t_uxinxi
* @mbggenerated
*/
Uxinxi selectByPrimaryKey(Integer uxinxiId);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table t_uxinxi
* @mbggenerated
*/
List<Uxinxi> selectAll(@Param("uxinxi")Uxinxi record,@Param("page")int page,@Param("rows")int rows, @Param("sdate")String sdate, @Param("edate")String edate);
/**
* This method was generated by MyBatis Generator. This method corresponds to the database table t_uxinxi
* @mbggenerated
*/
int updateByPrimaryKey(Uxinxi record);
} | 29.714286 | 159 | 0.758013 |
6b5d63928899abd7d727e9a982542fd0fe720e15 | 759 | package test.general;
/**
* In this example, the constructor for class A passes the new instance of A to B.doSomething.<br>
* As a result, the instance of A—and all of its fields—escapes the scope of the constructor.
*/
public class EscapeAnalysis {
public static void main(final String args[]) {
new A(new B());
}
}
class A {
final int finalValue;
public A(final B b) {
super();
b.doSomething(this); // this escapes!
finalValue = 23;
}
int getTheValue() {
return finalValue;
}
}
class B {
void doSomething(final A a) {
System.out.println(a.getTheValue());
}
}
// http://en.wikipedia.org/wiki/Escape_analysis
// http://www.javaspecialists.eu/archive/Issue179.html | 20.513514 | 98 | 0.632411 |
1c1a569c88d5fe3a4ec61f159c33c16655bee94f | 3,917 | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.11.18 at 02:29:52 PM CET
//
package eu.fp7.secured.mspl;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for IPsecTechnologyParameter complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="IPsecTechnologyParameter">
* <complexContent>
* <extension base="{http://modeliosoft/xsddesigner/a22bd60b-ee3d-425c-8618-beb6a854051a/ITResource.xsd}TechnologySpecificParameters">
* <sequence>
* <element name="IPsecProtocol" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="isTunnel" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* <element name="localEndpoint" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="remoteEndpoint" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "IPsecTechnologyParameter", propOrder = {
"iPsecProtocol",
"isTunnel",
"localEndpoint",
"remoteEndpoint"
})
public class IPsecTechnologyParameter
extends TechnologySpecificParameters
{
@XmlElement(name = "IPsecProtocol")
protected String iPsecProtocol;
protected Boolean isTunnel;
protected String localEndpoint;
protected String remoteEndpoint;
/**
* Gets the value of the iPsecProtocol property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIPsecProtocol() {
return iPsecProtocol;
}
/**
* Sets the value of the iPsecProtocol property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIPsecProtocol(String value) {
this.iPsecProtocol = value;
}
/**
* Gets the value of the isTunnel property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isIsTunnel() {
return isTunnel;
}
/**
* Sets the value of the isTunnel property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsTunnel(Boolean value) {
this.isTunnel = value;
}
/**
* Gets the value of the localEndpoint property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalEndpoint() {
return localEndpoint;
}
/**
* Sets the value of the localEndpoint property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalEndpoint(String value) {
this.localEndpoint = value;
}
/**
* Gets the value of the remoteEndpoint property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getRemoteEndpoint() {
return remoteEndpoint;
}
/**
* Sets the value of the remoteEndpoint property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setRemoteEndpoint(String value) {
this.remoteEndpoint = value;
}
}
| 25.601307 | 141 | 0.60531 |
ee25aee4ca923191a8819f0c23efa32c63865bf1 | 20,042 | package org.springframework.security.web.authentication.rememberme;
import java.lang.reflect.Method;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.authentication.AccountStatusException;
import org.springframework.security.authentication.AccountStatusUserDetailsChecker;
import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper;
import org.springframework.security.core.authority.mapping.NullAuthoritiesMapper;
import org.springframework.security.crypto.codec.Base64;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsChecker;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
/**
* Base class for RememberMeServices implementations.
*
* @author Luke Taylor
* @author Rob Winch
* @since 2.0
*/
public abstract class AbstractRememberMeServices implements RememberMeServices, InitializingBean, LogoutHandler {
//~ Static fields/initializers =====================================================================================
public static final String SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY = "SPRING_SECURITY_REMEMBER_ME_COOKIE";
public static final String DEFAULT_PARAMETER = "_spring_security_remember_me";
public static final int TWO_WEEKS_S = 1209600;
private static final String DELIMITER = ":";
//~ Instance fields ================================================================================================
protected final Log logger = LogFactory.getLog(getClass());
protected final MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
private UserDetailsService userDetailsService;
private UserDetailsChecker userDetailsChecker = new AccountStatusUserDetailsChecker();
private AuthenticationDetailsSource<HttpServletRequest, ?> authenticationDetailsSource = new WebAuthenticationDetailsSource();
private String cookieName = SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY;
private String parameter = DEFAULT_PARAMETER;
private boolean alwaysRemember;
private String key;
private int tokenValiditySeconds = TWO_WEEKS_S;
private Boolean useSecureCookie = null;
private Method setHttpOnlyMethod;
private GrantedAuthoritiesMapper authoritiesMapper = new NullAuthoritiesMapper();
/**
* @deprecated Use constructor injection
*/
@Deprecated
protected AbstractRememberMeServices() {
this.setHttpOnlyMethod = ReflectionUtils.findMethod(Cookie.class,"setHttpOnly", boolean.class);
}
protected AbstractRememberMeServices(String key, UserDetailsService userDetailsService) {
Assert.hasLength(key, "key cannot be empty or null");
Assert.notNull(userDetailsService, "UserDetailsService cannot be null");
this.key = key;
this.userDetailsService = userDetailsService;
this.setHttpOnlyMethod = ReflectionUtils.findMethod(Cookie.class,"setHttpOnly", boolean.class);
}
public void afterPropertiesSet() throws Exception {
Assert.hasLength(key, "key cannot be empty or null");
Assert.notNull(userDetailsService, "A UserDetailsService is required");
}
/**
* Template implementation which locates the Spring Security cookie, decodes it into
* a delimited array of tokens and submits it to subclasses for processing
* via the <tt>processAutoLoginCookie</tt> method.
* <p>
* The returned username is then used to load the UserDetails object for the user, which in turn
* is used to create a valid authentication token.
*/
public final Authentication autoLogin(HttpServletRequest request, HttpServletResponse response) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie == null) {
return null;
}
logger.debug("Remember-me cookie detected");
if (rememberMeCookie.length() == 0) {
logger.debug("Cookie was empty");
cancelCookie(request, response);
return null;
}
UserDetails user = null;
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
user = processAutoLoginCookie(cookieTokens, request, response);
userDetailsChecker.check(user);
logger.debug("Remember-me cookie accepted");
return createSuccessfulAuthentication(request, user);
} catch (CookieTheftException cte) {
cancelCookie(request, response);
throw cte;
} catch (UsernameNotFoundException noUser) {
logger.debug("Remember-me login was valid but corresponding user not found.", noUser);
} catch (InvalidCookieException invalidCookie) {
logger.debug("Invalid remember-me cookie: " + invalidCookie.getMessage());
} catch (AccountStatusException statusInvalid) {
logger.debug("Invalid UserDetails: " + statusInvalid.getMessage());
} catch (RememberMeAuthenticationException e) {
logger.debug(e.getMessage());
}
cancelCookie(request, response);
return null;
}
/**
* Locates the Spring Security remember me cookie in the request and returns its value.
* The cookie is searched for by name and also by matching the context path to the cookie path.
*
* @param request the submitted request which is to be authenticated
* @return the cookie value (if present), null otherwise.
*/
protected String extractRememberMeCookie(HttpServletRequest request) {
Cookie[] cookies = request.getCookies();
if ((cookies == null) || (cookies.length == 0)) {
return null;
}
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
return cookie.getValue();
}
}
return null;
}
/**
* Creates the final <tt>Authentication</tt> object returned from the <tt>autoLogin</tt> method.
* <p>
* By default it will create a <tt>RememberMeAuthenticationToken</tt> instance.
*
* @param request the original request. The configured <tt>AuthenticationDetailsSource</tt> will
* use this to build the details property of the returned object.
* @param user the <tt>UserDetails</tt> loaded from the <tt>UserDetailsService</tt>. This will be
* stored as the principal.
*
* @return the <tt>Authentication</tt> for the remember-me authenticated user
*/
protected Authentication createSuccessfulAuthentication(HttpServletRequest request, UserDetails user) {
RememberMeAuthenticationToken auth = new RememberMeAuthenticationToken(key, user,
authoritiesMapper.mapAuthorities(user.getAuthorities()));
auth.setDetails(authenticationDetailsSource.buildDetails(request));
return auth;
}
/**
* Decodes the cookie and splits it into a set of token strings using the ":" delimiter.
*
* @param cookieValue the value obtained from the submitted cookie
* @return the array of tokens.
* @throws InvalidCookieException if the cookie was not base64 encoded.
*/
protected String[] decodeCookie(String cookieValue) throws InvalidCookieException {
for (int j = 0; j < cookieValue.length() % 4; j++) {
cookieValue = cookieValue + "=";
}
if (!Base64.isBase64(cookieValue.getBytes())) {
throw new InvalidCookieException( "Cookie token was not Base64 encoded; value was '" + cookieValue + "'");
}
String cookieAsPlainText = new String(Base64.decode(cookieValue.getBytes()));
String[] tokens = StringUtils.delimitedListToStringArray(cookieAsPlainText, DELIMITER);
if ((tokens[0].equalsIgnoreCase("http") || tokens[0].equalsIgnoreCase("https")) && tokens[1].startsWith("//")) {
// Assume we've accidentally split a URL (OpenID identifier)
String[] newTokens = new String[tokens.length - 1];
newTokens[0] = tokens[0] + ":" + tokens[1];
System.arraycopy(tokens, 2, newTokens, 1, newTokens.length - 1);
tokens = newTokens;
}
return tokens;
}
/**
* Inverse operation of decodeCookie.
*
* @param cookieTokens the tokens to be encoded.
* @return base64 encoding of the tokens concatenated with the ":" delimiter.
*/
protected String encodeCookie(String[] cookieTokens) {
StringBuilder sb = new StringBuilder();
for(int i=0; i < cookieTokens.length; i++) {
sb.append(cookieTokens[i]);
if (i < cookieTokens.length - 1) {
sb.append(DELIMITER);
}
}
String value = sb.toString();
sb = new StringBuilder(new String(Base64.encode(value.getBytes())));
while (sb.charAt(sb.length() - 1) == '=') {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
public final void loginFail(HttpServletRequest request, HttpServletResponse response) {
logger.debug("Interactive login attempt was unsuccessful.");
cancelCookie(request, response);
onLoginFail(request, response);
}
protected void onLoginFail(HttpServletRequest request, HttpServletResponse response) {}
/**
* {@inheritDoc}
*
* <p>
* Examines the incoming request and checks for the presence of the configured "remember me" parameter.
* If it's present, or if <tt>alwaysRemember</tt> is set to true, calls <tt>onLoginSucces</tt>.
* </p>
*/
public final void loginSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication successfulAuthentication) {
if (!rememberMeRequested(request, parameter)) {
logger.debug("Remember-me login not requested.");
return;
}
onLoginSuccess(request, response, successfulAuthentication);
}
/**
* Called from loginSuccess when a remember-me login has been requested.
* Typically implemented by subclasses to set a remember-me cookie and potentially store a record
* of it if the implementation requires this.
*/
protected abstract void onLoginSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication successfulAuthentication);
/**
* Allows customization of whether a remember-me login has been requested.
* The default is to return true if <tt>alwaysRemember</tt> is set or the configured parameter name has
* been included in the request and is set to the value "true".
*
* @param request the request submitted from an interactive login, which may include additional information
* indicating that a persistent login is desired.
* @param parameter the configured remember-me parameter name.
*
* @return true if the request includes information indicating that a persistent login has been
* requested.
*/
protected boolean rememberMeRequested(HttpServletRequest request, String parameter) {
if (alwaysRemember) {
return true;
}
String paramValue = request.getParameter(parameter);
if (paramValue != null) {
if (paramValue.equalsIgnoreCase("true") || paramValue.equalsIgnoreCase("on") ||
paramValue.equalsIgnoreCase("yes") || paramValue.equals("1")) {
return true;
}
}
if (logger.isDebugEnabled()) {
logger.debug("Did not send remember-me cookie (principal did not set parameter '" + parameter + "')");
}
return false;
}
/**
* Called from autoLogin to process the submitted persistent login cookie. Subclasses should
* validate the cookie and perform any additional management required.
*
* @param cookieTokens the decoded and tokenized cookie value
* @param request the request
* @param response the response, to allow the cookie to be modified if required.
* @return the UserDetails for the corresponding user account if the cookie was validated successfully.
* @throws RememberMeAuthenticationException if the cookie is invalid or the login is invalid for some
* other reason.
* @throws UsernameNotFoundException if the user account corresponding to the login cookie couldn't be found
* (for example if the user has been removed from the system).
*/
protected abstract UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
HttpServletResponse response) throws RememberMeAuthenticationException, UsernameNotFoundException;
/**
* Sets a "cancel cookie" (with maxAge = 0) on the response to disable persistent logins.
*/
protected void cancelCookie(HttpServletRequest request, HttpServletResponse response) {
logger.debug("Cancelling cookie");
Cookie cookie = new Cookie(cookieName, null);
cookie.setMaxAge(0);
cookie.setPath(getCookiePath(request));
response.addCookie(cookie);
}
/**
* Sets the cookie on the response.
*
* By default a secure cookie will be used if the connection is secure. You can set the {@code useSecureCookie}
* property to {@code false} to override this. If you set it to {@code true}, the cookie will always be flagged
* as secure. If Servlet 3.0 is used, the cookie will be marked as HttpOnly.
*
* @param tokens the tokens which will be encoded to make the cookie value.
* @param maxAge the value passed to {@link Cookie#setMaxAge(int)}
* @param request the request
* @param response the response to add the cookie to.
*/
protected void setCookie(String[] tokens, int maxAge, HttpServletRequest request, HttpServletResponse response) {
String cookieValue = encodeCookie(tokens);
Cookie cookie = new Cookie(cookieName, cookieValue);
cookie.setMaxAge(maxAge);
cookie.setPath(getCookiePath(request));
if (useSecureCookie == null) {
cookie.setSecure(request.isSecure());
} else {
cookie.setSecure(useSecureCookie);
}
if(setHttpOnlyMethod != null) {
ReflectionUtils.invokeMethod(setHttpOnlyMethod, cookie, Boolean.TRUE);
} else if (logger.isDebugEnabled()) {
logger.debug("Note: Cookie will not be marked as HttpOnly because you are not using Servlet 3.0 (Cookie#setHttpOnly(boolean) was not found).");
}
response.addCookie(cookie);
}
private String getCookiePath(HttpServletRequest request) {
String contextPath = request.getContextPath();
return contextPath.length() > 0 ? contextPath : "/";
}
/**
* Implementation of {@code LogoutHandler}. Default behaviour is to call {@code cancelCookie()}.
*/
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
if (logger.isDebugEnabled()) {
logger.debug( "Logout of user "
+ (authentication == null ? "Unknown" : authentication.getName()));
}
cancelCookie(request, response);
}
public void setCookieName(String cookieName) {
Assert.hasLength(cookieName, "Cookie name cannot be empty or null");
this.cookieName = cookieName;
}
protected String getCookieName() {
return cookieName;
}
public void setAlwaysRemember(boolean alwaysRemember) {
this.alwaysRemember = alwaysRemember;
}
/**
* Sets the name of the parameter which should be checked for to see if a remember-me has been requested
* during a login request. This should be the same name you assign to the checkbox in your login form.
*
* @param parameter the HTTP request parameter
*/
public void setParameter(String parameter) {
Assert.hasText(parameter, "Parameter name cannot be empty or null");
this.parameter = parameter;
}
public String getParameter() {
return parameter;
}
protected UserDetailsService getUserDetailsService() {
return userDetailsService;
}
/**
*
* @deprecated Use constructor injection
*/
@Deprecated
public void setUserDetailsService(UserDetailsService userDetailsService) {
Assert.notNull(userDetailsService, "UserDetailsService canot be null");
this.userDetailsService = userDetailsService;
}
/**
*
* @deprecated Use constructor injection
*/
@Deprecated
public void setKey(String key) {
this.key = key;
}
public String getKey() {
return key;
}
public void setTokenValiditySeconds(int tokenValiditySeconds) {
this.tokenValiditySeconds = tokenValiditySeconds;
}
protected int getTokenValiditySeconds() {
return tokenValiditySeconds;
}
/**
* Whether the cookie should be flagged as secure or not. Secure cookies can only be sent over an HTTPS connection
* and thus cannot be accidentally submitted over HTTP where they could be intercepted.
* <p>
* By default the cookie will be secure if the request is secure. If you only want to use remember-me over
* HTTPS (recommended) you should set this property to {@code true}.
*
* @param useSecureCookie set to {@code true} to always user secure cookies, {@code false} to disable their use.
*/
public void setUseSecureCookie(boolean useSecureCookie) {
this.useSecureCookie = useSecureCookie;
}
protected AuthenticationDetailsSource<HttpServletRequest,?> getAuthenticationDetailsSource() {
return authenticationDetailsSource;
}
public void setAuthenticationDetailsSource(AuthenticationDetailsSource<HttpServletRequest,?> authenticationDetailsSource) {
Assert.notNull(authenticationDetailsSource, "AuthenticationDetailsSource cannot be null");
this.authenticationDetailsSource = authenticationDetailsSource;
}
/**
* Sets the strategy to be used to validate the {@code UserDetails} object obtained for
* the user when processing a remember-me cookie to automatically log in a user.
*
* @param userDetailsChecker
* the strategy which will be passed the user object to allow it to be rejected if account should not
* be allowed to authenticate (if it is locked, for example). Defaults to a
* {@code AccountStatusUserDetailsChecker} instance.
*
*/
public void setUserDetailsChecker(UserDetailsChecker userDetailsChecker) {
this.userDetailsChecker = userDetailsChecker;
}
public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) {
this.authoritiesMapper = authoritiesMapper;
}
}
| 41.238683 | 155 | 0.685461 |
bb392f91ba70ad702d72bf977040f7e21ed93a09 | 383 | public String read(String url) throws IOException {
URL myurl = new URL(url);
BufferedReader in = new BufferedReader(new InputStreamReader(myurl.openStream()));
StringBuffer sb = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) sb.append(inputLine);
in.close();
return sb.toString();
}
| 38.3 | 90 | 0.624021 |
29e0afa67d6408061e072038d6c590ee5f5afaba | 322 | package com.blog.service;
import com.blog.bean.Theme;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ThemeService {
int addTheme(Theme theme);
int deleteThemeById(int id);
int updateTheme(Theme theme);
List<Theme> getThemes();
Theme getThemeById(int id);
}
| 16.1 | 43 | 0.723602 |
fb7f8516c956e16f5c19d3c2e46b30a687cb53b5 | 717 | package language.tree.expression;
import org.objectweb.asm.MethodVisitor;
import language.compiler.SymbolTable;
import language.compiler.Token;
public class ArraySizeExpression extends Expression {
public final Expression array;
public ArraySizeExpression(Token firstToken, Expression param) {
super(firstToken);
this.array = param;
this.type = Types.INT;
}
@Override
public void decorate(SymbolTable symtab) throws Exception {
array.decorate(symtab);
if (array.type != Types.ARRAY) throw new Exception("Invalid ArraySizeExpression");
}
@Override
public void generate(MethodVisitor mv, SymbolTable symtab) throws Exception {
array.generate(mv, symtab);
mv.visitInsn(ARRAYLENGTH);
}
}
| 23.129032 | 84 | 0.771269 |
0b83376be98d4109dfd6f0a675573ffbff284d90 | 4,370 | package cn.micro.biz.commons.trace;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.LongAdder;
/**
* Global Trace Statistic
*
* @author lry
*/
@Slf4j
public enum TraceStatistic {
// ===
INSTANCE;
private static final Map<String, LongAdder[]> REQUESTS = new ConcurrentHashMap<>();
private static final String STATISTIC = ">>>>> [{}]:" +
"[0-49ms:{}][50-199ms:{}][200-499ms:{}][500-999ms:{}][1000-1999ms:{}][2000-2999ms:{}][3000ms+:{}]";
private static final int SECTION2 = 50;
private static final int SECTION3 = 200;
private static final int SECTION4 = 500;
private static final int SECTION5 = 1000;
private static final int SECTION6 = 2000;
private static final int SECTION7 = 3000;
private ScheduledExecutorService dumpScheduled;
/**
* 启动线程,每分钟打印日志,重置统计区间的取值
*/
public void initialize(TraceProperties properties) {
dumpScheduled = new ScheduledThreadPoolExecutor(1,
new ThreadFactoryBuilder().setNameFormat("micro-trace-task").setDaemon(true).build());
dumpScheduled.scheduleAtFixedRate(() -> {
try {
TraceStatistic.INSTANCE.dump();
} catch (Exception e) {
//catch all exception: do nothing
}
}, 5000L, properties.getDumpPeriod().toMillis(), TimeUnit.MILLISECONDS);
}
private synchronized void dump() {
if (REQUESTS.isEmpty()) {
return;
}
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Begin dump request statistic info <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
for (Map.Entry<String, LongAdder[]> entry : REQUESTS.entrySet()) {
LongAdder[] sectionArr = entry.getValue();
if (sectionArr == null) {
return;
}
long num1 = sectionArr[0].sumThenReset();
long num2 = sectionArr[1].sumThenReset();
long num3 = sectionArr[2].sumThenReset();
long num4 = sectionArr[3].sumThenReset();
long num5 = sectionArr[4].sumThenReset();
long num6 = sectionArr[5].sumThenReset();
long num7 = sectionArr[6].sumThenReset();
if (num7 > 0) {
log.warn(STATISTIC, entry.getKey(), num1, num2, num3, num4, num5, num6, num7);
} else {
log.info(STATISTIC, entry.getKey(), num1, num2, num3, num4, num5, num6, num7);
}
}
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> End dump request statistic info <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
// dump完成后清理map记录
REQUESTS.clear();
}
/**
* 记录统计信息
*
* @param requestURI 请求的完整url
* @param duration 请求的响应延时
*/
public synchronized void put(String requestURI, int duration) {
LongAdder[] sectionArr = REQUESTS.get(requestURI);
if (sectionArr == null) {
sectionArr = new LongAdder[7];
sectionArr[0] = new LongAdder();
sectionArr[1] = new LongAdder();
sectionArr[2] = new LongAdder();
sectionArr[3] = new LongAdder();
sectionArr[4] = new LongAdder();
sectionArr[5] = new LongAdder();
sectionArr[6] = new LongAdder();
REQUESTS.put(requestURI, sectionArr);
}
if (duration < SECTION2) {
sectionArr[0].increment();
} else if (duration < SECTION3) {
sectionArr[1].increment();
} else if (duration < SECTION4) {
sectionArr[2].increment();
} else if (duration < SECTION5) {
sectionArr[3].increment();
} else if (duration < SECTION6) {
sectionArr[4].increment();
} else if (duration < SECTION7) {
sectionArr[5].increment();
} else {
sectionArr[6].increment();
}
}
public void destroy() {
if (dumpScheduled != null) {
dumpScheduled.shutdown();
}
REQUESTS.clear();
}
}
| 33.615385 | 149 | 0.556064 |
ef9fb63268498fdc4fb72d43e6c0adefadf4bade | 6,590 | package Source;
import java.util.Scanner;
public class MainMenu {
// DECLARAR VARIABLES GLOBALES
private int statusCount, alertCode;
private String[] menus, names;
private String rPlayer;
private int[][] status;
private Scanner input;
// INICIALIZAR VARIABLES
public MainMenu() {
rPlayer = "Jugador ID:#" + Utils.randomString(Utils.random(1, 5)) + Utils.random(0, 10000);
input = new Scanner(System.in);
menus = new Strings().menus;
status = new int[100][3];
names = new String[100];
statusCount = -1;
alertCode = 0;
}
// MOSTRAR MENU SI SALE
private Boolean showExitMenu() {
// MOSTRAR MENU DE SALIR
alertCode = 0;
Utils.printMenu(menus[5], 0);
// RETORNAR SI ES SI
return (Utils.confirm(rPlayer, input));
}
// MOSTRAR JUGADORES ORDENADOS
private void showOrderPlayers(int mode, String[] orderNames, int[][] orderPoints, int index, int customIndex) {
// DECLAR LIMITES PARA IMPRIMIR
String modeFormat = "";
int space = orderNames[index].length();
int wins = customIndex < 0 ? index : customIndex;
// MOSTRAR ESTADO
if (mode == 0) {
modeFormat = (orderPoints[index][0] < 10 ? 0 : "") + Integer.toString(orderPoints[index][0]) + " "
+ Integer.toString(orderPoints[index][2]) + " " + Integer.toString(orderPoints[index][1]);
space = 50;
}
// MOSTRAR SOLO LOS PUNTOS
else if (mode == 3) {
modeFormat = Integer.toString(orderPoints[index][0]);
space = 67;
}
// MOSTRAR NOMBRES
Utils.print(Integer.toString(wins + 1) + ". " + orderNames[index] + " ");
// SEPARAR EN LA PANTALLA
Utils.print(Utils.repeatString("-", (space - orderNames[index].length() - 3)));
// IMPRIMIR COMPLETO
Utils.print(((mode == 1 || mode == 2) ? "" : "-> ") + modeFormat + "\n");
}
// MOSTRAR JUGADORES
public void showPlayers(int mode, String title, String[] orderNames, int[][] orderPoints) {
// NUEVO CONTADOR
int winnersCount = 0;
int loosersCount = 0;
alertCode = 0;
// IMPRIMIR MENU
Utils.printMenu(title, alertCode);
Utils.print(mode == 0 ? menus[20] : mode == 3 ? menus[22] : menus[23]);
// RECORRER ESTADOS
for (int satusIndex = 0; satusIndex < statusCount + 1; satusIndex++) {
// SI EL MODO ES 0 MOSTRAR ORDENADOS
if (mode == 0)
showOrderPlayers(0, orderNames, orderPoints, satusIndex, -1);
// MOSTRAR 3 PUNTUACIONES MAS ALTAS
else if (mode == 3 && satusIndex < 3)
showOrderPlayers(3, orderNames, orderPoints, satusIndex, -1);
// SINO MOSTRAR CONDICIONALMENTE
else if (mode == 1) {
if (status[satusIndex][2] == 3 || status[satusIndex][0] == 0) {
showOrderPlayers(2, orderNames, orderPoints, satusIndex, loosersCount);
loosersCount++;
}
} else if (mode == 2 && status[satusIndex][0] > 0 && status[satusIndex][2] != 3) {
showOrderPlayers(2, orderNames, orderPoints, satusIndex, winnersCount);
winnersCount++;
}
}
// ERROR 11 SI NO EXISTEN PERDEDORES
if (mode == 1 && loosersCount == 0)
alertCode = 11;
// ERROR 12 SI NO EXISTEN GANADORES
else if (mode == 2 && winnersCount == 0)
alertCode = 12;
else {
// SALIR CON CUALQUIER PALABRA
Utils.print("\n");
Utils.getOption(rPlayer, input);
}
}
// MOSTRAR PARTIDAS
private void showGames() {
alertCode = 0;
showPlayers(0, menus[24], names, status);
}
// MOSTRAR ORDENADOS POR PUNTOS
private void showPoints() {
alertCode = 0;
// REDUCIR ARRAYS
int[][] newStatus = Utils.reduce(status, statusCount + 1, 3);
String[] newNames = Utils.reduceString(names, statusCount + 1);
// ORDENAR PUNTOS
StrandInt order = Utils.orderByPoints(newStatus, newNames, statusCount + 1);
int[][] orderPoints = order.index;
String[] orderNames = order.value;
// MOSTRAR JUGADORES ORDENADOS
showPlayers(3, menus[2], orderNames, orderPoints);
}
private void showCredits() {
// IMRPIMIR INFORMACION DE DESARROLADOR
Utils.printMenu(menus[25], 0);
// SALIR
Utils.getOption(rPlayer, input);
}
// MENU DE HISTORIAL
private void showHistory() {
// SIN ALERTAS
alertCode = 0;
// VERIFICAR SI EXISTEN PARTIDAS
if (statusCount >= 0) {
// INICIALIZAR MENU
boolean breakShowHistory = false;
// INICIAR MENU
while (!breakShowHistory) {
// MOSTRAR MENU
Utils.printMenu(menus[1], alertCode);
int historyOption = Utils.getOption(rPlayer, input);
// VERIFICAR OPCION
switch (historyOption) {
case 1:
// MOSTRAR JUGADORES ORDENADOS
showGames();
break;
case 2:
showPoints();
break;
case 3:
// MOSTRAR JUGADORES QUE PERDIERON
showPlayers(1, menus[3], names, status);
break;
case 4:
// MOSTRAR JUGAFORES QUE ENCONTRARON TODAS LAS PALABRAS
showPlayers(2, menus[4], names, status);
break;
case 5:
// SALIR
breakShowHistory = true;
default:
alertCode = 1;
}
}
// SIN ALERTAS
alertCode = 0;
}
// SINO MOSTRAR ERROR 4
else
alertCode = 13;
}
// MENU PRINCIPAL
public void printMenu() {
// INICIALIZAR MENU
boolean breakMenu = false;
alertCode = 0;
while (!breakMenu) {
// MOSTRAR MENU
Utils.printMenu(menus[0], alertCode);
int mainOption = Utils.getOption(rPlayer, input);
switch (mainOption) {
case 1:
// INICIAR UN NUEVO JUEGO
Game soap = new Game();
// AGREGAR NOMBRE Y EMPEZAR
soap.setPlayer(rPlayer);
soap.start();
// ASIGNAR VALORES DE LAS PARTIDAS
statusCount++;
int[] currentStatus = soap.getStatus();
String currentNames = soap.getName();
status[statusCount] = currentStatus;
names[statusCount] = currentNames;
// SIN ALERTAS
alertCode = currentStatus[2] == 3 ? 9 : currentStatus[0] == 0 ? 9 : 14;
break;
case 2:
// MENU DE PARTIDAS
showHistory();
break;
case 3:
showCredits();
break;
case 4:
// MENU DE SALIDA
breakMenu = showExitMenu();
break;
// MENSAJE DE ERROR
default:
alertCode = 1;
}
}
}
} | 27.231405 | 113 | 0.579059 |
76015d6a423b25ba774af4405a69f8559575f85e | 1,199 | package com.example.administrator.newmovie.CustomView;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.administrator.newmovie.R;
/**
* Created by Administrator on 2017/10/11.
*/
public class TitleBar extends RelativeLayout {
private TextView title ;
private ImageButton back ;
public TitleBar(Context context) {
super(context);
initView();
}
public TitleBar(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
}
public TitleBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView();
}
private void initView() {
inflate(getContext(), R.layout.title_bar,this);
title = (TextView) findViewById(R.id.trailer_title);
back = (ImageButton) findViewById(R.id.back);
}
public void setTitle(String s){
title.setText(s+"预告片");
}
public void setBackListener (OnClickListener onClickListener){
back.setOnClickListener(onClickListener);
}
}
| 24.469388 | 76 | 0.688073 |
f2248f24987e803de6060ee86cd2b394153cdc39 | 4,873 | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.Oauth2Service.GrantType;
import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.IOException;
import java.net.URI;
class PkceOauth2ServiceTest {
Oauth2Service oauth2Service = Mockito.mock(Oauth2Service.class);
PkceOauth2Service pkceOauth2Service = new PkceOauth2Service(oauth2Service) {
@Override
public String codeChallenge() {
return "1234";
}
};
Parameters parameters = new Parameters();
@Test
void codeVerifierParameterAddedForAuthorizationCodeExchange() throws IOException {
parameters.setGrantType(GrantType.AUTHORIZATION_CODE.toString());
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() != null &&
p.getCodeVerifier().equals(pkceOauth2Service.codeVerifier())));
}
@Test
void codeVerifierParameterCanBeOverridden() throws IOException {
parameters.setGrantType(GrantType.AUTHORIZATION_CODE.toString());
String codeVerifier = "code-verifier";
parameters.setCodeVerifier(codeVerifier);
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() != null &&
p.getCodeVerifier().equals(codeVerifier)));
}
@Test
void codeVerifierParameterIsNotAddedForTokenRefresh() throws IOException {
parameters.setGrantType(GrantType.REFRESH_TOKEN.toString());
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() == null));
}
@Test
void getAuthorizationRequestUri() throws IOException {
String authorisationRequestUri = "https://authorisation.endpoint?" +
"response_type=code&state=state&redirect_uri=https%3A%2F%2Fredirect.uri";
String expectedOutput = authorisationRequestUri + "&" +
Parameters.CODE_CHALLENGE_METHOD + "=S256&" +
Parameters.CODE_CHALLENGE + "=" + pkceOauth2Service.codeChallenge();
Mockito.when(oauth2Service.getAuthorizationRequestUri(Mockito.any(), Mockito.any()))
.thenReturn(URI.create(authorisationRequestUri));
URI actual = pkceOauth2Service.getAuthorizationRequestUri(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getAuthorizationRequestUri(Mockito.any(), Mockito.any());
Assertions.assertEquals(actual.toString(), expectedOutput);
}
@Test
void getAuthorizationRequestUriWithOverriddenPkceParameters() throws IOException {
String authorisationRequestUri = "https://authorisation.endpoint?" +
"response_type=code&state=state&redirect_uri=https%3A%2F%2Fredirect.uri";
String codeChallengeMethod = "plain";
String codeChallenge = "code-challenge";
String expectedOutput = authorisationRequestUri + "&" +
Parameters.CODE_CHALLENGE_METHOD + "=" + codeChallengeMethod + "&" +
Parameters.CODE_CHALLENGE + "=" + codeChallenge;
parameters.setCodeChallengeMethod(codeChallengeMethod);
parameters.setCodeChallenge(codeChallenge);
Mockito.when(oauth2Service.getAuthorizationRequestUri(Mockito.any(), Mockito.any()))
.thenReturn(URI.create(authorisationRequestUri));
URI actual = pkceOauth2Service.getAuthorizationRequestUri(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getAuthorizationRequestUri(Mockito.any(), Mockito.any());
Assertions.assertEquals(actual.toString(), expectedOutput);
}
}
| 41.29661 | 92 | 0.712703 |
ccb5903effe4291a543958090132a3fb3e38bba5 | 1,940 | package net.mishna;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.Window;
import net.mishna.utils.DBAdapter;
public class SplashScreen extends Activity {
// TODO : add the app initilize here : DB copy to sd card etc ...
protected int _splashTime = 5000;
private Thread splashTread;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE); // Hide activity title .
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
// thread for displaying the SplashScreen
splashTread = new Thread() {
@Override
public void run() {
try {
synchronized (this) {
wait(_splashTime);
}
} catch (InterruptedException e) {
} finally {
finish();
Intent i = new Intent();
i.setClass(getApplicationContext(), MainActivity.class);
startActivity(i);
}
}
};
splashTread.start();
initializeApp();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
synchronized (splashTread) {
splashTread.notifyAll();
}
}
return true;
}
/**
* This method is responsible for application init processes .
*/
private void initializeApp() {
Context ctx = BaseApplication.getContext();
DBAdapter.initilizeApplicationDatabase(ctx.getDatabasePath(DBAdapter.DATABASE_NAME).getParent(), ctx.getAssets());
}
}
| 25.866667 | 122 | 0.581959 |
04e7dfdc9d61c94cff565a42c5761625d11fb941 | 5,561 | package ru.otus.nio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
*/
public class NioServer {
static Logger log = LoggerFactory.getLogger(NioServer.class);
private Selector selector;
private MessageProcessor processor;
final ByteBuffer buffer = ByteBuffer.allocate(256);
public NioServer(int port) throws IOException {
// Создаем неблокирующий channel и привязываем его к порту сервера
ServerSocketChannel serverChannel = ServerSocketChannel.open();
serverChannel.configureBlocking(false);
serverChannel.socket().bind(new InetSocketAddress(port));
// Мультиплексор для channel'a
selector = Selector.open();
// Селектор будет отлавливать события определенного типа на этом channel
// При инициализации нужно отлавливать события - "Подключение клиента"
serverChannel.register(selector, SelectionKey.OP_ACCEPT);
processor = new MessageProcessor();
}
private void loop() {
while (true) {
try {
// Ждем событий на channel
selector.select();
// Может прийти несколько событий одновременно, для каждого события сохраняется ключ
Iterator<SelectionKey> selectedKeys = selector.selectedKeys().iterator();
while (selectedKeys.hasNext()) {
// Получаем и сразу удаляем ключ - мы его обработали
SelectionKey key = selectedKeys.next();
selectedKeys.remove();
// В зависимости от события вызываем обработчик
if (key.isAcceptable()) {
accept(key);
} else if (key.isReadable()) {
log.info("READ: " + key.channel().toString());
read(key);
} else if (key.isWritable()) {
log.info("WRITE: " + key.channel().toString());
write(key);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void accept(SelectionKey key) throws IOException {
// Если пришел accept, значит используется ServerSocketChannel
// на accept() можно получить канал к клиенту (по аналогии с Socket)
ServerSocketChannel serverSocketChannel = (ServerSocketChannel) key.channel();
SocketChannel socketChannel = serverSocketChannel.accept();
log.info("ACCEPT: " + socketChannel.toString());
socketChannel.configureBlocking(false);
// Регистрируем на селекторе новый канал, сервер пассивный - ждет, когда клиент напишет
socketChannel.register(selector, SelectionKey.OP_READ);
}
private void read_(SelectionKey key) throws Exception {
SocketChannel socketChannel = (SocketChannel) key.channel();
int numRead;
try {
buffer.clear();
numRead = socketChannel.read(buffer);
} catch (IOException e) {
// The remote forcibly closed the connection, cancel
// the selection key and close the channel.
key.cancel();
socketChannel.close();
return;
}
if (numRead == -1) {
// Remote entity shut the socket down cleanly. Do the
// same from our end and cancel the channel.
key.channel().close();
key.cancel();
return;
}
buffer.flip();
byte[] data = new byte[numRead];
buffer.get(data);
processor.process(new Message(socketChannel, data));
}
private void read(SelectionKey key) throws Exception {
SocketChannel socketChannel = (SocketChannel) key.channel();
ByteBuffer buffer = ByteBuffer.allocate(32);
// Attempt to read off the channel
int numRead;
try {
numRead = socketChannel.read(buffer);
} catch (IOException e) {
// The remote forcibly closed the connection, cancel
// the selection key and close the channel.
key.cancel();
socketChannel.close();
return;
}
if (numRead == -1) {
// Remote entity shut the socket down cleanly. Do the
// same from our end and cancel the channel.
key.channel().close();
key.cancel();
return;
}
// Read data from channel and echoing
buffer.flip();
byte[] data = new byte[numRead];
buffer.get(data);
socketChannel.write(ByteBuffer.wrap(data));
System.out.println("on read: " + new String(data));
// Ждем записи в канал
// key.interestOps(SelectionKey.OP_WRITE);
}
private void write(SelectionKey key) throws IOException {
SocketChannel socketChannel = (SocketChannel) key.channel();
String resp = "deadbeaf";
ByteBuffer buffer = ByteBuffer.wrap(resp.getBytes());
socketChannel.write(buffer);
// key.interestOps(SelectionKey.OP_READ);
}
public static void main(String[] args) throws IOException {
NioServer server = new NioServer(9000);
server.loop();
}
}
| 35.420382 | 100 | 0.596655 |
9615f3dcaa9baf00a8e9457ed958f655a7229353 | 1,498 | package org.frameworkset.tran.es;
/**
* Copyright 2008 biaoping.yin
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
import org.frameworkset.elasticsearch.entity.ESDatas;
import org.frameworkset.elasticsearch.scroll.HandlerInfo;
import org.frameworkset.elasticsearch.scroll.ParralBreakableScrollHandler;
import org.frameworkset.tran.context.ImportContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>Description: </p>
* <p></p>
* <p>Copyright (c) 2018</p>
* @Date 2019/1/11 15:19
* @author biaoping.yin
* @version 1.0
*/
public abstract class BaseESExporterScrollHandler<T> extends ParralBreakableScrollHandler<T> {
protected ImportContext importContext ;
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
public BaseESExporterScrollHandler(ImportContext importContext ) {
this.importContext = importContext;
}
public abstract void handle(ESDatas<T> response, HandlerInfo handlerInfo) throws Exception ;
}
| 30.571429 | 94 | 0.764352 |
7165c2eb6fb7bdd6d7ac4c2ee7ac4ebe7ea73032 | 21,247 | /*
* Copyright (c) 2021 Titan Robotics Club (http://www.titanrobotics.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package teamcode.Season_Setup;
import android.os.Environment;
import com.qualcomm.robotcore.hardware.DcMotor;
import TrcCommonLib.trclib.TrcPose2D;
/**
* This class contains robot and subsystem constants and parameters.
*/
public class RobotParams
{
/**
* This class contains robot preferences. It controls enabling/disabling of various robot features.
*/
public static class Preferences
{
// System Preferences
public static boolean useVision = true;
public static boolean visionOnly = false;
public static boolean useBlinkin = false;
public static boolean useTraceLog = true;
public static boolean useBatteryMonitor = false;
public static boolean useLoopPerformanceMonitor = true;
public static boolean speakEnabled = false;
// Competition Mode
public static boolean competitionMode = true;
// Mechanism Preferences
public static boolean initSubsystems = true;
public static boolean useArmSystem = true; // Includes: Collector, Arm Extension, Arm Rotator, Arm Platform Rotator
public static boolean useDuckSystem = true; // Includes: CarouselSpinner, CarouselExtenderOne, CarouselExtenderTwo
} // class Preferences
// Enum declaration for different drive styles.
public enum DriveMode
{
TANK_MODE,
ARCADE_MODE
} // enum DriveMode
public static final String LOG_PATH_FOLDER =
Environment.getExternalStorageDirectory().getPath() + "/FIRST/ftc3491";
//----------------------------------------------------------------------------------------------
// Robot Parameters
//----------------------------------------------------------------------------------------------
// Drivebase
public static final String HWNAME_LEFT_FRONT_WHEEL = "frontL";
public static final String HWNAME_RIGHT_FRONT_WHEEL = "frontR";
public static final String HWNAME_LEFT_BACK_WHEEL = "backL";
public static final String HWNAME_RIGHT_BACK_WHEEL = "backR";
// Mechanism (Motors and Servos)
public static final String HWNAME_COLLECTOR = "collector";
public static final String HWNAME_ARM_EXTENDER = "armExtender";
public static final String HWNAME_ARM_ROTATOR = "armRotator";
public static final String HWNAME_ARM_PLATFORM_ROTATOR = "armPlatformRotator";
public static final String HWNAME_CAROUSEL_SPINNER = "carouselSpinner";
public static final String HWNAME_CAROUSEL_SPINNER_EXTENDER_ONE = "carouselExtenderOne";
public static final String HWNAME_CAROUSEL_SPINNER_EXTENDER_TWO = "carouselExtenderTwo";
// Sensors
public static final String HWNAME_IMU = "imu";
public static final String HWNAME_WEBCAM = "Webcam 1";
// static final String HWNAME_BLINKIN = "blinkin";
// Field dimensions
static final double FULL_FIELD_INCHES = 141.0;
static final double HALF_FIELD_INCHES = FULL_FIELD_INCHES/2.0;
static final double QUAD_FIELD_INCHES = FULL_FIELD_INCHES/4.0;
static final double FULL_TILE_INCHES = 23.75;
static final double HALF_TILE_INCHES = FULL_TILE_INCHES/2.0;
// Robot dimensions
public static final double ROBOT_LENGTH = 17.0;
public static final double ROBOT_WIDTH = 15.0;
//// Start positions
static final double STARTPOS_FROM_FIELDCENTER_Y = HALF_FIELD_INCHES - ROBOT_LENGTH/2.0;
static final double STARTPOS_FROM_FIELDCENTER_X1 = QUAD_FIELD_INCHES;
static final double STARTPOS_FROM_FIELDCENTER_X2 = HALF_TILE_INCHES;
// Red position
public static final TrcPose2D STARTPOS_RED_NEAR_CAROUSEL =
new TrcPose2D(-STARTPOS_FROM_FIELDCENTER_X1, -STARTPOS_FROM_FIELDCENTER_Y, 0.0);
public static final TrcPose2D STARTPOS_RED_FAR_CAROUSEL =
new TrcPose2D(STARTPOS_FROM_FIELDCENTER_X2, -STARTPOS_FROM_FIELDCENTER_Y, 0.0);
// Blue position
public static final TrcPose2D STARTPOS_BLUE_NEAR_CAROUSEL =
new TrcPose2D(-STARTPOS_FROM_FIELDCENTER_X1, STARTPOS_FROM_FIELDCENTER_Y, 180.0);
public static final TrcPose2D STARTPOS_BLUE_FAR_CAROUSEL =
new TrcPose2D(STARTPOS_FROM_FIELDCENTER_X2, STARTPOS_FROM_FIELDCENTER_Y, 180.0);
// Motor Odometries
// (Drive Motors) - https://www.gobilda.com/5203-series-yellow-jacket-planetary-gear-motor-19-2-1-ratio-24mm-length-8mm-rex-shaft-312-rpm-3-3-5v-encoder/
public static final double GOBILDA_5203_312_ENCODER_PPR = 537.689839572;
public static final double GOBILDA_5203_312_RPM = 312.0;
public static final double GOBILDA_5203_312_MAX_VELOCITY_PPS =
GOBILDA_5203_312_ENCODER_PPR*GOBILDA_5203_312_RPM/60.0; // 2795.987 pps
// (Arm Rotator Motor) - https://www.gobilda.com/5204-series-yellow-jacket-planetary-gear-motor-99-5-1-ratio-80mm-length-8mm-rex-shaft-60-rpm-3-3-5v-encoder/
public static final double GOBILDA_5204_60_ENCODER_PPR = 2786.21098687;
public static final double GOBILDA_5204_60_RPM = 60.0;
public static final double GOBILDA_5204_60_MAX_VELOCITY_PPS =
GOBILDA_5204_60_ENCODER_PPR*GOBILDA_5204_60_RPM/60.0;
// (Core Hex) - https://www.revrobotics.com/rev-41-1300/
public static final double REV_CORE_HEX_ENCODER_PPR = 288.0;
public static final double REV_CORE_HEX_RPM = 125.0;
public static final double REV_CORE_MAX_VELOCITY_PPS =
REV_CORE_HEX_ENCODER_PPR*REV_CORE_HEX_RPM/60.0;
// (UltraPlanetary Motor - with 3:1,4:1,5:1) - https://www.revrobotics.com/rev-41-1600/
public static final double REV_ULTRAPLANETARY_ENCODER_PPR = 28.0 *3*4*5;
public static final double REV_ULTRAPLANETARY_RPM = 6000.0/ (3*4*5);
public static final double REV_ULTRAPLANETARY_MAX_VELOCITY_PPS =
REV_ULTRAPLANETARY_ENCODER_PPR*REV_ULTRAPLANETARY_RPM/60.0;
// DriveBase subsystem
public static final DriveMode ROBOT_DRIVE_MODE = DriveMode.TANK_MODE;
public static final DcMotor.RunMode DRIVE_MOTOR_MODE = DcMotor.RunMode.RUN_WITHOUT_ENCODER;
public static final boolean LEFT_WHEEL_INVERTED = true;
public static final boolean RIGHT_WHEEL_INVERTED = false;
public static final boolean DRIVE_WHEEL_BRAKE_MODE = true;
public static final double TURN_POWER_LIMIT = 0.5;
public static final double SLOW_DRIVE_POWER_SCALE = 0.5;
public static final boolean PID_DRIVEBASE_STALL_ENABLED = true;
// Velocity controlled constants.
public static final double DRIVE_MOTOR_MAX_VELOCITY_PPS = GOBILDA_5203_312_MAX_VELOCITY_PPS;
public static final double ENCODER_Y_KP = 0.032; // Previous val: N/A
public static final double ENCODER_Y_KI = 0.0;
public static final double ENCODER_Y_KD = 0.007; // Previous val: N/A
public static final double ENCODER_Y_TOLERANCE = 1.0;
public static final double ENCODER_Y_INCHES_PER_COUNT = 0.05885658375298495669047260284064;
public static final double GYRO_KP = 0.020;
public static final double GYRO_KI = 0.0;
public static final double GYRO_KD = 0.000;
public static final double GYRO_TOLERANCE = 2.0;
public static final double PIDDRIVE_STALL_TIMEOUT = 0.2; // in seconds.
//// Pure Pursuit parameters
// No-Load max velocity (i.e. theoretical maximum)
// goBILDA 5203-312 motor, max shaft speed = 312 RPM
// motor-to-wheel gear ratio = 1:1
// max wheel speed = pi * wheel diameter * wheel gear ratio * motor RPM / 60.0
// = 3.1415926535897932384626433832795 * 4 in. * 1.0 * 312.0 / 60.0
// = 65.345127194667699360022982372214 in./sec.
public static final double ROBOT_MAX_VELOCITY = 25.0; // measured maximum from drive speed test.
public static final double ROBOT_MAX_ACCELERATION = 3380.0; // measured maximum from drive speed test
public static final double ROBOT_VEL_KP = 0.0;
public static final double ROBOT_VEL_KI = 0.0;
public static final double ROBOT_VEL_KD = 0.0;
// KF should be set to the reciprocal of max tangential velocity (time to travel unit distance), units: sec./in.
public static final double ROBOT_VEL_KF = 1.0 / ROBOT_MAX_VELOCITY;
public static final double PPD_FOLLOWING_DISTANCE = 6.0; // If robot does not turn properly, change to larger value
public static final double PPD_POS_TOLERANCE = 2.0;
public static final double PPD_TURN_TOLERANCE = 1.0;
// // Homography
// public static final double HOMOGRAPHY_CAMERA_TOPLEFT_X = 0.0;
// public static final double HOMOGRAPHY_CAMERA_TOPLEFT_Y = 0.0;
// public static final double HOMOGRAPHY_CAMERA_TOPRIGHT_X = 639;
// public static final double HOMOGRAPHY_CAMERA_TOPRIGHT_Y = 0;
// public static final double HOMOGRAPHY_CAMERA_BOTTOMLEFT_X = 0.0;
// public static final double HOMOGRAPHY_CAMERA_BOTTOMLEFT_Y = 479;
// public static final double HOMOGRAPHY_CAMERA_BOTTOMRIGHT_X = 639;
// public static final double HOMOGRAPHY_CAMERA_BOTTOMRIGHT_Y = 479;
//
// // These should be in real-world robot coordinates. Needs calibration after camera is actually mounted in position.
// // Measurement unit: inches
// public static final double HOMOGRAPHY_WORLD_TOPLEFT_X = -22.25;
// public static final double HOMOGRAPHY_WORLD_TOPLEFT_Y = 60;
// public static final double HOMOGRAPHY_WORLD_TOPRIGHT_X = 23;
// public static final double HOMOGRAPHY_WORLD_TOPRIGHT_Y =60;
// public static final double HOMOGRAPHY_WORLD_BOTTOMLEFT_X = -8.75;
// public static final double HOMOGRAPHY_WORLD_BOTTOMLEFT_Y = 16;
// public static final double HOMOGRAPHY_WORLD_BOTTOMRIGHT_X = 7.5;
// public static final double HOMOGRAPHY_WORLD_BOTTOMRIGHT_Y = 16;
//
//
// // Vision subsystem.
// public static final String TRACKABLE_IMAGES_FILE = "FreightFrenzy";
// public static final double CAMERA_FRONT_OFFSET = 7.5; // Camera offset from front of robot in inches
// public static final double CAMERA_HEIGHT_OFFSET = 16.0; // Camera offset from floor in inches
// public static final double CAMERA_LEFT_OFFSET = 8.875; // Camera offset from left of robot in inches
//----------------------------------------------------------------------------------------------
// Mechanism Parameters/ subsystems
//----------------------------------------------------------------------------------------------
// Collector
public static final double COLLECTOR_PICKUP_POWER = 0.0;
public static final double COLLECTOR_DEPOSIT_POWER = 1.0;
public static final double COLLECTOR_STOP_POWER = 0.5;
public static final double COLLECTOR_PICKUP_TIME = 0.0;
public static final double COLLECTOR_DEPOSITING_TIME = 2.0;
// Arm Extender
public static final double ARM_EXTENDER_KP = 0.5;
public static final double ARM_EXTENDER_KI = 0.0;
public static final double ARM_EXTENDER_KD = 0.0;
public static final double ARM_EXTENDER_TOLERANCE = 0.2;
public static final double ARM_EXTENDER_ENCODER_PPR = 375.0; // Prev: REV_CORE_HEX_ENCODER_PPR
// https://www.revrobotics.com/rev-41-1300/
public static final double ARM_EXTENDER_SPROCKET_DIAMETER = 1.952853882; // in inches
public static final double ARM_EXTENDER_INCHES_PER_COUNT = 8.0/ ARM_EXTENDER_ENCODER_PPR; // Prev: Math.PI * ARM_EXTENDER_SPROCKET_DIAMETER/ARM_EXTENDER_ENCODER_PPR
public static final double ARM_EXTENDER_OFFSET = 0.0;
public static final double ARM_EXTENDER_MIN_POS = -0.2; // in inches (true min = 0.0)
public static final double ARM_EXTENDER_MAX_POS = 8.2; // in inches (true max = 8.0)
public static final boolean ARM_EXTENDER_MOTOR_INVERTED = false;
public static final boolean ARM_EXTENDER_HAS_LOWER_LIMIT_SWITCH = false;
public static final boolean ARM_EXTENDER_LOWER_LIMIT_INVERTED = false;
public static final boolean ARM_EXTENDER_HAS_UPPER_LIMIT_SWITCH = false;
public static final boolean ARM_EXTENDER_UPPER_LIMIT_INVERTED = false;
public static final double ARM_EXTENDER_CAL_POWER = 0.5; // Calibration Power
public static final double ARM_EXTENDER_STALL_MIN_POWER = 0.45;
public static final double ARM_EXTENDER_STALL_TOLERANCE = 0.0;
public static final double ARM_EXTENDER_STALL_TIMEOUT = 0.5;
public static final double ARM_EXTENDER_RESET_TIMEOUT = 0.5;
public static final double[] ARM_EXTENDER_PRESET_LENGTH = new double[] {ARM_EXTENDER_MIN_POS, 3, 6, 8};
public static final double ARM_EXTENDER_SLOW_POWER_SCALE = 0.5;
// Arm Rotator subsystem
public static final double ARM_ROTATOR_KP = 0.03;
public static final double ARM_ROTATOR_KI = 0.0;
public static final double ARM_ROTATOR_KD = 0.0;
public static final double ARM_ROTATOR_TOLERANCE = 5.0;
public static final double ARM_ROTATOR_ENCODER_PPR = GOBILDA_5204_60_ENCODER_PPR;
// https://www.gobilda.com/5204-series-yellow-jacket-planetary-gear-motor-99-5-1-ratio-80mm-length-8mm-rex-shaft-60-rpm-3-3-5v-encoder/
public static final double ARM_ROTATOR_GEAR_RATIO = 1.0;
public static final double ARM_ROTATOR_DEG_PER_COUNT = 360.0/(ARM_ROTATOR_ENCODER_PPR * ARM_ROTATOR_GEAR_RATIO);
public static final double ARM_ROTATOR_OFFSET = 22.0; // (True value is 20.3) Changed by around 16 degrees after moving up and down for the first time. - Prev Val: 41.2, 7.4
public static final double ARM_ROTATOR_OFFSET_TELEOP = 40.0; // (True value is 51.6) Changed by around 16 degrees after moving up and down for the first time. - Prev Val: 25.7
public static final double ARM_ROTATOR_MIN_POS = 54.7;
public static final double ARM_ROTATOR_MAX_POS = 130.0;
public static final boolean ARM_ROTATOR_MOTOR_INVERTED = true;
public static final boolean ARM_ROTATOR_HAS_LOWER_LIMIT_SWITCH = false;
public static final boolean ARM_ROTATOR_LOWER_LIMIT_INVERTED = false;
public static final boolean ARM_ROTATOR_HAS_UPPER_LIMIT_SWITCH = false;
public static final boolean ARM_ROTATOR_UPPER_LIMIT_INVERTED = false;
public static final double ARM_ROTATOR_MAX_GRAVITY_COMPENSATION = 0.03;
public static final double ARM_ROTATOR_STALL_MIN_POWER = ARM_ROTATOR_MAX_GRAVITY_COMPENSATION+.3;
public static final double ARM_ROTATOR_STALL_TOLERANCE = 0.0;
public static final double ARM_ROTATOR_STALL_TIMEOUT = 0.5;
public static final double ARM_ROTATOR_RESET_TIMEOUT = 0.5;
public static final double ARM_ROTATOR_CAL_POWER = ARM_ROTATOR_STALL_MIN_POWER+0.05;
public static final double[] ARM_ROTATOR_PRESET_LEVELS = new double[] {ARM_ROTATOR_MIN_POS, 60, 80, 115};
public static final double ARM_ROTATOR_SLOW_POWER_SCALE = 0.375;
public static final double ARM_ROTATOR_LOWERING_ARM_POWER_SCALE = 4.0;
// Arm Platform Rotator
public static final double ARM_PLATFORM_ROTATOR_KP = 0.005;
public static final double ARM_PLATFORM_ROTATOR_KI = 0.0;
public static final double ARM_PLATFORM_ROTATOR_KD = 0.0;
public static final double ARM_PLATFORM_ROTATOR_TOLERANCE = 2.0;
public static final double ARM_PLATFORM_ROTATOR_ENCODER_PPR = 1536.25; // Prev: REV_ULTRAPLANETARY_ENCODER_PPR
// https://www.revrobotics.com/rev-41-1600/
public static final double ARM_PLATFORM_ROTATOR_GEAR_RATIO = 1.0;
public static final double ARM_PLATFORM_ROTATOR_DEG_PER_COUNT = 360.0/ ARM_PLATFORM_ROTATOR_ENCODER_PPR; // Prev: 360.0/(ARM_PLATFORM_ROTATOR_ENCODER_PPR * ARM_PLATFORM_ROTATOR_GEAR_RATIO)
public static final double ARM_PLATFORM_ROTATOR_OFFSET = -90.0; // Prev - 65.4
public static final double ARM_PLATFORM_ROTATOR_OFFSET_TELEOP = 0.0;
public static final double ARM_PLATFORM_ROTATOR_MIN_POS = -200.0;
public static final double ARM_PLATFORM_ROTATOR_MAX_POS = 200.0;
public static final boolean ARM_PLATFORM_ROTATOR_MOTOR_INVERTED = false;
public static final boolean ARM_PLATFORM_ROTATOR_HAS_LOWER_LIMIT_SWITCH = false;
public static final boolean ARM_PLATFORM_ROTATOR_LOWER_LIMIT_INVERTED = false;
public static final boolean ARM_PLATFORM_ROTATOR_HAS_UPPER_LIMIT_SWITCH = false;
public static final boolean ARM_PLATFORM_ROTATOR_UPPER_LIMIT_INVERTED = false;
public static final double ARM_PLATFORM_ROTATOR_CAL_POWER = 0.2;
public static final double ARM_PLATFORM_ROTATOR_STALL_MIN_POWER = 0.1;
public static final double ARM_PLATFORM_ROTATOR_STALL_TOLERANCE = 0.0;
public static final double ARM_PLATFORM_ROTATOR_STALL_TIMEOUT = 1.0;
public static final double ARM_PLATFORM_ROTATOR_RESET_TIMEOUT = 0.5;
public static final double[] ARM_PLATFORM_ROTATOR_PRESET_LEVELS = new double[] {-180.0, -90.0, 0.0, 90.0, 180.0}; // Back, Left, Front, Right, Back
public static final double ARM_PLATFORM_ROTATOR_SLOW_POWER_SCALE = 0.25;
// Carousel Spinner
public static final double CAROUSEL_SPINNER_BLUE = 0.0;
public static final double CAROUSEL_SPINNER_RED = 1.0;
public static final double CAROUSEL_SPINNER_STOP_POWER = 0.5;
public static final double CAROUSEL_SPINNER_SPIN_TIME = 4.0;
// Carousel Extender One
public static final double CAROUSEL_EXTENDER_ONE_RETRACT_POWER = 0.7;
public static final double CAROUSEL_EXTENDER_ONE_EXTEND_POWER = 0.3;
public static final double CAROUSEL_EXTENDER_ONE_STOP_POWER = 0.5;
public static final double CAROUSEL_EXTENDER_ONE_EXTENDING_TIME = 3.4;
// Carousel Extender Two
public static final double CAROUSEL_EXTENDER_TWO_RETRACT_POWER = 1.0;
public static final double CAROUSEL_EXTENDER_TWO_EXTEND_POWER = 0.0;
public static final double CAROUSEL_EXTENDER_TWO_STOP_POWER = 0.5;
public static final double CAROUSEL_EXTENDER_TWO_EXTENDING_TIME = 3.4;
} // class RobotInfo
| 61.585507 | 198 | 0.655528 |
459420b74e3f2c50994a7ffd6e6cbfbf3cd242c2 | 1,755 | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.BlockPos;
public class S28PacketEffect implements Packet<INetHandlerPlayClient> {
private int field_149251_a;
private BlockPos field_179747_b;
private int field_149249_b;
private boolean field_149246_f;
public S28PacketEffect() {
}
public S28PacketEffect(int p_i45978_1_, BlockPos p_i45978_2_, int p_i45978_3_, boolean p_i45978_4_) {
this.field_149251_a = p_i45978_1_;
this.field_179747_b = p_i45978_2_;
this.field_149249_b = p_i45978_3_;
this.field_149246_f = p_i45978_4_;
}
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException {
this.field_149251_a = p_148837_1_.readInt();
this.field_179747_b = p_148837_1_.func_179259_c();
this.field_149249_b = p_148837_1_.readInt();
this.field_149246_f = p_148837_1_.readBoolean();
}
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException {
p_148840_1_.writeInt(this.field_149251_a);
p_148840_1_.func_179255_a(this.field_179747_b);
p_148840_1_.writeInt(this.field_149249_b);
p_148840_1_.writeBoolean(this.field_149246_f);
}
public void func_148833_a(INetHandlerPlayClient p_148833_1_) {
p_148833_1_.func_147277_a(this);
}
public boolean func_149244_c() {
return this.field_149246_f;
}
public int func_149242_d() {
return this.field_149251_a;
}
public int func_149241_e() {
return this.field_149249_b;
}
public BlockPos func_179746_d() {
return this.field_179747_b;
}
}
| 29.745763 | 104 | 0.747009 |
ec9afa989bb44641972cfbc31d077fa32a79e2f0 | 3,973 | package com.mark.test.framework.server.client;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
/**
* Created by mark .
* Data : 2017/8/14
* Author : mark
* Desc :
*/
public class SocketClient {
static Logger logger = LoggerFactory.getLogger(SocketClient.class);
/**
* NIO socket客户端
*
* @param msg 发送的信息
*/
public void sendMsgWithNIO(String msg) {
SocketChannel socketChannel = null;
InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", 8877);
try {
socketChannel = SocketChannel.open();
socketChannel.configureBlocking(false);
socketChannel.connect(inetSocketAddress);
while (!socketChannel.finishConnect()) {
logger.info("Haven't connect to server");
Thread.sleep(1000);
}
logger.info("Connected to remote server {}", inetSocketAddress.getAddress());
ByteBuffer buffer = ByteBuffer.allocate(1024);
buffer.put(msg.getBytes());
buffer.flip();
while (buffer.hasRemaining()) {
socketChannel.write(buffer);
}
buffer.clear();
} catch (IOException e) {
e.printStackTrace();
try {
assert socketChannel != null;
socketChannel.close();
} catch (IOException e1) {
e1.printStackTrace();
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
try {
assert socketChannel != null;
socketChannel.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 向socket服务器发送消息
*
* @param msg
* @throws IOException
*/
public void sendMsg(String msg) {
Socket socket = new Socket();
SocketAddress socketAddress = new InetSocketAddress("localhost", 8877);
BufferedWriter bufferedWriter = null;
BufferedReader bufferedReader = null;
try {
socket.connect(socketAddress, 15000);
// //端口复用
// socket.setReuseAddress(true);
// socket.setSoLinger(true,30);
bufferedWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
bufferedWriter.write(msg);
bufferedWriter.flush();
logger.info("消息已经发送");
socket.shutdownOutput();
while (true){
logger.info("等待响应");
bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String retmsg = bufferedReader.readLine();
if(!retmsg.isEmpty()){
logger.info("服务端返回信息为:{}", retmsg);
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
assert bufferedWriter != null;
bufferedWriter.close();
if (!socket.isClosed()) {
socket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
String msg = "00001000<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<tx><HEAD><TRANSRNO>GH0005</TRANSRNO><BANKCODE>Test</BANKCODE><TRANSORGNO>xxxxxxxx</TRANSORGNO><SERIALNUMBER>XOL201802140000000005043</SERIALNUMBER><TRANSRDATE>20180214190000</TRANSRDATE></HEAD><BODY><IDCODE>320525196801112536</IDCODE></BODY></tx>";
SocketClient socketClient = new SocketClient();
socketClient.sendMsg(msg);
}
}
| 32.040323 | 266 | 0.555248 |
37a5798e8c4bc7e8884ab2cb3f08b98e348f3ee9 | 1,884 | /*
* Copyright (C) 2020 Dremio
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dremio.nessie.versioned.impl;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.immutables.value.Value.Immutable;
import com.dremio.nessie.versioned.store.Entity;
import com.dremio.nessie.versioned.store.Id;
import com.google.common.collect.ImmutableList;
/**
* Describes a list of parent hashes from the current hash.
*/
@Immutable
abstract class ParentList {
static final int MAX_PARENT_LIST_SIZE = 50;
public static final ParentList EMPTY = ImmutableParentList.builder().addParents(Id.EMPTY).build();
public abstract List<Id> getParents();
public ParentList cloneWithAdditional(Id id) {
return ImmutableParentList.builder().addAllParents(
Stream.concat(
Stream.of(id),
getParents().stream())
.limit(MAX_PARENT_LIST_SIZE)
.collect(ImmutableList.toImmutableList()))
.build();
}
public final Id getParent() {
return getParents().get(0);
}
public Entity toEntity() {
return Entity.ofList(getParents().stream().map(Id::toEntity));
}
public static ParentList fromEntity(Entity value) {
return ImmutableParentList.builder().addAllParents(value.getList().stream().map(Id::fromEntity).collect(Collectors.toList())).build();
}
}
| 29.904762 | 138 | 0.727707 |
a4086824a78e6b2c397b961ce8a52557b5bd72ae | 954 | package com.github.jacal.demo.groups.domain;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.neo4j.ogm.annotation.GraphId;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;
import org.springframework.data.annotation.Id;
import javax.annotation.Generated;
import java.util.LinkedHashSet;
import java.util.Set;
@NodeEntity
@NoArgsConstructor
@Getter @Setter
public class Person {
@GraphId
private Long id;
private String lastName;
private String firstName;
@Relationship(type = "MEMBER_OF")
private Set<Group> subscribedGroups = new LinkedHashSet<>();
@Relationship(type = "OWNS")
private Set<Group> ownedGroups = new LinkedHashSet<>();
public String getName() {
return firstName + " " + lastName;
}
}
| 25.105263 | 64 | 0.759958 |
1c9b7c2876b240a20b3f6f246a5ae51cec85ec69 | 4,501 | /**
* Copyright 2020 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.kogito.kafka;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyCollection;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
@Disabled("Causing issues on Quarkus Platform CI")
@ExtendWith(MockitoExtension.class)
public class KafkaClientTest {
private static final String TOPIC = "my-topic";
private static final String MESSAGE_TO_CONSUME = "my-message-to-consume";
private static final String MESSAGE_TO_PRODUCE = "my-message-to-produce";
@Mock
private KafkaProducer<String, String> producer;
@Mock
private KafkaConsumer<String, String> consumer;
private KafkaClient client;
private List<String> messages;
private CountDownLatch waiter;
@BeforeEach
public void setup() {
messages = new ArrayList<>();
waiter = new CountDownLatch(1);
}
@Test
public void shouldConsumeMessage() throws InterruptedException {
givenKafkaClient();
whenConsume();
thenConsumerIsSubscribed();
thenMessageIsReceived();
}
@Test
public void shouldProduceMessage() {
givenKafkaClient();
whenProduceMessage();
thenProducerIsInvoked();
}
@Test
public void shouldCloseWhenShutdown() {
givenKafkaClient();
whenShutdown();
thenProducerIsClosed();
thenConsumerIsClosed();
}
private void givenKafkaClient() {
client = new KafkaClient(producer, consumer);
}
private void whenShutdown() {
client.shutdown();
}
@SuppressWarnings("unchecked")
private void whenConsume() {
ConsumerRecord<String, String> record = mock(ConsumerRecord.class);
ConsumerRecords<String, String> records = mock(ConsumerRecords.class);
lenient().when(records.spliterator()).thenReturn(Collections.singleton(record).spliterator());
lenient().when(record.value()).thenReturn(MESSAGE_TO_CONSUME);
lenient().when(consumer.poll(any(Duration.class))).thenReturn(records);
client.consume(TOPIC, message -> {
messages.add(message);
waiter.countDown();
});
}
private void whenProduceMessage() {
client.produce(MESSAGE_TO_PRODUCE, TOPIC);
}
private void thenProducerIsInvoked() {
verify(producer).send(eq(new ProducerRecord<>(TOPIC, MESSAGE_TO_PRODUCE)), any());
}
private void thenConsumerIsSubscribed() {
verify(consumer).subscribe(anyCollection());
}
private void thenProducerIsClosed() {
verify(producer).close();
}
private void thenConsumerIsClosed() {
verify(consumer).close();
}
private void thenMessageIsReceived() throws InterruptedException {
waiter.await(5000, TimeUnit.MILLISECONDS);
verify(consumer, Mockito.atLeastOnce()).commitSync();
assertTrue(messages.contains(MESSAGE_TO_CONSUME));
}
}
| 31.697183 | 102 | 0.714064 |
6c1e5b409427b237fe09d5bc85b6bf4089ae3c31 | 6,416 | /*
* Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
*
* BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
*
* License for BK-BASE 蓝鲸基础平台:
* --------------------------------------------------------------------
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.tencent.bk.base.datahub.databus.pipe.cal;
import com.tencent.bk.base.datahub.databus.pipe.utils.JdbcUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class CacheMapImpl {
private static final Logger log = LoggerFactory.getLogger(CacheMapImpl.class);
private static final int UPDATE_INTERVAL = 900; // 15min, 15 * 60 TODO test
public static final String SEP = "|";
private ConcurrentMap<String, Map<String, Object>> cache = new ConcurrentHashMap<>();
private ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);
// for test only
private String connUrl;
private String connUser;
private String connPass;
private String connDb;
/**
* 缓存时间类
* 负责定时更新、缓存信息的获取等功能
*/
private CacheMapImpl(String host, String port, String user, String pass, String db) {
connUrl = "jdbc:mysql://" + host + ":" + port + "/";
connUser = user;
connPass = pass;
connDb = db;
try {
exec.scheduleAtFixedRate(new UpdateCache(), 30, UPDATE_INTERVAL, TimeUnit.SECONDS);
} catch (Exception e) {
log.error("failed to update cache items at fixed rate!", e);
}
}
/**
* 负责定时更新、缓存信息的获取等功能
*/
class UpdateCache implements Runnable {
@Override
public void run() {
try {
updateCache();
} catch (Exception e) {
log.warn("failed to update cache map in one loop!!", e);
}
}
}
private static volatile CacheMapImpl INSTANCE;
/**
* 获取cache map实例
*
* @param host db的hostname/ip
* @param port db的端口
* @param user db的账户名
* @param pass db的密码
* @param db 数据库名称
* @return cache map实例
*/
public static final CacheMapImpl getInstance(String host, String port, String user, String pass, String db) {
if (INSTANCE == null) {
synchronized (CacheMapImpl.class) {
if (INSTANCE == null) {
INSTANCE = new CacheMapImpl(host, port, user, pass, db);
}
}
}
return INSTANCE;
}
public String getCacheKey(String tableName, String mapColumn, String keysColumn) {
return tableName + SEP + mapColumn + SEP + keysColumn;
}
/**
* 将指定的map配置添加到缓存中
*
* @param tableName 数据库表名
* @param mapColumn 数据库表中的字段名称,用于构建cache中mapping的value
* @param keysColumn 数据库表中的字段名称列表,用于构建cache中mapping的key
*/
public void addCache(String tableName, String mapColumn, String keysColumn) {
String cacheKey = getCacheKey(tableName, mapColumn, keysColumn);
log.info("start to init cache for {}", cacheKey);
synchronized (this) {
if (!cache.containsKey(cacheKey)) {
cache.putIfAbsent(cacheKey, new HashMap<String, Object>());
}
}
if (cache.get(cacheKey).size() == 0) {
cache.put(cacheKey, getCacheItems(tableName, mapColumn, keysColumn));
}
}
/**
* 从数据库中获取缓存对象,放入map中。
*
* @param tableName 数据库表名
* @param mapColumn 返回的map中的value字段的名称
* @param keysColumn 返回的map中的key字段的名称
* @return 包含key->value的键值对的map数据结构
*/
private Map<String, Object> getCacheItems(String tableName, String mapColumn, String keysColumn) {
log.info("get cache items for {} | {} | {}", tableName, mapColumn, keysColumn);
try {
return JdbcUtils.getCache(connUrl, connUser, connPass, connDb, tableName, mapColumn, keysColumn, SEP);
} catch (Exception e) {
log.error("failed to get cache items from DB", e);
}
return new HashMap<>();
}
/**
* 更新所有的缓存数据
*/
private void updateCache() throws Exception {
Set<String> keySet = cache.keySet();
log.info("start to update map cache {}", keySet);
for (String cacheKey : keySet) {
String[] arr = StringUtils.split(cacheKey, SEP);
log.info("update cache cachekey: {}, sep: {}, arr: {}", cacheKey, SEP, arr);
Map<String, Object> res = getCacheItems(arr[0], arr[1], arr[2]);
if (res.size() > 0) {
log.info("updating cache items for {}", cacheKey);
cache.put(cacheKey, res);
}
}
log.info("all map cache updated");
}
/**
* 从cache中获取指定cacheKey下的key的映射值。
*
* @param cacheKey cacheKey,由表名、映射value字段,映射key字段,分隔符组成
* @param key 用于检索map中数据的key值
* @return key的映射值
*/
public Object get(String cacheKey, String key) {
return cache.get(cacheKey).get(key);
}
}
| 35.252747 | 114 | 0.63404 |
82c19a7b69327ad22288c5b08a471ab860f94617 | 1,545 | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: POGOProtos.Rpc.proto
package POGOProtos.Rpc;
public interface GymDisplayProtoOrBuilder extends
// @@protoc_insertion_point(interface_extends:POGOProtos.Rpc.GymDisplayProto)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .POGOProtos.Rpc.GymEventProto gym_event = 1;</code>
*/
java.util.List<POGOProtos.Rpc.GymEventProto>
getGymEventList();
/**
* <code>repeated .POGOProtos.Rpc.GymEventProto gym_event = 1;</code>
*/
POGOProtos.Rpc.GymEventProto getGymEvent(int index);
/**
* <code>repeated .POGOProtos.Rpc.GymEventProto gym_event = 1;</code>
*/
int getGymEventCount();
/**
* <code>repeated .POGOProtos.Rpc.GymEventProto gym_event = 1;</code>
*/
java.util.List<? extends POGOProtos.Rpc.GymEventProtoOrBuilder>
getGymEventOrBuilderList();
/**
* <code>repeated .POGOProtos.Rpc.GymEventProto gym_event = 1;</code>
*/
POGOProtos.Rpc.GymEventProtoOrBuilder getGymEventOrBuilder(
int index);
/**
* <code>int32 total_gym_cp = 2;</code>
* @return The totalGymCp.
*/
int getTotalGymCp();
/**
* <code>double lowest_pokemon_motivation = 3;</code>
* @return The lowestPokemonMotivation.
*/
double getLowestPokemonMotivation();
/**
* <code>int32 slots_available = 4;</code>
* @return The slotsAvailable.
*/
int getSlotsAvailable();
/**
* <code>int64 occupied_millis = 5;</code>
* @return The occupiedMillis.
*/
long getOccupiedMillis();
}
| 26.637931 | 81 | 0.688026 |
c01577087df7175768e91eab9621d13310c0e0e4 | 2,151 | // Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.commands;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Constants;
import frc.robot.subsystems.Climber;
public class ClimberCommand extends CommandBase {
Climber climberSys;
XboxController controller;
/** Creates a new ClimberCommand. */
public ClimberCommand(Climber climberSys, XboxController controller) {
// Use addRequirements() here to declare subsystem dependencies.
this.climberSys = climberSys;
this.controller = controller;
addRequirements(climberSys);
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
climberSys.resetEncoders();
}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if(controller.getBButtonPressed()){
climberSys.resetEncoders();
}
SmartDashboard.putNumber("MOTOR 7 ENCODER: ", climberSys.get7());
SmartDashboard.putNumber("MOTOR 8 ENCODER: ", climberSys.get8());
SmartDashboard.updateValues();
// if (controller) {
// climberSys.move(0.3);
// }
// else if (controller.getPOV(4) != -1) {
// climberSys.move(-0.3);
// }
// else {
// climberSys.move(0);
// }
if(controller.getRightTriggerAxis() > 0.1 && climberSys.get7() < 244348){
climberSys.move(controller.getRightTriggerAxis() * 0.5);
// climberSys.get8() > 0
}else if(Math.abs(controller.getLeftTriggerAxis()) > 0.1 && climberSys.get7() > 0){
climberSys.move(-controller.getLeftTriggerAxis() * 0.5);
}else{
climberSys.move(0);
}
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
| 26.8875 | 87 | 0.689447 |
f45f03166521187cf0d9e3e83e5fce21630c38e6 | 3,668 | package people.source.webcrawler;
import edu.uci.ics.crawler4j.crawler.CrawlConfig;
import edu.uci.ics.crawler4j.crawler.CrawlController;
import edu.uci.ics.crawler4j.crawler.WebCrawler;
import edu.uci.ics.crawler4j.fetcher.PageFetcher;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtConfig;
import edu.uci.ics.crawler4j.robotstxt.RobotstxtServer;
import lombok.extern.slf4j.Slf4j;
import people.api.TextResourceConsumer;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.stream.Stream;
@Slf4j
public class WikiCrawlerController implements CrawlController.WebCrawlerFactory {
private TextResourceConsumer resourceConsumer;
private CrawlController controller;
public WikiCrawlerController(TextResourceConsumer rc) {
this.resourceConsumer = rc;
}
@Override
public WebCrawler newInstance() throws Exception {
return new WikiCrawler(resourceConsumer);
}
public void stop() {
if (controller != null) {
controller.shutdown();
controller.waitUntilFinish();
}
}
public void start() {
/*
* crawlStorageFolder is a folder where intermediate crawl data is
* stored.
*/
String crawlStorageFolder = "./crawler_data";
/*
* numberOfCrawlers shows the number of concurrent threads that should
* be initiated for crawling.
*/
final int numberOfCrawlers = 2;
CrawlConfig config = new CrawlConfig();
config.setCrawlStorageFolder(crawlStorageFolder);
/*
* Be polite: Make sure that we don't send more than 1 request per
* second (1000 milliseconds between requests).
*/
config.setPolitenessDelay(0);
/*
* You can set the maximum crawl depth here. The default value is -1 for
* unlimited depth
*/
config.setMaxDepthOfCrawling(2);
/*
* You can set the maximum number of pages to crawl. The default value
* is -1 for unlimited number of pages
*/
config.setMaxPagesToFetch(10_000);
/**
* Do you want crawler4j to crawl also binary data ?
* example: the contents of pdf, or the metadata of images etc
*/
config.setIncludeBinaryContentInCrawling(false);
/*
* Do you need to set a proxy? If so, you can use:
* config.setProxyHost("proxyserver.example.com");
* config.setProxyPort(8080);
*
* If your proxy also needs authentication:
* config.setProxyUsername(username); config.getProxyPassword(password);
*/
/*
* This config parameter can be used to set your crawl to be resumable
* (meaning that you can resume the crawl from a previously
* interrupted/crashed crawl). Note: if you enable resuming feature and
* want to start a fresh crawl, you need to delete the contents of
* rootFolder manually.
*/
config.setResumableCrawling(false);
/*
* Instantiate the controller for this crawl.
*/
PageFetcher pageFetcher = new PageFetcher(config);
RobotstxtConfig robotstxtConfig = new RobotstxtConfig();
RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcher);
try {
controller = new CrawlController(config, pageFetcher, robotstxtServer);
} catch (Exception e) {
log.error(e.getMessage());
return;
}
try (Stream<String> stream = Files.lines(Paths.get("./url_seeds.txt"))) {
stream.forEach(url -> controller.addSeed(url));
} catch (IOException e) {
log.error(e.getMessage());
return;
}
controller.startNonBlocking(this::newInstance, numberOfCrawlers);
}
public boolean isFinished() {
return (controller.isFinished());
}
}
| 28.88189 | 89 | 0.698201 |
6734329b826a52ca984002b6912d0e470f20af5e | 12,423 | package org.carlspring.cloud.storage.s3fs;
import java.lang.reflect.InvocationTargetException;
import java.net.URI;
import java.time.Duration;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentials;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration;
import software.amazon.awssdk.core.exception.SdkClientException;
import software.amazon.awssdk.core.retry.RetryPolicy;
import software.amazon.awssdk.core.signer.Signer;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.apache.ApacheHttpClient;
import software.amazon.awssdk.http.apache.ProxyConfiguration;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain;
import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.S3ClientBuilder;
import software.amazon.awssdk.services.s3.S3Configuration;
import software.amazon.awssdk.services.s3.model.Protocol;
import static software.amazon.awssdk.core.client.config.SdkAdvancedClientOption.SIGNER;
import static software.amazon.awssdk.core.client.config.SdkAdvancedClientOption.USER_AGENT_PREFIX;
/**
* Factory base class to create a new S3Client instance.
*/
public abstract class S3Factory
{
public static final String REGION = "s3fs_region";
public static final String ACCESS_KEY = "s3fs_access_key";
public static final String SECRET_KEY = "s3fs_secret_key";
public static final String REQUEST_METRIC_COLLECTOR_CLASS = "s3fs_request_metric_collector_class";
public static final String CONNECTION_TIMEOUT = "s3fs_connection_timeout";
public static final String MAX_CONNECTIONS = "s3fs_max_connections";
public static final String MAX_ERROR_RETRY = "s3fs_max_retry_error";
public static final String PROTOCOL = "s3fs_protocol";
public static final String PROXY_DOMAIN = "s3fs_proxy_domain";
public static final String PROXY_HOST = "s3fs_proxy_host";
public static final String PROXY_PASSWORD = "s3fs_proxy_password";
public static final String PROXY_PORT = "s3fs_proxy_port";
public static final String PROXY_USERNAME = "s3fs_proxy_username";
public static final String PROXY_WORKSTATION = "s3fs_proxy_workstation";
/**
* @deprecated Not supported according to https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md#133-client-override-configuration
*/
@Deprecated
public static final String SOCKET_SEND_BUFFER_SIZE_HINT = "s3fs_socket_send_buffer_size_hint";
/**
* @deprecated Not supported according to https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md#133-client-override-configuration
*/
@Deprecated
public static final String SOCKET_RECEIVE_BUFFER_SIZE_HINT = "s3fs_socket_receive_buffer_size_hint";
public static final String SOCKET_TIMEOUT = "s3fs_socket_timeout";
public static final String USER_AGENT = "s3fs_user_agent";
public static final String SIGNER_OVERRIDE = "s3fs_signer_override";
public static final String PATH_STYLE_ACCESS = "s3fs_path_style_access";
private static final Logger LOGGER = LoggerFactory.getLogger(S3Factory.class);
private static final String DEFAULT_PROTOCOL = Protocol.HTTPS.toString();
private static final Region DEFAULT_REGION = Region.US_EAST_1;
private static final int RADIX = 10;
/**
* Build a new Amazon S3 instance with the URI and the properties provided
*
* @param uri URI mandatory
* @param props Properties with the credentials and others options
* @return {@link software.amazon.awssdk.services.s3.S3Client}
*/
public S3Client getS3Client(final URI uri,
final Properties props)
{
S3ClientBuilder builder = getS3ClientBuilder();
if (uri.getHost() != null)
{
final URI endpoint = getEndpointUri(uri.getHost(), uri.getPort(), props);
builder.endpointOverride(endpoint);
}
builder.region(getRegion(props))
.credentialsProvider(getCredentialsProvider(props))
.httpClient(getHttpClient(props))
.overrideConfiguration(getOverrideConfiguration(props))
.serviceConfiguration(getServiceConfiguration(props));
return createS3Client(builder);
}
private URI getEndpointUri(final String host,
final int port,
final Properties props)
{
final String scheme = getProtocol(props);
String endpointStr;
if (port != -1)
{
endpointStr = String.format("%s://%s:%d", scheme, host, port);
}
else
{
endpointStr = String.format("%s://%s", scheme, host);
}
return URI.create(endpointStr);
}
protected S3ClientBuilder getS3ClientBuilder()
{
return S3Client.builder();
}
private String getProtocol(final Properties props)
{
if (props.getProperty(PROTOCOL) != null)
{
return Protocol.fromValue(props.getProperty(PROTOCOL)).toString();
}
return DEFAULT_PROTOCOL;
}
private Region getRegion(final Properties props)
{
if (props.getProperty(REGION) != null)
{
return Region.of(props.getProperty(REGION));
}
try
{
return new DefaultAwsRegionProviderChain().getRegion();
}
catch (final SdkClientException e)
{
LOGGER.warn("Unable to load region from any of the providers in the chain");
}
return DEFAULT_REGION;
}
protected SdkHttpClient getHttpClient(final Properties props)
{
final ApacheHttpClient.Builder builder = getApacheHttpClientBuilder(props);
return builder.build();
}
private ApacheHttpClient.Builder getApacheHttpClientBuilder(final Properties props)
{
final ApacheHttpClient.Builder builder = ApacheHttpClient.builder();
if (props.getProperty(CONNECTION_TIMEOUT) != null)
{
try
{
final Duration duration = Duration.ofMillis(
Long.parseLong(props.getProperty(CONNECTION_TIMEOUT), RADIX));
builder.connectionTimeout(duration);
}
catch (final NumberFormatException e)
{
printWarningMessage(props, CONNECTION_TIMEOUT);
}
}
if (props.getProperty(MAX_CONNECTIONS) != null)
{
try
{
final int maxConnections = Integer.parseInt(props.getProperty(MAX_CONNECTIONS), RADIX);
builder.maxConnections(maxConnections);
}
catch (final NumberFormatException e)
{
printWarningMessage(props, MAX_CONNECTIONS);
}
}
if (props.getProperty(SOCKET_TIMEOUT) != null)
{
try
{
final Duration duration = Duration.ofMillis(Long.parseLong(props.getProperty(SOCKET_TIMEOUT), RADIX));
builder.socketTimeout(duration);
}
catch (final NumberFormatException e)
{
printWarningMessage(props, SOCKET_TIMEOUT);
}
}
return builder.proxyConfiguration(getProxyConfiguration(props));
}
/**
* should return a new S3Client
*
* @param builder S3ClientBuilder mandatory.
* @return {@link software.amazon.awssdk.services.s3.S3Client}
*/
protected abstract S3Client createS3Client(final S3ClientBuilder builder);
protected AwsCredentialsProvider getCredentialsProvider(final Properties props)
{
AwsCredentialsProvider credentialsProvider;
if (props.getProperty(ACCESS_KEY) == null && props.getProperty(SECRET_KEY) == null)
{
credentialsProvider = DefaultCredentialsProvider.create();
}
else
{
final AwsCredentials awsCredentials = getAwsCredentials(props);
credentialsProvider = StaticCredentialsProvider.create(awsCredentials);
}
return credentialsProvider;
}
protected AwsCredentials getAwsCredentials(final Properties props)
{
return AwsBasicCredentials.create(props.getProperty(ACCESS_KEY), props.getProperty(SECRET_KEY));
}
protected S3Configuration getServiceConfiguration(final Properties props)
{
S3Configuration.Builder builder = S3Configuration.builder();
if (props.getProperty(PATH_STYLE_ACCESS) != null && Boolean.parseBoolean(props.getProperty(PATH_STYLE_ACCESS)))
{
builder.pathStyleAccessEnabled(true);
}
return builder.build();
}
protected ClientOverrideConfiguration getOverrideConfiguration(final Properties props)
{
final ClientOverrideConfiguration.Builder builder = ClientOverrideConfiguration.builder();
if (props.getProperty(MAX_ERROR_RETRY) != null)
{
try
{
final Integer numRetries = Integer.parseInt(props.getProperty(MAX_ERROR_RETRY), RADIX);
final RetryPolicy retryPolicy = RetryPolicy.builder().numRetries(numRetries).build();
builder.retryPolicy(retryPolicy);
}
catch (final NumberFormatException e)
{
printWarningMessage(props, MAX_ERROR_RETRY);
}
}
if (props.getProperty(USER_AGENT) != null)
{
builder.putAdvancedOption(USER_AGENT_PREFIX, props.getProperty(USER_AGENT));
}
if (props.getProperty(SIGNER_OVERRIDE) != null)
{
try
{
final Class<?> clazz = Class.forName(props.getProperty(SIGNER_OVERRIDE));
final Signer signer = (Signer) clazz.getDeclaredConstructor().newInstance();
builder.putAdvancedOption(SIGNER, signer);
}
catch (final ClassNotFoundException | NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e)
{
printWarningMessage(props, SIGNER_OVERRIDE);
}
}
return builder.build();
}
protected ProxyConfiguration getProxyConfiguration(final Properties props)
{
final ProxyConfiguration.Builder builder = ProxyConfiguration.builder();
if (props.getProperty(PROXY_HOST) != null)
{
final String host = props.getProperty(PROXY_HOST);
final String portStr = props.getProperty(PROXY_PORT);
int port = -1;
try
{
port = portStr != null ? Integer.parseInt(portStr, RADIX) : -1;
}
catch (final NumberFormatException e)
{
printWarningMessage(props, PROXY_PORT);
}
final URI uri = getEndpointUri(host, port, props);
builder.endpoint(uri);
}
if (props.getProperty(PROXY_USERNAME) != null)
{
builder.username(props.getProperty(PROXY_USERNAME));
}
if (props.getProperty(PROXY_PASSWORD) != null)
{
builder.password(props.getProperty(PROXY_PASSWORD));
}
if (props.getProperty(PROXY_DOMAIN) != null)
{
builder.ntlmDomain(props.getProperty(PROXY_DOMAIN));
}
if (props.getProperty(PROXY_WORKSTATION) != null)
{
builder.ntlmWorkstation(props.getProperty(PROXY_WORKSTATION));
}
return builder.build();
}
private void printWarningMessage(final Properties props,
final String propertyName)
{
LOGGER.warn("The '{}' property could not be loaded with this value: {}",
propertyName,
props.getProperty(propertyName));
}
}
| 34.412742 | 154 | 0.658617 |
447e55eb8f0fb27467e7e0a7ee8ccd8a97432f12 | 3,538 | package io.home.pi.web.controller;
import io.home.pi.persistence.model.TokenLog;
import io.home.pi.persistence.model.User;
import io.home.pi.persistence.service.TokenLogService;
import io.home.pi.persistence.service.UserService;
import io.home.pi.service.UserAuthService;
import io.home.pi.service.UserRegService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.Locale;
import java.util.Optional;
import static java.lang.Boolean.TRUE;
/**
* PROJECT : pi
* PACKAGE : io.home.pi.web.controller
* USER : sean
* DATE : 04-July-2018
* TIME : 01:07
*/
@Slf4j
@Controller
public class ConfirmationCtrl {
private final UserAuthService userAuthService;
private UserRegService userRegService;
private UserService userService;
private MessageSource messageSource;
private TokenLogService tokenLogService;
@Autowired
public ConfirmationCtrl(UserRegService userRegService, UserService userService, UserAuthService userAuthService) {
this.userRegService = userRegService;
this.userService = userService;
this.userAuthService = userAuthService;
}
@Autowired
@Qualifier("english")
public void setMessageSource(MessageSource messageSource) {
this.messageSource = messageSource;
}
@Autowired
public void setTokenLogService(TokenLogService tokenLogService) {
this.tokenLogService = tokenLogService;
}
//ToDo: Add the missing modelAttributes to the html pages.
@GetMapping(value = "/confirm**")
public String confirmRegistration(HttpServletRequest request, final Model model, @RequestParam("token") final String token) {
Locale locale = new Locale(Locale.UK.toString(), request.getLocale().getCountry());
final String result = userRegService.validateVerificationToken(token);
if (result.equals("valid")) {
final Optional<TokenLog> optionalToken = tokenLogService.findByToken(token);
if (optionalToken.isPresent()) {
User disabledUser = optionalToken.get().getUser();
disabledUser.setEnabled(TRUE);
disabledUser.setToken(null); //Delete the token & prevent it from being reused.
final User enabledUser = userService.saveOrUpdate(disabledUser);
userAuthService.authWithoutPassword(enabledUser.getUsername(), request.getSession(TRUE));
model.addAttribute("message", messageSource.getMessage("message.accountVerified", null, locale));
return "redirect:/pi/dashboard?lang=" + locale.getLanguage();
} else {
model.addAttribute("message", "Invalid Token");
model.addAttribute("token", token);
return "redirect:/user/login?error=true";
}
}
model.addAttribute("message", messageSource.getMessage("auth.message." + result, null, locale));
model.addAttribute("expired", "expired".equals(result));
model.addAttribute("token", token);
return "redirect:/user/login?error=true&lang=" + locale.getLanguage();
}
}
| 38.456522 | 129 | 0.710854 |
346b2939cae2555ebf3516f8830a0bf182520f8e | 4,200 | package de.bmoth.modelchecker.ltl;
import de.bmoth.TestParser;
import de.bmoth.modelchecker.ModelCheckingResult;
import de.bmoth.modelchecker.esmc.ExplicitStateModelChecker;
import de.bmoth.parser.ast.nodes.MachineNode;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
public class LTLModelCheckerTest extends TestParser {
private MachineBuilder builder;
private MachineNode machine;
private ModelCheckingResult result;
@Before
public void init() {
builder = new MachineBuilder();
machine = null;
result = null;
}
@Test
public void testObviouslyBrokenProperty() {
machine = builder
.setName("CorrectCounter")
.setDefinitions("ASSERT_LTL_1 == \"G({0=1})\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertFalse(result.isCorrect());
assertEquals(3, result.getSteps());
}
@Test
public void testObviouslyCorrectProperty() {
machine = builder
.setName("CorrectCounter")
.setDefinitions("ASSERT_LTL_1 == \"G {1=1}\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertTrue(result.isCorrect());
assertEquals(3, result.getSteps());
}
@Test
public void testCorrectCounter() {
machine = builder
.setName("CorrectCounter")
.setDefinitions("ASSERT_LTL_1 == \"G {c<5}\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertTrue(result.isCorrect());
assertEquals(3, result.getSteps());
}
@Test
@Ignore
public void testCorrectCounterWithNext() {
machine = builder
.setName("CorrectCounter")
.setDefinitions("ASSERT_LTL_1 == \"G X {c<5}\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertTrue(result.isCorrect());
assertEquals(3, result.getSteps());
}
@Test
public void testBrokenCounter() {
machine = builder
.setName("BrokenCounter")
.setDefinitions("ASSERT_LTL_1 == \"G {c<0}\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertFalse(result.isCorrect());
assertEquals(3, result.getSteps());
}
@Test
public void testBrokenCounterWithNext() {
machine = builder
.setName("BrokenCounter")
.setDefinitions("ASSERT_LTL_1 == \"G X {c<0}\"")
.setSets("")
.setVariables("c")
.setInvariant("c:NAT")
.setInitialization("c := 0")
.addOperation("inc = PRE c < 2 THEN c:=c+1 END")
.addOperation("reset = c:=0")
.build();
result = new ExplicitStateModelChecker(machine).check();
assertFalse(result.isCorrect());
assertEquals(3, result.getSteps());
}
}
| 31.111111 | 64 | 0.554524 |
367c694fc6bf9140ea31fc7f44332435b0307047 | 586 | package dev.hephaestus.glowcase.client.gui.screen.ingame;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
public abstract class GlowcaseScreen extends Screen {
protected GlowcaseScreen() {
super(LiteralText.EMPTY);
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
fill(matrices, 0, 0, this.width, this.height, 0x88000000);
super.render(matrices, mouseX, mouseY, delta);
}
@Override
public boolean isPauseScreen() {
return false;
}
}
| 24.416667 | 80 | 0.766212 |
810d8d6498ed666d132460c0c28a5505a1ab368d | 427 | package com.salesmanager.core.model.shoppingcart;
import com.salesmanager.core.model.catalog.product.attribute.ReadableProductOptionValue;
public class ReadableShoppingCartAttributeOptionValue extends ReadableProductOptionValue {
/**
*
*/
private static final long serialVersionUID = 1L;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| 21.35 | 90 | 0.775176 |
7260589905fc6037dd559825ce06b60fe5fc2cb2 | 78,832 | // Generated from /home/vlad/Code/jvaas-platform/jvaas-postgresql/src/main/resources/antlr/SQLParser.g4 by ANTLR 4.8
package io.jvaas.sql.postgresql.gen;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link SQLParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface SQLParserVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link SQLParser#sql}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSql(SQLParser.SqlContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#qnameParser}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQnameParser(SQLParser.QnameParserContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionArgsParser}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionArgsParser(SQLParser.FunctionArgsParserContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vexEof}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVexEof(SQLParser.VexEofContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#plpgsqlFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPlpgsqlFunction(SQLParser.PlpgsqlFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#plpgsqlFunctionTestList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPlpgsqlFunctionTestList(SQLParser.PlpgsqlFunctionTestListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatement(SQLParser.StatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dataStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDataStatement(SQLParser.DataStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#scriptStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScriptStatement(SQLParser.ScriptStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#scriptTransaction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScriptTransaction(SQLParser.ScriptTransactionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#transactionMode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTransactionMode(SQLParser.TransactionModeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#lockTable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLockTable(SQLParser.LockTableContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#lockMode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLockMode(SQLParser.LockModeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#scriptAdditional}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitScriptAdditional(SQLParser.ScriptAdditionalContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#additionalStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAdditionalStatement(SQLParser.AdditionalStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#explainStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExplainStatement(SQLParser.ExplainStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#explainQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExplainQuery(SQLParser.ExplainQueryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#executeStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExecuteStatement(SQLParser.ExecuteStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#declareStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclareStatement(SQLParser.DeclareStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#showStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitShowStatement(SQLParser.ShowStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#explainOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExplainOption(SQLParser.ExplainOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userName}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserName(SQLParser.UserNameContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableColsList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableColsList(SQLParser.TableColsListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableCols}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableCols(SQLParser.TableColsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vacuumMode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVacuumMode(SQLParser.VacuumModeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vacuumOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVacuumOption(SQLParser.VacuumOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#analyzeMode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAnalyzeMode(SQLParser.AnalyzeModeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#booleanValue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBooleanValue(SQLParser.BooleanValueContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#fetchMoveDirection}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFetchMoveDirection(SQLParser.FetchMoveDirectionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaStatement(SQLParser.SchemaStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaCreate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaCreate(SQLParser.SchemaCreateContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaAlter}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaAlter(SQLParser.SchemaAlterContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaDrop}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaDrop(SQLParser.SchemaDropContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaImport}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaImport(SQLParser.SchemaImportContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterFunctionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterFunctionStatement(SQLParser.AlterFunctionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterAggregateStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterAggregateStatement(SQLParser.AlterAggregateStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterExtensionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterExtensionStatement(SQLParser.AlterExtensionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterExtensionAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterExtensionAction(SQLParser.AlterExtensionActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#extensionMemberObject}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExtensionMemberObject(SQLParser.ExtensionMemberObjectContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterSchemaStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterSchemaStatement(SQLParser.AlterSchemaStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterLanguageStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterLanguageStatement(SQLParser.AlterLanguageStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterTableStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterTableStatement(SQLParser.AlterTableStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableAction(SQLParser.TableActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#columnAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColumnAction(SQLParser.ColumnActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#identityBody}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentityBody(SQLParser.IdentityBodyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterIdentity}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterIdentity(SQLParser.AlterIdentityContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#storageOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStorageOption(SQLParser.StorageOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#validateConstraint}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValidateConstraint(SQLParser.ValidateConstraintContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropConstraint}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropConstraint(SQLParser.DropConstraintContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableDeferrable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableDeferrable(SQLParser.TableDeferrableContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableInitialyImmed}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableInitialyImmed(SQLParser.TableInitialyImmedContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionActionsCommon}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionActionsCommon(SQLParser.FunctionActionsCommonContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionDef(SQLParser.FunctionDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterIndexStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterIndexStatement(SQLParser.AlterIndexStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indexDefAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndexDefAction(SQLParser.IndexDefActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterDefaultPrivileges}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterDefaultPrivileges(SQLParser.AlterDefaultPrivilegesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#abbreviatedGrantOrRevoke}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAbbreviatedGrantOrRevoke(SQLParser.AbbreviatedGrantOrRevokeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#grantOptionFor}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGrantOptionFor(SQLParser.GrantOptionForContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterSequenceStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterSequenceStatement(SQLParser.AlterSequenceStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterViewStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterViewStatement(SQLParser.AlterViewStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterEventTrigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterEventTrigger(SQLParser.AlterEventTriggerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterEventTriggerAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterEventTriggerAction(SQLParser.AlterEventTriggerActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterTypeStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterTypeStatement(SQLParser.AlterTypeStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterDomainStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterDomainStatement(SQLParser.AlterDomainStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterServerStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterServerStatement(SQLParser.AlterServerStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterServerAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterServerAction(SQLParser.AlterServerActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterFtsStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterFtsStatement(SQLParser.AlterFtsStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterFtsConfiguration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterFtsConfiguration(SQLParser.AlterFtsConfigurationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#typeAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeAction(SQLParser.TypeActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setDefColumn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetDefColumn(SQLParser.SetDefColumnContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropDef(SQLParser.DropDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createIndexStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateIndexStatement(SQLParser.CreateIndexStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indexRest}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndexRest(SQLParser.IndexRestContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indexSort}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndexSort(SQLParser.IndexSortContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#includingIndex}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIncludingIndex(SQLParser.IncludingIndexContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indexWhere}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndexWhere(SQLParser.IndexWhereContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createExtensionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateExtensionStatement(SQLParser.CreateExtensionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createLanguageStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateLanguageStatement(SQLParser.CreateLanguageStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createEventTrigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateEventTrigger(SQLParser.CreateEventTriggerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTypeStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTypeStatement(SQLParser.CreateTypeStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createDomainStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateDomainStatement(SQLParser.CreateDomainStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createServerStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateServerStatement(SQLParser.CreateServerStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFtsDictionary}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFtsDictionary(SQLParser.CreateFtsDictionaryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#optionWithValue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOptionWithValue(SQLParser.OptionWithValueContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFtsConfiguration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFtsConfiguration(SQLParser.CreateFtsConfigurationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFtsTemplate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFtsTemplate(SQLParser.CreateFtsTemplateContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFtsParser}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFtsParser(SQLParser.CreateFtsParserContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createCollation}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateCollation(SQLParser.CreateCollationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterCollation}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterCollation(SQLParser.AlterCollationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#collationOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCollationOption(SQLParser.CollationOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createUserMapping}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateUserMapping(SQLParser.CreateUserMappingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterUserMapping}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterUserMapping(SQLParser.AlterUserMappingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterUserOrRole}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterUserOrRole(SQLParser.AlterUserOrRoleContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterUserOrRoleSetReset}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterUserOrRoleSetReset(SQLParser.AlterUserOrRoleSetResetContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleSetReset}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleSetReset(SQLParser.UserOrRoleSetResetContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterGroup}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterGroup(SQLParser.AlterGroupContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterGroupAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterGroupAction(SQLParser.AlterGroupActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterTablespace}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterTablespace(SQLParser.AlterTablespaceContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterOwner}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterOwner(SQLParser.AlterOwnerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterTablespaceAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterTablespaceAction(SQLParser.AlterTablespaceActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterStatistics}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterStatistics(SQLParser.AlterStatisticsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterForeignDataWrapper}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterForeignDataWrapper(SQLParser.AlterForeignDataWrapperContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterForeignDataWrapperAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterForeignDataWrapperAction(SQLParser.AlterForeignDataWrapperActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterOperatorStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterOperatorStatement(SQLParser.AlterOperatorStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterOperatorAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterOperatorAction(SQLParser.AlterOperatorActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#operatorSetRestrictJoin}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOperatorSetRestrictJoin(SQLParser.OperatorSetRestrictJoinContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropUserMapping}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropUserMapping(SQLParser.DropUserMappingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropOwned}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropOwned(SQLParser.DropOwnedContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropOperatorStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropOperatorStatement(SQLParser.DropOperatorStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#targetOperator}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTargetOperator(SQLParser.TargetOperatorContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#domainConstraint}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDomainConstraint(SQLParser.DomainConstraintContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTransformStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTransformStatement(SQLParser.CreateTransformStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createAccessMethod}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateAccessMethod(SQLParser.CreateAccessMethodContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createUserOrRole}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateUserOrRole(SQLParser.CreateUserOrRoleContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleOption(SQLParser.UserOrRoleOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleOptionForAlter}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleOptionForAlter(SQLParser.UserOrRoleOptionForAlterContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleOrGroupCommonOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleOrGroupCommonOption(SQLParser.UserOrRoleOrGroupCommonOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleCommonOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleCommonOption(SQLParser.UserOrRoleCommonOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#userOrRoleOrGroupOptionForCreate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUserOrRoleOrGroupOptionForCreate(SQLParser.UserOrRoleOrGroupOptionForCreateContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createGroup}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateGroup(SQLParser.CreateGroupContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#groupOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroupOption(SQLParser.GroupOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTablespace}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTablespace(SQLParser.CreateTablespaceContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createStatistics}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateStatistics(SQLParser.CreateStatisticsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createForeignDataWrapper}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateForeignDataWrapper(SQLParser.CreateForeignDataWrapperContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#optionWithoutEqual}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOptionWithoutEqual(SQLParser.OptionWithoutEqualContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createOperatorStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateOperatorStatement(SQLParser.CreateOperatorStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#operatorName}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOperatorName(SQLParser.OperatorNameContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#operatorOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOperatorOption(SQLParser.OperatorOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createAggregateStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateAggregateStatement(SQLParser.CreateAggregateStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#aggregateParam}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAggregateParam(SQLParser.AggregateParamContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetStatement(SQLParser.SetStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetAction(SQLParser.SetActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#sessionLocalOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSessionLocalOption(SQLParser.SessionLocalOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setStatementValue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetStatementValue(SQLParser.SetStatementValueContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createRewriteStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateRewriteStatement(SQLParser.CreateRewriteStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#rewriteCommand}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRewriteCommand(SQLParser.RewriteCommandContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTriggerStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTriggerStatement(SQLParser.CreateTriggerStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#triggerReferencing}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTriggerReferencing(SQLParser.TriggerReferencingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#whenTrigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhenTrigger(SQLParser.WhenTriggerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ruleCommon}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRuleCommon(SQLParser.RuleCommonContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ruleMemberObject}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRuleMemberObject(SQLParser.RuleMemberObjectContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#columnsPermissions}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColumnsPermissions(SQLParser.ColumnsPermissionsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableColumnPrivileges}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableColumnPrivileges(SQLParser.TableColumnPrivilegesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#permissions}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPermissions(SQLParser.PermissionsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#permission}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPermission(SQLParser.PermissionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#otherRules}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOtherRules(SQLParser.OtherRulesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#grantToRule}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGrantToRule(SQLParser.GrantToRuleContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#revokeFromCascadeRestrict}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRevokeFromCascadeRestrict(SQLParser.RevokeFromCascadeRestrictContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#rolesNames}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRolesNames(SQLParser.RolesNamesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#roleNameWithGroup}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRoleNameWithGroup(SQLParser.RoleNameWithGroupContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#commentOnStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCommentOnStatement(SQLParser.CommentOnStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#securityLabel}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSecurityLabel(SQLParser.SecurityLabelContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#commentMemberObject}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCommentMemberObject(SQLParser.CommentMemberObjectContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#labelMemberObject}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabelMemberObject(SQLParser.LabelMemberObjectContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFunctionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFunctionStatement(SQLParser.CreateFunctionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createFunctParams}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateFunctParams(SQLParser.CreateFunctParamsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#transformForType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTransformForType(SQLParser.TransformForTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionRetTable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionRetTable(SQLParser.FunctionRetTableContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionColumnNameType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionColumnNameType(SQLParser.FunctionColumnNameTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionParameters}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionParameters(SQLParser.FunctionParametersContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionArgs}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionArgs(SQLParser.FunctionArgsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#aggOrder}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAggOrder(SQLParser.AggOrderContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#characterString}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCharacterString(SQLParser.CharacterStringContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionArguments}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionArguments(SQLParser.FunctionArgumentsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#argmode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArgmode(SQLParser.ArgmodeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createSequenceStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateSequenceStatement(SQLParser.CreateSequenceStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#sequenceBody}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSequenceBody(SQLParser.SequenceBodyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#signedNumberLiteral}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSignedNumberLiteral(SQLParser.SignedNumberLiteralContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#signedNumericalLiteral}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSignedNumericalLiteral(SQLParser.SignedNumericalLiteralContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#sign}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSign(SQLParser.SignContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createSchemaStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateSchemaStatement(SQLParser.CreateSchemaStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createPolicyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreatePolicyStatement(SQLParser.CreatePolicyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterPolicyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterPolicyStatement(SQLParser.AlterPolicyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropPolicyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropPolicyStatement(SQLParser.DropPolicyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createSubscriptionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateSubscriptionStatement(SQLParser.CreateSubscriptionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterSubscriptionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterSubscriptionStatement(SQLParser.AlterSubscriptionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterSubscriptionAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterSubscriptionAction(SQLParser.AlterSubscriptionActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createCastStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateCastStatement(SQLParser.CreateCastStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropCastStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropCastStatement(SQLParser.DropCastStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createOperatorFamilyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateOperatorFamilyStatement(SQLParser.CreateOperatorFamilyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterOperatorFamilyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterOperatorFamilyStatement(SQLParser.AlterOperatorFamilyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#operatorFamilyAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOperatorFamilyAction(SQLParser.OperatorFamilyActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#addOperatorToFamily}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAddOperatorToFamily(SQLParser.AddOperatorToFamilyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropOperatorFromFamily}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropOperatorFromFamily(SQLParser.DropOperatorFromFamilyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropOperatorFamilyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropOperatorFamilyStatement(SQLParser.DropOperatorFamilyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createOperatorClassStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateOperatorClassStatement(SQLParser.CreateOperatorClassStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createOperatorClassOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateOperatorClassOption(SQLParser.CreateOperatorClassOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterOperatorClassStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterOperatorClassStatement(SQLParser.AlterOperatorClassStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropOperatorClassStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropOperatorClassStatement(SQLParser.DropOperatorClassStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createConversionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateConversionStatement(SQLParser.CreateConversionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterConversionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterConversionStatement(SQLParser.AlterConversionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createPublicationStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreatePublicationStatement(SQLParser.CreatePublicationStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterPublicationStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterPublicationStatement(SQLParser.AlterPublicationStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterPublicationAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterPublicationAction(SQLParser.AlterPublicationActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#onlyTableMultiply}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOnlyTableMultiply(SQLParser.OnlyTableMultiplyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterTriggerStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterTriggerStatement(SQLParser.AlterTriggerStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#alterRuleStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlterRuleStatement(SQLParser.AlterRuleStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#copyStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCopyStatement(SQLParser.CopyStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#copyFromStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCopyFromStatement(SQLParser.CopyFromStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#copyToStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCopyToStatement(SQLParser.CopyToStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#copyOptionList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCopyOptionList(SQLParser.CopyOptionListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#copyOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCopyOption(SQLParser.CopyOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createViewStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateViewStatement(SQLParser.CreateViewStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ifExists}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfExists(SQLParser.IfExistsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ifNotExists}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfNotExists(SQLParser.IfNotExistsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#viewColumns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitViewColumns(SQLParser.ViewColumnsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#withCheckOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithCheckOption(SQLParser.WithCheckOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTableStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTableStatement(SQLParser.CreateTableStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createTableAsStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateTableAsStatement(SQLParser.CreateTableAsStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#createForeignTableStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreateForeignTableStatement(SQLParser.CreateForeignTableStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#defineTable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineTable(SQLParser.DefineTableContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#definePartition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefinePartition(SQLParser.DefinePartitionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#forValuesBound}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForValuesBound(SQLParser.ForValuesBoundContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionBoundSpec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionBoundSpec(SQLParser.PartitionBoundSpecContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionBoundPart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionBoundPart(SQLParser.PartitionBoundPartContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#defineColumns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineColumns(SQLParser.DefineColumnsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#defineType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineType(SQLParser.DefineTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionBy}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionBy(SQLParser.PartitionByContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionMethod}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionMethod(SQLParser.PartitionMethodContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionColumn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionColumn(SQLParser.PartitionColumnContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#defineServer}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineServer(SQLParser.DefineServerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#defineForeignOptions}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefineForeignOptions(SQLParser.DefineForeignOptionsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#foreignOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForeignOption(SQLParser.ForeignOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#foreignOptionName}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForeignOptionName(SQLParser.ForeignOptionNameContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#listOfTypeColumnDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitListOfTypeColumnDef(SQLParser.ListOfTypeColumnDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableColumnDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableColumnDef(SQLParser.TableColumnDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableOfTypeColumnDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableOfTypeColumnDef(SQLParser.TableOfTypeColumnDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableColumnDefinition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableColumnDefinition(SQLParser.TableColumnDefinitionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#likeOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLikeOption(SQLParser.LikeOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#constraintCommon}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstraintCommon(SQLParser.ConstraintCommonContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#constrBody}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstrBody(SQLParser.ConstrBodyContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#allOp}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAllOp(SQLParser.AllOpContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#allSimpleOp}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAllSimpleOp(SQLParser.AllSimpleOpContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#opChars}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOpChars(SQLParser.OpCharsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indexParameters}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndexParameters(SQLParser.IndexParametersContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#namesInParens}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNamesInParens(SQLParser.NamesInParensContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#namesReferences}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNamesReferences(SQLParser.NamesReferencesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#storageParameter}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStorageParameter(SQLParser.StorageParameterContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#storageParameterOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStorageParameterOption(SQLParser.StorageParameterOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#storageParameterName}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStorageParameterName(SQLParser.StorageParameterNameContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#withStorageParameter}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithStorageParameter(SQLParser.WithStorageParameterContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#storageParameterOid}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStorageParameterOid(SQLParser.StorageParameterOidContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#onCommit}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOnCommit(SQLParser.OnCommitContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableSpace}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableSpace(SQLParser.TableSpaceContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#action}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAction(SQLParser.ActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ownerTo}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOwnerTo(SQLParser.OwnerToContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#renameTo}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRenameTo(SQLParser.RenameToContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setSchema}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetSchema(SQLParser.SetSchemaContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableColumnPrivilege}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableColumnPrivilege(SQLParser.TableColumnPrivilegeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#usageSelectUpdate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUsageSelectUpdate(SQLParser.UsageSelectUpdateContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#partitionByColumns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartitionByColumns(SQLParser.PartitionByColumnsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#cascadeRestrict}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCascadeRestrict(SQLParser.CascadeRestrictContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#collateIdentifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCollateIdentifier(SQLParser.CollateIdentifierContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indirectionVar}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndirectionVar(SQLParser.IndirectionVarContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dollarNumber}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDollarNumber(SQLParser.DollarNumberContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indirectionList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndirectionList(SQLParser.IndirectionListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indirection}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndirection(SQLParser.IndirectionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropFunctionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropFunctionStatement(SQLParser.DropFunctionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropTriggerStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropTriggerStatement(SQLParser.DropTriggerStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropRuleStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropRuleStatement(SQLParser.DropRuleStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dropStatements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDropStatements(SQLParser.DropStatementsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ifExistNamesRestrictCascade}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfExistNamesRestrictCascade(SQLParser.IfExistNamesRestrictCascadeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#idToken}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdToken(SQLParser.IdTokenContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#identifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentifier(SQLParser.IdentifierContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#identifierNontype}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentifierNontype(SQLParser.IdentifierNontypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#colLabel}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColLabel(SQLParser.ColLabelContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tokensNonreserved}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTokensNonreserved(SQLParser.TokensNonreservedContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tokensNonreservedExceptFunctionType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTokensNonreservedExceptFunctionType(SQLParser.TokensNonreservedExceptFunctionTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tokensReservedExceptFunctionType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTokensReservedExceptFunctionType(SQLParser.TokensReservedExceptFunctionTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tokensReserved}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTokensReserved(SQLParser.TokensReservedContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tokensNonkeyword}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTokensNonkeyword(SQLParser.TokensNonkeywordContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaQualifiedNameNontype}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaQualifiedNameNontype(SQLParser.SchemaQualifiedNameNontypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#typeList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeList(SQLParser.TypeListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dataType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDataType(SQLParser.DataTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#arrayType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArrayType(SQLParser.ArrayTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#predefinedType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPredefinedType(SQLParser.PredefinedTypeContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#intervalField}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIntervalField(SQLParser.IntervalFieldContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#typeLength}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeLength(SQLParser.TypeLengthContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#precisionParam}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrecisionParam(SQLParser.PrecisionParamContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vex}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVex(SQLParser.VexContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vexB}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVexB(SQLParser.VexBContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#op}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOp(SQLParser.OpContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#allOpRef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAllOpRef(SQLParser.AllOpRefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#datetimeOverlaps}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDatetimeOverlaps(SQLParser.DatetimeOverlapsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#valueExpressionPrimary}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValueExpressionPrimary(SQLParser.ValueExpressionPrimaryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#unsignedValueSpecification}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnsignedValueSpecification(SQLParser.UnsignedValueSpecificationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#unsignedNumericLiteral}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnsignedNumericLiteral(SQLParser.UnsignedNumericLiteralContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#truthValue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTruthValue(SQLParser.TruthValueContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#caseExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCaseExpression(SQLParser.CaseExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#castSpecification}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCastSpecification(SQLParser.CastSpecificationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionCall}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionCall(SQLParser.FunctionCallContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#vexOrNamedNotation}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVexOrNamedNotation(SQLParser.VexOrNamedNotationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#pointer}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPointer(SQLParser.PointerContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionConstruct}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionConstruct(SQLParser.FunctionConstructContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#extractFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExtractFunction(SQLParser.ExtractFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#systemFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSystemFunction(SQLParser.SystemFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dateTimeFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDateTimeFunction(SQLParser.DateTimeFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#stringValueFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStringValueFunction(SQLParser.StringValueFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#xmlFunction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlFunction(SQLParser.XmlFunctionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#xmlTableColumn}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlTableColumn(SQLParser.XmlTableColumnContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#comparisonMod}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComparisonMod(SQLParser.ComparisonModContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#filterClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFilterClause(SQLParser.FilterClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#windowDefinition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWindowDefinition(SQLParser.WindowDefinitionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#frameClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFrameClause(SQLParser.FrameClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#frameBound}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFrameBound(SQLParser.FrameBoundContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#arrayExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArrayExpression(SQLParser.ArrayExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#arrayElements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArrayElements(SQLParser.ArrayElementsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#typeCoercion}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeCoercion(SQLParser.TypeCoercionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#schemaQualifiedName}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchemaQualifiedName(SQLParser.SchemaQualifiedNameContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#setQualifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSetQualifier(SQLParser.SetQualifierContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#tableSubquery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableSubquery(SQLParser.TableSubqueryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectStmt(SQLParser.SelectStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#afterOps}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAfterOps(SQLParser.AfterOpsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectStmtNoParens}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectStmtNoParens(SQLParser.SelectStmtNoParensContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#withClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithClause(SQLParser.WithClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#withQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithQuery(SQLParser.WithQueryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectOps}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectOps(SQLParser.SelectOpsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectOpsNoParens}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectOpsNoParens(SQLParser.SelectOpsNoParensContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectPrimary}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectPrimary(SQLParser.SelectPrimaryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectList(SQLParser.SelectListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#selectSublist}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelectSublist(SQLParser.SelectSublistContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#intoTable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIntoTable(SQLParser.IntoTableContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#fromItem}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFromItem(SQLParser.FromItemContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#fromPrimary}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFromPrimary(SQLParser.FromPrimaryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#aliasClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAliasClause(SQLParser.AliasClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#fromFunctionColumnDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFromFunctionColumnDef(SQLParser.FromFunctionColumnDefContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#groupbyClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroupbyClause(SQLParser.GroupbyClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#groupingElementList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroupingElementList(SQLParser.GroupingElementListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#groupingElement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroupingElement(SQLParser.GroupingElementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#valuesStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValuesStmt(SQLParser.ValuesStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#valuesValues}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValuesValues(SQLParser.ValuesValuesContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#orderbyClause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrderbyClause(SQLParser.OrderbyClauseContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#sortSpecifierList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSortSpecifierList(SQLParser.SortSpecifierListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#sortSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSortSpecifier(SQLParser.SortSpecifierContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#orderSpecification}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrderSpecification(SQLParser.OrderSpecificationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#nullOrdering}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNullOrdering(SQLParser.NullOrderingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#insertStmtForPsql}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInsertStmtForPsql(SQLParser.InsertStmtForPsqlContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#insertColumns}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInsertColumns(SQLParser.InsertColumnsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#indirectionIdentifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndirectionIdentifier(SQLParser.IndirectionIdentifierContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#conflictObject}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConflictObject(SQLParser.ConflictObjectContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#conflictAction}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConflictAction(SQLParser.ConflictActionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#deleteStmtForPsql}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeleteStmtForPsql(SQLParser.DeleteStmtForPsqlContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#updateStmtForPsql}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUpdateStmtForPsql(SQLParser.UpdateStmtForPsqlContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#updateSet}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUpdateSet(SQLParser.UpdateSetContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#notifyStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNotifyStmt(SQLParser.NotifyStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#truncateStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTruncateStmt(SQLParser.TruncateStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#identifierList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentifierList(SQLParser.IdentifierListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#anonymousBlock}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAnonymousBlock(SQLParser.AnonymousBlockContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#compOptions}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompOptions(SQLParser.CompOptionsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionBlock}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionBlock(SQLParser.FunctionBlockContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#startLabel}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStartLabel(SQLParser.StartLabelContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#declarations}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclarations(SQLParser.DeclarationsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclaration(SQLParser.DeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#typeDeclaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeDeclaration(SQLParser.TypeDeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#argumentsList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArgumentsList(SQLParser.ArgumentsListContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#dataTypeDec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDataTypeDec(SQLParser.DataTypeDecContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#exceptionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExceptionStatement(SQLParser.ExceptionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionStatements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionStatements(SQLParser.FunctionStatementsContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#functionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunctionStatement(SQLParser.FunctionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#baseStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBaseStatement(SQLParser.BaseStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#var}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVar(SQLParser.VarContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#diagnosticOption}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDiagnosticOption(SQLParser.DiagnosticOptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#performStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPerformStmt(SQLParser.PerformStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#assignStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAssignStmt(SQLParser.AssignStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#executeStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExecuteStmt(SQLParser.ExecuteStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#controlStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitControlStatement(SQLParser.ControlStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#cursorStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursorStatement(SQLParser.CursorStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#option}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOption(SQLParser.OptionContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#transactionStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTransactionStatement(SQLParser.TransactionStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#messageStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMessageStatement(SQLParser.MessageStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#logLevel}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLogLevel(SQLParser.LogLevelContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#raiseUsing}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRaiseUsing(SQLParser.RaiseUsingContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#raiseParam}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRaiseParam(SQLParser.RaiseParamContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#returnStmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturnStmt(SQLParser.ReturnStmtContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#loopStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLoopStatement(SQLParser.LoopStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#loopStart}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLoopStart(SQLParser.LoopStartContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#usingVex}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUsingVex(SQLParser.UsingVexContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#ifStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfStatement(SQLParser.IfStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#caseStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCaseStatement(SQLParser.CaseStatementContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#plpgsqlQuery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPlpgsqlQuery(SQLParser.PlpgsqlQueryContext ctx);
/**
* Visit a parse tree produced by {@link SQLParser#lineComment}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLineComment(SQLParser.LineCommentContext ctx);
} | 34.289691 | 116 | 0.737505 |
806d5f913480514d4e7057a9eb5955ab8c382d24 | 287 | package org.fintx.accounting.util;
import org.fintx.util.UniqueId;
public final class Ids {
private Ids() {
throw new RuntimeException("Not allowed to create Ids instance");
}
public static String getId() {
return UniqueId.get().toBase64String();
}
}
| 19.133333 | 73 | 0.665505 |
4c0b22ba4dac3a4efdf7f0035068663c04587a23 | 1,098 | package com.simibubi.create.foundation.utility.outliner;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.AABB;
public class ChasingAABBOutline extends AABBOutline {
AABB targetBB;
AABB prevBB;
public ChasingAABBOutline(AABB bb) {
super(bb);
prevBB = bb.inflate(0);
targetBB = bb.inflate(0);
}
public void target(AABB target) {
targetBB = target;
}
@Override
public void tick() {
prevBB = bb;
setBounds(interpolateBBs(bb, targetBB, .5f));
}
@Override
public void render(PoseStack ms, SuperRenderTypeBuffer buffer, float pt) {
renderBB(ms, buffer, interpolateBBs(prevBB, bb, pt));
}
private static AABB interpolateBBs(AABB current, AABB target, float pt) {
return new AABB(Mth.lerp(pt, current.minX, target.minX),
Mth.lerp(pt, current.minY, target.minY), Mth.lerp(pt, current.minZ, target.minZ),
Mth.lerp(pt, current.maxX, target.maxX), Mth.lerp(pt, current.maxY, target.maxY),
Mth.lerp(pt, current.maxZ, target.maxZ));
}
}
| 25.534884 | 84 | 0.735883 |
984ad3d3983120421230fe28306a7a498f4e81b1 | 381 | package symbolicexecution.exceptions;
@SuppressWarnings("serial")
public class ReferenceNotFoundException extends RuntimeException {
private final String ref;
public ReferenceNotFoundException(String reference) {
super("Reference String \"" + reference + "\" was not found.\n");
this.ref = reference;
}
public String getReference() {
return ref;
}
}
| 23.8125 | 68 | 0.71916 |
94f81caabcc1715e3c0f2323f0e2f6179ff4c905 | 370 | /**
* Базовые алгоритмы
*/
open module xyz.cofe.ecolls {
requires java.base;
requires transitive java.logging;
exports xyz.cofe.ecolls;
exports xyz.cofe.collection.graph;
exports xyz.cofe.collection;
exports xyz.cofe.fn;
exports xyz.cofe.iter;
exports xyz.cofe.num;
exports xyz.cofe.scn;
exports xyz.cofe.sort;
} | 23.125 | 39 | 0.656757 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.