repo_name stringlengths 5 108 | path stringlengths 6 333 | size stringlengths 1 6 | content stringlengths 4 977k | license stringclasses 15 values |
|---|---|---|---|---|
Frank-Wu/stratosphere-streaming | flink-streaming-examples/src/main/java/org/apache/flink/streaming/examples/join/JoinTask.java | 2746 | /**
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses 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 org.apache.flink.streaming.examples.join;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.flink.api.java.functions.FlatMapFunction;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.util.Collector;
public class JoinTask extends
FlatMapFunction<Tuple3<String, String, Integer>, Tuple3<String, Integer, Integer>> {
private static final long serialVersionUID = 749913336259789039L;
private HashMap<String, ArrayList<Integer>> gradeHashmap;
private HashMap<String, ArrayList<Integer>> salaryHashmap;
public JoinTask() {
gradeHashmap = new HashMap<String, ArrayList<Integer>>();
salaryHashmap = new HashMap<String, ArrayList<Integer>>();
}
@Override
public void flatMap(Tuple3<String, String, Integer> value,
Collector<Tuple3<String, Integer, Integer>> out) throws Exception {
String streamId = value.f0;
String name = value.f1;
// Joins the input value with the already known values. If it is a grade
// then with the salaries, if it is a salary then with the grades. Also
// stores the new element.
if (streamId.equals("grade")) {
if (salaryHashmap.containsKey(name)) {
for (Integer salary : salaryHashmap.get(name)) {
Tuple3<String, Integer, Integer> outputTuple = new Tuple3<String, Integer, Integer>(
name, value.f2, salary);
out.collect(outputTuple);
}
}
if (!gradeHashmap.containsKey(name)) {
gradeHashmap.put(name, new ArrayList<Integer>());
}
gradeHashmap.get(name).add(value.f2);
} else {
if (gradeHashmap.containsKey(name)) {
for (Integer grade : gradeHashmap.get(name)) {
Tuple3<String, Integer, Integer> outputTuple = new Tuple3<String, Integer, Integer>(
name, grade, value.f2);
out.collect(outputTuple);
}
}
if (!salaryHashmap.containsKey(name)) {
salaryHashmap.put(name, new ArrayList<Integer>());
}
salaryHashmap.get(name).add(value.f2);
}
}
}
| apache-2.0 |
katsuster/ememu | emu/src/net/katsuster/ememu/arm/SecondaryINTC.java | 3533 | package net.katsuster.ememu.arm;
import net.katsuster.ememu.generic.*;
import net.katsuster.ememu.generic.core.*;
import net.katsuster.ememu.generic.bus.*;
/**
* 2nd 割り込みコントローラ
*
* <p>
* 参考: Versatile Application Baseboard for ARM926EJ-S User Guide
* ARM DUI0225D
* </p>
*/
public class SecondaryINTC extends Controller32
implements INTDestination {
private NormalINTC intc;
public static final int MAX_INTSRCS = 32;
public static final int REG_SIC_STATUS = 0x000;
public static final int REG_SIC_RAWSTAT = 0x004;
public static final int REG_SIC_ENABLE = 0x008;
public static final int REG_SIC_ENSET = 0x008;
public static final int REG_SIC_ENCLR = 0x00c;
public static final int REG_SIC_SOFTINTSET = 0x010;
public static final int REG_SIC_SOFTINTCLR = 0x014;
public static final int REG_SIC_PICENABLE = 0x020;
public static final int REG_SIC_PICENSET = 0x020;
public static final int REG_SIC_PICENCLR = 0x024;
public SecondaryINTC() {
intc = new NormalINTC(MAX_INTSRCS);
intc.connectINTDestination(this);
addReg(REG_SIC_ENCLR, "SIC_ENCLR", 0x00000000);
addReg(REG_SIC_PICENSET, "SIC_PICENSET", 0x00000000);
//FIXME: Workaround for Linux Versatile Device Tree.
// CONFIG_MACH_VERSATILE_DT
addReg(0x02c, "", 0x00000000);
}
/**
* 割り込みコントローラにコアを接続します。
*
* @param n 割り込み線の番号
* @param c 割り込みを発生させるコア
*/
public void connectINTSource(int n, INTSource c) {
intc.connectINTSource(n, c);
}
/**
* 割り込みコントローラからコアを切断します。
*
* 切断後はコアからの割り込みを受け付けません。
*
* @param n 割り込み線の番号
*/
public void disconnectINTSource(int n) {
intc.disconnectINTSource(n);
}
@Override
public int readWord(BusMaster64 m, long addr) {
int regaddr;
int result;
regaddr = (int)(addr & BitOp.getAddressMask(LEN_WORD_BITS));
switch (regaddr) {
case REG_SIC_ENCLR:
//TODO: not implemented
System.out.printf("SIC_ENCLR: read 0x%08x\n", 0);
result = 0x0;
break;
case REG_SIC_PICENSET:
//TODO: not implemented
System.out.printf("SIC_PICENSET: read 0x%08x\n", 0);
result = 0x0;
break;
default:
result = super.readWord(m, regaddr);
break;
}
return result;
}
@Override
public void writeWord(BusMaster64 m, long addr, int data) {
int regaddr;
regaddr = (int) (addr & BitOp.getAddressMask(LEN_WORD_BITS));
switch (regaddr) {
case REG_SIC_ENCLR:
//TODO: not implemented
System.out.printf("SIC_ENCLR: 0x%08x\n", data);
break;
case REG_SIC_PICENSET:
//TODO: not implemented
System.out.printf("SIC_PICENSET: 0x%08x\n", data);
break;
default:
super.writeWord(m, regaddr, data);
break;
}
}
@Override
public boolean isRaisedInterrupt() {
return false;
}
@Override
public void setRaisedInterrupt(boolean m) {
//FIXME: do nothing
m = false;
}
@Override
public void run() {
//do nothing
}
}
| apache-2.0 |
stoyanr/Masterminder | mastermind/test/com/stoyanr/mastermind/MainTest.java | 6138 | /*
* $Id: $
*
* Copyright 2012 Stoyan Rachev (stoyanr@gmail.com)
*
* 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.stoyanr.mastermind;
import static com.stoyanr.mastermind.Messages.*;
import static org.junit.Assert.assertEquals;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.StringTokenizer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
@RunWith(value = Parameterized.class)
public class MainTest
{
private static final String[] TEST_ARGS_1 = new String[] { "-a", "ABCD", "-l", "2", "-r", "4",
"-s", "knuth", "-p", "3" };
private static final String T_INTRO = "i";
private static final String T_COWS = "c";
private static final String T_BULLS = "b";
private static final String O_ERROR = "e";
private static final String O_WON = "w";
private static final String O_LOST = "l";
private static final String M_WRONG_OUTPUT = "Wrong output:";
private static final String DELIM = "-";
private final transient String[] args;
private final transient String input;
private final transient String outputSchema;
private transient int numRounds;
public MainTest(final String[] args, final String input, final String outputSchema)
{
super();
this.args = Arrays.copyOf(args, args.length);
this.input = input;
this.outputSchema = outputSchema;
}
@Parameters
public static Collection<Object[]> data()
{
// @formatter:off, @checkstyle:off
final Object[][] data = new Object[][]
{
{ TEST_ARGS_1, "", "i-AB-c-e" },
{ TEST_ARGS_1, "a", "i-AB-c-e" },
{ TEST_ARGS_1, "-1\n0\n", "i-AB-c-b-e" }, // NOPMD AvoidDuplicateLiterals
{ TEST_ARGS_1, "3\n0\n", "i-AB-c-b-e" },
{ TEST_ARGS_1, "1\n1\n", "i-AB-c-b-e" },
{ TEST_ARGS_1, "2\n2\n", "i-AB-c-b-e" },
{ TEST_ARGS_1, "0\n0\n0\n0\n0\n0\n", "i-AB-c-b-CC-c-b-DD-c-b-e" },
{ TEST_ARGS_1, "0\n2\n", "i-AB-c-b-w" },
{ TEST_ARGS_1, "0\n0\n0\n2\n", "i-AB-c-b-CC-c-b-w" },
{ TEST_ARGS_1, "0\n0\n0\n0\n0\n2\n", "i-AB-c-b-CC-c-b-DD-c-b-w" },
/*
{ new String[] { "-a", "ABCDEF", "-l", "4", "-r", "9", "-s", "simple" }, "a", "i-AAAA-c-e" },
{ new String[] { "-a", "ABCDEF", "-l", "4", "-r", "5", "-s", "knuth" }, "a", "i-AABB-c-e" },
{ new String[] { "-a", "ABCDEF", "-l", "4", "-r", "6", "-s", "exp_size" }, "a", "i-AABC-c-e" },
*/
};
// @formatter:on, @checkstyle:on
return Arrays.asList(data);
}
@Test
public final void testRun()
{
final String output = run();
assertEquals(M_WRONG_OUTPUT, buildOutput(), output);
}
public final String run()
{
final Reader reader = new StringReader(input);
final Writer writer = new StringWriter();
final Main main = new Main(args, reader, writer);
main.run();
return writer.toString();
}
public final String buildOutput()
{
final List<String> tokens = tokenizeSchema(outputSchema);
return buildOutput(tokens);
}
private List<String> tokenizeSchema(final String schema)
{
final List<String> tokens = new ArrayList<String>();
final StringTokenizer tokenizer = new StringTokenizer(schema, DELIM);
while (tokenizer.hasMoreTokens())
{
final String token = tokenizer.nextToken();
tokens.add(token);
}
return tokens;
}
private String buildOutput(final List<String> tokens)
{
final StringBuilder builder = new StringBuilder();
appendGuesses(tokens, builder);
appendOutcome(tokens, builder);
return builder.toString();
}
private void appendGuesses(final List<String> tokens, final StringBuilder builder)
{
numRounds = 0;
for (int i = 0; i < tokens.size() - 1; i++)
{
final String token = tokens.get(i);
if (token.equals(T_INTRO))
{
builder.append(M_C_STARTING_GAME);
builder.append("\n");
}
else if (token.equals(T_COWS))
{
builder.append(M_C_COWS);
}
else if (token.equals(T_BULLS))
{
builder.append(M_C_BULLS);
}
else
{
builder.append(String.format(M_C_GUESS, token));
builder.append("\n");
numRounds++;
}
}
}
private void appendOutcome(final List<String> tokens, final StringBuilder builder)
{
final String outcome = tokens.get(tokens.size() - 1);
if (outcome.equals(O_ERROR))
{
builder.append(MastermindException.class.toString());
}
else if (outcome.equals(O_WON))
{
builder.append(String.format(M_C_GAME_WON, numRounds));
}
else if (outcome.equals(O_LOST))
{
builder.append(String.format(M_C_GAME_LOST, numRounds));
}
builder.append("\n");
}
}
| apache-2.0 |
coder173025/MagicCube | library/src/main/java/com/mc/library/database/realm/wrapper/RealmBoolean.java | 448 | package com.mc.library.database.realm.wrapper;
import io.realm.RealmObject;
/**
* Created by dinghui on 2016/10/24.
*/
public class RealmBoolean extends RealmObject {
private boolean value;
public RealmBoolean() {
}
public RealmBoolean(boolean value) {
this.value = value;
}
public boolean isValue() {
return value;
}
public void setValue(boolean value) {
this.value = value;
}
}
| apache-2.0 |
robert-bor/CSVeed | src/test/java/org/csveed/api/CsvClientTest.java | 13637 | package org.csveed.api;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import org.csveed.bean.BeanInstructionsImpl;
import org.csveed.bean.ColumnNameMapper;
import org.csveed.report.CsvException;
import org.csveed.test.converters.BeanSimpleConverter;
import org.csveed.test.model.BeanCustomComments;
import org.csveed.test.model.BeanSimple;
import org.csveed.test.model.BeanVariousNotAnnotated;
import org.csveed.test.model.BeanWithCustomNumber;
import org.csveed.test.model.BeanWithMultipleStrings;
import org.junit.jupiter.api.Test;
public class CsvClientTest {
@Test
public void writeBeansBasedOnClass() throws IOException {
try (StringWriter writer = new StringWriter()) {
List<BeanWithMultipleStrings> beans = new ArrayList<>();
beans.add(createBean("row 1, cell 3", "row 1, cell 2", "row 1, cell 1"));
beans.add(createBean("row 2, cell 3", "row 2, cell 2", "row 2, cell 1"));
beans.add(createBean("row 3, cell 3", "row 3, cell 2", "row 3, cell 1"));
CsvClient<BeanWithMultipleStrings> client = new CsvClientImpl<>(
writer, BeanWithMultipleStrings.class
);
client.writeBeans(beans);
assertEquals(
"\"gamma\";\"beta\";\"alpha\"\r\n"+
"\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+
"\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n"+
"\"row 3, cell 1\";\"row 3, cell 2\";\"row 3, cell 3\"\r\n",
writer.getBuffer().toString());
}
}
@Test
public void writeBeansBasedOnInstructions() throws IOException {
try (StringWriter writer = new StringWriter()) {
List<BeanWithMultipleStrings> beans = new ArrayList<>();
beans.add(createBean("row 1, cell 3", "row 1, cell 2", "row 1, cell 1"));
beans.add(createBean("row 2, cell 3", "row 2, cell 2", "row 2, cell 1"));
beans.add(createBean("row 3, cell 3", "row 3, cell 2", "row 3, cell 1"));
CsvClient<BeanWithMultipleStrings> client = new CsvClientImpl<>(
writer, new BeanInstructionsImpl(BeanWithMultipleStrings.class)
.mapColumnNameToProperty("alpha", "alpha")
.mapColumnNameToProperty("beta", "beta")
.ignoreProperty("gamma")
);
client.writeBeans(beans);
assertEquals(
"\"beta\";\"alpha\"\r\n"+
"\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+
"\"row 2, cell 2\";\"row 2, cell 3\"\r\n"+
"\"row 3, cell 2\";\"row 3, cell 3\"\r\n",
writer.getBuffer().toString());
}
}
private BeanWithMultipleStrings createBean(String alpha, String beta, String gamma) {
BeanWithMultipleStrings bean = new BeanWithMultipleStrings();
bean.setAlpha(alpha);
bean.setBeta(beta);
bean.setGamma(gamma);
return bean;
}
@Test
public void readAndWriteRows() throws IOException {
Reader reader = new StringReader(
"alpha;beta;gamma\n"+
"\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\n"+
"\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\n"
);
CsvClient<Reader> csvReader = new CsvClientImpl<>(reader);
List<Row> rows = csvReader.readRows();
try (StringWriter writer = new StringWriter()) {
CsvClient<StringWriter> csvWriter = new CsvClientImpl<>(writer);
csvWriter.writeHeader(rows.get(0).getHeader());
csvWriter.writeRows(rows);
assertEquals(
"\"alpha\";\"beta\";\"gamma\"\r\n"+
"\"row 1, cell 1\";\"row 1, cell 2\";\"row 1, cell 3\"\r\n"+
"\"row 2, cell 1\";\"row 2, cell 2\";\"row 2, cell 3\"\r\n",
writer.getBuffer().toString());
}
}
@Test
public void writeRow() throws IOException {
try (StringWriter writer = new StringWriter()) {
CsvClient<StringWriter> csvClient = new CsvClientImpl<StringWriter>(writer)
.setUseHeader(false);
csvClient.writeRow(new String[] { "alpha", "beta", "gamma" } );
assertEquals("\"alpha\";\"beta\";\"gamma\"\r\n", writer.getBuffer().toString());
}
}
@Test
public void writeRowsLF() throws IOException {
writeRows("\n");
}
@Test
public void writeRowsCRLF() throws IOException {
writeRows("\r\n");
}
private void writeRows(String lineTerminators) throws IOException {
try (StringWriter writer = new StringWriter()) {
CsvClient<StringWriter> csvClient = new CsvClientImpl<StringWriter>(writer)
.setUseHeader(false)
.setEndOfLine(lineTerminators.toCharArray());
csvClient.writeHeader(new String[] {
"h1", "h2", "h3"
} );
csvClient.writeRows(new String[][] {
{ "l1c1", "l1c2", "l1c3" },
{ "l2c1", "l2c2", "l2c3" },
{ "l3c1", "l3c2", "l3c3" }
} );
assertEquals(
"\"h1\";\"h2\";\"h3\"" + lineTerminators +
"\"l1c1\";\"l1c2\";\"l1c3\"" + lineTerminators +
"\"l2c1\";\"l2c2\";\"l2c3\"" + lineTerminators +
"\"l3c1\";\"l3c2\";\"l3c3\"" + lineTerminators,
writer.getBuffer().toString());
}
}
@Test
public void windowsCRLF0x0d0x0a() {
char[] file = new char[] {
'n', 'a', 'm', 'e', 0x0d, 0x0a,
'A', 'l', 'p', 'h', 'a', 0x0d, 0x0a,
'B', 'e', 't', 'a', 0x0d, 0x0a,
'G', 'a', 'm', 'm', 'a'
};
String fileText = new String(file);
Reader reader = new StringReader(fileText);
CsvClient<BeanSimple> csvClient = new CsvClientImpl<>(reader, BeanSimple.class);
final List<BeanSimple> beans = csvClient.readBeans();
assertEquals(3, beans.size());
}
@Test
public void doNotSkipCommentLineMustCauseColumnCheckToFail() {
Reader reader = new StringReader(
"name;name 2;name 3\n"+
"# ignore me!\n"
);
CsvClient<StringWriter> csvClient = new CsvClientImpl<StringWriter>(reader)
.skipCommentLines(false);
assertThrows(CsvException.class, () -> {
csvClient.readRows();
});
}
@Test
public void customComments() {
Reader reader = new StringReader(
"name\n"+
"% ignore me!\n"+
"some name\n"
);
CsvClient<BeanCustomComments> csvClient = new CsvClientImpl<>(reader, BeanCustomComments.class);
List<BeanCustomComments> beans = csvClient.readBeans();
assertEquals(1, beans.size());
}
@Test
public void callBeanMethodOnNonBeanReaderFacade() {
Reader reader = new StringReader("");
CsvClient<StringWriter> csvClient = new CsvClientImpl<>(reader);
assertThrows(CsvException.class, () -> {
csvClient.readBean();
});
}
@Test
public void customNumberConversion() {
Reader reader = new StringReader(
"money\n"+
"11.398,22"
);
CsvClient<BeanWithCustomNumber> beanReader = new CsvClientImpl<>(reader, BeanWithCustomNumber.class)
.setLocalizedNumber("number", Locale.GERMANY);
BeanWithCustomNumber bean = beanReader.readBean();
assertEquals(Double.valueOf(11398.22), bean.getNumber());
}
@Test
public void readLinesLF() {
readLines("\n");
}
@Test
public void readLinesCRLF() {
readLines("\r\n");
}
private void readLines(String lineTerminators) {
Reader reader = new StringReader("text,year,number,date,lines,year and month" + lineTerminators + "'a bit of text',1983,42.42,1972-01-13,'line 1',2013-04" + lineTerminators
+ "'more text',1984,42.42,1972-01-14,'line 1" + lineTerminators + "line 2',2014-04" + lineTerminators + "# please ignore me"
+ lineTerminators + "'and yet more text',1985,42.42,1972-01-15,'line 1" + lineTerminators + "line 2" + lineTerminators
+ "line 3',2015-04" + lineTerminators);
CsvClient<BeanVariousNotAnnotated> csvClient =
new CsvClientImpl<>(reader, BeanVariousNotAnnotated.class)
.setEscape('\\')
.setQuote('\'')
.setComment('#')
.setEndOfLine(new char[]{'\n'})
.setSeparator(',')
.setStartRow(1)
.setUseHeader(true)
.setMapper(ColumnNameMapper.class)
.ignoreProperty("ignoreMe")
.mapColumnNameToProperty("text", "txt")
.setRequired("txt", true)
.mapColumnNameToProperty("year", "year")
.mapColumnNameToProperty("number", "number")
.mapColumnNameToProperty("date", "date")
.setDate("date", "yyyy-MM-dd")
.mapColumnNameToProperty("year and month", "yearMonth")
.setDate("yearMonth", "yyyy-MM")
.mapColumnNameToProperty("lines", "simple")
.setConverter("simple", new BeanSimpleConverter())
;
List<BeanVariousNotAnnotated> beans = csvClient.readBeans();
assertTrue(csvClient.isFinished());
assertEquals(6, csvClient.getCurrentLine());
assertEquals(3, beans.size());
}
@Test
public void multipleHeaderReads() {
Reader reader = new StringReader(
"text;year;number;date;lines;year and month\n"+
"\"a bit of text\";1983;42.42;1972-01-13;\"line 1\";2013-04\n"+
"\"more text\";1984;42.42;1972-01-14;\"line 1\nline 2\";2014-04\n"+
"\"and yet more text\";1985;42.42;1972-01-15;\"line 1\nline 2\nline 3\";2015-04\n"
);
CsvClient<BeanVariousNotAnnotated> csvClient =
new CsvClientImpl<>(reader, BeanVariousNotAnnotated.class);
assertNotNull(csvClient.readHeader());
assertNotNull(csvClient.readHeader());
}
@Test
public void requiredField() {
Reader reader = new StringReader(
"alpha;beta;gamma\n"+
"\"l1c1\";\"l1c2\";\"l1c3\"\n"+
"\"l2c1\";\"l2c2\";\"l2c3\"\n"+
"\"l3c1\";\"l3c2\";"
);
CsvClient<BeanWithMultipleStrings> csvClient =
new CsvClientImpl<>(reader, BeanWithMultipleStrings.class)
.setMapper(ColumnNameMapper.class)
.setRequired("gamma", true);
assertThrows(CsvException.class, () -> {
csvClient.readBeans();
});
}
@Test
public void startAtLaterLine() {
Reader reader = new StringReader(
"-- ignore line 1\n"+
"-- ignore line 2\n"+
"-- ignore line 3\n"+
"text;year;number;date;lines;year and month\n"+
"\"a bit of text\";1983;42.42;1972-01-13;\"line 1\";2013-04\n"+
"\"more text\";1984;42.42;1972-01-14;\"line 1\nline 2\";2014-04\n"+
"\"and yet more text\";1985;42.42;1972-01-15;\"line 1\nline 2\nline 3\";2015-04\n"
);
CsvClient<BeanVariousNotAnnotated> csvClient =
new CsvClientImpl<>(reader, BeanVariousNotAnnotated.class)
.setStartRow(4);
List<Row> rows = csvClient.readRows();
assertEquals(3, rows.size());
assertEquals(8, csvClient.getCurrentLine());
}
@Test
public void commentLinesNotSkipped() {
Reader reader = new StringReader(
"Issue ID;Submitter\n"+
"#1;Bill\n"+
"#2;Mary\n"+
"#3;Jane\n"+
"#4;Will"
);
CsvClient<BeanSimple> csvClient = new CsvClientImpl<>(reader, BeanSimple.class)
.skipCommentLines(false);
List<Row> rows = csvClient.readRows();
assertEquals(4, rows.size());
}
@Test
public void headerNotWrittenForOtherwiseEmptyCsv() throws IOException {
try (StringWriter writer = new StringWriter()) {
new CsvClientImpl<>(
writer, BeanWithMultipleStrings.class
);
assertEquals("", writer.getBuffer().toString());
}
}
@Test
public void writeHeaderBasedOnBeanProperties() throws IOException {
try (StringWriter writer = new StringWriter()) {
CsvClient<BeanWithMultipleStrings> client = new CsvClientImpl<>(
writer, BeanWithMultipleStrings.class
);
client.writeHeader();
assertEquals("\"gamma\";\"beta\";\"alpha\"\r\n", writer.getBuffer().toString());
}
}
}
| apache-2.0 |
helloscala/helloscala | hs-nosql/src/main/java/helloscala/nosql/cassandra/CassandraHelper.java | 3199 | /*
* Copyright 2017 helloscala.com
*
* 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 helloscala.nosql.cassandra;
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.DataType;
import com.datastax.driver.extras.codecs.arrays.DoubleArrayCodec;
import com.datastax.driver.extras.codecs.arrays.FloatArrayCodec;
import com.datastax.driver.extras.codecs.arrays.IntArrayCodec;
import com.datastax.driver.extras.codecs.arrays.LongArrayCodec;
import com.datastax.driver.extras.codecs.jdk8.InstantCodec;
import com.datastax.driver.extras.codecs.jdk8.LocalDateCodec;
import com.datastax.driver.extras.codecs.jdk8.LocalTimeCodec;
import com.datastax.driver.extras.codecs.jdk8.ZonedDateTimeCodec;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import helloscala.common.Configuration;
import helloscala.common.Configuration$;
/**
* Created by yangbajing(yangbajing@gmail.com) on 2017-03-21.
*/
public class CassandraHelper {
/**
* 获得 Cassandra 连接 Cluster
*/
public static Cluster getCluster(CassandraConf c) {
Cluster.Builder builder = Cluster.builder()
.addContactPoints(c.nodes())
// .withLoadBalancingPolicy(new RoundRobinPolicy())
.withClusterName(c.clusterName());
if (c.username().isDefined() && c.password().isDefined()) {
builder = builder.withCredentials(c.username().get(), c.password().get());
}
Cluster cluster = builder.build();
cluster.getConfiguration().getCodecRegistry()
.register(new ZonedDateTimeCodec(cluster.getMetadata().newTupleType(DataType.timestamp(), DataType.varchar())))
.register(new IntArrayCodec())
.register(new FloatArrayCodec())
.register(new DoubleArrayCodec())
.register(new LongArrayCodec())
.register(LocalDateTimeCode.instance)
.register(InstantCodec.instance)
.register(LocalDateCodec.instance)
.register(LocalTimeCodec.instance);
return cluster;
}
public static Cluster getClusterFromConfigPath(String path) {
return getCluster(getConf(path));
}
public static CassandraConf getConf(String path) {
Configuration config = Configuration$.MODULE$.apply(ConfigFactory.load().getConfig(path));
return getConf(config);
}
public static CassandraConf getConf(Config config) {
return getConf(Configuration$.MODULE$.apply(config));
}
public static CassandraConf getConf(Configuration config) {
return CassandraConf$.MODULE$.apply(config);
}
}
| apache-2.0 |
sockeqwe/mosby | mvp/src/main/java/com/hannesdorfmann/mosby3/mvp/delegate/ActivityMvpDelegateImpl.java | 7155 | /*
* Copyright 2015 Hannes Dorfmann.
*
* 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.hannesdorfmann.mosby3.mvp.delegate;
import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import com.hannesdorfmann.mosby3.PresenterManager;
import com.hannesdorfmann.mosby3.mvp.MvpPresenter;
import com.hannesdorfmann.mosby3.mvp.MvpView;
import java.util.UUID;
/**
* The concrete implementation of {@link}
*
* @param <V> The type of {@link MvpView}
* @param <P> The type of {@link MvpPresenter}
* @author Hannes Dorfmann
* @see ActivityMvpDelegate
* @since 1.1.0
*/
public class ActivityMvpDelegateImpl<V extends MvpView, P extends MvpPresenter<V>>
implements ActivityMvpDelegate {
protected static final String KEY_MOSBY_VIEW_ID = "com.hannesdorfmann.mosby3.activity.mvp.id";
public static boolean DEBUG = false;
private static final String DEBUG_TAG = "ActivityMvpDelegateImpl";
private MvpDelegateCallback<V, P> delegateCallback;
protected boolean keepPresenterInstance;
protected Activity activity;
protected String mosbyViewId = null;
/**
* @param activity The Activity
* @param delegateCallback The callback
* @param keepPresenterInstance true, if the presenter instance should be kept across screen
* orientation changes. Otherwise false.
*/
public ActivityMvpDelegateImpl(@NonNull Activity activity,
@NonNull MvpDelegateCallback<V, P> delegateCallback, boolean keepPresenterInstance) {
if (activity == null) {
throw new NullPointerException("Activity is null!");
}
if (delegateCallback == null) {
throw new NullPointerException("MvpDelegateCallback is null!");
}
this.delegateCallback = delegateCallback;
this.activity = activity;
this.keepPresenterInstance = keepPresenterInstance;
}
/**
* Determines whether or not a Presenter Instance should be kept
*
* @param keepPresenterInstance true, if the delegate has enabled keep
*/
static boolean retainPresenterInstance(boolean keepPresenterInstance, Activity activity) {
return keepPresenterInstance && (activity.isChangingConfigurations()
|| !activity.isFinishing());
}
/**
* Generates the unique (mosby internal) view id and calls {@link
* MvpDelegateCallback#createPresenter()}
* to create a new presenter instance
*
* @return The new created presenter instance
*/
private P createViewIdAndCreatePresenter() {
P presenter = delegateCallback.createPresenter();
if (presenter == null) {
throw new NullPointerException(
"Presenter returned from createPresenter() is null. Activity is " + activity);
}
if (keepPresenterInstance) {
mosbyViewId = UUID.randomUUID().toString();
PresenterManager.putPresenter(activity, mosbyViewId, presenter);
}
return presenter;
}
@Override public void onCreate(Bundle bundle) {
P presenter = null;
if (bundle != null && keepPresenterInstance) {
mosbyViewId = bundle.getString(KEY_MOSBY_VIEW_ID);
if (DEBUG) {
Log.d(DEBUG_TAG,
"MosbyView ID = " + mosbyViewId + " for MvpView: " + delegateCallback.getMvpView());
}
if (mosbyViewId != null
&& (presenter = PresenterManager.getPresenter(activity, mosbyViewId)) != null) {
//
// Presenter restored from cache
//
if (DEBUG) {
Log.d(DEBUG_TAG,
"Reused presenter " + presenter + " for view " + delegateCallback.getMvpView());
}
} else {
//
// No presenter found in cache, most likely caused by process death
//
presenter = createViewIdAndCreatePresenter();
if (DEBUG) {
Log.d(DEBUG_TAG, "No presenter found although view Id was here: "
+ mosbyViewId
+ ". Most likely this was caused by a process death. New Presenter created"
+ presenter
+ " for view "
+ getMvpView());
}
}
} else {
//
// Activity starting first time, so create a new presenter
//
presenter = createViewIdAndCreatePresenter();
if (DEBUG) {
Log.d(DEBUG_TAG, "New presenter " + presenter + " for view " + getMvpView());
}
}
if (presenter == null) {
throw new IllegalStateException(
"Oops, Presenter is null. This seems to be a Mosby internal bug. Please report this issue here: https://github.com/sockeqwe/mosby/issues");
}
delegateCallback.setPresenter(presenter);
getPresenter().attachView(getMvpView());
if (DEBUG) {
Log.d(DEBUG_TAG, "View" + getMvpView() + " attached to Presenter " + presenter);
}
}
private P getPresenter() {
P presenter = delegateCallback.getPresenter();
if (presenter == null) {
throw new NullPointerException("Presenter returned from getPresenter() is null");
}
return presenter;
}
private V getMvpView() {
V view = delegateCallback.getMvpView();
if (view == null) {
throw new NullPointerException("View returned from getMvpView() is null");
}
return view;
}
@Override public void onDestroy() {
boolean retainPresenterInstance = retainPresenterInstance(keepPresenterInstance, activity);
getPresenter().detachView();
if (!retainPresenterInstance){
getPresenter().destroy();
}
if (!retainPresenterInstance && mosbyViewId != null) {
PresenterManager.remove(activity, mosbyViewId);
}
if (DEBUG) {
if (retainPresenterInstance) {
Log.d(DEBUG_TAG, "View"
+ getMvpView()
+ " destroyed temporarily. View detached from presenter "
+ getPresenter());
} else {
Log.d(DEBUG_TAG, "View"
+ getMvpView()
+ " destroyed permanently. View detached permanently from presenter "
+ getPresenter());
}
}
}
@Override public void onPause() {
}
@Override public void onResume() {
}
@Override public void onStart() {
}
@Override public void onStop() {
}
@Override public void onRestart() {
}
@Override public void onContentChanged() {
}
@Override public void onSaveInstanceState(Bundle outState) {
if (keepPresenterInstance && outState != null) {
outState.putString(KEY_MOSBY_VIEW_ID, mosbyViewId);
if (DEBUG) {
Log.d(DEBUG_TAG,
"Saving MosbyViewId into Bundle. ViewId: " + mosbyViewId + " for view " + getMvpView());
}
}
}
@Override public void onPostCreate(Bundle savedInstanceState) {
}
}
| apache-2.0 |
marekvorp777/mvorp | chapter_001/src/test/java/ru/job4j/CalculatorTest.java | 1499 | package ru.job4j;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
*Class of tests for 'Calculator.java'.
*
*@author mvorp
*@since 16.07.2018
*@version 1
*/
public class CalculatorTest {
/**
* Validation that 1.0 + 1.0 = 2.0 .
*/
@Test
public void whenAddOnePlusOneThenTwo() {
Calculator calc = new Calculator();
calc.add(1D, 1D);
double result = calc.getResult();
double expected = 2D;
assertThat(result, is(expected));
}
/**
* Validation that 4.0 - 2.0 = 2.0 .
*/
@Test
public void whenSubtractFourMinusTwoThenTwo() {
Calculator calc = new Calculator();
calc.subtract(4D, 2D);
double result = calc.getResult();
double expected = 2D;
assertThat(result, is(expected));
}
/**
* Validation that 4.0 / 2.0 = 2.0 .
*/
@Test
public void whenDivFourDivideTwoThenOne() {
Calculator calc = new Calculator();
calc.div(4D, 2D);
double result = calc.getResult();
double expected = 2D;
assertThat(result, is(expected));
}
/**
* Validation that 2.0 * 2.0 = 4.0 .
*/
@Test
public void whenMultipleTwoMultiplyTwoThenFour() {
Calculator calc = new Calculator();
calc.multiple(2D, 2D);
double result = calc.getResult();
double expected = 4D;
assertThat(result, is(expected));
}
} | apache-2.0 |
aparod/jonix | jonix-common/src/main/java/com/tectonica/jonix/codelist/EpublicationTypes.java | 11935 | /*
* Copyright (C) 2012 Zach Melamed
*
* Latest version available online at https://github.com/zach-m/jonix
* Contact me at zach@tectonica.co.il
*
* 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.tectonica.jonix.codelist;
import java.util.HashMap;
import java.util.Map;
/*
* NOTE: THIS IS AN AUTO-GENERATED FILE, DON'T EDIT MANUALLY
*/
/**
* <code>Enum</code> that corresponds to ONIX <b>Codelist 10</b>
* <p>
* Description: Epublication type code
*
* @see <a href="http://www.editeur.org/14/code-lists">ONIX Codelists</a>
*/
public enum EpublicationTypes
{
/**
* An epublication viewed as a unique package of content which may be converted into any of a number of different
* types for delivery to the consumer. This code is used when an ONIX <Product> record describes the content
* package and lists within the record the different forms in which it is available.
*/
Epublication_content_package_("000"), //
/**
* An epublication delivered in a basic, unprotected, HTML format. Do NOT use for HTML-based formats which include
* DRM protection.
*/
HTML("001"), //
/**
* An epublication delivered in a basic, unprotected, PDF format. Do NOT use for PDF-based formats which include DRM
* protection.
*/
PDF("002"), //
/**
* An epublication delivered in PDF format, capable of being read in the standard Acrobat Reader, and protected by
* PDF-Merchant DRM features. (This format is no longer supported for new applications.).
*/
PDF_Merchant("003"), //
/**
* An epublication delivered in an enhanced PDF format, using Adobe’s proprietary EBX DRM, capable of being
* read in the Adobe Ebook Reader software, on any platform which can support this software, which was formerly
* known as Glassbook.
*/
Adobe_Ebook_Reader("004"), //
/**
* An epublication delivered in an unencrypted Microsoft .LIT format, capable of being read in the Microsoft Reader
* software at any level, on any platform which can support this software. (Level 3 differs from Level 1 only in
* that it embeds the name of the original purchaser.).
*/
Microsoft_Reader_Level_1_Level_3("005"), //
/**
* An epublication delivered in the Microsoft .LIT format, with full encryption, capable of being read in the
* Microsoft Reader software at Level 5, on any platform which can support this software.
*/
Microsoft_Reader_Level_5("006"), //
/**
* An epublication delivered in a proprietary HTML- or OEBF-based format, capable of being read only through
* subscription to the NetLibrary service.
*/
NetLibrary("007"), //
/**
* An epublication delivered in a proprietary format through a web browser, capable of being read only through
* subscription to the MetaText service (the educational division of NetLibrary).
*/
MetaText("008"), //
/**
* An epublication delivered in a proprietary PDF-based format, capable of being read only through subscription to
* the MightyWords service.
*/
MightyWords("009"), //
/**
* An epublication delivered in a proprietary HTML-based format, capable of being read in reading software which may
* be used on handheld devices using the Palm OS or Pocket PC/Windows CE operating systems.
*/
eReader_AKA_Palm_Reader("010"), //
/**
* An epublication delivered in a proprietary format capable of being read in reading software which is specific to
* the Softbook hardware platform. Also capable of being read on the Softbook’s successor, the Gemstar REB
* 1200.
*/
Softbook("011"), //
/**
* An epublication delivered in a proprietary .RB format, capable of being read in reading software which is
* specific to the RocketBook hardware platform. Also capable of being read on the RocketBook’s successor, the
* Gemstar REB 1100.
*/
RocketBook("012"), //
/**
* An epublication delivered in a proprietary .RB format, capable of being read in reading software which is
* specific to the Gemstar REB 1100 hardware platform. Also capable of being read on the RocketBook with some loss
* of functionality.
*/
Gemstar_REB_1100("013"), //
/**
* An epublication delivered in a proprietary format, capable of being read in reading software which is specific to
* the Gemstar REB 1200 hardware platform. Also capable of being read on the Softbook with some loss of
* functionality.
*/
Gemstar_REB_1200("014"), //
/**
* An epublication delivered in Franklin’s proprietary HTML-based format, capable of being read in reading
* software which is specific to the Franklin eBookman platform.
*/
Franklin_eBookman("015"), //
/**
* An epublication delivered in a proprietary XML-based format and available for online access only through
* subscription to the Books24x7 service.
*/
Books24x7("016"), //
/**
* An epublication available through DigitalOwl proprietary packaging, distribution and DRM software, delivered in a
* variety of formats across a range of platforms.
*/
DigitalOwl("017"), //
/**
* An epublication delivered in a proprietary HTML-based format, capable of being read in Handheldmed reader
* software on Palm OS, Windows, and EPOC/Psion handheld devices, available only through the Handheldmed service.
*/
Handheldmed("018"), //
/**
* An epublication delivered in a proprietary ???-based format and available for download only through the WizeUp
* service.
*/
WizeUp("019"), //
/**
* An epublication delivered in the proprietary TK3 format, capable of being read only in the TK3 reader software
* supplied by Night Kitchen Inc, on any platform which can support this software.
*/
TK3("020"), //
/**
* An epublication delivered in an encrypted .RTF format, capable of being read only in the Litraweb Visor software,
* and available only from Litraweb.com.
*/
Litraweb("021"), //
/**
* An epublication delivered in a proprietary format, capable of being read in the MobiPocket software on PalmOS,
* WindowsCE /Pocket PC, Franklin eBookman, and EPOC32 handheld devices, available through the MobiPocket service.
* Includes Amazon Kindle formats up to and including version 7 – but prefer code 031 for version 7, and
* always use 031 for KF8.
*/
MobiPocket("022"), //
/**
* An epublication delivered in the standard distribution format specified in the Open Ebook Publication Structure
* (OEBPS) format and capable of being read in any OEBPS-compliant reading system. Includes EPUB format up to and
* including version 2 – but prefer code 029 for EPUB 2, and always use 029 for EPUB 3.
*/
Open_Ebook("023"), //
/**
* An epublication delivered in a proprietary format, capable of being read in Town Compass DataViewer reader
* software on a Palm OS handheld device.
*/
Town_Compass_DataViewer("024"), //
/**
* An epublication delivered in an openly available .TXT format, with ASCII or UTF-8 encoding, as used for example
* in Project Gutenberg.
*/
TXT("025"), //
/**
* An epublication delivered as a self-executing file including its own reader software, and created with
* proprietary ExeBook Self-Publisher software.
*/
ExeBook("026"), //
/**
* An epublication in a Sony proprietary format for use with the Sony Reader and LIBRIé reading devices.
*/
Sony_BBeB("027"), //
VitalSource_Bookshelf("028"), //
/**
* An epublication delivered using the Open Publication Structure / OPS Container Format standard of the
* International Digital Publishing Forum (IDPF). [This value was originally defined as ‘Adobe Digital
* Editions’, which is not an epublication format but a reader which supports PDF or EPUB (IDPF) formats.
* Since PDF is already covered by code 002, it was agreed, and announced to the ONIX listserv in September 2009,
* that code 029 should be refined to represent EPUB format.].
*/
EPUB("029"), //
MyiLibrary("030"), //
/**
* Amazon proprietary file format derived from Mobipocket format, used for Kindle devices and Kindle reader
* software.
*/
Kindle("031"), //
/**
* An epublication made available by Google in association with a publisher; readable online on a browser-enabled
* device and offline on designated ebook readers.
*/
Google_Edition("032"), //
/**
* An epublication in a proprietary format combining text and video content and available to be used online or as a
* downloadable application for a mobile device – see www.vook.com.
*/
Vook("033"), //
/**
* An epublication in a proprietary format for use with DXReader software.
*/
DXReader("034"), //
/**
* An epublication in a format proprietary to the Ebook Library service.
*/
EBL("035"), //
/**
* An epublication in a format proprietary to the Ebrary service.
*/
Ebrary("036"), //
/**
* An epublication in a proprietary format for use with iSilo software on various hardware platforms.
*/
iSilo("037"), //
/**
* An epublication in a proprietary format for use with Plucker reader software on Palm and other handheld devices.
*/
Plucker("038"), //
/**
* A format proprietary to the VitalSource service.
*/
VitalBook("039"), //
/**
* Epublication packaged as an application for iOS (eg Apple iPhone, iPad etc) containing both executable code and
* content. Content can be described with <ProductContentType>.
*/
Book_app_for_iOS("040"), //
/**
* Epublication packaged as an application for Android (eg Android phone or tablet) containing both executable code
* and content. Content can be described with <ProductContentType>.
*/
Android_app_("041"), //
/**
* Epublication packaged as an application. Technical requirements such as target operating system and/or device
* should be provided in <EpubTypeNote>. Content can be described with <ProductContentType>.
*/
Other_app_("042"), //
/**
* XML Paper Specification format [File extension .xps] for (eg) Blio.
*/
XPS("043"), //
/**
* Apple’s iBook format (a proprietary extension of EPUB), can only be read on Apple iOS devices.
*/
iBook("044"), //
/**
* Proprietary format based on EPUB used by Barnes and Noble for fixed-format e-books, readable on NOOK devices and
* Nook reader software.
*/
ePIB("045"), //
/**
* Sharable Content Object Reference Model, standard content and packaging format for e-learning objects.
*/
SCORM("046"), //
/**
* E-book Plus (proprietary Norwegian e-book format based on HTML5 documents packaged within a zipped .ebp file).
*/
EBP("047"), //
/**
* Proprietary format based on PDF used by Barnes and Noble for fixed-format e-books, readable on some NOOK devices
* and Nook reader software. <p>NOTE: Introduced in Onix3
*/
Page_Perfect("048"), //
/**
* Product consists of parts in different formats.
*/
Multiple_formats("098"), //
/**
* Unknown, or no code yet assigned for this format.
*/
Unspecified("099");
public final String value;
private EpublicationTypes(String value)
{
this.value = value;
}
private static Map<String, EpublicationTypes> map;
private static Map<String, EpublicationTypes> map()
{
if (map == null)
{
map = new HashMap<>();
for (EpublicationTypes e : values())
map.put(e.value, e);
}
return map;
}
public static EpublicationTypes byValue(String value)
{
if (value == null || value.isEmpty())
return null;
return map().get(value);
}
}
| apache-2.0 |
OpenUniversity/ovirt-engine | frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SnapshotDetailModel.java | 1527 | package org.ovirt.engine.ui.uicommonweb.models.vms;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.ovirt.engine.core.common.businessentities.Snapshot;
import org.ovirt.engine.ui.uicommonweb.models.EntityModel;
import org.ovirt.engine.ui.uicommonweb.models.ListModel;
import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
public class SnapshotDetailModel extends EntityModel {
private String name;
public String getName() {
return name;
}
public void setName(String value) {
if (!Objects.equals(name, value)) {
name = value;
onPropertyChanged(new PropertyChangedEventArgs("Name")); //$NON-NLS-1$
}
}
private Snapshot snapshot;
public Snapshot getSnapshot() {
return snapshot;
}
public void setSnapshot(Snapshot value) {
if (snapshot != value) {
snapshot = value;
onPropertyChanged(new PropertyChangedEventArgs("Snapshot")); //$NON-NLS-1$
}
}
public SnapshotDetailModel() {
setName(""); //$NON-NLS-1$
}
public ListModel getEntityListModel() {
ListModel listModel = new ListModel();
ArrayList arrayList = new ArrayList();
for (Object object : (List) getEntity()) {
EntityModel entityModel = new EntityModel();
entityModel.setEntity(object);
arrayList.add(entityModel);
}
listModel.setItems(arrayList);
return listModel;
}
}
| apache-2.0 |
ymittal/codeu_project_2017 | android/app/src/main/java/com/google/codeu/chatme/common/view/BaseFragment.java | 1070 | package com.google.codeu.chatme.common.view;
import android.app.ProgressDialog;
import android.support.v4.app.Fragment;
import android.widget.Toast;
public class BaseFragment extends Fragment implements BaseFragmentView {
private ProgressDialog mProgressDialog;
@Override
public void showProgressDialog(int message) {
if (mProgressDialog == null) {
mProgressDialog = new ProgressDialog(getContext());
mProgressDialog.setMessage(getString(message));
mProgressDialog.setIndeterminate(true);
}
mProgressDialog.show();
}
@Override
public void hideProgressDialog() {
if (mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}
@Override
public void makeToast(int messageId) {
Toast.makeText(getContext(), getString(messageId), Toast.LENGTH_SHORT).show();
}
@Override
public void makeToast(String message) {
Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
}
}
| apache-2.0 |
gawkermedia/googleads-java-lib | examples/dfp_axis/src/main/java/dfp/axis/v201508/proposallineitemservice/GetProposalLineItemsByStatement.java | 3753 | // Copyright 2015 Google Inc. 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 dfp.axis.v201508.proposallineitemservice;
import com.google.api.ads.common.lib.auth.OfflineCredentials;
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
import com.google.api.ads.dfp.axis.factory.DfpServices;
import com.google.api.ads.dfp.axis.utils.v201508.StatementBuilder;
import com.google.api.ads.dfp.axis.v201508.ProposalLineItem;
import com.google.api.ads.dfp.axis.v201508.ProposalLineItemPage;
import com.google.api.ads.dfp.axis.v201508.ProposalLineItemServiceInterface;
import com.google.api.ads.dfp.lib.client.DfpSession;
import com.google.api.client.auth.oauth2.Credential;
/**
* This example gets all proposal line items belonging to a specific proposal.
* To see which proposals exist, run GetAllProposals.java.
*
* Credentials and properties in {@code fromFile()} are pulled from the
* "ads.properties" file. See README for more info.
*/
public class GetProposalLineItemsByStatement {
// Set the ID of the proposal to filter proposal line items on.
private static final String PROPOSAL_ID = "INSERT_PROPOSAL_ID_HERE;";
public static void runExample(DfpServices dfpServices, DfpSession session,
String proposalId) throws Exception {
// Get the ProposalLineItemService.
ProposalLineItemServiceInterface proposalLineItemService =
dfpServices.get(session, ProposalLineItemServiceInterface.class);
// Create a statement to select proposal line items belonging to a proposal.
StatementBuilder statementBuilder = new StatementBuilder()
.where("proposalId = :proposalId")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("proposalId", proposalId);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get proposal line items by statement.
ProposalLineItemPage page =
proposalLineItemService.getProposalLineItemsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (ProposalLineItem proposalLineItem : page.getResults()) {
System.out.printf(
"%d) Proposal line item with ID %d and name '%s' was found.%n", i++,
proposalLineItem.getId(), proposalLineItem.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
}
public static void main(String[] args) throws Exception {
// Generate a refreshable OAuth2 credential.
Credential oAuth2Credential = new OfflineCredentials.Builder()
.forApi(Api.DFP)
.fromFile()
.build()
.generateCredential();
// Construct a DfpSession.
DfpSession session = new DfpSession.Builder()
.fromFile()
.withOAuth2Credential(oAuth2Credential)
.build();
DfpServices dfpServices = new DfpServices();
runExample(dfpServices, session, PROPOSAL_ID);
}
}
| apache-2.0 |
lumongo/lumongo | lumongo-ui/src/main/java/org/lumongo/ui/client/widgets/base/Footer.java | 2071 | package org.lumongo.ui.client.widgets.base;
import com.google.gwt.dom.client.Style;
import com.google.gwt.user.client.Window;
import gwt.material.design.client.constants.Color;
import gwt.material.design.client.constants.FooterType;
import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.ui.MaterialButton;
import gwt.material.design.client.ui.MaterialColumn;
import gwt.material.design.client.ui.MaterialFooter;
import gwt.material.design.client.ui.MaterialLabel;
import gwt.material.design.client.ui.MaterialRow;
/**
* Created by Payam Meyer on 3/10/17.
* @author pmeyer
*/
public class Footer extends MaterialFooter {
public Footer() {
setBackgroundColor(Color.GREY_DARKEN_2);
MaterialRow row = new MaterialRow();
MaterialColumn leftColumn = new MaterialColumn(12, 6, 6);
MaterialColumn rightColumn = new MaterialColumn(12, 6, 6);
row.add(leftColumn);
row.add(rightColumn);
add(row);
setType(FooterType.FIXED);
MaterialLabel label = new MaterialLabel("LuMongo is distributed under a commercially friendly Apache Software license");
label.setTextColor(Color.WHITE);
label.setMarginTop(15);
leftColumn.add(label);
MaterialButton chatButton = new MaterialButton("Chat with Us");
chatButton.setMarginTop(10);
chatButton.setMarginLeft(20);
chatButton.setFloat(Style.Float.RIGHT);
chatButton.setIconType(IconType.CHAT_BUBBLE);
chatButton.addClickHandler(clickEvent -> Window
.open("https://gitter.im/lumongo/lumongo?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge", "_blank",
"menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
rightColumn.add(chatButton);
MaterialButton sourceButton = new MaterialButton("Source");
sourceButton.setMarginTop(10);
sourceButton.setIconType(IconType.CODE);
sourceButton.setFloat(Style.Float.RIGHT);
sourceButton.addClickHandler(
clickEvent -> Window.open("https://github.com/lumongo/lumongo", "_blank", "menubar=1,status=1,toolbar=1,scrollbars=1,resizable=1"));
rightColumn.add(sourceButton);
}
}
| apache-2.0 |
sambathl/example101 | src/main/java/example101/booter/ServiceBooter.java | 1909 | /**
* (c) Copyright 2009-2015 Velocimetrics Ltd
* All Rights Reserved
* Permission is granted to licensees to use
* or alter this software for any purpose, including commercial applications,
* only according to the terms laid out in the Software License Agreement.
* All other use of this source code is expressly forbidden.
*/
package example101.booter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @author SAMBATH
*
*/
@SpringBootApplication(scanBasePackages = { "example101.booter", "example101.config", "example101.service" })
@EnableSwagger2
public class ServiceBooter extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(ServiceBooter.class);
}
public static void main(String[] args) {
SpringApplication.run(ServiceBooter.class, args);
}
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build();
}
@LoadBalanced
@Bean
public RestTemplate getRestTemplate(RestTemplateBuilder builder) {
return builder.build();
}
} | apache-2.0 |
neoautus/lucidj | extras/AntInstaller/AntInstaller-beta0.8/src/org/tp23/antinstaller/runtime/TextRunner.java | 4327 | /*
* Copyright 2005 Paul Hinds
*
* 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.tp23.antinstaller.runtime;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.ResourceBundle;
import org.tp23.antinstaller.InstallException;
import org.tp23.antinstaller.Installer;
import org.tp23.antinstaller.InstallerContext;
import org.tp23.antinstaller.page.Page;
import org.tp23.antinstaller.page.SimpleInputPage;
import org.tp23.antinstaller.renderer.AntOutputRenderer;
import org.tp23.antinstaller.renderer.RendererFactory;
import org.tp23.antinstaller.renderer.text.AbstractTextPageRenderer;
import org.tp23.antinstaller.renderer.text.TextMessageRenderer;
/**
*
* <p>Runs the installer from the text only command line (console) </p>
* <p>This class uses the Installer object tree as its data source and renderers
* from the org.tp23.antinstaller.renderer.text package </p>
* <p>Copyright (c) 2004</p>
* <p>Company: tp23</p>
* @author Paul Hinds
* @version $Id: TextRunner.java,v 1.10 2007/01/19 00:24:36 teknopaul Exp $
*/
public class TextRunner extends AntRunner
implements Runner {
private static final ResourceBundle res = ResourceBundle.getBundle("org.tp23.antinstaller.renderer.Res");
protected final InstallerContext ctx;
protected final Installer installer;
private final Logger logger;
protected final IfPropertyHelper ifHelper;
public TextRunner(InstallerContext ctx) throws IOException {
super(ctx);
this.ctx = ctx;
this.installer = ctx.getInstaller();
this.logger = ctx.getLogger();
ctx.setMessageRenderer(new TextMessageRenderer());
ctx.setAntOutputRenderer(new AntOutputRenderer(){
public PrintStream getErr() {
return System.err;
}
public PrintStream getOut() {
return System.out;
}
});
this.ifHelper = new IfPropertyHelper(ctx);
}
/**
* Renders the installer on the command line, this method blocks until
* the UI has finished
* @throws InstallException
* @return boolean false implies the install was aborted
*/
public boolean runInstaller() throws InstallException {
try {
return renderPages(installer.getPages());
}
catch (Exception ex) {
logger.log("FATAL exception during installation:"+ex.getMessage());
logger.log(installer, ex);
ctx.getMessageRenderer().printMessage(res.getString("installationFailed") + ":" + ex.getMessage());
//Fixed BUG: ctx.getMessageRenderer().printMessage("Installation failed:"+ex.getMessage());
throw new InstallException("Installation failed", ex);
}
}
private boolean renderPages(Page[] pages) throws ClassNotFoundException, InstallException{
Page next = null;
for (int i = 0; i < pages.length; i++) {
next = pages[i];
if(next instanceof SimpleInputPage){
// skip iftarget specified and missing
if(!ifHelper.ifTarget(next, pages))continue;
// skip page if ifProperty is specified and property is missing
if(!ifHelper.ifProperty(next))continue;
}
AbstractTextPageRenderer renderer = RendererFactory.getTextPageRenderer(next);
renderer.setContext(ctx);
renderer.init( new BufferedReader(new InputStreamReader(System.in)), System.out);
ctx.setCurrentPage(next);
renderer.renderPage(next);
if (next.isAbort()){
return false;
}
runPost(next);
}
return true;
}
public InstallerContext getInstallerContext() {
return ctx;
}
/**
* Called when Ant has finished its work
*/
public void antFinished() {
System.out.println(res.getString("finished"));
//System.exit(0);
}
/**
* Called is Ant failed to install correctly
*/
public void fatalError(){
System.out.println(res.getString("failed"));
//System.exit(1);
}
public String toString() {
return "TextRunner";
}
}
| apache-2.0 |
likel/leetcode-java | src/MaximumWidthofBinaryTree/Solution.java | 1626 | package MaximumWidthofBinaryTree;
class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) {
val = x;
}
}
class Solution {
private boolean hasChild(TreeNode node) {
return node != null && (node.left != null || node.right != null);
}
private TreeNode[] resize(TreeNode[] oldNodes, int l, int r) {
int newSize = (r - l + 1) * 2;
TreeNode[] table = new TreeNode[newSize];
// The leftest node's left child and the rightest node's right child might null.
// But we don't need to handle it here.
for (int i = l; i <= r; i++) {
if (oldNodes[i] != null) {
int j = (i - l) << 1;
table[j] = oldNodes[i].left;
table[j + 1] = oldNodes[i].right;
} // else be null
}
return table;
}
public int widthOfBinaryTree(TreeNode root) {
TreeNode[] nodes = new TreeNode[]{root};
int width = 0;
int l, r;
for (; ; ) {
TreeNode[] table = nodes;
int n = table.length;
l = 0;
while (l < n && table[l] == null)
l++;
r = n - 1;
while (r >= 0 && table[r] == null)
r--;
if (width < (r - l + 1))
width = r - l + 1;
while (l < n && !hasChild(table[l]))
l++;
while (r >= 0 && !hasChild(table[r]))
r--;
if (r < l || (nodes = resize(table, l, r)) == null)
break;
}
return width;
}
} | apache-2.0 |
triathematician/blaisemath | blaise-graphics/src/main/java/com/googlecode/blaisemath/graphics/GraphicMouseMoveHandler.java | 2020 | package com.googlecode.blaisemath.graphics;
/*
* #%L
* BlaiseGraphics
* --
* Copyright (C) 2009 - 2021 Elisha Peterson
* --
* 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%
*/
import com.googlecode.blaisemath.coordinate.CoordinateBean;
import com.googlecode.blaisemath.coordinate.DraggableCoordinate;
import java.awt.geom.Point2D;
/**
* Implementation of an object drag using a point property pattern. Maintains
* a record of the initial point and the relative movement to set a new point as
* the object is being dragged.
*
* @see CoordinateBean
* @see DraggableCoordinate
*
* @author Elisha Peterson
*/
public final class GraphicMouseMoveHandler extends GraphicMouseDragHandler {
private final DraggableCoordinate<Point2D> bean;
private Point2D beanStart;
/**
* Construct with specified object that can get and set a point
*
* @param bean object that can get/set a point
*/
public GraphicMouseMoveHandler(final DraggableCoordinate<Point2D> bean) {
this.bean = bean;
}
@Override
public void mouseDragInitiated(GraphicMouseEvent e, Point2D start) {
beanStart = new Point2D.Double(bean.getPoint().getX(), bean.getPoint().getY());
}
@Override
public void mouseDragInProgress(GraphicMouseEvent e, Point2D start) {
bean.setPoint(beanStart, start, e.getGraphicLocation());
}
@Override
public void mouseDragCompleted(GraphicMouseEvent e, Point2D start) {
beanStart = null;
}
}
| apache-2.0 |
box/box-java-sdk | src/main/java/com/box/sdk/PartialCollection.java | 3750 | package com.box.sdk;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
/**
* A collection that contains a subset of items that are a part of a larger collection. The items within a partial
* collection begin at an offset within the full collection and end at a specified limit. Note that the actual size of a
* partial collection may be less than its limit since the limit only specifies the maximum size. For example, if
* there's a full collection with a size of 3, then a partial collection with offset 0 and limit 3 would be equal to a
* partial collection with offset 0 and limit 100.
*
* @param <E> the type of elements in this partial collection.
*/
public class PartialCollection<E> implements Collection<E> {
private final Collection<E> collection;
private final long offset;
private final long limit;
private final long fullSize;
/**
* Constructs a PartialCollection with a specified offset, limit, and full size.
*
* @param offset the offset within in the full collection.
* @param limit the maximum number of items after the offset.
* @param fullSize the total number of items in the full collection.
*/
public PartialCollection(long offset, long limit, long fullSize) {
this.collection = new ArrayList<E>();
this.offset = offset;
this.limit = limit;
this.fullSize = fullSize;
}
/**
* Gets the offset within the full collection where this collection's items begin.
*
* @return the offset within the full collection where this collection's items begin.
*/
public long offset() {
return this.offset;
}
/**
* Gets the maximum number of items within the full collection that begin at {@link #offset}.
*
* @return the maximum number of items within the full collection that begin at the offset.
*/
public long limit() {
return this.limit;
}
/**
* Gets the size of the full collection that this partial collection is based off of.
*
* @return the size of the full collection that this partial collection is based off of.
*/
public long fullSize() {
return this.fullSize;
}
@Override
public boolean add(E e) {
return this.collection.add(e);
}
@Override
public boolean addAll(Collection<? extends E> c) {
return this.collection.addAll(c);
}
@Override
public void clear() {
this.collection.clear();
}
@Override
public boolean contains(Object o) {
return this.collection.contains(o);
}
@Override
public boolean containsAll(Collection<?> c) {
return this.collection.containsAll(c);
}
@Override
public boolean equals(Object o) {
return this.collection.equals(o);
}
@Override
public int hashCode() {
return this.collection.hashCode();
}
@Override
public boolean isEmpty() {
return this.collection.isEmpty();
}
@Override
public Iterator<E> iterator() {
return this.collection.iterator();
}
@Override
public boolean remove(Object o) {
return this.collection.remove(o);
}
@Override
public boolean removeAll(Collection<?> c) {
return this.collection.removeAll(c);
}
@Override
public boolean retainAll(Collection<?> c) {
return this.collection.retainAll(c);
}
@Override
public int size() {
return this.collection.size();
}
@Override
public Object[] toArray() {
return this.collection.toArray();
}
@Override
public <T> T[] toArray(T[] a) {
return this.collection.toArray(a);
}
}
| apache-2.0 |
aglne/dubbo | dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyServer.java | 6845 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses 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 org.apache.dubbo.remoting.transport.netty4;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.logger.Logger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.ExecutorUtil;
import org.apache.dubbo.common.utils.NetUtils;
import org.apache.dubbo.common.utils.UrlUtils;
import org.apache.dubbo.remoting.Channel;
import org.apache.dubbo.remoting.ChannelHandler;
import org.apache.dubbo.remoting.Constants;
import org.apache.dubbo.remoting.RemotingException;
import org.apache.dubbo.remoting.Server;
import org.apache.dubbo.remoting.transport.AbstractServer;
import org.apache.dubbo.remoting.transport.dispatcher.ChannelHandlers;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.dubbo.common.constants.CommonConstants.IO_THREADS_KEY;
/**
* NettyServer
*/
public class NettyServer extends AbstractServer implements Server {
private static final Logger logger = LoggerFactory.getLogger(NettyServer.class);
private Map<String, Channel> channels; // <ip:port, channel>
private ServerBootstrap bootstrap;
private io.netty.channel.Channel channel;
private EventLoopGroup bossGroup;
private EventLoopGroup workerGroup;
public NettyServer(URL url, ChannelHandler handler) throws RemotingException {
super(url, ChannelHandlers.wrap(handler, ExecutorUtil.setThreadName(url, SERVER_THREAD_POOL_NAME)));
}
@Override
protected void doOpen() throws Throwable {
bootstrap = new ServerBootstrap();
bossGroup = new NioEventLoopGroup(1, new DefaultThreadFactory("NettyServerBoss", true));
workerGroup = new NioEventLoopGroup(getUrl().getPositiveParameter(IO_THREADS_KEY, Constants.DEFAULT_IO_THREADS),
new DefaultThreadFactory("NettyServerWorker", true));
final NettyServerHandler nettyServerHandler = new NettyServerHandler(getUrl(), this);
channels = nettyServerHandler.getChannels();
bootstrap.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childOption(ChannelOption.TCP_NODELAY, Boolean.TRUE)
.childOption(ChannelOption.SO_REUSEADDR, Boolean.TRUE)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childHandler(new ChannelInitializer<NioSocketChannel>() {
@Override
protected void initChannel(NioSocketChannel ch) throws Exception {
// FIXME: should we use getTimeout()?
int idleTimeout = UrlUtils.getIdleTimeout(getUrl());
NettyCodecAdapter adapter = new NettyCodecAdapter(getCodec(), getUrl(), NettyServer.this);
ch.pipeline()//.addLast("logging",new LoggingHandler(LogLevel.INFO))//for debug
.addLast("decoder", adapter.getDecoder())
.addLast("encoder", adapter.getEncoder())
.addLast("server-idle-handler", new IdleStateHandler(0, 0, idleTimeout, MILLISECONDS))
.addLast("handler", nettyServerHandler);
}
});
// bind
ChannelFuture channelFuture = bootstrap.bind(getBindAddress());
channelFuture.syncUninterruptibly();
channel = channelFuture.channel();
}
@Override
protected void doClose() throws Throwable {
try {
if (channel != null) {
// unbind.
channel.close();
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
try {
Collection<org.apache.dubbo.remoting.Channel> channels = getChannels();
if (channels != null && channels.size() > 0) {
for (org.apache.dubbo.remoting.Channel channel : channels) {
try {
channel.close();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
try {
if (bootstrap != null) {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
try {
if (channels != null) {
channels.clear();
}
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
@Override
public Collection<Channel> getChannels() {
Collection<Channel> chs = new HashSet<Channel>();
for (Channel channel : this.channels.values()) {
if (channel.isConnected()) {
chs.add(channel);
} else {
channels.remove(NetUtils.toAddressString(channel.getRemoteAddress()));
}
}
return chs;
}
@Override
public Channel getChannel(InetSocketAddress remoteAddress) {
return channels.get(NetUtils.toAddressString(remoteAddress));
}
@Override
public boolean canHandleIdle() {
return true;
}
@Override
public boolean isBound() {
return channel.isActive();
}
}
| apache-2.0 |
STRiDGE/dozer | core/src/test/java/org/dozer/vo/direction/EntityBase.java | 1069 | /*
* Copyright 2005-2017 Dozer Project
*
* 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.dozer.vo.direction;
/**
* @author dmitry.buzdin
*/
public abstract class EntityBase implements Entity {
private String id;
public void setId(String id) {
this.id = id;
}
public String getId() {
return this.id;
}
@Override
public int hashCode() {
if (this.id == null) {
throw new IllegalStateException("Id not mapped yet: BOEM.");
}
return this.id.hashCode();
}
}
| apache-2.0 |
zoozooll/MyExercise | VV/src/com/beem/project/btf/utils/AndroidDeviceUtil.java | 424 | /**
*
*/
package com.beem.project.btf.utils;
import android.content.Context;
/**
* @author Aaron Lee Created at 下午8:15:07 2015-9-9
*/
public class AndroidDeviceUtil {
public static int getScreenWidth(Context context) {
return context.getResources().getDisplayMetrics().widthPixels;
}
public static int getScreenHeight(Context context) {
return context.getResources().getDisplayMetrics().heightPixels;
}
}
| apache-2.0 |
0nirvana0/grib2reader | src/ucar/units/UnitSystemImpl.java | 4391 | /*
* Copyright 1998-2014 University Corporation for Atmospheric Research/Unidata
*
* Portions of this software were developed by the Unidata Program at the
* University Corporation for Atmospheric Research.
*
* Access and use of this software shall impose the following obligations
* and understandings on the user. The user is granted the right, without
* any fee or cost, to use, copy, modify, alter, enhance and distribute
* this software, and any derivative works thereof, and its supporting
* documentation for any purpose whatsoever, provided that this entire
* notice appears in all copies of the software, derivative works and
* supporting documentation. Further, UCAR requests that the user credit
* UCAR/Unidata in any publications that result from the use of this
* software or in any product that includes this software. The names UCAR
* and/or Unidata, however, may not be used in any advertising or publicity
* to endorse or promote any products or commercial entity unless specific
* written permission is obtained from UCAR/Unidata. The user also
* understands that UCAR/Unidata is not obligated to provide the user with
* any support, consulting, training or assistance of any kind with regard
* to the use, operation and performance of this software nor to provide
* the user with any updates, revisions, new versions or "bug fixes."
*
* THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
*/
package ucar.units;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Iterator;
/**
* @author Steven R. Emmerson
*/
public class UnitSystemImpl implements UnitSystem, Serializable {
private static final long serialVersionUID = 1L;
/**
* The quantity-to-base-unit map.
*
* @serial
*/
private final HashMap<BaseQuantity, BaseUnit> quantityMap;
/**
* The base unit database;
*
* @serial
*/
private final UnitDB baseUnitDB;
/**
* The complete database;
*
* @serial
*/
private final UnitDBImpl acceptableUnitDB;
/**
* Constructs from a base unit database and a derived unit database.
*
* @param baseUnitDB
* The base unit database. Shall only contain base units.
* @param derivedUnitDB
* The derived unit database. Shall not contain any base units.
* @throws UnitExistsException
* A unit with the same identifier exists in both databases.
*/
protected UnitSystemImpl(final UnitDBImpl baseUnitDB,
final UnitDBImpl derivedUnitDB) throws UnitExistsException {
quantityMap = new HashMap<BaseQuantity, BaseUnit>(baseUnitDB
.nameCount());
for (final Iterator<?> iter = baseUnitDB.getIterator(); iter.hasNext();) {
final Unit unit = (Unit) iter.next();
final BaseUnit baseUnit = (BaseUnit) unit;
quantityMap.put(baseUnit.getBaseQuantity(), baseUnit);
}
this.baseUnitDB = baseUnitDB;
acceptableUnitDB = new UnitDBImpl(baseUnitDB.nameCount()
+ derivedUnitDB.nameCount(), baseUnitDB.symbolCount()
+ derivedUnitDB.symbolCount());
acceptableUnitDB.add(baseUnitDB);
acceptableUnitDB.add(derivedUnitDB);
}
/**
* Returns the base unit database.
*
* @return The base unit database.
*/
public final UnitDB getBaseUnitDB() {
return baseUnitDB;
}
/**
* Returns the complete unit database.
*
* @return The complete unit database (both base units and derived units).
*/
public final UnitDB getUnitDB() {
return acceptableUnitDB;
}
/**
* Returns the base unit corresponding to a base quantity.
*
* @param quantity
* The base quantity.
* @return The base unit corresponding to the base quantity in this system
* of units or <code>
* null</code> if no such unit exists.
*/
public final BaseUnit getBaseUnit(final BaseQuantity quantity) {
return quantityMap.get(quantity);
}
}
| apache-2.0 |
didi/DoraemonKit | Android/dokit/src/main/java/com/didichuxing/doraemonkit/kit/network/okhttp/interceptor/DokitCapInterceptor.java | 5678 | package com.didichuxing.doraemonkit.kit.network.okhttp.interceptor;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.didichuxing.doraemonkit.kit.core.DoKitManager;
import com.didichuxing.doraemonkit.kit.network.NetworkManager;
import com.didichuxing.doraemonkit.kit.network.bean.NetworkRecord;
import com.didichuxing.doraemonkit.kit.network.bean.WhiteHostBean;
import com.didichuxing.doraemonkit.kit.network.core.DefaultResponseHandler;
import com.didichuxing.doraemonkit.kit.network.core.NetworkInterpreter;
import com.didichuxing.doraemonkit.kit.network.core.RequestBodyHelper;
import com.didichuxing.doraemonkit.kit.network.okhttp.ForwardingResponseBody;
import com.didichuxing.doraemonkit.kit.network.okhttp.InterceptorUtil;
import com.didichuxing.doraemonkit.kit.network.okhttp.OkHttpInspectorRequest;
import com.didichuxing.doraemonkit.kit.network.okhttp.OkHttpInspectorResponse;
import com.didichuxing.doraemonkit.kit.network.utils.OkHttpResponseKt;
import com.didichuxing.doraemonkit.util.LogHelper;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import okhttp3.MediaType;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
/**
* 抓包拦截器
*/
public class DokitCapInterceptor extends AbsDoKitInterceptor {
private final NetworkInterpreter mNetworkInterpreter = NetworkInterpreter.get();
@NonNull
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
if (!NetworkManager.isActive()) {
Request request = chain.request();
try {
return chain.proceed(request);
} catch (Exception e) {
ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json;charset=utf-8"), "" + e.getMessage());
return new Response.Builder()
.code(400)
.message(String.format("%s==>Exception:%s", chain.request().url().host(), e.getMessage()))
.request(request)
.body(responseBody)
.protocol(Protocol.HTTP_1_1)
.build();
}
}
Request request = chain.request();
int requestId = mNetworkInterpreter.nextRequestId();
Response response;
try {
response = chain.proceed(request);
} catch (Exception e) {
LogHelper.e(getTAG(), "e===>" + e.getMessage());
mNetworkInterpreter.httpExchangeFailed(requestId, e.toString());
ResponseBody responseBody = ResponseBody.create(MediaType.parse("application/json;charset=utf-8"), "" + e.getMessage());
return new Response.Builder()
.code(400)
.message(String.format("%s==>Exception:%s", chain.request().url().host(), e.getMessage()))
.request(request)
.body(responseBody)
.protocol(Protocol.HTTP_1_1)
.build();
}
String strContentType = response.header("Content-Type");
//如果是图片则不进行拦截
if (InterceptorUtil.isImg(strContentType)) {
return response;
}
//白名单过滤
if (!matchWhiteHost(request)) {
return response;
}
RequestBodyHelper requestBodyHelper = new RequestBodyHelper();
OkHttpInspectorRequest inspectorRequest =
new OkHttpInspectorRequest(requestId, request, requestBodyHelper);
String platform = "native";
if (request.url().toString().contains("dokit_flag")) {
platform = "web";
}
NetworkRecord record = mNetworkInterpreter.createRecord(requestId, platform, inspectorRequest);
NetworkInterpreter.InspectorResponse inspectorResponse = new OkHttpInspectorResponse(
requestId,
request,
response);
mNetworkInterpreter.fetchResponseInfo(record, inspectorResponse);
ResponseBody body = response.body();
InputStream responseStream = null;
MediaType contentType = null;
if (body != null) {
contentType = body.contentType();
responseStream = body.byteStream();
}
responseStream = mNetworkInterpreter.interpretResponseStream(
contentType != null ? contentType.toString() : null,
responseStream,
new DefaultResponseHandler(mNetworkInterpreter, requestId, record));
record.mResponseBody = OkHttpResponseKt.bodyContent(response);
LogHelper.d("http-monitor", "response body >>>\n" + record.mResponseBody);
if (responseStream != null) {
response = response.newBuilder()
.body(new ForwardingResponseBody(body, responseStream))
.build();
}
return response;
}
/**
* 是否命中白名单规则
*
* @return bool
*/
private boolean matchWhiteHost(Request request) {
List<WhiteHostBean> whiteHostBeans = DoKitManager.WHITE_HOSTS;
if (whiteHostBeans.isEmpty()) {
return true;
}
for (WhiteHostBean whiteHostBean : whiteHostBeans) {
if (TextUtils.isEmpty(whiteHostBean.getHost())) {
continue;
}
String realHost = request.url().host();
//正则判断
if (whiteHostBean.getHost().equalsIgnoreCase(realHost)) {
return true;
}
}
return false;
}
} | apache-2.0 |
SAGROUP2/apps-android-wikipedia | app/src/test/java/org/wikipedia/json/NamespaceTypeAdapterTest.java | 2615 | package org.wikipedia.json;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.ParameterizedRobolectricTestRunner;
import org.robolectric.ParameterizedRobolectricTestRunner.Parameters;
import org.wikipedia.page.Namespace;
import java.util.Arrays;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.wikipedia.json.GsonMarshaller.marshal;
import static org.wikipedia.json.GsonUnmarshaller.unmarshal;
@RunWith(ParameterizedRobolectricTestRunner.class) public class NamespaceTypeAdapterTest {
@Parameters(name = "{0}") public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {{DeferredParam.NULL}, {DeferredParam.SPECIAL},
{DeferredParam.MAIN}, {DeferredParam.TALK}});
}
@Nullable private final Namespace namespace;
public NamespaceTypeAdapterTest(@NonNull DeferredParam param) {
this.namespace = param.val();
}
@Test public void testWriteRead() {
Namespace result = unmarshal(Namespace.class, marshal(namespace));
assertThat(result, is(namespace));
}
@Test public void testReadOldData() throws Throwable {
// Prior to 3210ce44, we marshaled Namespace as the name string of the enum, instead of
// the code number, and when we switched to using the code number, we didn't introduce
// backwards-compatible checks for the old-style strings that may still be present in
// some local serialized data.
// TODO: remove after April 2017?
String marshaledStr = namespace == null ? "null" : "\"" + namespace.name() + "\"";
Namespace ns = unmarshal(Namespace.class, marshaledStr);
assertThat(ns, is(namespace));
}
// SparseArray is a Roboelectric mocked class which is unavailable at static time; defer
// evaluation until TestRunner is executed
private enum DeferredParam {
NULL() {
@Nullable @Override
Namespace val() {
return null;
}
},
SPECIAL() {
@Nullable @Override Namespace val() {
return Namespace.SPECIAL;
}
},
MAIN() {
@Nullable @Override Namespace val() {
return Namespace.MAIN;
}
},
TALK() {
@Nullable @Override Namespace val() {
return Namespace.TALK;
}
};
@Nullable abstract Namespace val();
}
}
| apache-2.0 |
Jcba/kascontroller-backend | rest/src/main/java/application/controller/SensorDataController.java | 813 | package application.controller;
import application.model.Temperature;
import application.service.api.SensorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class SensorDataController {
private final SensorService sensorService;
@Autowired
public SensorDataController(final SensorService sensorService) {
this.sensorService = sensorService;
}
@RequestMapping(value = "/temperature", method = RequestMethod.GET)
public List<Temperature> getTemperatureData() {
return sensorService.getTemperatureData();
}
}
| apache-2.0 |
pacozaa/BoofCV | main/ip/test/boofcv/abst/filter/binary/TestGlobalFixedBinaryFilter.java | 1818 | /*
* Copyright (c) 2011-2014, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.abst.filter.binary;
import boofcv.alg.filter.binary.GThresholdImageOps;
import boofcv.alg.misc.GImageMiscOps;
import boofcv.core.image.GeneralizedImageOps;
import boofcv.struct.image.ImageFloat32;
import boofcv.struct.image.ImageSingleBand;
import boofcv.struct.image.ImageType;
import boofcv.struct.image.ImageUInt8;
import boofcv.testing.BoofTesting;
import org.junit.Test;
import java.util.Random;
/**
* @author Peter Abeles
*/
public class TestGlobalFixedBinaryFilter {
Random rand = new Random(234);
@Test
public void compare() {
Class imageTypes[] = new Class[]{ImageUInt8.class,ImageFloat32.class};
for( Class type : imageTypes ) {
ImageSingleBand input = GeneralizedImageOps.createSingleBand(type, 30, 40);
ImageUInt8 found = new ImageUInt8(30,40);
ImageUInt8 expected = new ImageUInt8(30,40);
GImageMiscOps.fillUniform(input, rand, 0, 200);
GlobalFixedBinaryFilter alg = new GlobalFixedBinaryFilter(120,true, ImageType.single(type));
alg.process(input,found);
GThresholdImageOps.threshold(input,expected,120,true);
BoofTesting.assertEquals(found, expected, 0);
}
}
} | apache-2.0 |
gchq/stroom | stroom-query/stroom-query-common/src/main/java/stroom/query/common/v2/InMemorySearchResponseCreatorCache.java | 1216 | package stroom.query.common.v2;
import com.google.common.cache.LoadingCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
class InMemorySearchResponseCreatorCache implements SearchResponseCreatorCache {
private static final Logger LOGGER = LoggerFactory.getLogger(InMemorySearchResponseCreatorCache.class);
private final LoadingCache<Key, SearchResponseCreator> cache;
InMemorySearchResponseCreatorCache(final LoadingCache<Key, SearchResponseCreator> cache) {
this.cache = cache;
}
@Override
public SearchResponseCreator get(final SearchResponseCreatorCache.Key key) {
return cache.getUnchecked(key);
}
@Override
public void remove(final SearchResponseCreatorCache.Key key) {
cache.invalidate(key);
cache.cleanUp();
}
@Override
public void evictExpiredElements() {
cache.cleanUp();
}
@Override
public void clear() {
LOGGER.debug("Removing all items from cache {}", cache);
try {
cache.invalidateAll();
cache.cleanUp();
} catch (final RuntimeException e) {
LOGGER.error("Error clearing cache: " + e.getMessage(), e);
}
}
}
| apache-2.0 |
haikuowuya/android_system_code | src/java/awt/AWTException.java | 873 | /*
* Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.awt;
/**
* Signals that an Absract Window Toolkit exception has occurred.
*
* @author Arthur van Hoff
*/
public class AWTException extends Exception {
/*
* JDK 1.1 serialVersionUID
*/
private static final long serialVersionUID = -1900414231151323879L;
/**
* Constructs an instance of <code>AWTException</code> with the
* specified detail message. A detail message is an
* instance of <code>String</code> that describes this particular
* exception.
* @param msg the detail message
* @since JDK1.0
*/
public AWTException(String msg) {
super(msg);
}
}
| apache-2.0 |
rafaeltuelho/redhat-jb297-labs | jb297-unit3-lab-3-1/src/main/java/br/net/rafaeltuelho/jb297/unit3/model/Driver.java | 1731 | package br.net.rafaeltuelho.jb297.unit3.model;
import java.io.Serializable;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import java.sql.Timestamp;
import javax.persistence.*;
/**
* Entity implementation class for Entity: Driver
*
*/
@Entity
@Table(schema="MAPPER")
public class Driver implements Serializable {
@Id
private Long id;
private String licensenbr;
private String firstname;
private String lastname;
private String mi;
private Timestamp dob;
private Timestamp license_issued;
private Integer nbr_tickets;
private static final long serialVersionUID = 1L;
public Driver() {
super();
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getLicensenbr() {
return this.licensenbr;
}
public void setLicensenbr(String licensenbr) {
this.licensenbr = licensenbr;
}
public String getFirstname() {
return this.firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return this.lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getMi() {
return this.mi;
}
public void setMi(String mi) {
this.mi = mi;
}
public Timestamp getDob() {
return this.dob;
}
public void setDob(Timestamp dob) {
this.dob = dob;
}
public Timestamp getLicense_issued() {
return this.license_issued;
}
public void setLicense_issued(Timestamp license_issued) {
this.license_issued = license_issued;
}
public Integer getNbr_tickets() {
return this.nbr_tickets;
}
public void setNbr_tickets(Integer nbr_tickets) {
this.nbr_tickets = nbr_tickets;
}
}
| apache-2.0 |
marcingrzejszczak/spring-cloud-sleuth | spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/instrument/web/TraceHandlerInterceptor.java | 7421 | /*
* Copyright 2013-2017 the original author or 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 org.springframework.cloud.sleuth.instrument.web;
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicReference;
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.BeanFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.TraceKeys;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.util.ExceptionUtils;
import org.springframework.cloud.sleuth.util.SpanNameUtil;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
/**
* {@link org.springframework.web.servlet.HandlerInterceptor} that wraps handling of a
* request in a Span. Adds tags related to the class and method name.
*
* The interceptor will not create spans for error controller related paths.
*
* It's important to note that this implementation will set the request attribute
* {@link TraceRequestAttributes#HANDLED_SPAN_REQUEST_ATTR} when the request is processed.
* That way the {@link TraceFilter} will not create the "fallback" span.
*
* @author Marcin Grzejszczak
* @since 1.0.3
*/
public class TraceHandlerInterceptor extends HandlerInterceptorAdapter {
private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());
private final BeanFactory beanFactory;
private Tracer tracer;
private TraceKeys traceKeys;
private AtomicReference<ErrorController> errorController;
public TraceHandlerInterceptor(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler) throws Exception {
String spanName = spanName(handler);
boolean continueSpan = getRootSpanFromAttribute(request) != null;
Span span = continueSpan ? getRootSpanFromAttribute(request) : getTracer().createSpan(spanName);
if (log.isDebugEnabled()) {
log.debug("Handling span " + span);
}
addClassMethodTag(handler, span);
addClassNameTag(handler, span);
setSpanInAttribute(request, span);
if (!continueSpan) {
setNewSpanCreatedAttribute(request, span);
}
return true;
}
private boolean isErrorControllerRelated(HttpServletRequest request) {
return getErrorController() != null && getErrorController().getErrorPath()
.equals(request.getRequestURI());
}
private void addClassMethodTag(Object handler, Span span) {
if (handler instanceof HandlerMethod) {
String methodName = ((HandlerMethod) handler).getMethod().getName();
getTracer().addTag(getTraceKeys().getMvc().getControllerMethod(), methodName);
if (log.isDebugEnabled()) {
log.debug("Adding a method tag with value [" + methodName + "] to a span " + span);
}
}
}
private void addClassNameTag(Object handler, Span span) {
String className;
if (handler instanceof HandlerMethod) {
className = ((HandlerMethod) handler).getBeanType().getSimpleName();
} else {
className = handler.getClass().getSimpleName();
}
if (log.isDebugEnabled()) {
log.debug("Adding a class tag with value [" + className + "] to a span " + span);
}
getTracer().addTag(getTraceKeys().getMvc().getControllerClass(), className);
}
private String spanName(Object handler) {
if (handler instanceof HandlerMethod) {
return SpanNameUtil.toLowerHyphen(((HandlerMethod) handler).getMethod().getName());
}
return SpanNameUtil.toLowerHyphen(handler.getClass().getSimpleName());
}
@Override
public void afterConcurrentHandlingStarted(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
Span spanFromRequest = getNewSpanFromAttribute(request);
Span rootSpanFromRequest = getRootSpanFromAttribute(request);
if (log.isDebugEnabled()) {
log.debug("Closing the span " + spanFromRequest + " and detaching its parent " + rootSpanFromRequest + " since the request is asynchronous");
}
getTracer().close(spanFromRequest);
getTracer().detach(rootSpanFromRequest);
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response,
Object handler, Exception ex) throws Exception {
if (isErrorControllerRelated(request)) {
if (log.isDebugEnabled()) {
log.debug("Skipping closing of a span for error controller processing");
}
return;
}
Span span = getRootSpanFromAttribute(request);
if (ex != null) {
String errorMsg = ExceptionUtils.getExceptionMessage(ex);
if (log.isDebugEnabled()) {
log.debug("Adding an error tag [" + errorMsg + "] to span " + span + "");
}
getTracer().addTag(Span.SPAN_ERROR_TAG_NAME, errorMsg);
}
if (getNewSpanFromAttribute(request) != null) {
if (log.isDebugEnabled()) {
log.debug("Closing span " + span);
}
Span newSpan = getNewSpanFromAttribute(request);
getTracer().continueSpan(newSpan);
getTracer().close(newSpan);
clearNewSpanCreatedAttribute(request);
}
}
private Span getNewSpanFromAttribute(HttpServletRequest request) {
return (Span) request.getAttribute(TraceRequestAttributes.NEW_SPAN_REQUEST_ATTR);
}
private Span getRootSpanFromAttribute(HttpServletRequest request) {
return (Span) request.getAttribute(TraceFilter.TRACE_REQUEST_ATTR);
}
private void setSpanInAttribute(HttpServletRequest request, Span span) {
request.setAttribute(TraceRequestAttributes.HANDLED_SPAN_REQUEST_ATTR, span);
}
private void setNewSpanCreatedAttribute(HttpServletRequest request, Span span) {
request.setAttribute(TraceRequestAttributes.NEW_SPAN_REQUEST_ATTR, span);
}
private void clearNewSpanCreatedAttribute(HttpServletRequest request) {
request.removeAttribute(TraceRequestAttributes.NEW_SPAN_REQUEST_ATTR);
}
private Tracer getTracer() {
if (this.tracer == null) {
this.tracer = this.beanFactory.getBean(Tracer.class);
}
return this.tracer;
}
private TraceKeys getTraceKeys() {
if (this.traceKeys == null) {
this.traceKeys = this.beanFactory.getBean(TraceKeys.class);
}
return this.traceKeys;
}
ErrorController getErrorController() {
if (this.errorController == null) {
try {
ErrorController errorController = this.beanFactory.getBean(ErrorController.class);
this.errorController = new AtomicReference<>(errorController);
} catch (NoSuchBeanDefinitionException e) {
if (log.isTraceEnabled()) {
log.trace("ErrorController bean not found");
}
this.errorController = new AtomicReference<>();
}
}
return this.errorController.get();
}
}
| apache-2.0 |
liuyb4016/model_project | model_springmvc/src/main/java/cn/liuyb/app/portal/service/impl/RoleUrlServiceImpl.java | 2512 | package cn.liuyb.app.portal.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.liuyb.app.portal.dao.RoleUrlDao;
import cn.liuyb.app.portal.domain.RoleUrl;
import cn.liuyb.app.portal.service.RoleUrlService;
@Service
public class RoleUrlServiceImpl implements RoleUrlService{
//private static final Logger logger = Slf4jLogUtils.getLogger(RoleUrlServiceImpl.class);
@Autowired
private RoleUrlDao roleUrlDao;
@Transactional
@Override
public void add(RoleUrl roleUrl){
roleUrlDao.create(roleUrl);
}
@Transactional
@Override
public void delete(RoleUrl roleUrl) {
roleUrlDao.delete(roleUrl);
}
@Transactional
@Override
public void update(RoleUrl roleUrl) {
roleUrlDao.update(roleUrl);
}
@Override
public List<RoleUrl> findRoleUrlByClassName(String className) {
return roleUrlDao.findRoleUrlByClassName(className);
}
@Override
public List<Object> findRoleUrlGroupByClassName() {
return roleUrlDao.findRoleUrlGroupByClassName();
}
@Override
public boolean isBeingRoleUrlByUrlAndType(String url) {
return roleUrlDao.isBeingRoleUrlByUrlAndType(url);
}
@Override
public int countRoleUrlByClassName(String className) {
return roleUrlDao.countRoleUrlByClassName(className);
}
@Override
public List<RoleUrl> findRoleUrlByClassName(int start, int max,
String className) {
return roleUrlDao.findRoleUrlByClassName(start, max, className);
}
@Override
public int countRoleUrlGroupByClassName() {
return roleUrlDao.countRoleUrlGroupByClassName();
}
@Override
public List<Object> findRoleUrlGroupByClassName(int start, int max) {
return roleUrlDao.findRoleUrlGroupByClassName(start, max);
}
@Override
public RoleUrl getRoleUrlById(Long id) {
return roleUrlDao.find(id);
}
@Override
public List<RoleUrl> findRoleUrlByUrlAndTypeReadOnly(String url, Integer readOnly) {
return roleUrlDao.findRoleUrlByUrlAndTypeReadOnly(url, readOnly);
}
@Override
public boolean isBeingRoleUrlByUrlAndTypeReadOnly(String url,Integer readOnly) {
return roleUrlDao.isBeingRoleUrlByUrlAndTypeReadOnly(url, readOnly);
}
@Override
public List<RoleUrl> findRoleUrlByUserFunctionModel(String userFunctionModel) {
return roleUrlDao.findRoleUrlByUserFunctionModel(userFunctionModel);
}
}
| apache-2.0 |
sekigor/hawkular-agent | hawkular-wildfly-agent/src/main/java/org/hawkular/agent/monitor/scheduler/SchedulerConfiguration.java | 4044 | /*
* Copyright 2015 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* 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.hawkular.agent.monitor.scheduler;
import org.hawkular.agent.monitor.extension.MonitorServiceConfiguration;
/**
* @author John Mazzitelli
*
*/
public class SchedulerConfiguration {
public static final int DEFAULT_NUM_METRIC_SCHEDULER_THREADS = 2;
public static final int DEFAULT_NUM_AVAIL_SCHEDULER_THREADS = 2;
public static final int DEFAULT_METRIC_DISPATCHER_BUFFER_SIZE = 1000;
public static final int DEFAULT_METRIC_DISPATCHER_MAX_BATCH_SIZE = 100;
public static final int DEFAULT_AVAIL_DISPATCHER_BUFFER_SIZE = 500;
public static final int DEFAULT_AVAIL_DISPATCHER_MAX_BATCH_SIZE = 50;
private int metricSchedulerThreads = DEFAULT_NUM_METRIC_SCHEDULER_THREADS;
private int availSchedulerThreads = DEFAULT_NUM_AVAIL_SCHEDULER_THREADS;
private int metricDispatcherBufferSize = DEFAULT_METRIC_DISPATCHER_BUFFER_SIZE;
private int metricDispatcherMaxBatchSize = DEFAULT_METRIC_DISPATCHER_MAX_BATCH_SIZE;
private int availDispatcherBufferSize = DEFAULT_AVAIL_DISPATCHER_BUFFER_SIZE;
private int availDispatcherMaxBatchSize = DEFAULT_AVAIL_DISPATCHER_MAX_BATCH_SIZE;
private MonitorServiceConfiguration.StorageAdapterConfiguration storageAdapterConfig;
private MonitorServiceConfiguration.DiagnosticsConfiguration diagnosticsConfig;
public int getMetricSchedulerThreads() {
return metricSchedulerThreads;
}
public void setMetricSchedulerThreads(int schedulerThreads) {
this.metricSchedulerThreads = schedulerThreads;
}
public int getAvailSchedulerThreads() {
return availSchedulerThreads;
}
public void setAvailSchedulerThreads(int schedulerThreads) {
this.availSchedulerThreads = schedulerThreads;
}
public int getMetricDispatcherBufferSize() {
return metricDispatcherBufferSize;
}
public void setMetricDispatcherBufferSize(int metricDispatcherBufferSize) {
this.metricDispatcherBufferSize = metricDispatcherBufferSize;
}
public int getMetricDispatcherMaxBatchSize() {
return metricDispatcherMaxBatchSize;
}
public void setMetricDispatcherMaxBatchSize(int metricDispatcherMaxBatchSize) {
this.metricDispatcherMaxBatchSize = metricDispatcherMaxBatchSize;
}
public int getAvailDispatcherBufferSize() {
return availDispatcherBufferSize;
}
public void setAvailDispatcherBufferSize(int availDispatcherBufferSize) {
this.availDispatcherBufferSize = availDispatcherBufferSize;
}
public int getAvailDispatcherMaxBatchSize() {
return availDispatcherMaxBatchSize;
}
public void setAvailDispatcherMaxBatchSize(int availDispatcherMaxBatchSize) {
this.availDispatcherMaxBatchSize = availDispatcherMaxBatchSize;
}
public MonitorServiceConfiguration.StorageAdapterConfiguration getStorageAdapterConfig() {
return this.storageAdapterConfig;
}
public void setStorageAdapterConfig(MonitorServiceConfiguration.StorageAdapterConfiguration config) {
this.storageAdapterConfig = config;
}
public MonitorServiceConfiguration.DiagnosticsConfiguration getDiagnosticsConfig() {
return diagnosticsConfig;
}
public void setDiagnosticsConfig(MonitorServiceConfiguration.DiagnosticsConfiguration config) {
this.diagnosticsConfig = config;
}
}
| apache-2.0 |
wanlihuan/phone-touch | business-service/business-common-widget/src/main/java/com/android/phone/assistant/util/ThemeManager.java | 3634 | package com.android.phone.assistant.util;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.android.file.util.FileSystem;
import com.android.phone.assistant.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
public class ThemeManager {
Context mContext;
/**主题主目录名*/
public static final String THEME_PATH_MAINDIR = "themes";
/**存储默认的面板主题preference 键*/
public static String PPP_CURRENT_THEME_PATH = "PPP_current_path";
/**存储默认的touch主题preference 键*/
public static String TTT_CURRENT_THEME_PATH = "TTT_current_path";
public static final String MYTHEME_TOUCH_CONFIG_FILE_NAME = "touch";
public static final String MYTHEME_PANEL_CONFIG_FILE_NAME = "panel";
public static String currentThemeIconId = "default";
public static String currentThemeTypeFileName = MYTHEME_TOUCH_CONFIG_FILE_NAME;
//public static Map<String, TouchThemeItemInfo> mAdapterInfoList = new LinkedHashMap<String, TouchThemeItemInfo>();
public static List<ThemeInfo> mThemeInfoList = new ArrayList<ThemeInfo>();
public static List<ThemeInfo> mMyThemeInfoList = new ArrayList<ThemeInfo>();
public static String themePrice = "20";
/**
*
* @param cachePath
* app的缓存路径名,如:"/data/data/"+PackName+"/cache/
*/
public ThemeManager(Context context){
mContext = context;
}
/**
*
* @param cacheDir
* @param cacheChildDirName ..../cache/cacheChildDirName 如:touch 图片为ticon
* @param cacheFileName ..../cache/cacheChildDirName/cacheFileName缓存文件名
* @return
*/
public Bitmap decodeCacheIcon(File cacheDir, String cacheChildDirName, String cacheFileName){
//将assets目录ticon目录下的文件缓存起来
Bitmap bm1 = FileSystem.parsePngFile(cacheDir+"/"+cacheChildDirName+"/"+cacheFileName);
if(null != bm1){
return bm1;
}
bm1 = FileSystem.parsePngFile(
FileSystem.copyFileFromAssetsAndDecodeBinZip(mContext, cacheChildDirName +"/"+ cacheFileName,
cacheDir+"/"+cacheChildDirName)+"/"+cacheFileName);
if(null != bm1){
return bm1;
}else{
decodeCacheIcon(cacheDir, cacheChildDirName, cacheFileName);
}
return null;
}
public static void addThemeToCache(Context context){
//可能service已经先启动了,
/*Bitmap bitmap = ThemeCache.currentThemeCache.get("TTT_");
if(bitmap != null && bitmap.isRecycled() == false){
bitmap.recycle();
bitmap = null;
}
bitmap = ThemeCache.currentThemeCache.get("PPP_");
if(bitmap != null && bitmap.isRecycled() == false){
bitmap.recycle();
bitmap = null;
}*/
SharedPreferences preferences = context.getSharedPreferences("ThemeConfig", Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
String defaultPPPThemeDir = context.getResources().getString(R.string.PPP_default_theme_path);
String defaultTTTThemeDir = context.getResources().getString(R.string.TTT_default_theme_path);
if(ThemeCache.currentThemeCache.get("PPP_") == null)
ThemeCache.currentThemeCache.put("PPP_",
FileSystem.parsePngFile(
FileSystem.getCacheRootDir(context,
ThemeManager.THEME_PATH_MAINDIR).getAbsolutePath()+
preferences.getString(ThemeManager.PPP_CURRENT_THEME_PATH, defaultPPPThemeDir)));
if(ThemeCache.currentThemeCache.get("TTT_") == null)
ThemeCache.currentThemeCache.put("TTT_",
FileSystem.parsePngFile(
FileSystem.getCacheRootDir(context,
ThemeManager.THEME_PATH_MAINDIR).getAbsolutePath()+
preferences.getString(ThemeManager.TTT_CURRENT_THEME_PATH, defaultTTTThemeDir)));
}
}
| apache-2.0 |
ResearchStack/ResearchStack | skin/src/main/java/org/researchstack/skin/ui/SignUpTaskActivity.java | 4990 | package org.researchstack.skin.ui;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import org.researchstack.backbone.StorageAccess;
import org.researchstack.backbone.result.StepResult;
import org.researchstack.backbone.result.TaskResult;
import org.researchstack.backbone.step.Step;
import org.researchstack.backbone.task.Task;
import org.researchstack.backbone.ui.ViewTaskActivity;
import org.researchstack.backbone.ui.callbacks.ActivityCallback;
import org.researchstack.backbone.ui.step.layout.StepLayout;
import org.researchstack.backbone.ui.step.layout.StepPermissionRequest;
import org.researchstack.backbone.utils.TextUtils;
import org.researchstack.skin.DataProvider;
import org.researchstack.skin.PermissionRequestManager;
import org.researchstack.skin.R;
import org.researchstack.skin.TaskProvider;
import org.researchstack.skin.task.OnboardingTask;
import org.researchstack.skin.ui.layout.SignUpEligibleStepLayout;
public class SignUpTaskActivity extends ViewTaskActivity implements ActivityCallback {
TaskResult consentResult;
public static Intent newIntent(Context context, Task task) {
Intent intent = new Intent(context, SignUpTaskActivity.class);
intent.putExtra(EXTRA_TASK, task);
return intent;
}
@Override
public void onDataAuth() {
if (StorageAccess.getInstance().hasPinCode(this)) {
super.onDataAuth();
} else // allow signup/in if no pincode
{
onDataReady();
}
}
@Override
public void onSaveStep(int action, Step step, StepResult result) {
// Save result to task
onSaveStepResult(step.getIdentifier(), result);
// Save Pin to disk, then save our consent info
if (action == ACTION_NEXT &&
step.getIdentifier().equals(OnboardingTask.SignUpPassCodeCreationStepIdentifier)) {
String pin = (String) result.getResult();
if (!TextUtils.isEmpty(pin)) {
StorageAccess.getInstance().createPinCode(this, pin);
}
if (consentResult != null) {
saveConsentResultInfo();
}
}
// Show next step
onExecuteStepAction(action);
}
@Override
public void startConsentTask() {
Intent intent = ConsentTaskActivity.newIntent(this,
TaskProvider.getInstance().get(TaskProvider.TASK_ID_CONSENT));
startActivityForResult(intent, SignUpEligibleStepLayout.CONSENT_REQUEST);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SignUpEligibleStepLayout.CONSENT_REQUEST) {
// User has passed through the entire consent flow
if (resultCode == Activity.RESULT_OK) {
consentResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
// If they've already created a pincode, save consent, otherwise go to pin creation
if (StorageAccess.getInstance().hasPinCode(this)) {
saveConsentResultInfo();
}
if (getCurrentStep().getIdentifier()
.equals(OnboardingTask.SignUpEligibleStepIdentifier)) {
showNextStep();
}
}
// User has exited
else {
finish();
}
} else if (PermissionRequestManager.getInstance()
.onNonSystemPermissionResult(this, requestCode, resultCode, data)) {
updateStepLayoutForPermission();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
private void saveConsentResultInfo() {
DataProvider.getInstance().saveConsent(this, consentResult);
}
@TargetApi(Build.VERSION_CODES.M)
@Override
public void onRequestPermission(String id) {
if (PermissionRequestManager.getInstance().isNonSystemPermission(id)) {
PermissionRequestManager.getInstance().onRequestNonSystemPermission(this, id);
} else {
requestPermissions(new String[]{id}, PermissionRequestManager.PERMISSION_REQUEST_CODE);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PermissionRequestManager.PERMISSION_REQUEST_CODE) {
updateStepLayoutForPermission();
}
}
private void updateStepLayoutForPermission() {
StepLayout stepLayout = (StepLayout) findViewById(R.id.rsb_current_step);
if (stepLayout instanceof StepPermissionRequest) {
((StepPermissionRequest) stepLayout)
.onUpdateForPermissionResult();
}
}
}
| apache-2.0 |
ConsecroMUD/ConsecroMUD | com/suscipio_solutions/consecro_mud/Locales/ShallowWater.java | 2901 | package com.suscipio_solutions.consecro_mud.Locales;
import java.util.List;
import com.suscipio_solutions.consecro_mud.Common.interfaces.CMMsg;
import com.suscipio_solutions.consecro_mud.Common.interfaces.PlayerStats;
import com.suscipio_solutions.consecro_mud.Items.interfaces.RawMaterial;
import com.suscipio_solutions.consecro_mud.Locales.interfaces.Room;
import com.suscipio_solutions.consecro_mud.MOBS.interfaces.MOB;
import com.suscipio_solutions.consecro_mud.core.CMLib;
import com.suscipio_solutions.consecro_mud.core.interfaces.Drink;
import com.suscipio_solutions.consecro_mud.core.interfaces.Environmental;
import com.suscipio_solutions.consecro_mud.core.interfaces.Places;
public class ShallowWater extends StdRoom implements Drink
{
@Override public String ID(){return "ShallowWater";}
public ShallowWater()
{
super();
name="the water";
basePhyStats.setWeight(2);
recoverPhyStats();
climask=Places.CLIMASK_WET;
}
@Override public int domainType(){return Room.DOMAIN_OUTDOORS_WATERSURFACE;}
@Override protected int baseThirst(){return 0;}
@Override public long decayTime(){return 0;}
@Override public void setDecayTime(long time){}
@Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(msg.amITarget(this)&&(msg.targetMinor()==CMMsg.TYP_DRINK))
{
if(liquidType()==RawMaterial.RESOURCE_SALTWATER)
{
msg.source().tell(L("You don't want to be drinking saltwater."));
return false;
}
return true;
}
return super.okMessage(myHost,msg);
}
@Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
CMLib.commands().handleHygienicMessage(msg, 100, PlayerStats.HYGIENE_WATERCLEAN);
if(msg.amITarget(this)&&(msg.targetMinor()==CMMsg.TYP_DRINK))
{
final MOB mob=msg.source();
final boolean thirsty=mob.curState().getThirst()<=0;
final boolean full=!mob.curState().adjThirst(thirstQuenched(),mob.maxState().maxThirst(mob.baseWeight()));
if(thirsty)
mob.tell(L("You are no longer thirsty."));
else
if(full)
mob.tell(L("You have drunk all you can."));
}
}
@Override public int thirstQuenched(){return 500;}
@Override public int liquidHeld(){return Integer.MAX_VALUE-1000;}
@Override public int liquidRemaining(){return Integer.MAX_VALUE-1000;}
@Override public int liquidType(){return RawMaterial.RESOURCE_FRESHWATER;}
@Override public void setLiquidType(int newLiquidType){}
@Override public void setThirstQuenched(int amount){}
@Override public void setLiquidHeld(int amount){}
@Override public void setLiquidRemaining(int amount){}
@Override public boolean disappearsAfterDrinking(){return false;}
@Override public boolean containsDrink(){return true;}
@Override public int amountTakenToFillMe(Drink theSource){return 0;}
@Override public List<Integer> resourceChoices(){return UnderWater.roomResources;}
}
| apache-2.0 |
hpehl/hal.next | core/src/main/java/org/jboss/hal/core/runtime/server/ServerActions.java | 41887 | /*
* Copyright 2015-2016 Red Hat, Inc, and individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.hal.core.runtime.server;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Predicate;
import javax.inject.Inject;
import javax.inject.Provider;
import com.google.common.base.Strings;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
import elemental2.dom.HTMLElement;
import org.jboss.gwt.elemento.core.Elements;
import org.jboss.hal.ballroom.Alert;
import org.jboss.hal.ballroom.dialog.BlockingDialog;
import org.jboss.hal.ballroom.dialog.Dialog;
import org.jboss.hal.ballroom.dialog.DialogFactory;
import org.jboss.hal.ballroom.form.Form;
import org.jboss.hal.ballroom.form.SingleSelectBoxItem;
import org.jboss.hal.ballroom.form.TextBoxItem;
import org.jboss.hal.core.Core;
import org.jboss.hal.core.mbui.dialog.AddResourceDialog;
import org.jboss.hal.core.mbui.dialog.NameItem;
import org.jboss.hal.core.mbui.form.ModelNodeForm;
import org.jboss.hal.core.mbui.form.OperationFormBuilder;
import org.jboss.hal.core.runtime.Action;
import org.jboss.hal.core.runtime.Result;
import org.jboss.hal.core.runtime.RunningState;
import org.jboss.hal.core.runtime.SuspendState;
import org.jboss.hal.core.runtime.Timeouts;
import org.jboss.hal.core.runtime.server.ServerUrlTasks.ReadSocketBinding;
import org.jboss.hal.core.runtime.server.ServerUrlTasks.ReadSocketBindingGroup;
import org.jboss.hal.dmr.Composite;
import org.jboss.hal.dmr.CompositeResult;
import org.jboss.hal.dmr.ModelNode;
import org.jboss.hal.dmr.Operation;
import org.jboss.hal.dmr.Property;
import org.jboss.hal.dmr.ResourceAddress;
import org.jboss.hal.dmr.dispatch.Dispatcher;
import org.jboss.hal.dmr.dispatch.Dispatcher.OnError;
import org.jboss.hal.dmr.dispatch.Dispatcher.OnFail;
import org.jboss.hal.flow.FlowContext;
import org.jboss.hal.flow.Outcome;
import org.jboss.hal.flow.Progress;
import org.jboss.hal.meta.AddressTemplate;
import org.jboss.hal.meta.ManagementModel;
import org.jboss.hal.meta.Metadata;
import org.jboss.hal.meta.StatementContext;
import org.jboss.hal.meta.processing.MetadataProcessor;
import org.jboss.hal.meta.processing.SuccessfulMetadataCallback;
import org.jboss.hal.resources.Icons;
import org.jboss.hal.resources.Ids;
import org.jboss.hal.resources.Names;
import org.jboss.hal.resources.Resources;
import org.jboss.hal.spi.Callback;
import org.jboss.hal.spi.Footer;
import org.jboss.hal.spi.Message;
import org.jboss.hal.spi.MessageEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.CompletableSubscriber;
import rx.Subscription;
import static elemental2.dom.DomGlobal.setTimeout;
import static org.jboss.gwt.elemento.core.Elements.a;
import static org.jboss.gwt.elemento.core.Elements.p;
import static org.jboss.gwt.elemento.core.Elements.span;
import static org.jboss.hal.core.runtime.RunningState.RUNNING;
import static org.jboss.hal.core.runtime.SuspendState.SUSPENDED;
import static org.jboss.hal.core.runtime.server.ServerConfigStatus.DISABLED;
import static org.jboss.hal.core.runtime.server.ServerConfigStatus.STARTED;
import static org.jboss.hal.core.runtime.server.ServerConfigStatus.STOPPED;
import static org.jboss.hal.core.runtime.server.ServerUrlTasks.URL_KEY;
import static org.jboss.hal.dmr.ModelDescriptionConstants.*;
import static org.jboss.hal.dmr.ModelNodeHelper.asEnumValue;
import static org.jboss.hal.dmr.ModelNodeHelper.getOrDefault;
import static org.jboss.hal.dmr.dispatch.TimeoutHandler.repeatOperationUntil;
import static org.jboss.hal.dmr.dispatch.TimeoutHandler.repeatUntilTimeout;
import static org.jboss.hal.flow.Flow.series;
import static org.jboss.hal.resources.CSS.fontAwesome;
import static org.jboss.hal.resources.CSS.marginLeft5;
import static org.jboss.hal.resources.CSS.pfIcon;
import static org.jboss.hal.resources.Ids.FORM;
import static org.jboss.hal.resources.UIConstants.SHORT_TIMEOUT;
public class ServerActions implements Timeouts {
private static final Logger logger = LoggerFactory.getLogger(ServerActions.class);
private static AddressTemplate serverConfigTemplate(Server server) {
return server.isStandalone()
? AddressTemplate.ROOT
: AddressTemplate.of("/host=" + server.getHost() + "/server-config=*" + server.getName());
}
private final EventBus eventBus;
private final Dispatcher dispatcher;
private final MetadataProcessor metadataProcessor;
private final Provider<Progress> progress;
private final Resources resources;
private final Map<String, Server> pendingServers;
private final ServerUrlStorage serverUrlStorage;
private final StatementContext statementContext;
@Inject
public ServerActions(EventBus eventBus,
Dispatcher dispatcher,
ServerUrlStorage serverUrlStorage,
StatementContext statementContext,
MetadataProcessor metadataProcessor,
@Footer Provider<Progress> progress,
Resources resources) {
this.eventBus = eventBus;
this.dispatcher = dispatcher;
this.serverUrlStorage = serverUrlStorage;
this.statementContext = statementContext;
this.metadataProcessor = metadataProcessor;
this.progress = progress;
this.resources = resources;
this.pendingServers = new HashMap<>();
}
// ------------------------------------------------------ server operations
public void copyServer(Server server, Callback callback) {
Operation operation = new Operation.Builder(ResourceAddress.root(), READ_CHILDREN_NAMES_OPERATION)
.param(CHILD_TYPE, HOST)
.build();
dispatcher.execute(operation, result -> {
List<String> hosts = new ArrayList<>();
result.asList().forEach(m -> hosts.add(m.asString()));
// get the first host only to retrieve the r-r-d for server-config
// as /host=*/server-config=*:read-operation-description(name=add) does not work
AddressTemplate template = AddressTemplate.of("/host=" + hosts.get(0) + "/server-config=*");
metadataProcessor.lookup(template, progress.get(), new SuccessfulMetadataCallback(eventBus, resources) {
@Override
public void onMetadata(Metadata metadata) {
String id = Ids.build(SERVER_GROUP, statementContext.selectedServerGroup(), SERVER,
FORM);
SingleSelectBoxItem hostFormItem = new SingleSelectBoxItem(HOST, Names.HOST, hosts,
false);
hostFormItem.setRequired(true);
NameItem nameItem = new NameItem();
ModelNodeForm<ModelNode> form = new ModelNodeForm.Builder<>(id, metadata)
.fromRequestProperties()
.unboundFormItem(nameItem, 0)
.unboundFormItem(hostFormItem, 1, resources.messages().addServerHostHelp())
.exclude(AUTO_START, SOCKET_BINDING_DEFAULT_INTERFACE,
SOCKET_BINDING_GROUP, UPDATE_AUTO_START_WITH_SERVER_STATUS)
.build();
AddResourceDialog dialog = new AddResourceDialog(resources.messages().copyServerTitle(),
form, (resource, payload) -> {
// read server-config recursively to retrieve nested resources
ModelNode serverConfigModel = new ModelNode();
serverConfigModel.get(HOST).set(server.getHost());
serverConfigModel.get(SERVER_CONFIG).set(server.getName());
ResourceAddress serverAddress = new ResourceAddress(serverConfigModel);
Operation opReadServer = new Operation.Builder(serverAddress, READ_RESOURCE_OPERATION)
.param(RECURSIVE, true)
.build();
dispatcher.execute(opReadServer, new Consumer<ModelNode>() {
@Override
public void accept(ModelNode newServerModel) {
String newServerName = nameItem.getValue();
// set the chosen group in the model
newServerModel.get(GROUP).set(payload.get(GROUP).asString());
if (payload.hasDefined(SOCKET_BINDING_PORT_OFFSET)) {
newServerModel.get(SOCKET_BINDING_PORT_OFFSET)
.set(payload.get(SOCKET_BINDING_PORT_OFFSET).asLong());
}
newServerModel.get(NAME).set(newServerName);
ModelNode newServerModelAddress = new ModelNode();
newServerModelAddress.get(HOST).set(hostFormItem.getValue());
newServerModelAddress.get(SERVER_CONFIG).set(newServerName);
Operation opAddServer = new Operation.Builder(
new ResourceAddress(newServerModelAddress), ADD)
.payload(newServerModel)
.build();
Composite comp = new Composite();
comp.add(opAddServer);
// create operation for each nested resource of the source server
createOperation(comp, JVM, newServerModel, newServerModelAddress);
createOperation(comp, INTERFACE, newServerModel, newServerModelAddress);
createOperation(comp, PATH, newServerModel, newServerModelAddress);
createOperation(comp, SYSTEM_PROPERTY, newServerModel, newServerModelAddress);
createOperation(comp, SSL, newServerModel, newServerModelAddress);
dispatcher.execute(comp, (CompositeResult result) -> {
MessageEvent.fire(eventBus, Message.success(
resources.messages()
.addResourceSuccess(Names.SERVER, newServerName)));
callback.execute();
}, (operation1, failure) -> {
MessageEvent.fire(eventBus, Message.error(
resources.messages().addResourceError(newServerName, failure)));
callback.execute();
}, (operation1, exception) -> {
MessageEvent.fire(eventBus, Message.error(resources.messages()
.addResourceError(newServerName, exception.getMessage())));
callback.execute();
});
}
private void createOperation(Composite composite, String resource, ModelNode model,
ModelNode baseAddress) {
if (model.hasDefined(resource)) {
List<Property> props = model.get(resource).asPropertyList();
props.forEach(p -> {
String propname = p.getName();
ModelNode _address = baseAddress.clone();
_address.get(resource).set(propname);
Operation operation = new Operation.Builder(
new ResourceAddress(_address), ADD)
.payload(p.getValue())
.build();
composite.add(operation);
});
}
}
});
});
dialog.show();
}
});
});
}
// ------------------------------------------------------ lifecycle operations
public void reload(Server server) {
Operation operation = new Operation.Builder(server.getServerConfigAddress(), RELOAD)
.param(BLOCKING, false)
.build();
reloadRestart(server, operation, Action.RELOAD, SERVER_RELOAD_TIMEOUT,
resources.messages().reload(server.getName()),
resources.messages().reloadServerQuestion(server.getName()),
resources.messages().reloadServerSuccess(server.getName()),
resources.messages().reloadServerError(server.getName()));
}
public void restart(Server server) {
if (server.isStandalone()) {
restartStandalone(server);
} else {
Operation operation = new Operation.Builder(server.getServerConfigAddress(), RESTART)
.param(BLOCKING, false)
.build();
reloadRestart(server, operation, Action.RESTART, SERVER_RESTART_TIMEOUT,
resources.messages().restart(server.getName()),
resources.messages().restartServerQuestion(server.getName()),
resources.messages().restartServerSuccess(server.getName()),
resources.messages().restartServerError(server.getName()));
}
}
private void restartStandalone(Server server) {
restartStandalone(server, resources.messages().restartStandaloneQuestion(server.getName()));
}
public void restartStandalone(Server server, SafeHtml question) {
String title = resources.messages().restart(server.getName());
DialogFactory.showConfirmation(title, question, () -> {
// execute the restart with a little delay to ensure the confirmation dialog is closed
// before the next dialog is opened (only one modal can be open at a time!)
setTimeout((o) -> {
prepare(server, Action.RESTART);
BlockingDialog pendingDialog = DialogFactory
.buildLongRunning(title,
resources.messages().restartStandalonePending(server.getName()));
pendingDialog.show();
Operation operation = new Operation.Builder(ResourceAddress.root(), SHUTDOWN)
.param(RESTART, true)
.build();
Operation ping = new Operation.Builder(ResourceAddress.root(), READ_RESOURCE_OPERATION).build();
dispatcher.execute(operation, result -> repeatUntilTimeout(dispatcher, SERVER_RESTART_TIMEOUT, ping)
.subscribe(new CompletableSubscriber() {
@Override
public void onSubscribe(Subscription d) {
}
@Override
public void onCompleted() {
// wait a little bit before event handlers try to use the restarted server
setTimeout((o1) -> {
pendingDialog.close();
finish(Server.STANDALONE, Result.SUCCESS, Message.success(
resources.messages()
.restartServerSuccess(server.getName())));
}, 666);
}
@Override
public void onError(Throwable e) {
pendingDialog.close();
DialogFactory.buildBlocking(title,
resources.messages().restartStandaloneTimeout(server.getName()))
.show();
finish(Server.STANDALONE, Result.TIMEOUT, null);
}
}),
(o1, failure) -> finish(Server.STANDALONE, Result.ERROR,
Message.error(resources.messages().restartServerError(server.getName()))),
(o2, exception) -> finish(Server.STANDALONE, Result.ERROR,
Message.error(resources.messages().restartServerError(server.getName()))));
}, SHORT_TIMEOUT);
});
}
private void reloadRestart(Server server, Operation operation, Action action, int timeout,
String title, SafeHtml question, SafeHtml successMessage, SafeHtml errorMessage) {
DialogFactory.showConfirmation(title, question, () -> {
prepare(server, action);
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, timeout,
server.isStandalone() ? readServerState(server) : readServerConfigStatus(server),
server.isStandalone() ? checkServerState(RUNNING) : checkServerConfigStatus(STARTED))
.subscribe(new ServerTimeoutCallback(server, action, successMessage)),
new ServerFailedCallback(server, errorMessage),
new ServerExceptionCallback(server, errorMessage));
});
}
public void suspend(Server server) {
if (!ManagementModel.supportsSuspend(server.getManagementVersion())) {
logger.error("Server {} using version {} does not support suspend operation", server.getName(),
server.getManagementVersion());
return;
}
metadataProcessor.lookup(serverConfigTemplate(server), progress.get(),
new MetadataProcessor.MetadataCallback() {
@Override
public void onMetadata(Metadata metadata) {
String id = Ids.build(SUSPEND, server.getName(), Ids.FORM);
Form<ModelNode> form = new OperationFormBuilder<>(id, metadata, SUSPEND).build();
Dialog dialog = DialogFactory.buildConfirmation(
resources.messages().suspend(server.getName()),
resources.messages().suspendServerQuestion(server.getName()),
form.element(),
Dialog.Size.MEDIUM,
() -> {
form.save();
int timeout = getOrDefault(form.getModel(), TIMEOUT,
() -> form.getModel().get(TIMEOUT).asInt(), 0);
int uiTimeout = timeout + SERVER_SUSPEND_TIMEOUT;
prepare(server, Action.SUSPEND);
Operation operation = new Operation.Builder(server.getServerConfigAddress(),
SUSPEND)
.param(TIMEOUT, timeout)
.build();
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, uiTimeout,
readSuspendState(server), checkSuspendState(SUSPENDED))
.subscribe(new ServerTimeoutCallback(server, Action.SUSPEND,
resources.messages()
.suspendServerSuccess(server.getName()))),
new ServerFailedCallback(server,
resources.messages().suspendServerError(server.getName())),
new ServerExceptionCallback(server,
resources.messages().suspendServerError(server.getName())));
});
dialog.registerAttachable(form);
dialog.show();
ModelNode model = new ModelNode();
model.get(TIMEOUT).set(0);
form.edit(model);
}
@Override
public void onError(Throwable error) {
MessageEvent.fire(eventBus,
Message.error(resources.messages().metadataError(), error.getMessage()));
}
});
}
public void resume(Server server) {
if (!ManagementModel.supportsSuspend(server.getManagementVersion())) {
logger.error("Server {} using version {} does not support resume operation", server.getName(),
server.getManagementVersion());
return;
}
prepare(server, Action.RESUME);
ResourceAddress address = server.isStandalone() ? server.getServerAddress() : server.getServerConfigAddress();
Operation operation = new Operation.Builder(address, RESUME).build();
dispatcher.execute(operation, result -> repeatOperationUntil(dispatcher, SERVER_START_TIMEOUT,
server.isStandalone() ? readServerState(server) : readServerConfigStatus(server),
server.isStandalone() ? checkServerState(RUNNING) : checkServerConfigStatus(STARTED))
.subscribe(new ServerTimeoutCallback(server, Action.RESUME,
resources.messages().resumeServerSuccess(server.getName()))),
new ServerFailedCallback(server, resources.messages().resumeServerError(server.getName())),
new ServerExceptionCallback(server, resources.messages().resumeServerError(server.getName())));
}
public void stop(Server server) {
metadataProcessor.lookup(serverConfigTemplate(server), progress.get(),
new MetadataProcessor.MetadataCallback() {
@Override
public void onMetadata(Metadata metadata) {
String id = Ids.build(STOP, server.getName(), Ids.FORM);
Form<ModelNode> form = new OperationFormBuilder<>(id, metadata, STOP)
.include(TIMEOUT).build();
Dialog dialog = DialogFactory.buildConfirmation(
resources.messages().stop(server.getName()),
resources.messages().stopServerQuestion(server.getName()),
form.element(),
Dialog.Size.MEDIUM,
() -> {
form.save();
int timeout = getOrDefault(form.getModel(), TIMEOUT,
() -> form.getModel().get(TIMEOUT).asInt(), 0);
int uiTimeout = timeout + SERVER_STOP_TIMEOUT;
prepare(server, Action.STOP);
Operation operation = new Operation.Builder(server.getServerConfigAddress(), STOP)
.param(TIMEOUT, timeout)
.param(BLOCKING, false)
.build();
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, uiTimeout,
readServerConfigStatus(server),
checkServerConfigStatus(STOPPED, DISABLED))
.subscribe(new ServerTimeoutCallback(server, Action.STOP,
resources.messages().stopServerSuccess(server.getName()))),
new ServerFailedCallback(server,
resources.messages().stopServerError(server.getName())),
new ServerExceptionCallback(server,
resources.messages().stopServerError(server.getName())));
});
dialog.registerAttachable(form);
dialog.show();
ModelNode model = new ModelNode();
model.get(TIMEOUT).set(0);
form.edit(model);
}
@Override
public void onError(Throwable error) {
MessageEvent
.fire(eventBus,
Message.error(resources.messages().metadataError(), error.getMessage()));
}
});
}
/**
* Call <code>/host={host}/server-config={sever}:stop(blocking=false)</code> the intended action is to immediately
* stop the server.
*
* @param server
*/
public void stopNow(Server server) {
prepare(server, Action.STOP);
Operation operation = new Operation.Builder(server.getServerConfigAddress(), STOP)
.param(BLOCKING, false)
.build();
dispatcher.execute(operation, result -> repeatOperationUntil(dispatcher, SERVER_STOP_TIMEOUT,
readServerConfigStatus(server), checkServerConfigStatus(STOPPED, DISABLED))
.subscribe(new ServerTimeoutCallback(server, Action.STOP,
resources.messages().stopServerSuccess(server.getName()))),
new ServerFailedCallback(server, resources.messages().stopServerError(server.getName())),
new ServerExceptionCallback(server, resources.messages().stopServerError(server.getName())));
}
public void destroy(Server server) {
DialogFactory.showConfirmation(resources.messages().destroy(server.getName()),
resources.messages().destroyServerQuestion(server.getName()),
() -> {
prepare(server, Action.DESTROY);
Operation operation = new Operation.Builder(server.getServerConfigAddress(), DESTROY).build();
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, SERVER_DESTROY_TIMEOUT,
readServerConfigStatus(server), checkServerConfigStatus(STOPPED, DISABLED))
.subscribe(new ServerTimeoutCallback(server, Action.DESTROY,
resources.messages().destroyServerSuccess(server.getName()))),
new ServerFailedCallback(server,
resources.messages().destroyServerError(server.getName())),
new ServerExceptionCallback(server,
resources.messages().destroyServerError(server.getName())));
});
}
public void kill(Server server) {
DialogFactory.showConfirmation(resources.messages().kill(server.getName()),
resources.messages().killServerQuestion(server.getName()),
() -> {
prepare(server, Action.KILL);
Operation operation = new Operation.Builder(server.getServerConfigAddress(), KILL).build();
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, SERVER_KILL_TIMEOUT,
readServerConfigStatus(server), checkServerConfigStatus(STOPPED, DISABLED))
.subscribe(new ServerTimeoutCallback(server, Action.KILL,
resources.messages().killServerSuccess(server.getName()))),
new ServerFailedCallback(server,
resources.messages().killServerError(server.getName())),
new ServerExceptionCallback(server,
resources.messages().killServerError(server.getName())));
});
}
public void start(Server server) {
prepare(server, Action.START);
Operation operation = new Operation.Builder(server.getServerConfigAddress(), START)
.param(BLOCKING, false)
.build();
dispatcher.execute(operation,
result -> repeatOperationUntil(dispatcher, SERVER_START_TIMEOUT,
readServerConfigStatus(server), checkServerConfigStatus(STARTED))
.subscribe(new ServerTimeoutCallback(server, Action.START,
resources.messages().startServerSuccess(server.getName()))),
new ServerFailedCallback(server, resources.messages().startServerError(server.getName())),
new ServerExceptionCallback(server, resources.messages().startServerError(server.getName())));
}
// ------------------------------------------------------ server url methods
/** Reads the URL and updates the specified HTML element */
public void readUrl(Server server, HTMLElement element) {
readUrl(server, new AsyncCallback<ServerUrl>() {
@Override
public void onFailure(Throwable caught) {
Elements.removeChildrenFrom(element);
element.textContent = Names.NOT_AVAILABLE;
}
@Override
public void onSuccess(ServerUrl url) {
Elements.removeChildrenFrom(element);
element.appendChild(a(url.getUrl())
.apply(a -> a.target = server.getId())
.textContent(url.getUrl()).element());
String icon;
String tooltip;
if (url.isCustom()) {
icon = fontAwesome("external-link");
tooltip = resources.constants().serverUrlCustom();
} else {
icon = pfIcon("server");
tooltip = resources.constants().serverUrlManagementModel();
}
element.appendChild(span().css(icon, marginLeft5).style("cursor:help").title(tooltip).element()); //NON-NLS
}
});
}
/** Reads the URL using the provided parameters */
public void readUrl(boolean standalone, String host, String serverGroup, String server,
AsyncCallback<ServerUrl> callback) {
if (serverUrlStorage.hasUrl(host, server)) {
ServerUrl serverUrl = new ServerUrl(serverUrlStorage.load(host, server), true);
callback.onSuccess(serverUrl);
} else {
series(new FlowContext(),
new ReadSocketBindingGroup(standalone, serverGroup, dispatcher),
new ReadSocketBinding(standalone, host, server, dispatcher))
.subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
logger.error(error.getMessage());
callback.onFailure(error);
}
@Override
public void onSuccess(FlowContext context) {
callback.onSuccess(context.get(URL_KEY));
}
});
}
}
/** Reads the URL using the information from the specified server instance */
private void readUrl(Server server, AsyncCallback<ServerUrl> callback) {
readUrl(server.isStandalone(), server.getHost(), server.getServerGroup(), server.getName(), callback);
}
public void editUrl(Server server, Callback callback) {
Alert alert = new Alert(Icons.ERROR, resources.messages().serverUrlError());
HTMLElement info = p().element();
TextBoxItem urlItem = new TextBoxItem(URL, Names.URL);
Form<ModelNode> form = new ModelNodeForm.Builder<>(Ids.SERVER_URL_FORM, Metadata.empty())
.unboundFormItem(urlItem)
.addOnly()
.onSave((f, changedValues) -> {
String url = urlItem.getValue();
if (Strings.isNullOrEmpty(url)) {
serverUrlStorage.remove(server.getHost(), server.getName());
} else {
serverUrlStorage.save(server.getHost(), server.getName(), url);
}
callback.execute();
})
.build();
Dialog dialog = new Dialog.Builder(resources.constants().editURL())
.add(alert.element())
.add(info)
.add(form.element())
.primary(form::save)
.cancel()
.closeIcon(true)
.closeOnEsc(true)
.build();
dialog.registerAttachable(form);
Elements.setVisible(alert.element(), false);
Elements.setVisible(info, false);
readUrl(server, new AsyncCallback<ServerUrl>() {
@Override
public void onFailure(Throwable caught) {
Elements.setVisible(alert.element(), true);
show(null);
}
@Override
public void onSuccess(ServerUrl serverUrl) {
if (serverUrl.isCustom()) {
info.innerHTML = resources.messages().serverUrlCustom().asString();
} else {
info.innerHTML = resources.messages().serverUrlManagementModel().asString();
}
Elements.setVisible(info, true);
show(serverUrl);
}
private void show(ServerUrl serverUrl) {
dialog.show();
form.edit(new ModelNode());
if (serverUrl != null) {
urlItem.setValue(serverUrl.getUrl());
}
}
});
}
// ------------------------------------------------------ helper methods
private void prepare(Server server, Action action) {
markAsPending(server); // mark as pending *before* firing the event!
eventBus.fireEvent(new ServerActionEvent(server, action));
}
private void finish(Server server, Result result, Message message) {
clearPending(server); // clear pending state *before* firing the event!
eventBus.fireEvent(new ServerResultEvent(server, result));
MessageEvent.fire(eventBus, message);
}
public void markAsPending(Server server) {
Core.setPendingLifecycleAction(true);
pendingServers.put(Ids.hostServer(server.getHost(), server.getName()), server);
logger.debug("Mark server {} as pending", server.getName());
}
public void clearPending(Server server) {
Core.setPendingLifecycleAction(false);
pendingServers.remove(Ids.hostServer(server.getHost(), server.getName()));
logger.debug("Clear pending state for server {}", server.getName());
}
public boolean isPending(Server server) {
return pendingServers.containsKey(Ids.hostServer(server.getHost(), server.getName()));
}
private Operation readServerConfigStatus(Server server) {
return new Operation.Builder(server.getServerConfigAddress(), READ_ATTRIBUTE_OPERATION)
.param(NAME, STATUS)
.build();
}
private Operation readServerState(Server server) {
return new Operation.Builder(server.getServerAddress(), READ_ATTRIBUTE_OPERATION)
.param(NAME, SERVER_STATE)
.build();
}
private Predicate<ModelNode> checkServerConfigStatus(ServerConfigStatus first, ServerConfigStatus... rest) {
return result -> {
ServerConfigStatus status = asEnumValue(result, name -> ServerConfigStatus.valueOf(name),
ServerConfigStatus.UNDEFINED);
return EnumSet.of(first, rest).contains(status);
};
}
private Predicate<ModelNode> checkServerState(RunningState first, RunningState... rest) {
return result -> {
RunningState state = asEnumValue(result, (name) -> RunningState.valueOf(name), RunningState.UNDEFINED);
return EnumSet.of(first, rest).contains(state);
};
}
private Operation readSuspendState(Server server) {
return new Operation.Builder(server.getServerAddress(), READ_ATTRIBUTE_OPERATION)
.param(NAME, SUSPEND_STATE)
.build();
}
private Predicate<ModelNode> checkSuspendState(SuspendState statusToReach) {
return result -> statusToReach == asEnumValue(result, name -> SuspendState.valueOf(name),
SuspendState.UNDEFINED);
}
private class ServerTimeoutCallback implements CompletableSubscriber {
private final Server server;
private final Action action;
private final SafeHtml successMessage;
ServerTimeoutCallback(Server server, Action action, SafeHtml successMessage) {
this.server = server;
this.action = action;
this.successMessage = successMessage;
}
@Override
public void onCompleted() {
if (Action.isStart(action)) {
// read boot errors
ResourceAddress address = server.getServerAddress().add(CORE_SERVICE, MANAGEMENT);
Operation operation = new Operation.Builder(address, READ_BOOT_ERRORS).build();
dispatcher.execute(operation, result -> {
if (!result.asList().isEmpty()) {
finish(server, Result.ERROR,
Message.error(resources.messages().serverBootErrors(server.getName())));
} else {
finish(server, Result.SUCCESS, Message.success(successMessage));
}
});
} else if (Action.isStop(action)) {
// update server for event
ResourceAddress address = server.getServerConfigAddress();
Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION)
.param(ATTRIBUTES_ONLY, true)
.param(INCLUDE_RUNTIME, true)
.build();
dispatcher.execute(operation, result -> {
Server stoppedServer = new Server(this.server.getHost(), result);
finish(stoppedServer, Result.SUCCESS, Message.success(successMessage));
});
} else {
finish(server, Result.SUCCESS, Message.success(successMessage));
}
}
@Override
public void onError(Throwable e) {
finish(server, Result.TIMEOUT, Message.error(resources.messages().serverTimeout(server.getName())));
}
@Override
public void onSubscribe(Subscription d) {
}
}
private class ServerFailedCallback implements OnFail {
private final Server server;
private final SafeHtml errorMessage;
ServerFailedCallback(Server server, SafeHtml errorMessage) {
this.server = server;
this.errorMessage = errorMessage;
}
@Override
public void onFailed(Operation operation, String failure) {
finish(server, Result.ERROR, Message.error(errorMessage, failure));
}
}
private class ServerExceptionCallback implements OnError {
private final Server server;
private final SafeHtml errorMessage;
ServerExceptionCallback(Server server, SafeHtml errorMessage) {
this.server = server;
this.errorMessage = errorMessage;
}
@Override
public void onException(Operation operation, Throwable exception) {
finish(server, Result.ERROR, Message.error(errorMessage, exception.getMessage()));
}
}
}
| apache-2.0 |
o19s/elasticsearch-learning-to-rank | src/main/java/com/o19s/es/ltr/ranker/ranklib/RanklibModelParser.java | 1644 | /*
* Copyright [2017] Doug Turnbull, Wikimedia Foundation
*
* 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.o19s.es.ltr.ranker.ranklib;
import ciir.umass.edu.learning.Ranker;
import ciir.umass.edu.learning.RankerFactory;
import com.o19s.es.ltr.feature.FeatureSet;
import com.o19s.es.ltr.ranker.LtrRanker;
import com.o19s.es.ltr.ranker.parser.LtrRankerParser;
/**
* Load a ranklib model from a script file, mostly a wrapper around the
* existing script that complies with the {@link LtrRankerParser} interface
*/
public class RanklibModelParser implements LtrRankerParser {
public static final String TYPE = "model/ranklib";
private final RankerFactory factory;
public RanklibModelParser(RankerFactory factory) {
this.factory = factory;
}
@Override
public LtrRanker parse(FeatureSet set, String model) {
Ranker ranklibRanker = factory.loadRankerFromString(model);
int numFeatures = ranklibRanker.getFeatures().length;
if (set != null) {
numFeatures = set.size();
}
return new RanklibRanker(ranklibRanker, numFeatures);
}
}
| apache-2.0 |
smilesman/s2jh | showcase/src/main/java/lab/s2jh/biz/core/hib/Boolean1T2FUserType.java | 1324 | package lab.s2jh.biz.core.hib;
import java.io.Serializable;
import org.hibernate.dialect.Dialect;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.DiscriminatorType;
import org.hibernate.type.PrimitiveType;
import org.hibernate.type.StringType;
import org.hibernate.type.descriptor.java.BooleanTypeDescriptor;
import org.hibernate.type.descriptor.sql.VarcharTypeDescriptor;
public class Boolean1T2FUserType extends AbstractSingleColumnStandardBasicType<Boolean> implements
PrimitiveType<Boolean>, DiscriminatorType<Boolean> {
public static final Boolean1T2FUserType INSTANCE = new Boolean1T2FUserType();
public Boolean1T2FUserType() {
super(VarcharTypeDescriptor.INSTANCE, new BooleanTypeDescriptor( '1', '2' ));
}
public String getName() {
return "boolean_1t2f_char_number";
}
public Class getPrimitiveClass() {
return boolean.class;
}
public Boolean stringToObject(String xml) throws Exception {
return fromString(xml);
}
public Serializable getDefaultValue() {
return Boolean.FALSE;
}
public String objectToSQLString(Boolean value, Dialect dialect) throws Exception {
return StringType.INSTANCE.objectToSQLString(value.booleanValue() ? "1" : "2", dialect);
}
}
| apache-2.0 |
Uni-Sol/batik | test-sources/org/apache/batik/dom/SetAttributeTest.java | 3303 | /*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.apache.batik.dom;
import org.w3c.dom.*;
import java.io.*;
import java.net.*;
import org.apache.batik.dom.util.*;
import org.apache.batik.util.*;
import org.apache.batik.test.*;
/**
* @author <a href="mailto:shillion@ilog.fr">Stephane Hillion</a>
* @version $Id$
*/
public class SetAttributeTest extends AbstractTest {
protected String testFileName;
protected String rootTag;
protected String targetId;
protected String targetAttribute;
protected String targetValue;
protected String parserClassName = XMLResourceDescriptor.getXMLParserClassName();
public static String ERROR_GET_ELEMENT_BY_ID_FAILED
= "error.get.element.by.id.failed";
public static String ENTRY_KEY_ID
= "entry.key.id";
public SetAttributeTest(String testFileName,
String rootTag,
String targetId,
String targetAttribute,
String targetValue){
this.testFileName = testFileName;
this.rootTag = rootTag;
this.targetId = targetId;
this.targetAttribute = targetAttribute;
this.targetValue = targetValue;
}
public String getParserClassName(){
return parserClassName;
}
public void setParserClassName(String parserClassName){
this.parserClassName = parserClassName;
}
public TestReport runImpl() throws Exception {
DocumentFactory df
= new SAXDocumentFactory(GenericDOMImplementation.getDOMImplementation(),
parserClassName);
File f = (new File(testFileName));
URL url = f.toURL();
Document doc = df.createDocument(null,
rootTag,
url.toString(),
url.openStream());
Element e = doc.getElementById(targetId);
if(e == null){
DefaultTestReport report = new DefaultTestReport(this);
report.setErrorCode(ERROR_GET_ELEMENT_BY_ID_FAILED);
report.addDescriptionEntry(ENTRY_KEY_ID,
targetId);
report.setPassed(false);
return report;
}
e.setAttribute(targetAttribute, targetValue);
if(targetValue.equals(e.getAttribute(targetAttribute))){
return reportSuccess();
}
DefaultTestReport report = new DefaultTestReport(this);
report.setErrorCode(TestReport.ERROR_TEST_FAILED);
report.setPassed(false);
return report;
}
}
| apache-2.0 |
rytina/socialapp-services | com.socialapp.services/src/com/socialapp/services/internal/callback/custom/GetLoggedInZipAndNameCallback.java | 1599 | package com.socialapp.services.internal.callback.custom;
import com.socialapp.services.IResultProcessor;
import com.socialapp.services.internal.callback.AjaxStatus;
import com.socialapp.services.internal.callback.custom.sharedstate.LoginState;
import com.socialapp.services.internal.util.UrlConstants;
import com.socialapp.services.util.SocialappServiceConstants;
import com.socialapp.services.util.Tuple;
public class GetLoggedInZipAndNameCallback extends ProcessableCallback<Tuple<String, String>>{
private static final String ZIP = "name=\"zip\" value=\"";
private static final String FORENAME = "name=\"forename\" value=\"";
public GetLoggedInZipAndNameCallback(IResultProcessor<Tuple<String, String>> proc) {
super(proc);
cookie(SocialappServiceConstants.PHPSESSID, LoginState.phpsessid);
}
@Override
public void callback(String request, String response, AjaxStatus status) {
String zip = null;
int index = response.indexOf(ZIP) + ZIP.length();
zip = response.substring(index, index+5);
int end = zip.indexOf('"');
if(end > 0){
zip = zip.substring(0, end);
}
String name = null;
index = response.indexOf(FORENAME) + FORENAME.length();
name = response.substring(index, index+50);
end = name.indexOf('"');
if(end > 0){
name = name.substring(0, end);
}
finalize(new Tuple<String, String>(zip, name), new Object[]{});
}
@Override
public boolean shouldLog() {
return false;
}
@Override
public String getUrl() {
return UrlConstants.APP_DOMAIN + UrlConstants.PROFILE;
}
@Override
public String getLogTableName() {
return null;
}
}
| apache-2.0 |
sparseware/ccp-bellavista | shared/com/sparseware/bellavista/external/fhir/aFHIRemoteService.java | 19010 | package com.sparseware.bellavista.external.fhir;
import com.appnativa.rare.exception.ApplicationException;
import com.appnativa.rare.scripting.Functions;
import com.appnativa.util.CharArray;
import com.appnativa.util.json.JSONArray;
import com.appnativa.util.json.JSONObject;
import com.appnativa.util.json.JSONTokener;
import com.appnativa.util.json.JSONWriter;
import com.sparseware.bellavista.ActionPath;
import com.sparseware.bellavista.MessageException;
import com.sparseware.bellavista.external.ActionLinkEx;
import com.sparseware.bellavista.external.fhir.FHIRJSONWatcher.aCallback;
import com.sparseware.bellavista.external.fhir.FHIRJSONWatcher.iCallback;
import com.sparseware.bellavista.external.fhir.FHIRServer.FHIRResource;
import com.sparseware.bellavista.external.fhir.FHIRUtils.MedicalCode;
import com.sparseware.bellavista.service.ContentWriter;
import com.sparseware.bellavista.service.HttpHeaders;
import com.sparseware.bellavista.service.NonFatalServiceException;
import com.sparseware.bellavista.service.aRemoteService;
import com.sparseware.bellavista.service.iHttpConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
public abstract class aFHIRemoteService extends aRemoteService {
protected FHIRServer server;
protected String columnNames[];
protected boolean summarySupported;
protected boolean readSupported;
protected boolean prefixSearchSupported;
protected boolean countSupported;
protected String resourceName;
protected ActionLinkEx lastLink;
protected String searchParams;
static HashSet<String> validExtensions = new HashSet<String>();
boolean nonConformant;
protected String pagingPath;
public static String MISSING_INVALID = "{fgColor:badData}MISSING/INVALID FHIR DATA";
public static String MISSING_INVALID_HTML = "{fgColor:badData}MISSING/INVALID FHIR DATA";
public static String BAD_ID = "_BAD_ID_";
public static MedicalCode missingInvalid = new MedicalCode(BAD_ID, null, MISSING_INVALID, null);
static {
validExtensions.add("json");
validExtensions.add("txt");
validExtensions.add("html");
}
public aFHIRemoteService() {
server = FHIRServer.getInstance();
nonConformant = server.getServerConfig().optBoolean("non_compliant");
prefixSearchSupported = server.getServerConfig().optBoolean("supports_prefix_search", true);
}
public aFHIRemoteService(String resourceName) {
server = FHIRServer.getInstance();
JSONObject o = server.getServerConfig().optJSONObject("fhir");
nonConformant = (o == null)
? false
: o.optBoolean("non_conformant");
this.resourceName = resourceName;
FHIRResource r = server.getResource(resourceName);
summarySupported = (r == null)
? false
: r.summarySupported;
readSupported = (r == null)
? false
: r.readSupported;
countSupported = (r == null)
? false
: r.countSupported;
}
protected String getPagingPath() {
if (pagingPath == null) {
String pkg = aFHIRemoteService.class.getPackage().getName();
String s = getClass().getName().substring(pkg.length() + 1);;
s = s.toLowerCase(Locale.US).replace('.', '/') + "/paging";
pagingPath = "/hub/main/" + s;
}
return pagingPath;
}
protected String createPagingUrl(String href, boolean json) {
@SuppressWarnings("resource") CharArray ca = new CharArray(getPagingPath());
ca.append('/').append(encodeLink(href));
if (json) {
ca.append(".json");
}
return ca.toString();
}
public Map<String, JSONObject> createReferenceMap(JSONArray a) {
int len = (a == null)
? 0
: a.length();
LinkedHashMap<String, JSONObject> map = new LinkedHashMap<String, JSONObject>(len);
for (int i = 0; i < len; i++) {
JSONObject o = a.getJSONObject(i);
String id = o.optString("id", null);
if (id != null) {
map.put(id, o);
}
}
return map;
}
public void sendTextAsHTML(iHttpConnection conn, HttpHeaders headers, String title, String data) throws IOException {
headers.setDefaultResponseHeaders();
headers.mimeHtml();
ContentWriter w = conn.getContentWriter();
FHIRUtils.writeHTMLDocumentStart(w, title);
w.write("<pre>\n");
w.write(data);
w.write("</pre>\n");
FHIRUtils.writeHTMLDocumentFinish(w);
}
public void sendImageAsHTML(iHttpConnection conn, HttpHeaders headers, String title, String type, String b64Data)
throws IOException {
headers.setDefaultResponseHeaders();
headers.mimeHtml();
ContentWriter w = conn.getContentWriter();
FHIRUtils.writeHTMLDocumentStart(w, null);
w.write("<div class=\"image_doc\">\n");
w.write("<img alt=\"" + title + "\"");
w.write(" src=\"data:" + type + ";base64,");
w.write(b64Data);
w.write("\"/>\n");
w.write("</div>\n");
FHIRUtils.writeHTMLDocumentFinish(w);
}
protected String getDateTime(JSONObject o) {
String date = o.optString("effectiveDateTime", null);
if (date == null) {
date = o.optString("issued");
if (date == null) {
JSONObject oo = o.optJSONObject("effectivePeriod");
if (oo != null) {
date = oo.optString("start", null);
if (date == null) {
date = oo.optString("end", null);
}
}
}
}
if ((date == null) || (date.length() == 0)) {
date = getResourceAsString("bv.text.unspecified_date");
}
return date;
}
protected String encodeLink(String url) {
return Functions.base64NOLF(url);
}
protected String decodeLink(String link) {
int n = link.lastIndexOf('.');
if (n != -1) {
link = link.substring(0, n);
}
return Functions.decodeBase64(link);
}
protected ActionLinkEx createSearchLink(String... params) {
StringBuilder sb = new StringBuilder(server.endPoint);
sb.append(resourceName);
sb.append('?');
int i = 0;
if ((params != null) && (params.length > 0)) {
if ((params != null) && (params.length > 0)) {
int len = params.length;
while(i < len) {
if (i > 0) {
sb.append('&');
}
String s = params[i++];
if (!countSupported && s.equals("_count")) {
i++;
} else {
sb.append(s).append('=').append(params[i++]);
}
}
}
}
if (summarySupported) {
if (i > 0) {
sb.append('&');
}
sb.append("_summary=true");
i++;
}
if (searchParams != null && searchParams.length()>0) {
if (i > 0) {
sb.append('&');
}
sb.append(searchParams);
}
i=sb.length();
if(sb.charAt(i-1)=='&') {
sb.setLength(i-1);
}
ActionLinkEx l = server.createLink(sb.toString());
lastLink = l;
return l;
}
protected ActionLinkEx createTextLink(String id) {
id = removeExtension(id);
StringBuilder sb = new StringBuilder(server.endPoint);
sb.append(resourceName).append('/').append(id);
if (summarySupported) {
sb.append("?_summary=text");
}
ActionLinkEx l = server.createLink(sb.toString());
lastLink = l;
if (!readSupported) { //should never happen for a build out server but put this here so that the client can be used for testing
throw new NonFatalServiceException(
"This server does not support the READ interaction on the specified resource. Please notify the service administrator.");
}
return l;
}
protected ActionLinkEx createReadLink(String id) {
return createReadLink(resourceName, id);
}
protected String removeExtension(String id) {
if (id != null) {
int n = id.lastIndexOf('.');
if (n != -1) {
String s = id.substring(n + 1);
if (validExtensions.contains(s)) {
id = id.substring(0, n);
}
}
}
if (nonConformant && BAD_ID.equals(id)) {
throw new NonFatalServiceException(server.getResourceAsString("bv.text.bad_fhir_id"));
}
return id;
}
protected ActionLinkEx createReadLink(String resourceName, String id) {
StringBuilder sb = new StringBuilder(server.endPoint);
sb.append(resourceName).append('/').append(removeExtension(id));
ActionLinkEx l = server.createLink(sb.toString());
lastLink = l;
if (!readSupported &&!nonConformant) { //should never happen for a build out server but put this here so that the client can be used for testing
throw new NonFatalServiceException(
"This server does not support the READ interaction on the specified resource. Please notify the service administrator.");
}
return l;
}
protected ActionLinkEx createReferenceReadLink(String reference) {
String url = server.fixLink(reference);
ActionLinkEx l = server.createLink(url);
lastLink = l;
return l;
}
protected void resolveReferences(JSONArray refs, Map<String, JSONObject> map) throws IOException {
int len = refs.length();
ArrayList<ActionLinkEx> links = null;
for (int i = len - 1; i > -1; i--) {
String ref = refs.getJSONObject(i).getString("reference");
if (ref.startsWith("#")) {
if (map != null) {
JSONObject o = map.remove(ref.substring(1));
if (o != null) {
refs.set(i, o);
} else {
refs.remove(i);
}
}
} else {
ActionLinkEx l = createReferenceReadLink(ref);
if (links == null) {
links = new ArrayList<ActionLinkEx>(len);
}
l.setLinkedIndex(i);
links.add(l);
}
}
if (links != null) {
len = links.size();
LinkWaiter waiter = null;
if (len > 1) {
waiter = new LinkWaiter(len - 1);
for (int i = 1; i < len; i++) {
waiter.addLink(links.get(i));
}
}
ActionLinkEx l = links.get(0);
JSONTokener t = null;
try {
t = new JSONTokener(l.getReader());
JSONObject o = new JSONObject(t);
refs.set(l.getLinkedIndex(), o);
if (waiter != null) {
waiter.startWaiting();
if (!waiter.hadError()) {
for (int i = 1; i < len; i++) {
ActionLinkEx ln = links.get(i);
refs.set(ln.getLinkedIndex(), waiter.getResult(i - 1));
}
}
}
} catch(Exception e) {
if (waiter != null) {
waiter.cancel(null, null);
}
} finally {
l.close();
if (t != null) {
t.dispose();
}
if (waiter != null) {
waiter.dispose();
}
}
}
}
protected JSONObject getReference(String ref) throws IOException {
ActionLinkEx l = createReferenceReadLink(ref);
JSONTokener t = null;
try {
t = new JSONTokener(l.getReader());
JSONObject o = new JSONObject(t);
return o;
} finally {
if (t != null) {
t.dispose();
}
l.close();
}
}
public ActionLinkEx getLastLink() {
return lastLink;
}
protected void search(Reader r, Object writer, final HttpHeaders headers, final Object... params) throws IOException {
final JSONWriter jw;
final Writer w;
final CharArray ca = new CharArray();
if (writer instanceof JSONWriter) {
jw = (JSONWriter) writer;
w = null;
} else {
w = (Writer) writer;
jw = null;
}
if (jw != null) {
jw.object();
jw.key("_columns").array();
for (String name : columnNames) {
jw.value(name);
}
jw.endArray();
jw.key("_rows").array();
}
JSONTokener t = new JSONTokener(r);
iCallback cb = new aCallback() {
@Override
public Object entryEncountered(JSONObject entry) {
try {
processResource(entry, jw, w, ca, params);
} catch(Exception e) {
throw ApplicationException.runtimeException(e);
}
return null;
}
@Override
public Object linkEncountered(String arrayName, String type, String url) {
if ("link".equals(arrayName)) { //top level link
if (type.equals("next")) {
headers.hasMore(createPagingUrl(cleanLink(url), jw != null));
} else if (type.equals("self")) {
headers.setLinkInfo(createPagingUrl(cleanLink(url), jw != null));
}
}
return null;
}
};
t.setWatcher(new FHIRJSONWatcher(cb));
@SuppressWarnings("unused") JSONObject o = new JSONObject(t);
t.dispose();
parsingComplete(jw, w, ca, params);
if (jw != null) {
jw.endArray();
jw.endObject();
}
}
protected void read(Reader r, Object writer, final HttpHeaders headers, final Object... params) throws IOException {
JSONObject o = getReadEntry(r);
if (o != null) {
final JSONWriter jw;
final Writer w;
if (writer instanceof JSONWriter) {
jw = (JSONWriter) writer;
jw.object();
w = null;
} else {
w = (Writer) writer;
jw = null;
}
readEntry(o, jw, w, params);
if (jw != null) {
jw.endObject();
}
}
}
public static JSONObject getReadEntry(Reader r) {
JSONTokener t = new JSONTokener(r);
try {
JSONObject o = new JSONObject(t);
t.dispose();
JSONObject entry = o;
if (o.optString("resourceType").equals("Bundle")) {
JSONArray a = o.optJSONArray("entry");
int len = (a == null)
? 0
: a.length();
if (len > 0) {
entry = a.getJSONObject(0).optJSONObject("resource");
}
}
if (entry.optString("resourceType").equals("OperationOutcome")) {
JSONArray issue = entry.optJSONArray("issue");
if (issue != null) {
throw new ApplicationException(issue.toString());
}
}
return entry;
} finally {
t.dispose();
}
}
protected void writeLinkedData(JSONWriter jw, String key, String linkedData, String value) throws IOException {
if (linkedData == null) {
jw.key(key).value(value);
} else {
jw.key(key).object();
if (linkedData != null) {
jw.key("linkedData").value(linkedData);
}
jw.key("value").value(value);
jw.endObject();
}
}
protected String cleanLink(String href) {
int n = href.indexOf(':');
if (n != -1) {
int p = href.indexOf('/');
if (p != -1) {
if (n < p) {
String ep = server.endPointNoSlash;
if (!href.startsWith(ep)) {
if (server.commandLine) {
return href;
}
throw new ApplicationException(server.getString("bv.text.bad_fhir_link", ep, href));
} else {
href = href.substring(ep.length());
}
}
}
}
return href;
}
protected void parsingComplete(JSONWriter jw, Writer w, CharArray ca, Object... params) throws IOException {}
protected void processResource(JSONObject resource, JSONWriter jw, Writer w, CharArray ca, Object... params)
throws IOException {
if (nonConformant) {
JSONObject o = resource.getJSONObject("resource");
o.put("_link", resource.optJSONArray("link"));
processEntry(o, jw, w, ca, params);
} else {
processEntry(resource.getJSONObject("resource"), jw, w, ca, params);
}
}
protected String getID(JSONObject entry) {
String id = entry.optString("id", null);
if ((id == null) && nonConformant) {
JSONArray link = entry.optJSONArray("_link");
JSONObject o = (link == null)
? null
: link.findJSONObject("relation", "self");
if (o != null) {
id = o.optString("url", null);
}
}
if (id != null) {
int n = id.lastIndexOf('/');
if (n != -1) {
id = id.substring(n + 1);
}
}
if (nonConformant) {
if ((id == null) || (id.length() == 0) || id.equals("0")) {
id = "__BV_BAD_ID__";
}
}
return id;
}
protected String getID(String id) {
if (id != null) {
int n = id.lastIndexOf('/');
if (n != -1) {
id = id.substring(n + 1);
}
}
return id;
}
public void paging(iHttpConnection conn, ActionPath path, InputStream data, HttpHeaders headers) throws IOException {
String href = decodeLink(path.toString());
ActionLinkEx l = server.createResourceLink(href);
try {
Object w = FHIRUtils.createWriter(path, conn.getContentWriter(), headers, true);
search(l.getReader(), w, headers);
} finally {
l.close();
}
}
public void processEntry(JSONObject entry, JSONWriter jw, Writer w, CharArray ca, Object... params)
throws IOException {}
public abstract void readEntry(JSONObject entry, JSONWriter jw, Writer w, Object... params) throws IOException;
protected void debugLog(String msg) {
if (server.debug) {
super.debugLog(msg);
} else {
server.debugLog(msg);
}
}
protected void ignoreException(Exception e) {
if (server.debug) {
super.ignoreException(e);
} else {
server.ignoreException(e);
}
}
protected String getResourceAsString(String name) {
return server.getResourceAsString(name);
}
protected RuntimeException missingRequiredData(String name, String id) {
return missingRequiredData(name, id, resourceName);
}
protected RuntimeException missingRequiredData(String name, String id, String resourceName) {
StringBuilder sb = new StringBuilder();
sb.append("Required element '").append(name);
sb.append("' is missing from FHIR '").append(resourceName).append("'");
if (id != null) {
sb.append(" with id:").append(id);
}
return new MessageException(sb.toString(), true);
}
protected RuntimeException invalidData(String name, String id) {
StringBuilder sb = new StringBuilder("Invalid/missing data ");
if (name != null) {
;
}
{
sb.append("for element '").append(name).append("' ");
}
sb.append(" in FHIR '").append(resourceName).append("'");
if (id != null) {
sb.append(" with id:").append(id);
}
return new MessageException(sb.toString(), true);
}
}
| apache-2.0 |
asiaon123/hsweb-framework | hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/support/client/ClientCredentialRequest.java | 934 | /*
* Copyright 2016 http://www.hswebframework.org
*
* 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.hswebframework.web.authorization.oauth2.server.support.client;
import org.hswebframework.web.authorization.oauth2.server.TokenRequest;
/**
*
* @author zhouhao
*/
public interface ClientCredentialRequest extends TokenRequest {
String getClientId();
String getClientSecret();
}
| apache-2.0 |
ppelleti/host-vfy | src/com/oblong/tls/verifier/InetAddressUtils.java | 4938 | /*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
/* This file originally came from:
* http://mirror.symnds.com/software/Apache//httpcomponents/httpclient/source/httpcomponents-client-4.3-beta2-src.tar.gz
* with the md5sum:
* c33bcafaf8a0ec2c82710bfb4eca17d1 httpcomponents-client-4.3-beta2-src.tar.gz
*
* Modified by Patrick Pelletier for Oblong Industries:
* - changed package name
* - removed immutable annotation
*/
package com.oblong.tls.verifier;
import java.util.regex.Pattern;
/**
* A collection of utilities relating to InetAddresses.
*
* @since 4.0
*/
// @Immutable
public class InetAddressUtils {
private InetAddressUtils() {
}
private static final String IPV4_BASIC_PATTERN_STRING =
"(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}" + // initial 3 fields, 0-255 followed by .
"([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])"; // final field, 0-255
private static final Pattern IPV4_PATTERN =
Pattern.compile("^" + IPV4_BASIC_PATTERN_STRING + "$");
private static final Pattern IPV4_MAPPED_IPV6_PATTERN = // TODO does not allow for redundant leading zeros
Pattern.compile("^::[fF]{4}:" + IPV4_BASIC_PATTERN_STRING + "$");
private static final Pattern IPV6_STD_PATTERN =
Pattern.compile(
"^[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){7}$");
private static final Pattern IPV6_HEX_COMPRESSED_PATTERN =
Pattern.compile(
"^(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)" + // 0-6 hex fields
"::" +
"(([0-9A-Fa-f]{1,4}(:[0-9A-Fa-f]{1,4}){0,5})?)$"); // 0-6 hex fields
/*
* The above pattern is not totally rigorous as it allows for more than 7 hex fields in total
*/
private static final char COLON_CHAR = ':';
// Must not have more than 7 colons (i.e. 8 fields)
private static final int MAX_COLON_COUNT = 7;
/**
* Checks whether the parameter is a valid IPv4 address
*
* @param input the address string to check for validity
* @return true if the input parameter is a valid IPv4 address
*/
public static boolean isIPv4Address(final String input) {
return IPV4_PATTERN.matcher(input).matches();
}
public static boolean isIPv4MappedIPv64Address(final String input) {
return IPV4_MAPPED_IPV6_PATTERN.matcher(input).matches();
}
/**
* Checks whether the parameter is a valid standard (non-compressed) IPv6 address
*
* @param input the address string to check for validity
* @return true if the input parameter is a valid standard (non-compressed) IPv6 address
*/
public static boolean isIPv6StdAddress(final String input) {
return IPV6_STD_PATTERN.matcher(input).matches();
}
/**
* Checks whether the parameter is a valid compressed IPv6 address
*
* @param input the address string to check for validity
* @return true if the input parameter is a valid compressed IPv6 address
*/
public static boolean isIPv6HexCompressedAddress(final String input) {
int colonCount = 0;
for(int i = 0; i < input.length(); i++) {
if (input.charAt(i) == COLON_CHAR) {
colonCount++;
}
}
return colonCount <= MAX_COLON_COUNT && IPV6_HEX_COMPRESSED_PATTERN.matcher(input).matches();
}
/**
* Checks whether the parameter is a valid IPv6 address (including compressed).
*
* @param input the address string to check for validity
* @return true if the input parameter is a valid standard or compressed IPv6 address
*/
public static boolean isIPv6Address(final String input) {
return isIPv6StdAddress(input) || isIPv6HexCompressedAddress(input);
}
}
| apache-2.0 |
oehme/analysing-gradle-performance | my-app/src/test/java/org/gradle/test/performance/mediummonolithicjavaproject/p413/Test8265.java | 2111 | package org.gradle.test.performance.mediummonolithicjavaproject.p413;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test8265 {
Production8265 objectUnderTest = new Production8265();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | apache-2.0 |
mcollovati/camel | components/camel-grpc/src/generated/java/org/apache/camel/component/grpc/GrpcEndpointConfigurer.java | 11872 | /* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.grpc;
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.spi.ConfigurerStrategy;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;
/**
* Generated by camel build tools - do NOT edit this file!
*/
@SuppressWarnings("unchecked")
public class GrpcEndpointConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
private static final Map<String, Object> ALL_OPTIONS;
static {
Map<String, Object> map = new CaseInsensitiveMap();
map.put("host", java.lang.String.class);
map.put("port", int.class);
map.put("service", java.lang.String.class);
map.put("flowControlWindow", int.class);
map.put("maxMessageSize", int.class);
map.put("bridgeErrorHandler", boolean.class);
map.put("consumerStrategy", org.apache.camel.component.grpc.GrpcConsumerStrategy.class);
map.put("forwardOnCompleted", boolean.class);
map.put("forwardOnError", boolean.class);
map.put("maxConcurrentCallsPerConnection", int.class);
map.put("routeControlledStreamObserver", boolean.class);
map.put("exceptionHandler", org.apache.camel.spi.ExceptionHandler.class);
map.put("exchangePattern", org.apache.camel.ExchangePattern.class);
map.put("lazyStartProducer", boolean.class);
map.put("method", java.lang.String.class);
map.put("producerStrategy", org.apache.camel.component.grpc.GrpcProducerStrategy.class);
map.put("streamRepliesTo", java.lang.String.class);
map.put("userAgent", java.lang.String.class);
map.put("basicPropertyBinding", boolean.class);
map.put("synchronous", boolean.class);
map.put("authenticationType", org.apache.camel.component.grpc.GrpcAuthType.class);
map.put("jwtAlgorithm", org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm.class);
map.put("jwtIssuer", java.lang.String.class);
map.put("jwtSecret", java.lang.String.class);
map.put("jwtSubject", java.lang.String.class);
map.put("keyCertChainResource", java.lang.String.class);
map.put("keyPassword", java.lang.String.class);
map.put("keyResource", java.lang.String.class);
map.put("negotiationType", io.grpc.netty.NegotiationType.class);
map.put("serviceAccountResource", java.lang.String.class);
map.put("trustCertCollectionResource", java.lang.String.class);
ALL_OPTIONS = map;
ConfigurerStrategy.addConfigurerClearer(GrpcEndpointConfigurer::clearConfigurers);
}
@Override
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
GrpcEndpoint target = (GrpcEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "authenticationtype":
case "authenticationType": target.getConfiguration().setAuthenticationType(property(camelContext, org.apache.camel.component.grpc.GrpcAuthType.class, value)); return true;
case "basicpropertybinding":
case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true;
case "bridgeerrorhandler":
case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
case "consumerstrategy":
case "consumerStrategy": target.getConfiguration().setConsumerStrategy(property(camelContext, org.apache.camel.component.grpc.GrpcConsumerStrategy.class, value)); return true;
case "exceptionhandler":
case "exceptionHandler": target.setExceptionHandler(property(camelContext, org.apache.camel.spi.ExceptionHandler.class, value)); return true;
case "exchangepattern":
case "exchangePattern": target.setExchangePattern(property(camelContext, org.apache.camel.ExchangePattern.class, value)); return true;
case "flowcontrolwindow":
case "flowControlWindow": target.getConfiguration().setFlowControlWindow(property(camelContext, int.class, value)); return true;
case "forwardoncompleted":
case "forwardOnCompleted": target.getConfiguration().setForwardOnCompleted(property(camelContext, boolean.class, value)); return true;
case "forwardonerror":
case "forwardOnError": target.getConfiguration().setForwardOnError(property(camelContext, boolean.class, value)); return true;
case "jwtalgorithm":
case "jwtAlgorithm": target.getConfiguration().setJwtAlgorithm(property(camelContext, org.apache.camel.component.grpc.auth.jwt.JwtAlgorithm.class, value)); return true;
case "jwtissuer":
case "jwtIssuer": target.getConfiguration().setJwtIssuer(property(camelContext, java.lang.String.class, value)); return true;
case "jwtsecret":
case "jwtSecret": target.getConfiguration().setJwtSecret(property(camelContext, java.lang.String.class, value)); return true;
case "jwtsubject":
case "jwtSubject": target.getConfiguration().setJwtSubject(property(camelContext, java.lang.String.class, value)); return true;
case "keycertchainresource":
case "keyCertChainResource": target.getConfiguration().setKeyCertChainResource(property(camelContext, java.lang.String.class, value)); return true;
case "keypassword":
case "keyPassword": target.getConfiguration().setKeyPassword(property(camelContext, java.lang.String.class, value)); return true;
case "keyresource":
case "keyResource": target.getConfiguration().setKeyResource(property(camelContext, java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "maxconcurrentcallsperconnection":
case "maxConcurrentCallsPerConnection": target.getConfiguration().setMaxConcurrentCallsPerConnection(property(camelContext, int.class, value)); return true;
case "maxmessagesize":
case "maxMessageSize": target.getConfiguration().setMaxMessageSize(property(camelContext, int.class, value)); return true;
case "method": target.getConfiguration().setMethod(property(camelContext, java.lang.String.class, value)); return true;
case "negotiationtype":
case "negotiationType": target.getConfiguration().setNegotiationType(property(camelContext, io.grpc.netty.NegotiationType.class, value)); return true;
case "producerstrategy":
case "producerStrategy": target.getConfiguration().setProducerStrategy(property(camelContext, org.apache.camel.component.grpc.GrpcProducerStrategy.class, value)); return true;
case "routecontrolledstreamobserver":
case "routeControlledStreamObserver": target.getConfiguration().setRouteControlledStreamObserver(property(camelContext, boolean.class, value)); return true;
case "serviceaccountresource":
case "serviceAccountResource": target.getConfiguration().setServiceAccountResource(property(camelContext, java.lang.String.class, value)); return true;
case "streamrepliesto":
case "streamRepliesTo": target.getConfiguration().setStreamRepliesTo(property(camelContext, java.lang.String.class, value)); return true;
case "synchronous": target.setSynchronous(property(camelContext, boolean.class, value)); return true;
case "trustcertcollectionresource":
case "trustCertCollectionResource": target.getConfiguration().setTrustCertCollectionResource(property(camelContext, java.lang.String.class, value)); return true;
case "useragent":
case "userAgent": target.getConfiguration().setUserAgent(property(camelContext, java.lang.String.class, value)); return true;
default: return false;
}
}
@Override
public Map<String, Object> getAllOptions(Object target) {
return ALL_OPTIONS;
}
public static void clearBootstrapConfigurers() {
}
public static void clearConfigurers() {
ALL_OPTIONS.clear();
}
@Override
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
GrpcEndpoint target = (GrpcEndpoint) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "authenticationtype":
case "authenticationType": return target.getConfiguration().getAuthenticationType();
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "consumerstrategy":
case "consumerStrategy": return target.getConfiguration().getConsumerStrategy();
case "exceptionhandler":
case "exceptionHandler": return target.getExceptionHandler();
case "exchangepattern":
case "exchangePattern": return target.getExchangePattern();
case "flowcontrolwindow":
case "flowControlWindow": return target.getConfiguration().getFlowControlWindow();
case "forwardoncompleted":
case "forwardOnCompleted": return target.getConfiguration().isForwardOnCompleted();
case "forwardonerror":
case "forwardOnError": return target.getConfiguration().isForwardOnError();
case "jwtalgorithm":
case "jwtAlgorithm": return target.getConfiguration().getJwtAlgorithm();
case "jwtissuer":
case "jwtIssuer": return target.getConfiguration().getJwtIssuer();
case "jwtsecret":
case "jwtSecret": return target.getConfiguration().getJwtSecret();
case "jwtsubject":
case "jwtSubject": return target.getConfiguration().getJwtSubject();
case "keycertchainresource":
case "keyCertChainResource": return target.getConfiguration().getKeyCertChainResource();
case "keypassword":
case "keyPassword": return target.getConfiguration().getKeyPassword();
case "keyresource":
case "keyResource": return target.getConfiguration().getKeyResource();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "maxconcurrentcallsperconnection":
case "maxConcurrentCallsPerConnection": return target.getConfiguration().getMaxConcurrentCallsPerConnection();
case "maxmessagesize":
case "maxMessageSize": return target.getConfiguration().getMaxMessageSize();
case "method": return target.getConfiguration().getMethod();
case "negotiationtype":
case "negotiationType": return target.getConfiguration().getNegotiationType();
case "producerstrategy":
case "producerStrategy": return target.getConfiguration().getProducerStrategy();
case "routecontrolledstreamobserver":
case "routeControlledStreamObserver": return target.getConfiguration().isRouteControlledStreamObserver();
case "serviceaccountresource":
case "serviceAccountResource": return target.getConfiguration().getServiceAccountResource();
case "streamrepliesto":
case "streamRepliesTo": return target.getConfiguration().getStreamRepliesTo();
case "synchronous": return target.isSynchronous();
case "trustcertcollectionresource":
case "trustCertCollectionResource": return target.getConfiguration().getTrustCertCollectionResource();
case "useragent":
case "userAgent": return target.getConfiguration().getUserAgent();
default: return null;
}
}
}
| apache-2.0 |
aws/aws-sdk-java | aws-java-sdk-mediaconvert/src/main/java/com/amazonaws/services/mediaconvert/model/DashIsoImageBasedTrickPlaySettings.java | 20115 | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.mediaconvert.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* Tile and thumbnail settings applicable when imageBasedTrickPlay is ADVANCED
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediaconvert-2017-08-29/DashIsoImageBasedTrickPlaySettings"
* target="_top">AWS API Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DashIsoImageBasedTrickPlaySettings implements Serializable, Cloneable, StructuredPojo {
/**
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert generates
* thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM, MediaConvert
* generates thumbnails according to the interval you specify in thumbnailInterval.
*/
private String intervalCadence;
/**
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with thumbnail
* width. If following the aspect ratio would lead to a total tile height greater than 4096, then the job will be
* rejected. Must be divisible by 2.
*/
private Integer thumbnailHeight;
/**
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter doesn't
* align with the output frame rate, MediaConvert automatically rounds the interval to align with the output frame
* rate. For example, if the output frame rate is 29.97 frames per second and you enter 5, MediaConvert uses a 150
* frame interval to generate thumbnails.
*/
private Double thumbnailInterval;
/** Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8. */
private Integer thumbnailWidth;
/** Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by 2. */
private Integer tileHeight;
/** Number of thumbnails in each row of a tile image. Set a value between 1 and 512. */
private Integer tileWidth;
/**
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert generates
* thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM, MediaConvert
* generates thumbnails according to the interval you specify in thumbnailInterval.
*
* @param intervalCadence
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert
* generates thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM,
* MediaConvert generates thumbnails according to the interval you specify in thumbnailInterval.
* @see DashIsoIntervalCadence
*/
public void setIntervalCadence(String intervalCadence) {
this.intervalCadence = intervalCadence;
}
/**
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert generates
* thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM, MediaConvert
* generates thumbnails according to the interval you specify in thumbnailInterval.
*
* @return The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert
* generates thumbnails for each IDR frame in the output (matching the GOP cadence). If set to
* FOLLOW_CUSTOM, MediaConvert generates thumbnails according to the interval you specify in
* thumbnailInterval.
* @see DashIsoIntervalCadence
*/
public String getIntervalCadence() {
return this.intervalCadence;
}
/**
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert generates
* thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM, MediaConvert
* generates thumbnails according to the interval you specify in thumbnailInterval.
*
* @param intervalCadence
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert
* generates thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM,
* MediaConvert generates thumbnails according to the interval you specify in thumbnailInterval.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DashIsoIntervalCadence
*/
public DashIsoImageBasedTrickPlaySettings withIntervalCadence(String intervalCadence) {
setIntervalCadence(intervalCadence);
return this;
}
/**
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert generates
* thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM, MediaConvert
* generates thumbnails according to the interval you specify in thumbnailInterval.
*
* @param intervalCadence
* The cadence MediaConvert follows for generating thumbnails. If set to FOLLOW_IFRAME, MediaConvert
* generates thumbnails for each IDR frame in the output (matching the GOP cadence). If set to FOLLOW_CUSTOM,
* MediaConvert generates thumbnails according to the interval you specify in thumbnailInterval.
* @return Returns a reference to this object so that method calls can be chained together.
* @see DashIsoIntervalCadence
*/
public DashIsoImageBasedTrickPlaySettings withIntervalCadence(DashIsoIntervalCadence intervalCadence) {
this.intervalCadence = intervalCadence.toString();
return this;
}
/**
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with thumbnail
* width. If following the aspect ratio would lead to a total tile height greater than 4096, then the job will be
* rejected. Must be divisible by 2.
*
* @param thumbnailHeight
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with
* thumbnail width. If following the aspect ratio would lead to a total tile height greater than 4096, then
* the job will be rejected. Must be divisible by 2.
*/
public void setThumbnailHeight(Integer thumbnailHeight) {
this.thumbnailHeight = thumbnailHeight;
}
/**
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with thumbnail
* width. If following the aspect ratio would lead to a total tile height greater than 4096, then the job will be
* rejected. Must be divisible by 2.
*
* @return Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with
* thumbnail width. If following the aspect ratio would lead to a total tile height greater than 4096, then
* the job will be rejected. Must be divisible by 2.
*/
public Integer getThumbnailHeight() {
return this.thumbnailHeight;
}
/**
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with thumbnail
* width. If following the aspect ratio would lead to a total tile height greater than 4096, then the job will be
* rejected. Must be divisible by 2.
*
* @param thumbnailHeight
* Height of each thumbnail within each tile image, in pixels. Leave blank to maintain aspect ratio with
* thumbnail width. If following the aspect ratio would lead to a total tile height greater than 4096, then
* the job will be rejected. Must be divisible by 2.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DashIsoImageBasedTrickPlaySettings withThumbnailHeight(Integer thumbnailHeight) {
setThumbnailHeight(thumbnailHeight);
return this;
}
/**
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter doesn't
* align with the output frame rate, MediaConvert automatically rounds the interval to align with the output frame
* rate. For example, if the output frame rate is 29.97 frames per second and you enter 5, MediaConvert uses a 150
* frame interval to generate thumbnails.
*
* @param thumbnailInterval
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter
* doesn't align with the output frame rate, MediaConvert automatically rounds the interval to align with the
* output frame rate. For example, if the output frame rate is 29.97 frames per second and you enter 5,
* MediaConvert uses a 150 frame interval to generate thumbnails.
*/
public void setThumbnailInterval(Double thumbnailInterval) {
this.thumbnailInterval = thumbnailInterval;
}
/**
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter doesn't
* align with the output frame rate, MediaConvert automatically rounds the interval to align with the output frame
* rate. For example, if the output frame rate is 29.97 frames per second and you enter 5, MediaConvert uses a 150
* frame interval to generate thumbnails.
*
* @return Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter
* doesn't align with the output frame rate, MediaConvert automatically rounds the interval to align with
* the output frame rate. For example, if the output frame rate is 29.97 frames per second and you enter 5,
* MediaConvert uses a 150 frame interval to generate thumbnails.
*/
public Double getThumbnailInterval() {
return this.thumbnailInterval;
}
/**
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter doesn't
* align with the output frame rate, MediaConvert automatically rounds the interval to align with the output frame
* rate. For example, if the output frame rate is 29.97 frames per second and you enter 5, MediaConvert uses a 150
* frame interval to generate thumbnails.
*
* @param thumbnailInterval
* Enter the interval, in seconds, that MediaConvert uses to generate thumbnails. If the interval you enter
* doesn't align with the output frame rate, MediaConvert automatically rounds the interval to align with the
* output frame rate. For example, if the output frame rate is 29.97 frames per second and you enter 5,
* MediaConvert uses a 150 frame interval to generate thumbnails.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DashIsoImageBasedTrickPlaySettings withThumbnailInterval(Double thumbnailInterval) {
setThumbnailInterval(thumbnailInterval);
return this;
}
/**
* Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
*
* @param thumbnailWidth
* Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
*/
public void setThumbnailWidth(Integer thumbnailWidth) {
this.thumbnailWidth = thumbnailWidth;
}
/**
* Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
*
* @return Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
*/
public Integer getThumbnailWidth() {
return this.thumbnailWidth;
}
/**
* Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
*
* @param thumbnailWidth
* Width of each thumbnail within each tile image, in pixels. Default is 312. Must be divisible by 8.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DashIsoImageBasedTrickPlaySettings withThumbnailWidth(Integer thumbnailWidth) {
setThumbnailWidth(thumbnailWidth);
return this;
}
/**
* Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by 2.
*
* @param tileHeight
* Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by
* 2.
*/
public void setTileHeight(Integer tileHeight) {
this.tileHeight = tileHeight;
}
/**
* Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by 2.
*
* @return Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by
* 2.
*/
public Integer getTileHeight() {
return this.tileHeight;
}
/**
* Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by 2.
*
* @param tileHeight
* Number of thumbnails in each column of a tile image. Set a value between 2 and 2048. Must be divisible by
* 2.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DashIsoImageBasedTrickPlaySettings withTileHeight(Integer tileHeight) {
setTileHeight(tileHeight);
return this;
}
/**
* Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
*
* @param tileWidth
* Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
*/
public void setTileWidth(Integer tileWidth) {
this.tileWidth = tileWidth;
}
/**
* Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
*
* @return Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
*/
public Integer getTileWidth() {
return this.tileWidth;
}
/**
* Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
*
* @param tileWidth
* Number of thumbnails in each row of a tile image. Set a value between 1 and 512.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public DashIsoImageBasedTrickPlaySettings withTileWidth(Integer tileWidth) {
setTileWidth(tileWidth);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getIntervalCadence() != null)
sb.append("IntervalCadence: ").append(getIntervalCadence()).append(",");
if (getThumbnailHeight() != null)
sb.append("ThumbnailHeight: ").append(getThumbnailHeight()).append(",");
if (getThumbnailInterval() != null)
sb.append("ThumbnailInterval: ").append(getThumbnailInterval()).append(",");
if (getThumbnailWidth() != null)
sb.append("ThumbnailWidth: ").append(getThumbnailWidth()).append(",");
if (getTileHeight() != null)
sb.append("TileHeight: ").append(getTileHeight()).append(",");
if (getTileWidth() != null)
sb.append("TileWidth: ").append(getTileWidth());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DashIsoImageBasedTrickPlaySettings == false)
return false;
DashIsoImageBasedTrickPlaySettings other = (DashIsoImageBasedTrickPlaySettings) obj;
if (other.getIntervalCadence() == null ^ this.getIntervalCadence() == null)
return false;
if (other.getIntervalCadence() != null && other.getIntervalCadence().equals(this.getIntervalCadence()) == false)
return false;
if (other.getThumbnailHeight() == null ^ this.getThumbnailHeight() == null)
return false;
if (other.getThumbnailHeight() != null && other.getThumbnailHeight().equals(this.getThumbnailHeight()) == false)
return false;
if (other.getThumbnailInterval() == null ^ this.getThumbnailInterval() == null)
return false;
if (other.getThumbnailInterval() != null && other.getThumbnailInterval().equals(this.getThumbnailInterval()) == false)
return false;
if (other.getThumbnailWidth() == null ^ this.getThumbnailWidth() == null)
return false;
if (other.getThumbnailWidth() != null && other.getThumbnailWidth().equals(this.getThumbnailWidth()) == false)
return false;
if (other.getTileHeight() == null ^ this.getTileHeight() == null)
return false;
if (other.getTileHeight() != null && other.getTileHeight().equals(this.getTileHeight()) == false)
return false;
if (other.getTileWidth() == null ^ this.getTileWidth() == null)
return false;
if (other.getTileWidth() != null && other.getTileWidth().equals(this.getTileWidth()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getIntervalCadence() == null) ? 0 : getIntervalCadence().hashCode());
hashCode = prime * hashCode + ((getThumbnailHeight() == null) ? 0 : getThumbnailHeight().hashCode());
hashCode = prime * hashCode + ((getThumbnailInterval() == null) ? 0 : getThumbnailInterval().hashCode());
hashCode = prime * hashCode + ((getThumbnailWidth() == null) ? 0 : getThumbnailWidth().hashCode());
hashCode = prime * hashCode + ((getTileHeight() == null) ? 0 : getTileHeight().hashCode());
hashCode = prime * hashCode + ((getTileWidth() == null) ? 0 : getTileWidth().hashCode());
return hashCode;
}
@Override
public DashIsoImageBasedTrickPlaySettings clone() {
try {
return (DashIsoImageBasedTrickPlaySettings) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.mediaconvert.model.transform.DashIsoImageBasedTrickPlaySettingsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| apache-2.0 |
kieker-monitoring/kieker | kieker-common/src/kieker/common/configuration/ReadOnlyConfiguration.java | 3492 | /***************************************************************************
* Copyright 2021 Kieker Project (https://kieker-monitoring.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.
***************************************************************************/
package kieker.common.configuration;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Map;
import java.util.Properties;
/**
* @author Christian Wulf
*
* @since 1.13
*/
public class ReadOnlyConfiguration extends Configuration {
private static final long serialVersionUID = 3692243455682718596L;
/**
* Create a read only configuration.
*
* @param properties
* properties of the configuration
*/
public ReadOnlyConfiguration(final Properties properties) {
super(properties);
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized Object setProperty(final String key, final String value) {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
public void setDefaultConfiguration(final Configuration defaultConfiguration) {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
public void setStringArrayProperty(final String key, final String[] value) {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized void clear() {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized void load(final InputStream inStream) throws IOException {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized void load(final Reader reader) throws IOException {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized void loadFromXML(final InputStream in) throws IOException {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized void putAll(final Map<? extends Object, ? extends Object> t) {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
@Override
@SuppressWarnings("PMD.AvoidSynchronizedAtMethodLevel")
public synchronized Object remove(final Object key) {
throw new UnsupportedOperationException("This is a read-only configuration. Changes are not permitted.");
}
}
| apache-2.0 |
VHAINNOVATIONS/Telepathology | Source/Java/ImagingExchangeCache/main/src/java/gov/va/med/imaging/exchange/storage/cache/mock/MockVASourcedCache.java | 4754 | package gov.va.med.imaging.exchange.storage.cache.mock;
import gov.va.med.GlobalArtifactIdentifier;
import gov.va.med.PatientIdentifier;
import gov.va.med.RoutingToken;
import gov.va.med.imaging.GUID;
import gov.va.med.imaging.ImageURN;
import gov.va.med.imaging.StudyURN;
import gov.va.med.imaging.exceptions.URNFormatException;
import gov.va.med.imaging.exchange.business.Study;
import gov.va.med.imaging.exchange.business.documents.Document;
import gov.va.med.imaging.exchange.business.vistarad.ExamSite;
import gov.va.med.imaging.exchange.business.vistarad.PatientEnterpriseExams;
import gov.va.med.imaging.exchange.enums.ImageFormat;
import gov.va.med.imaging.exchange.enums.ImageQuality;
import gov.va.med.imaging.exchange.enums.ObjectOrigin;
import gov.va.med.imaging.exchange.enums.StudyDeletedImageState;
import gov.va.med.imaging.exchange.enums.StudyLoadLevel;
import gov.va.med.imaging.exchange.storage.cache.ImmutableInstance;
import gov.va.med.imaging.exchange.storage.cache.VASourcedCache;
import gov.va.med.imaging.storage.cache.Cache;
import gov.va.med.imaging.storage.cache.Instance;
import gov.va.med.imaging.storage.cache.exceptions.CacheException;
import gov.va.med.imaging.storage.cache.exceptions.InvalidGroupNameException;
@SuppressWarnings({ "unused", "deprecation" })
public class MockVASourcedCache
extends AbstractMockCacheDecorator
implements VASourcedCache
{
@Override
public ImmutableInstance createImage(
GlobalArtifactIdentifier gaid,
String quality,
String mimeType)
throws CacheException
{
if( MockCacheConfigurator.getCreateImageCacheException() != null)
throw MockCacheConfigurator.getCreateImageCacheException();
Instance instance = new MockInstance();
ImmutableInstance immutableInstance = new ImmutableInstance(instance);
return immutableInstance;
}
@Override
public ImmutableInstance getImage(
GlobalArtifactIdentifier gaid,
String quality,
String mimeType)
throws CacheException
{
if( MockCacheConfigurator.getGetImageCacheException() != null)
throw MockCacheConfigurator.getGetImageCacheException();
Instance instance = new MockInstance();
ImmutableInstance immutableInstance = new ImmutableInstance(instance);
return immutableInstance;
}
@Override
public void createPatientEnterpriseExams(PatientEnterpriseExams patientEnterpriseExams)
throws CacheException
{
// TODO Auto-generated method stub
}
@Override
public PatientEnterpriseExams getPatientEnterpriseExams(String patientIcn)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see gov.va.med.imaging.exchange.storage.cache.VASourcedCache#createPatientPhotoId(java.lang.String, java.lang.String)
*/
@Override
public ImmutableInstance createPatientPhotoId(String siteNumber, PatientIdentifier patientIdentifier)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see gov.va.med.imaging.exchange.storage.cache.VASourcedCache#getPatientPhotoId(java.lang.String, java.lang.String)
*/
@Override
public ImmutableInstance getPatientPhotoId(String siteNumber, PatientIdentifier patientIdentifier)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public void createExamSite(RoutingToken routingToken, String patientIcn, ExamSite examSite)
throws CacheException
{
// TODO Auto-generated method stub
}
@Override
public ExamSite getExamSite(RoutingToken routingToken, String patientIcn)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableInstance getROIRelease(PatientIdentifier patientIdentifier, GUID guid)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableInstance createROIRelease(PatientIdentifier patientIdentifier, GUID guid)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableInstance getAnnotatedImage(GlobalArtifactIdentifier gaid,
ImageQuality imageQuality,
ImageFormat imageFormat) throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public ImmutableInstance createAnnotatedImage(
GlobalArtifactIdentifier gaid, ImageQuality imageQuality,
ImageFormat imageFormat)
throws CacheException
{
// TODO Auto-generated method stub
return null;
}
@Override
public Cache getWrappedCache()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getImageRegionName()
{
// TODO Auto-generated method stub
return null;
}
@Override
public String getMetadataRegionName()
{
// TODO Auto-generated method stub
return null;
}
}
| apache-2.0 |
eabramovich/Se-Java-17 | src/test/java/ru/st/selenium/AddNewUser.java | 611 | package ru.st.selenium;
import static org.testng.AssertJUnit.assertTrue;
import org.testng.annotations.Test;
import ru.st.selenium.model.User;
public class AddNewUser extends TestBase {
@Test
public void addNewUserOk() {
String username = "user" + System.currentTimeMillis();
User user = new User()
.setLogin(username)
.setPassword("password")
.setEmail(username + "@test.com");
app.getUserHelper().loginAs(ADMIN);
app.getUserHelper().createUser(user);
app.getUserHelper().logout();
app.getUserHelper().loginAs(user);
assertTrue(app.getUserHelper().isLoggedInAs(user));
}
}
| apache-2.0 |
inbloom/secure-data-service | POC/aggregation/mapreduce/src/test/java/org/slc/sli/aggregation/mapreduce/reduce/HighestTest.java | 4484 | /*
* Copyright 2012-2013 inBloom, Inc. and 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.slc.sli.aggregation.mapreduce.reduce;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import com.mongodb.hadoop.io.BSONWritable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.bson.BSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.slc.sli.aggregation.functions.Highest;
import org.slc.sli.aggregation.mapreduce.io.JobConfiguration;
import org.slc.sli.aggregation.mapreduce.map.key.EmittableKey;
import org.slc.sli.aggregation.mapreduce.map.key.TenantAndIdEmittableKey;
import org.slc.sli.aggregation.util.BSONUtilities;
/**
* HighestTest - Tests for he Highest value reducer
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({ Highest.class, Highest.Context.class })
public class HighestTest {
@SuppressWarnings("unchecked")
@Test
public void testReduce() throws Exception {
Highest toTest = new Highest();
TenantAndIdEmittableKey id = new TenantAndIdEmittableKey("metaData.tenatnId", "body.test.id");
id.setId(new Text("MytestId"));
id.setTenantId(new Text("Tenant1"));
ArrayList<BSONWritable> results = new ArrayList<BSONWritable>();
BSONWritable result1 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 16.0));
BSONWritable result2 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 31.0));
BSONWritable result3 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 5.0));
BSONWritable result4 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 12.0));
BSONWritable result5 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 3.0));
BSONWritable result6 = new BSONWritable(BSONUtilities.setValue("body.scoreResults.result", 27.0));
results.add(result1);
results.add(result2);
results.add(result3);
results.add(result4);
results.add(result5);
results.add(result6);
Highest.Context context = Mockito.mock(Highest.Context.class);
PowerMockito.when(context, "write", Matchers.any(EmittableKey.class),
Matchers.any(BSONObject.class)).thenAnswer(new Answer<BSONObject>() {
@Override
public BSONObject answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
assertNotNull(args);
assertEquals(args.length, 2);
assertTrue(args[0] instanceof TenantAndIdEmittableKey);
assertTrue(args[1] instanceof BSONWritable);
TenantAndIdEmittableKey id = (TenantAndIdEmittableKey) args[0];
assertEquals(id.getIdField().toString(), "body.test.id");
assertEquals(id.getId().toString(), "MytestId");
BSONWritable e = (BSONWritable) args[1];
String val = BSONUtilities.getValue(e, "calculatedValues.assessments.State Math for Grade 5.Highest");
assertNotNull(val);
assertEquals(31.0D, Double.parseDouble(val), 0.001D);
return null;
}
});
Configuration conf = new Configuration();
conf.set(JobConfiguration.CONFIGURATION_PROPERTY, "CalculatedValue.json");
PowerMockito.when(context, "getConfiguration").thenReturn(conf);
toTest.reduce(id, results, context);
}
}
| apache-2.0 |
google/data-transfer-project | portability-transfer/src/main/java/org/datatransferproject/transfer/WorkerExtensionContext.java | 3196 | /*
* Copyright 2018 The Data Transfer Project 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.datatransferproject.transfer;
import com.google.common.base.Preconditions;
import org.datatransferproject.api.launcher.Constants.Environment;
import org.datatransferproject.api.launcher.ExtensionContext;
import org.datatransferproject.api.launcher.Flag;
import org.datatransferproject.api.launcher.Monitor;
import org.datatransferproject.api.launcher.TypeManager;
import org.datatransferproject.config.extension.SettingsExtension;
import org.datatransferproject.launcher.types.TypeManagerImpl;
import org.datatransferproject.types.transfer.auth.TokenAuthData;
import org.datatransferproject.types.transfer.auth.TokenSecretAuthData;
import org.datatransferproject.types.transfer.auth.TokensAndUrlAuthData;
import java.util.HashMap;
import java.util.Map;
/** {@link ExtensionContext} used by the transfer worker. */
public class WorkerExtensionContext implements ExtensionContext {
private final TypeManager typeManager;
private final Map<Class<?>, Object> registered = new HashMap<>();
private final SettingsExtension settingsExtension;
// Required settings
private final String cloud;
private final Environment environment;
private final Monitor monitor;
WorkerExtensionContext(SettingsExtension settingsExtension, Monitor monitor) {
this.monitor = monitor;
this.typeManager = new TypeManagerImpl();
typeManager.registerTypes(
TokenAuthData.class, TokensAndUrlAuthData.class, TokenSecretAuthData.class);
registered.put(TypeManager.class, typeManager);
this.settingsExtension = settingsExtension;
cloud = settingsExtension.getSetting("cloud", null);
Preconditions.checkNotNull(cloud, "Required setting 'cloud' is missing");
environment = Environment.valueOf(settingsExtension.getSetting("environment", null));
Preconditions.checkNotNull(environment, "Required setting 'environment' is missing");
}
@Override
public TypeManager getTypeManager() {
return typeManager;
}
@Override
public Monitor getMonitor() {
return monitor;
}
@Override
public <T> T getService(Class<T> type) {
// returns null if no instance
return type.cast(registered.get(type));
}
@Override
public <T> void registerService(Class<T> type, T service) {
registered.put(type, service);
}
@Override
public <T> T getSetting(String setting, T defaultValue) {
return settingsExtension.getSetting(setting, defaultValue);
}
@Override
@Flag
public String cloud() {
return cloud;
}
@Override
@Flag
public Environment environment() {
return environment;
}
}
| apache-2.0 |
mrtheb/flume-forgives | src/test/java/TestHTTPSource.java | 18860 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses 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.
*/
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import org.junit.Assert;
import org.apache.flume.*;
import org.apache.flume.channel.ChannelProcessor;
import org.apache.flume.channel.MemoryChannel;
import org.apache.flume.channel.ReplicatingChannelSelector;
import org.apache.flume.conf.Configurables;
import org.apache.flume.event.JSONEvent;
import org.apache.flume.source.http.HTTPSource;
import org.apache.flume.source.http.HTTPSourceConfigurationConstants;
import org.apache.flume.source.http.HTTPSourceHandler;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpOptions;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.methods.HttpTrace;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import javax.net.ssl.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.*;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import static org.fest.reflect.core.Reflection.field;
/**
*
*/
public class TestHTTPSource {
private static HTTPSource source;
private static HTTPSource httpsSource;
// private static Channel httpsChannel;
private static Channel channel;
private static int selectedPort;
private static int sslPort;
DefaultHttpClient httpClient;
HttpPost postRequest;
private static int findFreePort() throws IOException {
ServerSocket socket = new ServerSocket(0);
int port = socket.getLocalPort();
socket.close();
return port;
}
@BeforeClass
public static void setUpClass() throws Exception {
selectedPort = findFreePort();
source = new HTTPSource();
channel = new MemoryChannel();
httpsSource = new HTTPSource();
httpsSource.setName("HTTPS Source");
Context ctx = new Context();
ctx.put("capacity", "100");
Configurables.configure(channel, ctx);
List<Channel> channels = new ArrayList<Channel>(1);
channels.add(channel);
ChannelSelector rcs = new ReplicatingChannelSelector();
rcs.setChannels(channels);
source.setChannelProcessor(new ChannelProcessor(rcs));
channel.start();
httpsSource.setChannelProcessor(new ChannelProcessor(rcs));
// HTTP context
Context context = new Context();
context.put("port", String.valueOf(selectedPort));
context.put("host", "0.0.0.0");
// SSL context props
Context sslContext = new Context();
sslContext.put(HTTPSourceConfigurationConstants.SSL_ENABLED, "true");
sslPort = findFreePort();
sslContext.put(HTTPSourceConfigurationConstants.CONFIG_PORT,
String.valueOf(sslPort));
sslContext.put(HTTPSourceConfigurationConstants.SSL_KEYSTORE_PASSWORD, "password");
sslContext.put(HTTPSourceConfigurationConstants.SSL_KEYSTORE, "src/test/resources/jettykeystore");
Configurables.configure(source, context);
Configurables.configure(httpsSource, sslContext);
source.start();
httpsSource.start();
}
@AfterClass
public static void tearDownClass() throws Exception {
source.stop();
channel.stop();
httpsSource.stop();
}
@Before
public void setUp() {
httpClient = new DefaultHttpClient();
postRequest = new HttpPost("http://0.0.0.0:" + selectedPort);
}
@Test
public void testSimple() throws IOException, InterruptedException {
StringEntity input = new StringEntity("[{\"headers\":{\"a\": \"b\"},\"body\": \"random_body\"},"
+ "{\"headers\":{\"e\": \"f\"},\"body\": \"random_body2\"}]");
//if we do not set the content type to JSON, the client will use
//ISO-8859-1 as the charset. JSON standard does not support this.
input.setContentType("application/json");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
Assert.assertEquals(HttpServletResponse.SC_OK,
response.getStatusLine().getStatusCode());
Transaction tx = channel.getTransaction();
tx.begin();
Event e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals("b", e.getHeaders().get("a"));
Assert.assertEquals("random_body", new String(e.getBody(), "UTF-8"));
e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals("f", e.getHeaders().get("e"));
Assert.assertEquals("random_body2", new String(e.getBody(), "UTF-8"));
tx.commit();
tx.close();
}
@Test
public void testTrace() throws Exception {
doTestForbidden(new HttpTrace("http://0.0.0.0:" + selectedPort));
}
@Test
public void testOptions() throws Exception {
doTestForbidden(new HttpOptions("http://0.0.0.0:" + selectedPort));
}
private void doTestForbidden(HttpRequestBase request) throws Exception {
HttpResponse response = httpClient.execute(request);
Assert.assertEquals(HttpServletResponse.SC_FORBIDDEN,
response.getStatusLine().getStatusCode());
}
@Test
public void testSimpleUTF16() throws IOException, InterruptedException {
StringEntity input = new StringEntity("[{\"headers\":{\"a\": \"b\"},\"body\": \"random_body\"},"
+ "{\"headers\":{\"e\": \"f\"},\"body\": \"random_body2\"}]", "UTF-16");
input.setContentType("application/json; charset=utf-16");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
Assert.assertEquals(HttpServletResponse.SC_OK,
response.getStatusLine().getStatusCode());
Transaction tx = channel.getTransaction();
tx.begin();
Event e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals("b", e.getHeaders().get("a"));
Assert.assertEquals("random_body", new String(e.getBody(), "UTF-16"));
e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals("f", e.getHeaders().get("e"));
Assert.assertEquals("random_body2", new String(e.getBody(), "UTF-16"));
tx.commit();
tx.close();
}
@Test
public void testInvalid() throws Exception {
StringEntity input = new StringEntity("[{\"a\": \"b\",[\"d\":\"e\"],\"body\": \"random_body\"},"
+ "{\"e\": \"f\",\"body\": \"random_body2\"}]");
input.setContentType("application/json");
postRequest.setEntity(input);
HttpResponse response = httpClient.execute(postRequest);
Assert.assertEquals(HttpServletResponse.SC_BAD_REQUEST,
response.getStatusLine().getStatusCode());
}
@Test
public void testBigBatchDeserializarionUTF8() throws Exception {
testBatchWithVariousEncoding("UTF-8");
}
@Test
public void testBigBatchDeserializarionUTF16() throws Exception {
testBatchWithVariousEncoding("UTF-16");
}
@Test
public void testBigBatchDeserializarionUTF32() throws Exception {
testBatchWithVariousEncoding("UTF-32");
}
@Test
public void testSingleEvent() throws Exception {
StringEntity input = new StringEntity("[{\"headers\" : {\"a\": \"b\"},\"body\":"
+ " \"random_body\"}]");
input.setContentType("application/json");
postRequest.setEntity(input);
httpClient.execute(postRequest);
Transaction tx = channel.getTransaction();
tx.begin();
Event e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals("b", e.getHeaders().get("a"));
Assert.assertEquals("random_body", new String(e.getBody(),"UTF-8"));
tx.commit();
tx.close();
}
@Test
public void testFullChannel() throws Exception {
HttpResponse response = putWithEncoding("UTF-8", 150).response;
Assert.assertEquals(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
response.getStatusLine().getStatusCode());
}
@Test
public void testFail() throws Exception {
HTTPSourceHandler handler = field("handler").ofType(HTTPSourceHandler.class)
.in(source).get();
//Cause an exception in the source - this is equivalent to any exception
//thrown by the handler since the handler is called inside a try-catch
field("handler").ofType(HTTPSourceHandler.class).in(source).set(null);
HttpResponse response = putWithEncoding("UTF-8", 1).response;
Assert.assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
response.getStatusLine().getStatusCode());
//Set the original handler back so tests don't fail after this runs.
field("handler").ofType(HTTPSourceHandler.class).in(source).set(handler);
}
@Test
public void testHandlerThrowingException() throws Exception {
//This will cause the handler to throw an
//UnsupportedCharsetException.
HttpResponse response = putWithEncoding("ISO-8859-1", 150).response;
Assert.assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
response.getStatusLine().getStatusCode());
}
private ResultWrapper putWithEncoding(String encoding, int n)
throws Exception{
Type listType = new TypeToken<List<JSONEvent>>() {
}.getType();
List<JSONEvent> events = Lists.newArrayList();
Random rand = new Random();
for (int i = 0; i < n; i++) {
Map<String, String> input = Maps.newHashMap();
for (int j = 0; j < 10; j++) {
input.put(String.valueOf(i) + String.valueOf(j), String.valueOf(i));
}
JSONEvent e = new JSONEvent();
e.setHeaders(input);
e.setBody(String.valueOf(rand.nextGaussian()).getBytes(encoding));
events.add(e);
}
Gson gson = new Gson();
String json = gson.toJson(events, listType);
StringEntity input = new StringEntity(json);
input.setContentType("application/json; charset=" + encoding);
postRequest.setEntity(input);
HttpResponse resp = httpClient.execute(postRequest);
return new ResultWrapper(resp, events);
}
@Test
public void testHttps() throws Exception {
doTestHttps(null);
}
@Ignore("Test fails probably because of SSLv3 support being removed, not confirmed")
@Test (expected = javax.net.ssl.SSLHandshakeException.class)
public void testHttpsSSLv3() throws Exception {
doTestHttps("SSLv3");
}
public void doTestHttps(String protocol) throws Exception {
Type listType = new TypeToken<List<JSONEvent>>() {
}.getType();
List<JSONEvent> events = Lists.newArrayList();
Random rand = new Random();
for (int i = 0; i < 10; i++) {
Map<String, String> input = Maps.newHashMap();
for (int j = 0; j < 10; j++) {
input.put(String.valueOf(i) + String.valueOf(j), String.valueOf(i));
}
input.put("MsgNum", String.valueOf(i));
JSONEvent e = new JSONEvent();
e.setHeaders(input);
e.setBody(String.valueOf(rand.nextGaussian()).getBytes("UTF-8"));
events.add(e);
}
Gson gson = new Gson();
String json = gson.toJson(events, listType);
HttpsURLConnection httpsURLConnection = null;
try {
TrustManager[] trustAllCerts = {new X509TrustManager() {
@Override
public void checkClientTrusted(
java.security.cert.X509Certificate[] x509Certificates, String s)
throws CertificateException {
// noop
}
@Override
public void checkServerTrusted(
java.security.cert.X509Certificate[] x509Certificates, String s)
throws CertificateException {
// noop
}
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
}};
SSLContext sc = null;
javax.net.ssl.SSLSocketFactory factory = null;
if (System.getProperty("java.vendor").contains("IBM")) {
sc = SSLContext.getInstance("SSL_TLS");
} else {
sc = SSLContext.getInstance("SSL");
}
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
};
sc.init(null, trustAllCerts, new SecureRandom());
if(protocol != null) {
factory = new DisabledProtocolsSocketFactory(sc.getSocketFactory(), protocol);
} else {
factory = sc.getSocketFactory();
}
HttpsURLConnection.setDefaultSSLSocketFactory(factory);
HttpsURLConnection.setDefaultHostnameVerifier(
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
URL sslUrl = new URL("https://0.0.0.0:" + sslPort);
httpsURLConnection = (HttpsURLConnection) sslUrl.openConnection();
httpsURLConnection.setDoInput(true);
httpsURLConnection.setDoOutput(true);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.getOutputStream().write(json.getBytes());
int statusCode = httpsURLConnection.getResponseCode();
Assert.assertEquals(200, statusCode);
Transaction transaction = channel.getTransaction();
transaction.begin();
for(int i = 0; i < 10; i++) {
Event e = channel.take();
Assert.assertNotNull(e);
Assert.assertEquals(String.valueOf(i), e.getHeaders().get("MsgNum"));
}
transaction.commit();
transaction.close();
} finally {
httpsURLConnection.disconnect();
}
}
@Test
public void testHttpsSourceNonHttpsClient() throws Exception {
Type listType = new TypeToken<List<JSONEvent>>() {
}.getType();
List<JSONEvent> events = Lists.newArrayList();
Random rand = new Random();
for (int i = 0; i < 10; i++) {
Map<String, String> input = Maps.newHashMap();
for (int j = 0; j < 10; j++) {
input.put(String.valueOf(i) + String.valueOf(j), String.valueOf(i));
}
input.put("MsgNum", String.valueOf(i));
JSONEvent e = new JSONEvent();
e.setHeaders(input);
e.setBody(String.valueOf(rand.nextGaussian()).getBytes("UTF-8"));
events.add(e);
}
Gson gson = new Gson();
String json = gson.toJson(events, listType);
HttpURLConnection httpURLConnection = null;
try {
URL url = new URL("http://0.0.0.0:" + sslPort);
httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.getOutputStream().write(json.getBytes());
httpURLConnection.getResponseCode();
Assert.fail("HTTP Client cannot connect to HTTPS source");
} catch (Exception exception) {
Assert.assertTrue("Exception expected", true);
} finally {
httpURLConnection.disconnect();
}
}
private void takeWithEncoding(String encoding, int n, List<JSONEvent> events)
throws Exception{
Transaction tx = channel.getTransaction();
tx.begin();
Event e = null;
int i = 0;
while (true) {
e = channel.take();
if (e == null) {
break;
}
Event current = events.get(i++);
Assert.assertEquals(new String(current.getBody(), encoding),
new String(e.getBody(), encoding));
Assert.assertEquals(current.getHeaders(), e.getHeaders());
}
Assert.assertEquals(n, events.size());
tx.commit();
tx.close();
}
private void testBatchWithVariousEncoding(String encoding) throws Exception {
testBatchWithVariousEncoding(encoding, 50);
}
private void testBatchWithVariousEncoding(String encoding, int n)
throws Exception {
List<JSONEvent> events = putWithEncoding(encoding, n).events;
takeWithEncoding(encoding, n, events);
}
private class ResultWrapper {
public final HttpResponse response;
public final List<JSONEvent> events;
public ResultWrapper(HttpResponse resp, List<JSONEvent> events){
this.response = resp;
this.events = events;
}
}
private class DisabledProtocolsSocketFactory extends javax.net.ssl.SSLSocketFactory {
private final javax.net.ssl.SSLSocketFactory socketFactory;
private final String[] protocols;
DisabledProtocolsSocketFactory(javax.net.ssl.SSLSocketFactory factory, String protocol) {
this.socketFactory = factory;
protocols = new String[1];
protocols[0] = protocol;
}
@Override
public String[] getDefaultCipherSuites() {
return socketFactory.getDefaultCipherSuites();
}
@Override
public String[] getSupportedCipherSuites() {
return socketFactory.getSupportedCipherSuites();
}
@Override
public Socket createSocket(Socket socket, String s, int i, boolean b)
throws IOException {
SSLSocket sc = (SSLSocket) socketFactory.createSocket(socket, s, i, b);
sc.setEnabledProtocols(protocols);
return sc;
}
@Override
public Socket createSocket(String s, int i)
throws IOException, UnknownHostException {
SSLSocket sc = (SSLSocket)socketFactory.createSocket(s, i);
sc.setEnabledProtocols(protocols);
return sc;
}
@Override
public Socket createSocket(String s, int i, InetAddress inetAddress, int i2)
throws IOException, UnknownHostException {
SSLSocket sc = (SSLSocket)socketFactory.createSocket(s, i, inetAddress,
i2);
sc.setEnabledProtocols(protocols);
return sc;
}
@Override
public Socket createSocket(InetAddress inetAddress, int i)
throws IOException {
SSLSocket sc = (SSLSocket)socketFactory.createSocket(inetAddress, i);
sc.setEnabledProtocols(protocols);
return sc;
}
@Override
public Socket createSocket(InetAddress inetAddress, int i,
InetAddress inetAddress2, int i2) throws IOException {
SSLSocket sc = (SSLSocket)socketFactory.createSocket(inetAddress, i,
inetAddress2, i2);
sc.setEnabledProtocols(protocols);
return sc;
}
}
}
| apache-2.0 |
arnost-starosta/midpoint | model/notifications-impl/src/main/java/com/evolveum/midpoint/notifications/impl/NotificationManagerImpl.java | 8364 | /*
* Copyright (c) 2010-2013 Evolveum
*
* 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.evolveum.midpoint.notifications.impl;
import com.evolveum.midpoint.notifications.api.EventHandler;
import com.evolveum.midpoint.notifications.api.NotificationFunctions;
import com.evolveum.midpoint.notifications.api.NotificationManager;
import com.evolveum.midpoint.notifications.api.events.BaseEvent;
import com.evolveum.midpoint.notifications.api.events.Event;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskManager;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EventHandlerType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* @author mederly
*/
@Component
public class NotificationManagerImpl implements NotificationManager {
private static final Trace LOGGER = TraceManager.getTrace(NotificationManager.class);
private static final String OPERATION_PROCESS_EVENT = NotificationManager.class + ".processEvent";
@Autowired
@Qualifier("cacheRepositoryService")
private transient RepositoryService cacheRepositoryService;
@Autowired
private NotificationFunctions notificationFunctions;
@Autowired
private TaskManager taskManager;
private boolean disabled = false; // for testing purposes (in order for model-intest to run more quickly)
private HashMap<Class<? extends EventHandlerType>,EventHandler> handlers = new HashMap<>();
private HashMap<String,Transport> transports = new HashMap<>();
public void registerEventHandler(Class<? extends EventHandlerType> clazz, EventHandler handler) {
LOGGER.trace("Registering event handler " + handler + " for " + clazz);
handlers.put(clazz, handler);
}
public EventHandler getEventHandler(EventHandlerType eventHandlerType) {
EventHandler handler = handlers.get(eventHandlerType.getClass());
if (handler == null) {
throw new IllegalStateException("Unknown handler for " + eventHandlerType);
} else {
return handler;
}
}
@Override
public void registerTransport(String name, Transport transport) {
LOGGER.trace("Registering notification transport {} under name {}", transport, name);
transports.put(name, transport);
}
// accepts name:subname (e.g. dummy:accounts) - a primitive form of passing parameters (will be enhanced/replaced in the future)
@Override
public Transport getTransport(String name) {
String key = name.split(":")[0];
Transport transport = transports.get(key);
if (transport == null) {
throw new IllegalStateException("Unknown transport named " + key);
} else {
return transport;
}
}
public void processEvent(@Nullable Event event) {
Task task = taskManager.createTaskInstance(OPERATION_PROCESS_EVENT);
processEvent(event, task, task.getResult());
}
public void processEvent(@Nullable Event event, Task task, OperationResult result) {
if (event == null) {
return;
}
if (event instanceof BaseEvent) {
((BaseEvent) event).setNotificationFunctions(notificationFunctions);
}
LOGGER.trace("NotificationManager processing event:\n{}", event.debugDumpLazily(1));
if (event.getAdHocHandler() != null) {
processEvent(event, event.getAdHocHandler(), task, result);
}
boolean errorIfNotFound = !SchemaConstants.CHANNEL_GUI_INIT_URI.equals(task.getChannel());
SystemConfigurationType systemConfigurationType = NotificationFunctionsImpl
.getSystemConfiguration(cacheRepositoryService, errorIfNotFound, result);
if (systemConfigurationType == null) { // something really wrong happened (or we are doing initial import of objects)
return;
}
// boolean specificSecurityPoliciesDefined = false;
// if (systemConfigurationType.getGlobalSecurityPolicyRef() != null) {
//
// SecurityPolicyType securityPolicyType = NotificationFuctionsImpl.getSecurityPolicyConfiguration(systemConfigurationType.getGlobalSecurityPolicyRef(), cacheRepositoryService, result);
// if (securityPolicyType != null && securityPolicyType.getAuthentication() != null) {
//
// for (MailAuthenticationPolicyType mailPolicy : securityPolicyType.getAuthentication().getMailAuthentication()) {
// NotificationConfigurationType notificationConfigurationType = mailPolicy.getNotificationConfiguration();
// if (notificationConfigurationType != null) {
// specificSecurityPoliciesDefined = true;
// processNotifications(notificationConfigurationType, event, task, result);
// }
// }
//
// for (SmsAuthenticationPolicyType mailPolicy : securityPolicyType.getAuthentication().getSmsAuthentication()) {
// NotificationConfigurationType notificationConfigurationType = mailPolicy.getNotificationConfiguration();
// if (notificationConfigurationType != null) {
// specificSecurityPoliciesDefined = true;
// processNotifications(notificationConfigurationType, event, task, result);
// }
// }
//
// return;
// }
// }
//
// if (specificSecurityPoliciesDefined) {
// LOGGER.trace("Specific policy for notifier set in security configuration, skupping notifiers defined in system configuration.");
// return;
// }
if (systemConfigurationType.getNotificationConfiguration() == null) {
LOGGER.trace("No notification configuration in repository, finished event processing.");
return;
}
NotificationConfigurationType notificationConfigurationType = systemConfigurationType.getNotificationConfiguration();
processNotifications(notificationConfigurationType, event, task, result);
LOGGER.trace("NotificationManager successfully processed event {} ({} top level handler(s))", event, notificationConfigurationType.getHandler().size());
}
private void processNotifications(NotificationConfigurationType notificationConfigurationType, Event event, Task task, OperationResult result){
for (EventHandlerType eventHandlerType : notificationConfigurationType.getHandler()) {
processEvent(event, eventHandlerType, task, result);
}
}
public boolean processEvent(Event event, EventHandlerType eventHandlerType, Task task, OperationResult result) {
try {
return getEventHandler(eventHandlerType).processEvent(event, eventHandlerType, this, task, result);
} catch (SchemaException e) {
LoggingUtils.logException(LOGGER, "Event couldn't be processed; event = {}", e, event);
return true; // continue if you can
}
}
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
}
| apache-2.0 |
MaDaPHaKa/Orient-object | object/src/main/java/com/orientechnologies/orient/object/db/graph/OGraphVertex.java | 14760 | /*
* Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com)
*
* 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.orientechnologies.orient.object.db.graph;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.orientechnologies.orient.core.annotation.OAfterDeserialization;
import com.orientechnologies.orient.core.db.graph.OGraphDatabase;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.exception.OGraphException;
import com.orientechnologies.orient.core.record.ORecord;
import com.orientechnologies.orient.core.record.impl.ODocument;
import com.orientechnologies.orient.core.type.ODocumentWrapper;
/**
* GraphDB Vertex class. It represent the vertex (or node) in the graph. The Vertex can have custom properties. You can read/write
* them using respectively get/set methods. The Vertex can be connected to other Vertexes using edges. The Vertex keeps the edges
* separated: "inEdges" for the incoming edges and "outEdges" for the outgoing edges.
*
* @see OGraphEdge
*/
public class OGraphVertex extends OGraphElement implements Cloneable {
private SoftReference<Set<OGraphEdge>> in;
private SoftReference<Set<OGraphEdge>> out;
public OGraphVertex(final ODatabaseGraphTx iDatabase) {
super(iDatabase, OGraphDatabase.VERTEX_CLASS_NAME);
}
public OGraphVertex(final ODatabaseGraphTx iDatabase, final String iClassName) {
super(iDatabase, iClassName != null ? iClassName : OGraphDatabase.VERTEX_CLASS_NAME);
}
public OGraphVertex(final ODatabaseGraphTx iDatabase, final ODocument iDocument) {
super(iDatabase, iDocument);
}
public OGraphVertex(final ODatabaseGraphTx iDatabase, final ODocument iDocument, final String iFetchPlan) {
super(iDatabase, iDocument);
}
@SuppressWarnings("unchecked")
@Override
public <RET extends ODocumentWrapper> RET save() {
super.save();
if (database != null)
database.registerUserObject(this, document);
return (RET) this;
}
@Override
public OGraphVertex clone() {
return new OGraphVertex(database, document);
}
@Override
@OAfterDeserialization
public void fromStream(final ODocument iDocument) {
super.fromStream(iDocument);
document.setTrackingChanges(false);
in = out = null;
}
/**
* Create a link between the current vertex and the target one. The link is of type iClassName.
*
* @param iTargetVertex
* Target vertex where to create the connection
* @param iClassName
* The name of the class to use for the Edge
* @return The new edge created
*/
@SuppressWarnings("unchecked")
public OGraphEdge link(final OGraphVertex iTargetVertex, final String iClassName) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
// CREATE THE EDGE BETWEEN ME AND THE TARGET
final OGraphEdge edge = new OGraphEdge(database, iClassName, this, iTargetVertex);
getOutEdges().add(edge);
Set<ODocument> recordEdges = ((Set<ODocument>) document.field(OGraphDatabase.VERTEX_FIELD_OUT));
if (recordEdges == null) {
recordEdges = new HashSet<ODocument>();
document.field(OGraphDatabase.VERTEX_FIELD_OUT, recordEdges);
}
recordEdges.add(edge.getDocument());
document.setDirty();
// INSERT INTO THE INGOING EDGES OF TARGET
iTargetVertex.getInEdges().add(edge);
recordEdges = ((Set<ODocument>) iTargetVertex.getDocument().field(OGraphDatabase.VERTEX_FIELD_IN));
if (recordEdges == null) {
recordEdges = new HashSet<ODocument>();
iTargetVertex.getDocument().field(OGraphDatabase.VERTEX_FIELD_IN, recordEdges);
}
recordEdges.add(edge.getDocument());
iTargetVertex.getDocument().setDirty();
return edge;
}
/**
* Create a link between the current vertex and the target one.
*
* @param iTargetVertex
* Target vertex where to create the connection
* @return The new edge created
*/
public OGraphEdge link(final OGraphVertex iTargetVertex) {
return link(iTargetVertex, null);
}
/**
* Remove the link between the current vertex and the target one.
*
* @param iTargetVertex
* Target vertex where to remove the connection
* @return Current vertex (useful for fluent calls)
*/
public OGraphVertex unlink(final OGraphVertex iTargetVertex) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
unlink(database, document, iTargetVertex.getDocument());
return this;
}
/**
* Returns true if the vertex has at least one incoming edge, otherwise false.
*/
public boolean hasInEdges() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);
return docs != null && !docs.isEmpty();
}
/**
* Returns true if the vertex has at least one outgoing edge, otherwise false.
*/
public boolean hasOutEdges() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_OUT);
return docs != null && !docs.isEmpty();
}
/**
* Returns the incoming edges of current node. If there are no edged, then an empty set is returned.
*/
public Set<OGraphEdge> getInEdges() {
return getInEdges(null);
}
/**
* Returns the incoming edges of current node having the requested label. If there are no edged, then an empty set is returned.
*/
public Set<OGraphEdge> getInEdges(final String iEdgeLabel) {
Set<OGraphEdge> temp = in != null ? in.get() : null;
if (temp == null) {
if (iEdgeLabel == null)
temp = new HashSet<OGraphEdge>();
in = new SoftReference<Set<OGraphEdge>>(temp);
final Set<Object> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);
if (docs != null) {
// TRANSFORM ALL THE ARCS
for (Object o : docs) {
final ODocument doc = (ODocument) ((OIdentifiable) o).getRecord();
if (iEdgeLabel != null && !iEdgeLabel.equals(doc.field(OGraphDatabase.LABEL)))
continue;
temp.add((OGraphEdge) database.getUserObjectByRecord(doc, null));
}
}
} else if (iEdgeLabel != null) {
// FILTER THE EXISTENT COLLECTION
HashSet<OGraphEdge> filtered = new HashSet<OGraphEdge>();
for (OGraphEdge e : temp) {
if (iEdgeLabel.equals(e.getLabel()))
filtered.add(e);
}
temp = filtered;
}
return temp;
}
/**
* Returns all the outgoing edges of current node. If there are no edged, then an empty set is returned.
*/
public Set<OGraphEdge> getOutEdges() {
return getOutEdges(null);
}
/**
* Returns the outgoing edge of current node having the requested label. If there are no edged, then an empty set is returned.
*/
public Set<OGraphEdge> getOutEdges(final String iEdgeLabel) {
Set<OGraphEdge> temp = out != null ? out.get() : null;
if (temp == null) {
temp = new HashSet<OGraphEdge>();
if (iEdgeLabel == null)
out = new SoftReference<Set<OGraphEdge>>(temp);
final Set<Object> docs = document.field(OGraphDatabase.VERTEX_FIELD_OUT);
if (docs != null) {
// TRANSFORM ALL THE ARCS
for (Object o : docs) {
final ODocument doc = (ODocument) ((OIdentifiable) o).getRecord();
if (iEdgeLabel != null && !iEdgeLabel.equals(doc.field(OGraphDatabase.LABEL)))
continue;
temp.add((OGraphEdge) database.getUserObjectByRecord(doc, null));
}
}
} else if (iEdgeLabel != null) {
// FILTER THE EXISTENT COLLECTION
HashSet<OGraphEdge> filtered = new HashSet<OGraphEdge>();
for (OGraphEdge e : temp) {
if (iEdgeLabel.equals(e.getLabel()))
filtered.add(e);
}
temp = filtered;
}
return temp;
}
/**
* Returns the set of Vertexes from the outgoing edges. It avoids to unmarshall edges.
*/
@SuppressWarnings("unchecked")
public Set<OGraphVertex> browseOutEdgesVertexes() {
final Set<OGraphVertex> resultset = new HashSet<OGraphVertex>();
Set<OGraphEdge> temp = out != null ? out.get() : null;
if (temp == null) {
final Set<OIdentifiable> docEdges = (Set<OIdentifiable>) document.field(OGraphDatabase.VERTEX_FIELD_OUT);
// TRANSFORM ALL THE EDGES
if (docEdges != null)
for (OIdentifiable d : docEdges) {
resultset.add((OGraphVertex) database.getUserObjectByRecord(
(ODocument) ((ODocument) d.getRecord()).field(OGraphDatabase.EDGE_FIELD_IN), null));
}
} else {
for (OGraphEdge edge : temp) {
resultset.add(edge.getIn());
}
}
return resultset;
}
/**
* Returns the set of Vertexes from the incoming edges. It avoids to unmarshall edges.
*/
@SuppressWarnings("unchecked")
public Set<OGraphVertex> browseInEdgesVertexes() {
final Set<OGraphVertex> resultset = new HashSet<OGraphVertex>();
Set<OGraphEdge> temp = in != null ? in.get() : null;
if (temp == null) {
final Set<ODocument> docEdges = (Set<ODocument>) document.field(OGraphDatabase.VERTEX_FIELD_IN);
// TRANSFORM ALL THE EDGES
if (docEdges != null)
for (ODocument d : docEdges) {
resultset.add((OGraphVertex) database.getUserObjectByRecord((ODocument) d.field(OGraphDatabase.EDGE_FIELD_OUT), null));
}
} else {
for (OGraphEdge edge : temp) {
resultset.add(edge.getOut());
}
}
return resultset;
}
public ODocument findInVertex(final OGraphVertex iVertexDocument) {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);
if (docs == null || docs.size() == 0)
return null;
for (ODocument d : docs) {
if (d.<ODocument> field(OGraphDatabase.EDGE_FIELD_IN).equals(iVertexDocument.getDocument()))
return d;
}
return null;
}
public ODocument findOutVertex(final OGraphVertex iVertexDocument) {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_OUT);
if (docs == null || docs.size() == 0)
return null;
for (ODocument d : docs) {
if (d.<ODocument> field(OGraphDatabase.EDGE_FIELD_OUT).equals(iVertexDocument.getDocument()))
return d;
}
return null;
}
public int getInEdgeCount() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);
return docs == null ? 0 : docs.size();
}
public int getOutEdgeCount() {
final Set<ODocument> docs = document.field(OGraphDatabase.VERTEX_FIELD_OUT);
return docs == null ? 0 : docs.size();
}
@Override
public void reset() {
document = null;
in = null;
out = null;
}
@SuppressWarnings("unchecked")
@Override
public void delete() {
// DELETE ALL THE IN-OUT EDGES FROM RAM
if (in != null) {
Set<OGraphEdge> set = in.get();
if (set != null)
set.clear();
}
in = null;
if (out != null) {
Set<OGraphEdge> set = out.get();
if (set != null)
set.clear();
}
out = null;
Set<ODocument> docs = (Set<ODocument>) document.field(OGraphDatabase.VERTEX_FIELD_IN);
if (docs != null)
for (ODocument doc : docs.toArray(new ODocument[docs.size()]))
OGraphEdge.delete(database, doc);
docs = (Set<ODocument>) document.field(OGraphDatabase.VERTEX_FIELD_OUT);
if (docs != null)
for (ODocument doc : docs.toArray(new ODocument[docs.size()]))
OGraphEdge.delete(database, doc);
database.unregisterPojo(this, document);
document.delete();
document = null;
}
public void onEvent(final ORecord<?> iDocument, final EVENT iEvent) {
if (iEvent == EVENT.UNLOAD) {
out = null;
in = null;
}
}
/**
* Unlinks all the edges between iSourceVertex and iTargetVertex
*
* @param iDatabase
* @param iSourceVertex
* @param iTargetVertex
*/
public static void unlink(final ODatabaseGraphTx iDatabase, final ODocument iSourceVertex, final ODocument iTargetVertex) {
if (iTargetVertex == null)
throw new IllegalArgumentException("Missed the target vertex");
if (iDatabase.existsUserObjectByRID(iSourceVertex.getIdentity())) {
// WORK ALSO WITH IN MEMORY OBJECTS
final OGraphVertex vertex = (OGraphVertex) iDatabase.getUserObjectByRecord(iSourceVertex, null);
// REMOVE THE EDGE OBJECT
if (vertex.out != null) {
final Set<OGraphEdge> obj = vertex.out.get();
if (obj != null)
for (OGraphEdge e : obj)
if (e.getIn().getDocument().equals(iTargetVertex))
obj.remove(e);
}
}
if (iDatabase.existsUserObjectByRID(iTargetVertex.getIdentity())) {
// WORK ALSO WITH IN MEMORY OBJECTS
final OGraphVertex vertex = (OGraphVertex) iDatabase.getUserObjectByRecord(iTargetVertex, null);
// REMOVE THE EDGE OBJECT FROM THE TARGET VERTEX
if (vertex.in != null) {
final Set<OGraphEdge> obj = vertex.in.get();
if (obj != null)
for (OGraphEdge e : obj)
if (e.getOut().getDocument().equals(iSourceVertex))
obj.remove(e);
}
}
final List<ODocument> edges2Remove = new ArrayList<ODocument>();
// REMOVE THE EDGE DOCUMENT
ODocument edge = null;
Set<ODocument> docs = iSourceVertex.field(OGraphDatabase.VERTEX_FIELD_OUT);
if (docs != null) {
// USE A TEMP ARRAY TO AVOID CONCURRENT MODIFICATION TO THE ITERATOR
for (OIdentifiable d : docs) {
final ODocument doc = (ODocument) d.getRecord();
if (doc.field(OGraphDatabase.EDGE_FIELD_IN).equals(iTargetVertex)) {
edges2Remove.add(doc);
edge = doc;
}
}
for (ODocument d : edges2Remove)
docs.remove(d);
}
if (edge == null)
throw new OGraphException("Edge not found between the ougoing edges");
iSourceVertex.setDirty();
iSourceVertex.save();
docs = iTargetVertex.field(OGraphDatabase.VERTEX_FIELD_IN);
// REMOVE THE EDGE DOCUMENT FROM THE TARGET VERTEX
if (docs != null) {
edges2Remove.clear();
for (OIdentifiable d : docs) {
final ODocument doc = (ODocument) d.getRecord();
if (doc.field(OGraphDatabase.EDGE_FIELD_IN).equals(iTargetVertex))
edges2Remove.add(doc);
}
for (ODocument d : edges2Remove)
docs.remove(d);
}
iTargetVertex.setDirty();
iTargetVertex.save();
edge.delete();
}
}
| apache-2.0 |
jexp/idea2 | plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/GrConstructorInvocationImpl.java | 6166 | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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.jetbrains.plugins.groovy.lang.psi.impl.statements;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.tree.TokenSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyResolveResult;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrConstructorInvocation;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrArgumentList;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.arguments.GrNamedArgument;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
import org.jetbrains.plugins.groovy.lang.psi.impl.GroovyPsiElementImpl;
import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
import org.jetbrains.plugins.groovy.lang.resolve.NonCodeMembersProcessor;
import org.jetbrains.plugins.groovy.lang.resolve.processors.MethodResolverProcessor;
/**
* User: Dmitry.Krasilschikov
* Date: 29.05.2007
*/
public class GrConstructorInvocationImpl extends GroovyPsiElementImpl implements GrConstructorInvocation {
public GrConstructorInvocationImpl(@NotNull ASTNode node) {
super(node);
}
public void accept(GroovyElementVisitor visitor) {
visitor.visitConstructorInvocation(this);
}
public String toString() {
return "Constructor invocation";
}
@NotNull
public GrArgumentList getArgumentList() {
return findChildByClass(GrArgumentList.class);
}
@Nullable
public GrExpression removeArgument(final int number) {
return getArgumentList().removeArgument(number);
}
public GrNamedArgument addNamedArgument(final GrNamedArgument namedArgument) throws IncorrectOperationException {
return getArgumentList().addNamedArgument(namedArgument);
}
public boolean isSuperCall() {
return findChildByType(GroovyTokenTypes.kSUPER) != null;
}
public boolean isThisCall() {
return findChildByType(GroovyTokenTypes.kTHIS) != null;
}
private static final TokenSet THIS_OR_SUPER_SET = TokenSet.create(GroovyTokenTypes.kTHIS, GroovyTokenTypes.kSUPER);
public PsiElement getThisOrSuperKeyword() {
return findChildByType(THIS_OR_SUPER_SET);
}
public GroovyResolveResult[] multiResolveConstructor() {
PsiClass clazz = getDelegatedClass();
if (clazz != null) {
PsiType[] argTypes = PsiUtil.getArgumentTypes(getFirstChild(), false, false);
PsiElementFactory factory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
PsiSubstitutor substitutor;
if (isThisCall()) {
substitutor = PsiSubstitutor.EMPTY;
} else {
GrTypeDefinition enclosing = getEnclosingClass();
assert enclosing != null;
substitutor = TypeConversionUtil.getSuperClassSubstitutor(clazz, enclosing, PsiSubstitutor.EMPTY);
}
PsiType thisType = factory.createType(clazz, substitutor);
MethodResolverProcessor processor = new MethodResolverProcessor(clazz.getName(), this, true, thisType, argTypes, PsiType.EMPTY_ARRAY);
clazz.processDeclarations(processor, ResolveState.initial().put(PsiSubstitutor.KEY, substitutor), null, this);
for (NonCodeMembersProcessor membersProcessor : NonCodeMembersProcessor.EP_NAME.getExtensions()) {
if (!membersProcessor.processNonCodeMembers(thisType, processor, this, true)) break;
}
return processor.getCandidates();
}
return GroovyResolveResult.EMPTY_ARRAY;
}
public PsiMethod resolveConstructor() {
return PsiImplUtil.extractUniqueElement(multiResolveConstructor());
}
public GroovyResolveResult resolveConstructorGenerics() {
return PsiImplUtil.extractUniqueResult(multiResolveConstructor());
}
public PsiClass getDelegatedClass() {
GrTypeDefinition typeDefinition = getEnclosingClass();
if (typeDefinition != null) {
return isThisCall() ? typeDefinition : typeDefinition.getSuperClass();
}
return null;
}
private GrTypeDefinition getEnclosingClass() {
return PsiTreeUtil.getParentOfType(this, GrTypeDefinition.class);
}
public PsiElement getElement() {
return this;
}
public TextRange getRangeInElement() {
return new TextRange(0, getThisOrSuperKeyword().getTextLength());
}
@Nullable
public PsiElement resolve() {
return resolveConstructor();
}
public String getCanonicalText() {
return getText(); //TODO
}
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
return this;
}
public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException {
return this;
}
public boolean isReferenceTo(PsiElement element) {
return element instanceof PsiMethod && ((PsiMethod)element).isConstructor() && getManager().areElementsEquivalent(element, resolve());
}
public Object[] getVariants() {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
public boolean isSoft() {
return false;
}
@Override
public PsiReference getReference() {
return this;
}
}
| apache-2.0 |
demidenko05/beige-uml | beige-uml-swing/src/main/java/org/beigesoft/uml/factory/awt/FactoryAsmTextLight.java | 3490 | package org.beigesoft.uml.factory.awt;
import java.awt.Frame;
import java.awt.Graphics2D;
import java.awt.Image;
import org.beigesoft.graphic.pojo.SettingsDraw;
import org.beigesoft.graphic.pojo.Point2D;
import org.beigesoft.graphic.service.ISrvDraw;
import org.beigesoft.service.ISrvI18n;
import org.beigesoft.ui.service.ISrvDialog;
import org.beigesoft.uml.app.model.SettingsGraphicUml;
import org.beigesoft.uml.assembly.AsmElementUmlInteractive;
import org.beigesoft.uml.assembly.IAsmElementUmlInteractive;
import org.beigesoft.uml.factory.IFactoryAsmElementUml;
import org.beigesoft.uml.factory.swing.FactoryEditorText;
import org.beigesoft.uml.pojo.TextUml;
import org.beigesoft.uml.service.graphic.SrvGraphicText;
import org.beigesoft.uml.service.interactive.SrvInteractiveText;
import org.beigesoft.uml.service.persist.xmllight.FileAndWriter;
import org.beigesoft.uml.service.persist.xmllight.SrvPersistLightXmlText;
public class FactoryAsmTextLight implements IFactoryAsmElementUml<IAsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter>, Graphics2D, SettingsDraw, FileAndWriter, TextUml> {
private final ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv;
private final SettingsGraphicUml graphicSettings;
private final FactoryEditorText factoryEditorTextUml;
private SrvGraphicText<TextUml, Graphics2D, SettingsDraw> graphicTextumlSrv;
private SrvPersistLightXmlText<TextUml> persistXmlTextUmlSrv;
private SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame> interactiveTextUmlSrv;
public FactoryAsmTextLight(ISrvDraw<Graphics2D, SettingsDraw, Image> drawSrv,
ISrvI18n i18nSrv, ISrvDialog<Frame> dialogSrv, SettingsGraphicUml graphicSettings,
Frame frameMain) {
this.drawSrv = drawSrv;
this.graphicSettings = graphicSettings;
this.factoryEditorTextUml = new FactoryEditorText(i18nSrv, dialogSrv, graphicSettings, frameMain);
}
@Override
public synchronized AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter> createAsmElementUml() {
TextUml textUml = new TextUml();
textUml.setPointStart(new Point2D(1, 1));
SettingsDraw drawSettings = new SettingsDraw();
AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter> asmTextUml =
new AsmElementUmlInteractive<TextUml, Graphics2D, SettingsDraw, FileAndWriter>(textUml, drawSettings, lazyGetGraphicTextUmlSrv(), lazyGetPersistXmlTextUmlSrv(),
lazyGetInteractiveTextUmlSrv());
return asmTextUml;
}
public synchronized SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame> lazyGetInteractiveTextUmlSrv() {
if(interactiveTextUmlSrv == null) {
interactiveTextUmlSrv = new SrvInteractiveText<TextUml, Graphics2D, SettingsDraw, Frame>
(lazyGetGraphicTextUmlSrv(), factoryEditorTextUml);
}
return interactiveTextUmlSrv;
}
public synchronized SrvPersistLightXmlText<TextUml> lazyGetPersistXmlTextUmlSrv() {
if(persistXmlTextUmlSrv == null) {
persistXmlTextUmlSrv = new SrvPersistLightXmlText<TextUml>();
}
return persistXmlTextUmlSrv;
}
public synchronized SrvGraphicText<TextUml, Graphics2D, SettingsDraw> lazyGetGraphicTextUmlSrv() {
if(graphicTextumlSrv == null) {
graphicTextumlSrv = new SrvGraphicText<TextUml, Graphics2D, SettingsDraw>(drawSrv, graphicSettings);
}
return graphicTextumlSrv;
}
public FactoryEditorText getFactoryEditorTextUml() {
return factoryEditorTextUml;
}
}
| apache-2.0 |
AssafMashiah/assafmashiah-yaml | src/test/java/org/yaml/snakeyaml/issues/issue64/MethodDesc.java | 1240 | /**
* Copyright (c) 2008-2011, http://www.snakeyaml.org
*
* 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.yaml.snakeyaml.issues.issue64;
import java.util.List;
public class MethodDesc {
private String name;
private List<Class<?>> argTypes;
public MethodDesc() {
}
public MethodDesc(String name, List<Class<?>> argTypes) {
this.name = name;
this.argTypes = argTypes;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Class<?>> getArgTypes() {
return argTypes;
}
public void setArgTypes(List<Class<?>> argTypes) {
this.argTypes = argTypes;
}
}
| apache-2.0 |
blademainer/common_utils | common_helper/src/main/java/com/xiongyingqi/util/Base64.java | 30567 |
package com.xiongyingqi.util;
public class Base64 {
/* ******** P U B L I C F I E L D S ******** */
public final static int NO_OPTIONS = 0;
public final static int ENCODE = 1;
public final static int DECODE = 0;
public final static int GZIP = 2;
public final static int DONT_BREAK_LINES = 8;
/* ******** P R I V A T E F I E L D S ******** */
private final static int MAX_LINE_LENGTH = 76;
private final static byte EQUALS_SIGN = (byte) '=';
private final static byte NEW_LINE = (byte) '\n';
private final static String PREFERRED_ENCODING = "UTF-8";
private final static byte[] ALPHABET;
private final static byte[] _NATIVE_ALPHABET = /*
* May be something funny
* like EBCDIC
*/
{(byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', (byte) 'F', (byte) 'G',
(byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N',
(byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U',
(byte) 'V', (byte) 'W', (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b',
(byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', (byte) 'g', (byte) 'h', (byte) 'i',
(byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', (byte) 'p',
(byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w',
(byte) 'x', (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3',
(byte) '4', (byte) '5', (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) '+',
(byte) '/'};
static {
byte[] __bytes;
try {
__bytes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.getBytes(PREFERRED_ENCODING);
} // end try
catch (java.io.UnsupportedEncodingException use) {
__bytes = _NATIVE_ALPHABET; // Fall back to native encoding
} // end catch
ALPHABET = __bytes;
} // end static
private final static byte[] DECODABET = {-9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8
-5, -5, // Whitespace: Tab and Linefeed
-9, -9, // Decimal 11 - 12
-5, // Whitespace: Carriage Return
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 -
// 26
-9, -9, -9, -9, -9, // Decimal 27 - 31
-5, // Whitespace: Space
-9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42
62, // Plus sign at decimal 43
-9, -9, -9, // Decimal 44 - 46
63, // Slash at decimal 47
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine
-9, -9, -9, // Decimal 58 - 60
-1, // Equals sign at decimal 61
-9, -9, -9, // Decimal 62 - 64
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through
// 'N'
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O'
// through 'Z'
-9, -9, -9, -9, -9, -9, // Decimal 91 - 96
26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a'
// through 'm'
39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n'
// through 'z'
-9, -9, -9, -9 // Decimal 123 - 126
/*
* ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 127 - 139
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 140 - 152
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 153 - 165
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 166 - 178
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 179 - 191
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 192 - 204
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 205 - 217
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 218 - 230
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 231 - 243
* -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9 // Decimal 244 - 255
*/
};
private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in
// encoding
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in
// encoding
private Base64() {
}
/* ******** E N C O D I N G M E T H O D S ******** */
private static byte[] encode3to4(byte[] b4, byte[] threeBytes, int numSigBytes) {
encode3to4(threeBytes, 0, numSigBytes, b4, 0);
return b4;
} // end encode3to4
private static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes,
byte[] destination, int destOffset) {
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes
// --------| || || || | Six bit groups to index ALPHABET
// >>18 >>12 >> 6 >> 0 Right shift necessary
// 0x3f 0x3f 0x3f Additional AND
// Create buffer with zero-padding if there are only one or two
// significant bytes passed in the array.
// We have to shift left 24 in order to flush out the 1's that appear
// when Java treats a value as negative that is cast from a byte to an
// int.
int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0)
| (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0)
| (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0);
switch (numSigBytes) {
case 3:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f];
return destination;
case 2:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f];
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
case 1:
destination[destOffset] = ALPHABET[(inBuff >>> 18)];
destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f];
destination[destOffset + 2] = EQUALS_SIGN;
destination[destOffset + 3] = EQUALS_SIGN;
return destination;
default:
return destination;
} // end switch
} // end encode3to4
public static String encodeObject(java.io.Serializable serializableObject) {
return encodeObject(serializableObject, NO_OPTIONS);
} // end encodeObject
public static String encodeObject(java.io.Serializable serializableObject, int options) {
// Streams
java.io.ByteArrayOutputStream baos = null;
java.io.OutputStream b64os = null;
java.io.ObjectOutputStream oos = null;
java.util.zip.GZIPOutputStream gzos = null;
// Isolate options
int gzip = (options & GZIP);
int dontBreakLines = (options & DONT_BREAK_LINES);
try {
// ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
baos = new java.io.ByteArrayOutputStream();
b64os = new OutputStream(baos, ENCODE | dontBreakLines);
// GZip?
if (gzip == GZIP) {
gzos = new java.util.zip.GZIPOutputStream(b64os);
oos = new java.io.ObjectOutputStream(gzos);
} // end if: gzip
else
oos = new java.io.ObjectOutputStream(b64os);
oos.writeObject(serializableObject);
} // end try
catch (java.io.IOException e) {
return null;
} // end catch
finally {
try {
oos.close();
} catch (Exception e) {
// Nothing to do
}
try {
gzos.close();
} catch (Exception e) {
// Nothing to do
}
try {
b64os.close();
} catch (Exception e) {
// Nothing to do
}
try {
baos.close();
} catch (Exception e) {
// Nothing to do
}
} // end finally
// Return value according to relevant encoding.
try {
return new String(baos.toByteArray(), PREFERRED_ENCODING);
} // end try
catch (java.io.UnsupportedEncodingException uue) {
return new String(baos.toByteArray());
} // end catch
} // end encode
public static String encodeBytes(byte[] source) {
return encodeBytes(source, 0, source.length, NO_OPTIONS);
} // end encodeBytes
public static String encodeBytes(byte[] source, int options) {
return encodeBytes(source, 0, source.length, options);
} // end encodeBytes
public static String encodeBytes(byte[] source, int off, int len) {
return encodeBytes(source, off, len, NO_OPTIONS);
} // end encodeBytes
public static String encodeBytes(byte[] source, int off, int len, int options) {
// Isolate options
int dontBreakLines = (options & DONT_BREAK_LINES);
int gzip = (options & GZIP);
// Compress?
if (gzip == GZIP) {
java.io.ByteArrayOutputStream baos = null;
java.util.zip.GZIPOutputStream gzos = null;
OutputStream b64os = null;
try {
// GZip -> Base64 -> ByteArray
baos = new java.io.ByteArrayOutputStream();
b64os = new OutputStream(baos, ENCODE | dontBreakLines);
gzos = new java.util.zip.GZIPOutputStream(b64os);
gzos.write(source, off, len);
gzos.close();
} // end try
catch (java.io.IOException e) {
return null;
} // end catch
finally {
try {
gzos.close();
} catch (Exception e) {
// Nothing to do
}
try {
b64os.close();
} catch (Exception e) {
// Nothing to do
}
try {
baos.close();
} catch (Exception e) {
// Nothing to do
}
} // end finally
// Return value according to relevant encoding.
try {
return new String(baos.toByteArray(), PREFERRED_ENCODING);
} // end try
catch (java.io.UnsupportedEncodingException uue) {
return new String(baos.toByteArray());
} // end catch
} // end if: compress
// Else, don't compress. Better not to use streams at all then.
else {
// Convert option to boolean in way that code likes it.
boolean breakLines = dontBreakLines == 0;
int len43 = len * 4 / 3;
byte[] outBuff = new byte[(len43) // Main 4:3
+ ((len % 3) > 0 ? 4 : 0) // Account for padding
+ (breakLines ? (len43 / MAX_LINE_LENGTH) : 0)]; // New
// lines
int d = 0;
int e = 0;
int len2 = len - 2;
int lineLength = 0;
for (; d < len2; d += 3, e += 4) {
encode3to4(source, d + off, 3, outBuff, e);
lineLength += 4;
if (breakLines && lineLength == MAX_LINE_LENGTH) {
outBuff[e + 4] = NEW_LINE;
e++;
lineLength = 0;
} // end if: end of line
} // en dfor: each piece of array
if (d < len) {
encode3to4(source, d + off, len - d, outBuff, e);
e += 4;
} // end if: some padding needed
// Return value according to relevant encoding.
try {
return new String(outBuff, 0, e, PREFERRED_ENCODING);
} // end try
catch (java.io.UnsupportedEncodingException uue) {
return new String(outBuff, 0, e);
} // end catch
} // end else: don't compress
} // end encodeBytes
/* ******** D E C O D I N G M E T H O D S ******** */
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) {
// Example: Dk==
if (source[srcOffset + 2] == EQUALS_SIGN) {
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6
// )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
| ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12);
destination[destOffset] = (byte) (outBuff >>> 16);
return 1;
}
// Example: DkL=
else if (source[srcOffset + 3] == EQUALS_SIGN) {
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6
// )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
| ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12)
| ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6);
destination[destOffset] = (byte) (outBuff >>> 16);
destination[destOffset + 1] = (byte) (outBuff >>> 8);
return 2;
}
// Example: DkLE
else {
try {
// Two ways to do the same thing. Don't know which way I like
// best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 )
// >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18)
| ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12)
| ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6)
| ((DECODABET[source[srcOffset + 3]] & 0xFF));
destination[destOffset] = (byte) (outBuff >> 16);
destination[destOffset + 1] = (byte) (outBuff >> 8);
destination[destOffset + 2] = (byte) (outBuff);
return 3;
} catch (Exception e) {
return -1;
} // e nd catch
}
} // end decodeToBytes
public static byte[] decode(byte[] source, int off, int len) {
int len34 = len * 3 / 4;
byte[] outBuff = new byte[len34]; // Upper limit on size of output
int outBuffPosn = 0;
byte[] b4 = new byte[4];
int b4Posn = 0;
int i;
byte sbiCrop;
byte sbiDecode;
for (i = off; i < off + len; i++) {
sbiCrop = (byte) (source[i] & 0x7f); // Only the low seven bits
sbiDecode = DECODABET[sbiCrop];
if (sbiDecode >= WHITE_SPACE_ENC) // White space, Equals sign or
// better
{
if (sbiDecode >= EQUALS_SIGN_ENC) {
b4[b4Posn++] = sbiCrop;
if (b4Posn > 3) {
outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn);
b4Posn = 0;
// If that was the equals sign, break out of 'for' loop
if (sbiCrop == EQUALS_SIGN)
break;
} // end if: quartet built
} // end if: equals sign or better
} // end if: white space, equals sign or better
else {
System.err.println("Bad Base64 input character at " + i + ": " + source[i]
+ "(decimal)");
return null;
} // end else:
} // each input character
byte[] out = new byte[outBuffPosn];
System.arraycopy(outBuff, 0, out, 0, outBuffPosn);
return out;
} // end decode
public static byte[] decode(String s) {
byte[] bytes;
try {
bytes = s.getBytes(PREFERRED_ENCODING);
} // end try
catch (java.io.UnsupportedEncodingException uee) {
bytes = s.getBytes();
} // end catch
// </change>
// Decode
bytes = decode(bytes, 0, bytes.length);
// Check to see if it's gzip-compressed
// GZIP Magic Two-Byte Number: 0x8b1f (35615)
if (bytes.length >= 2) {
int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
if (bytes != null && // In case decoding returned null
bytes.length >= 4 && // Don't want to get
// ArrayIndexOutOfBounds exception
java.util.zip.GZIPInputStream.GZIP_MAGIC == head) {
java.io.ByteArrayInputStream bais = null;
java.util.zip.GZIPInputStream gzis = null;
java.io.ByteArrayOutputStream baos = null;
byte[] buffer = new byte[2048];
int length;
try {
baos = new java.io.ByteArrayOutputStream();
bais = new java.io.ByteArrayInputStream(bytes);
gzis = new java.util.zip.GZIPInputStream(bais);
while ((length = gzis.read(buffer)) >= 0) {
baos.write(buffer, 0, length);
} // end while: reading input
// No error? Get new bytes.
bytes = baos.toByteArray();
} // end try
catch (java.io.IOException e) {
// Just return originally-decoded bytes
} // end catch
finally {
try {
baos.close();
} catch (Exception e) {
// Nothing to do
}
try {
gzis.close();
} catch (Exception e) {
// Nothing to do
}
try {
bais.close();
} catch (Exception e) {
// Nothing to do
}
} // end finally
} // end if: gzipped
} // end if: bytes.length >= 2
return bytes;
} // end decode
public static Object decodeToObject(String encodedObject) {
// Decode and gunzip if necessary
byte[] objBytes = decode(encodedObject);
java.io.ByteArrayInputStream bais = null;
java.io.ObjectInputStream ois = null;
Object obj = null;
try {
bais = new java.io.ByteArrayInputStream(objBytes);
ois = new java.io.ObjectInputStream(bais);
obj = ois.readObject();
} // end try
catch (java.io.IOException e) {
obj = null;
} // end catch
catch (ClassNotFoundException e) {
obj = null;
} // end catch
finally {
try {
if (bais != null)
bais.close();
} catch (Exception e) {
// Nothing to do
}
try {
if (ois != null)
ois.close();
} catch (Exception e) {
// Nothing to do
}
} // end finally
return obj;
} // end decodeObject
/* ******** I N N E R C L A S S I N P U T S T R E A M ******** */
public static class InputStream extends java.io.FilterInputStream {
private boolean encode; // Encoding or decoding
private int position; // Current position in the buffer
private byte[] buffer; // Small buffer holding converted data
private int bufferLength; // Length of buffer (3 or 4)
private int numSigBytes; // Number of meaningful bytes in the buffer
private int lineLength;
private boolean breakLines; // Break lines at less than 80 characters
public InputStream(java.io.InputStream in) {
this(in, DECODE);
} // end constructor
public InputStream(java.io.InputStream in, int options) {
super(in);
this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
this.encode = (options & ENCODE) == ENCODE;
this.bufferLength = encode ? 4 : 3;
this.buffer = new byte[bufferLength];
this.position = -1;
this.lineLength = 0;
} // end constructor
public int read() throws java.io.IOException {
// Do we need to get data?
if (position < 0) {
if (encode) {
byte[] b3 = new byte[3];
int numBinaryBytes = 0;
for (int i = 0; i < 3; i++) {
try {
int b = in.read();
// If end of stream, b is -1.
if (b >= 0) {
b3[i] = (byte) b;
numBinaryBytes++;
} // end if: not end of stream
} // end try: read
catch (java.io.IOException e) {
// Only a problem if we got no data at all.
if (i == 0)
throw e;
} // end catch
} // end for: each needed input byte
if (numBinaryBytes > 0) {
encode3to4(b3, 0, numBinaryBytes, buffer, 0);
position = 0;
numSigBytes = 4;
} // end if: got data
else {
return -1;
} // end else
} // end if: encoding
// Else decoding
else {
byte[] b4 = new byte[4];
int i;
for (i = 0; i < 4; i++) {
// Read four "meaningful" bytes:
int b;
do {
b = in.read();
} while (b >= 0 && DECODABET[b & 0x7f] <= WHITE_SPACE_ENC);
if (b < 0)
break; // Reads a -1 if end of stream
b4[i] = (byte) b;
} // end for: each needed input byte
if (i == 4) {
numSigBytes = decode4to3(b4, 0, buffer, 0);
position = 0;
} // end if: got four characters
else if (i == 0) {
return -1;
} // end else if: also padded correctly
else {
// Must have broken out from above.
throw new java.io.IOException("Improperly padded Base64 input.");
} // end
} // end else: decode
} // end else: get data
// Got data?
if (position >= 0) {
// End of relevant data?
if (/* !encode && */position >= numSigBytes)
return -1;
if (encode && breakLines && lineLength >= MAX_LINE_LENGTH) {
lineLength = 0;
return '\n';
} // end if
else {
lineLength++; // This isn't important when decoding
// but throwing an extra "if" seems
// just as wasteful.
int b = buffer[position++];
if (position >= bufferLength)
position = -1;
return b & 0xFF; // This is how you "cast" a byte that's
// intended to be unsigned.
} // end else
} // end if: position >= 0
// Else error
else {
// When JDK1.4 is more accepted, use an assertion here.
throw new java.io.IOException("Error in Base64 code reading stream.");
} // end else
} // end read
public int read(byte[] dest, int off, int len) throws java.io.IOException {
int i;
int b;
for (i = 0; i < len; i++) {
b = read();
// if( b < 0 && i == 0 )
// return -1;
if (b >= 0)
dest[off + i] = (byte) b;
else if (i == 0)
return -1;
else
break; // Out of 'for' loop
} // end for: each byte read
return i;
} // end read
} // end inner class InputStream
/* ******** I N N E R C L A S S O U T P U T S T R E A M ******** */
public static class OutputStream extends java.io.FilterOutputStream {
private boolean encode;
private int position;
private byte[] buffer;
private int bufferLength;
private int lineLength;
private boolean breakLines;
private byte[] b4; // Scratch used in a few places
private boolean suspendEncoding;
public OutputStream(java.io.OutputStream out) {
this(out, ENCODE);
} // end constructor
public OutputStream(java.io.OutputStream out, int options) {
super(out);
this.breakLines = (options & DONT_BREAK_LINES) != DONT_BREAK_LINES;
this.encode = (options & ENCODE) == ENCODE;
this.bufferLength = encode ? 3 : 4;
this.buffer = new byte[bufferLength];
this.position = 0;
this.lineLength = 0;
this.suspendEncoding = false;
this.b4 = new byte[4];
} // end constructor
public void write(int theByte) throws java.io.IOException {
// Encoding suspended?
if (suspendEncoding) {
super.out.write(theByte);
return;
} // end if: supsended
// Encode?
if (encode) {
buffer[position++] = (byte) theByte;
if (position >= bufferLength) // Enough to encode.
{
out.write(encode3to4(b4, buffer, bufferLength));
lineLength += 4;
if (breakLines && lineLength >= MAX_LINE_LENGTH) {
out.write(NEW_LINE);
lineLength = 0;
} // end if: end of line
position = 0;
} // end if: enough to output
} // end if: encoding
// Else, Decoding
else {
// Meaningful Base64 character?
if (DECODABET[theByte & 0x7f] > WHITE_SPACE_ENC) {
buffer[position++] = (byte) theByte;
if (position >= bufferLength) // Enough to output.
{
int len = Base64.decode4to3(buffer, 0, b4, 0);
out.write(b4, 0, len);
// out.write( Base64.decode4to3( buffer ) );
position = 0;
} // end if: enough to output
} // end if: meaningful base64 character
else if (DECODABET[theByte & 0x7f] != WHITE_SPACE_ENC) {
throw new java.io.IOException("Invalid character in Base64 data.");
} // end else: not white space either
} // end else: decoding
} // end write
public void write(byte[] theBytes, int off, int len) throws java.io.IOException {
// Encoding suspended?
if (suspendEncoding) {
super.out.write(theBytes, off, len);
return;
} // end if: supsended
for (int i = 0; i < len; i++) {
write(theBytes[off + i]);
} // end for: each byte written
} // end write
public void flushBase64() throws java.io.IOException {
if (position > 0) {
if (encode) {
out.write(encode3to4(b4, buffer, position));
position = 0;
} // end if: encoding
else {
throw new java.io.IOException("Base64 input not properly padded.");
} // end else: decoding
} // end if: buffer partially full
} // end flush
public void close() throws java.io.IOException {
// 1. Ensure that pending characters are written
flushBase64();
// 2. Actually close the stream
// Base class both flushes and closes.
super.close();
buffer = null;
out = null;
} // end close
public void suspendEncoding() throws java.io.IOException {
flushBase64();
this.suspendEncoding = true;
} // end suspendEncoding
public void resumeEncoding() {
this.suspendEncoding = false;
} // end resumeEncoding
} // end inner class OutputStream
} // end class Base64
| apache-2.0 |
Governance/dtgov | dtgov-war/src/test/java/org/overlord/sramp/governance/workflow/WorkflowFactoryTest.java | 2140 | /*
* Copyright 2011 JBoss 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 org.overlord.sramp.governance.workflow;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.overlord.sramp.governance.workflow.jbpm.EmbeddedJbpmManager;
/**
* @author <a href="mailto:kurt.stam@gmail.com">Kurt Stam</a>
*/
public class WorkflowFactoryTest {
@Test
public void testFindServiceConfig() {
URL url = this.getClass().getClassLoader().getResource("META-INF/services/org.overlord.sramp.governance.workflow.BpmManager"); //$NON-NLS-1$
// System.out.println("URL=" + url);
Assert.assertNotNull(url);
}
@Test
public void testPersistenceFactory() throws Exception {
BpmManager bpmManager = WorkflowFactory.newInstance();
Assert.assertEquals(EmbeddedJbpmManager.class, bpmManager.getClass());
}
@Test @Ignore //the BPM engine needs to be running for this test to pass
public void testNewProcessInstance() throws Exception {
BpmManager bpmManager = WorkflowFactory.newInstance();
String processId = "com.sample.evaluation"; //$NON-NLS-1$
Map<String,Object> parameters = new HashMap<String,Object>();
parameters.put("employee", "krisv"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.put("reason", "just bc"); //$NON-NLS-1$ //$NON-NLS-2$
parameters.put("uuid", "some-uuid-" + new Date()); //$NON-NLS-1$ //$NON-NLS-2$
bpmManager.newProcessInstance(null, processId, parameters);
}
}
| apache-2.0 |
JPLeRouzic/PhysioSim | ODEsolver/interpreter/Ex5.java | 852 | package ODEsolver.interpreter;
//-----------------------------------------------------------------------------
// Written 2002 by Juergen Arndt.
//
//
// File Ex5.java
// Use semantische funktion fuer "-"
//-----------------------------------------------------------------------------
class Ex5 implements SemFuncPointer
{
public int exec (double a) // dummy
{
return 1;
}
public int exec ()
{
//System.out.println (" \nEx5: subtraktives minus");
Node SubNode = new Node();
Node MaxTopNode;
Node K;
SubNode.SetInfoString ("sub");
SubNode.SetRang (sub);
MaxTopNode = (Node) stack.peek();
K = SubNode.DiveToAttachPoint (MaxTopNode);
SubNode.AttachToTree (K);
stack.push (SubNode);
return 1;
}
public int exec (String str)
{
return 1;
}
}
| apache-2.0 |
checketts/spring-metrics | src/main/java/org/springframework/metrics/instrument/binder/LogbackMetrics.java | 2719 | /**
* Copyright 2017 Pivotal Software, 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 org.springframework.metrics.instrument.binder;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.turbo.TurboFilter;
import ch.qos.logback.core.spi.FilterReply;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.springframework.metrics.instrument.Counter;
import org.springframework.metrics.instrument.MeterRegistry;
public class LogbackMetrics implements MeterBinder {
@Override
public void bindTo(MeterRegistry registry) {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
context.addTurboFilter(new MetricsTurboFilter(registry));
}
}
class MetricsTurboFilter extends TurboFilter {
private final Counter errorCounter;
private final Counter warnCounter;
private final Counter infoCounter;
private final Counter debugCounter;
private final Counter traceCounter;
MetricsTurboFilter(MeterRegistry registry) {
errorCounter = registry.counter("logback_events", "level", "error");
warnCounter = registry.counter("logback_events", "level", "warn");
infoCounter = registry.counter("logback_events", "level", "info");
debugCounter = registry.counter("logback_events", "level", "debug");
traceCounter = registry.counter("logback_events", "level", "trace");
}
@Override
public FilterReply decide(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) {
switch(level.toInt()) {
case Level.ERROR_INT:
errorCounter.increment();
break;
case Level.WARN_INT:
warnCounter.increment();
break;
case Level.INFO_INT:
infoCounter.increment();
break;
case Level.DEBUG_INT:
debugCounter.increment();
break;
case Level.TRACE_INT:
traceCounter.increment();
break;
}
return FilterReply.NEUTRAL;
}
}
| apache-2.0 |
emily-e/webframework | src/main/java/net/metanotion/web/examples/FileServerSessionsApp.java | 4140 | /***************************************************************************
Copyright 2012 Emily Estes
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.metanotion.web.examples;
import net.metanotion.io.JavaFileSystem;
import net.metanotion.simpletemplate.ResourceFactory;
import net.metanotion.simpletemplate.StaticResources;
import net.metanotion.util.Unknown;
import net.metanotion.web.Default;
import net.metanotion.web.RequestObject;
import net.metanotion.web.SessionFactory;
import net.metanotion.web.concrete.BasicRequestObject;
import net.metanotion.web.concrete.DefaultDispatcher;
import net.metanotion.web.servlets.ServerUtil;
/** <p>This example doesn't add any new functionality over the {@link net.metanotion.web.examples.FileServerApp}
example, however instead of implementing {@link net.metanotion.web.SessionHandler}, this app implements
{@link net.metanotion.web.SessionFactory}. A SessionFactory instance is asked for on every HTTP Request that doesn't
have a cached session. Session instances are cached by whatever mechanism/strategy the
{@link net.metanotion.web.SessionStore} implementation uses. The default implementation uses Session cookies (provided
by the Servlet API) to cache it's session object instances.</p>
<p>Of course, sessions can differentiate between users, so we could add authentication to this example and have a file
server that requires users to log in and only serve up files that specific user has access to. Or whatever else we
might do with sessions. Also, note that since you control the session object, you control what instance variables are
associated with the session, and so on.</p>
*/
public final class FileServerSessionsApp implements SessionFactory<RequestObject> {
/** This is the main method to start this application server instance.
@param args The command line arguments, however, this application only takes one: The path to read files from
to respond to HTTP requests.
*/
public static void main(final String[] args) {
try {
/** We need to represent our folder as a file system for the static file server component. */
final JavaFileSystem files = new JavaFileSystem(args[0]);
/** The "default server" is an implementation of the "Default" component that uses a ResourceFactory. */
final ResourceFactory resources = new StaticResources(files);
ServerUtil.launchJettyServer(8080, new DefaultDispatcher(), new FileServerSessionsApp(resources));
} catch (final Exception e) {
e.printStackTrace();
}
}
/** The application wide resource factory. */
private final ResourceFactory resources;
/** Create the SessionFactory instance for our application to respond to HTTP requests.
@param resources The resource factory to load the files this server is hosting.
*/
public FileServerSessionsApp(final ResourceFactory resources) { this.resources = resources; }
@Override public Unknown newSession(final RequestObject ro) {
return new Session(resources);
}
/** This is the session object that represents all session state. One instance is create per session. */
private static final class Session implements Unknown, Default {
private final ResourceFactory resources;
public Session(final ResourceFactory resources) { this.resources = resources; }
@Override public Object lookupInterface(Class theInterface) { return this; }
@Override public Object get(String url) {
return this.resources.get(url).skin(null, new BasicRequestObject());
}
}
}
| apache-2.0 |
Gigaspaces/xap-openspaces | src/main/java/org/openspaces/core/executor/internal/ExecutorMetaDataProvider.java | 3362 | /*
* Copyright 2006-2007 the original author or 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 org.openspaces.core.executor.internal;
import com.gigaspaces.annotation.pojo.SpaceRouting;
import com.gigaspaces.internal.reflection.IMethod;
import com.gigaspaces.internal.reflection.ReflectionUtil;
import com.gigaspaces.internal.utils.collections.CopyOnUpdateMap;
import org.openspaces.core.executor.TaskRoutingProvider;
import org.springframework.dao.DataAccessException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
/**
* A helper class allowing to extract meta data related to executors/tasks (such as
* routing information).
*
* @author kimchy
*/
public class ExecutorMetaDataProvider {
private Map<Class, IMethod> routingMethods = new CopyOnUpdateMap<Class, IMethod>();
private static IMethod NO_METHOD;
static {
try {
NO_METHOD = ReflectionUtil.createMethod(Object.class.getMethod("toString"));
} catch (NoSuchMethodException e) {
// won't happen
}
}
public Object findRouting(Object obj) {
if (obj == null) {
return null;
}
if (obj instanceof TaskRoutingProvider) {
return ((TaskRoutingProvider) obj).getRouting();
}
IMethod method = routingMethods.get(obj.getClass());
if (method == null) {
method = findRoutingMethod(obj);
routingMethods.put(obj.getClass(), method);
}
if (method == NO_METHOD) {
return null;
}
try {
return method.invoke(obj);
} catch (IllegalAccessException e) {
throw new FailedToExecuteRoutingMethodException(e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new FailedToExecuteRoutingMethodException(e.getTargetException().getMessage(), e.getTargetException());
}
}
public static class FailedToExecuteRoutingMethodException extends DataAccessException {
private static final long serialVersionUID = -3598757232489798078L;
public FailedToExecuteRoutingMethodException(String msg, Throwable cause) {
super(msg, cause);
}
}
private static IMethod findRoutingMethod(Object task) {
Class targetClass = task.getClass();
do {
Method[] methods = targetClass.getDeclaredMethods();
for (Method method : methods) {
if (method.isAnnotationPresent(SpaceRouting.class)) {
method.setAccessible(true);
return ReflectionUtil.createMethod(method);
}
}
targetClass = targetClass.getSuperclass();
} while (targetClass != null);
return NO_METHOD;
}
}
| apache-2.0 |
nvanbenschoten/motion | motion/src/main/java/com/nvanbenschoten/motion/SensorInterpreter.java | 7277 | package com.nvanbenschoten.motion;
import android.content.Context;
import android.hardware.SensorEvent;
import android.hardware.SensorManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.view.Surface;
import android.view.WindowManager;
import static android.hardware.SensorManager.AXIS_MINUS_X;
import static android.hardware.SensorManager.AXIS_MINUS_Y;
import static android.hardware.SensorManager.AXIS_X;
import static android.hardware.SensorManager.AXIS_Y;
/*
* Copyright 2014 Nathan VanBenschoten
*
* 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.
*/
class SensorInterpreter {
private static final String TAG = SensorInterpreter.class.getName();
/**
* The standardized tilt vector corresponding to yaw, pitch, and roll deltas from target matrix.
*/
private float[] mTiltVector = new float[3];
/**
* Whether the SensorInterpreter has set a target to calculate tilt offset from.
*/
private boolean mTargeted = false;
/**
* The target rotation matrix to calculate tilt offset from.
*/
private float[] mTargetMatrix = new float[16];
/**
* Rotation matrices used during calculation.
*/
private float[] mRotationMatrix = new float[16];
private float[] mOrientedRotationMatrix = new float[16];
/**
* Holds a shortened version of the rotation vector for compatibility purposes.
*/
private float[] mTruncatedRotationVector;
/**
* The sensitivity the parallax effect has towards tilting.
*/
private float mTiltSensitivity = 2.0f;
/**
* Converts sensor data in a {@link SensorEvent} to yaw, pitch, and roll.
*
* @param context the context of the
* @param event the event to interpret
* @return an interpreted vector of yaw, pitch, and roll delta values
*/
@SuppressWarnings("SuspiciousNameCombination")
public float[] interpretSensorEvent(@NonNull Context context, @Nullable SensorEvent event) {
if (event == null) {
return null;
}
// Retrieves the RotationVector from SensorEvent
float[] rotationVector = getRotationVectorFromSensorEvent(event);
// Set target rotation if none has been set
if (!mTargeted) {
setTargetVector(rotationVector);
return null;
}
// Get rotation matrix from event's values
SensorManager.getRotationMatrixFromVector(mRotationMatrix, rotationVector);
// Acquire rotation of screen
final int rotation = ((WindowManager) context
.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay()
.getRotation();
// Calculate angle differential between target and current orientation
if (rotation == Surface.ROTATION_0) {
SensorManager.getAngleChange(mTiltVector, mRotationMatrix, mTargetMatrix);
} else {
// Adjust axes on screen orientation by remapping coordinates
switch (rotation) {
case Surface.ROTATION_90:
SensorManager.remapCoordinateSystem(mRotationMatrix, AXIS_Y, AXIS_MINUS_X, mOrientedRotationMatrix);
break;
case Surface.ROTATION_180:
SensorManager.remapCoordinateSystem(mRotationMatrix, AXIS_MINUS_X, AXIS_MINUS_Y, mOrientedRotationMatrix);
break;
case Surface.ROTATION_270:
SensorManager.remapCoordinateSystem(mRotationMatrix, AXIS_MINUS_Y, AXIS_X, mOrientedRotationMatrix);
break;
}
SensorManager.getAngleChange(mTiltVector, mOrientedRotationMatrix, mTargetMatrix);
}
// Perform value scaling and clamping on value array
for (int i = 0; i < mTiltVector.length; i++) {
// Map domain of tilt vector from radian (-PI, PI) to fraction (-1, 1)
mTiltVector[i] /= Math.PI;
// Adjust for tilt sensitivity
mTiltVector[i] *= mTiltSensitivity;
// Clamp values to image bounds
if (mTiltVector[i] > 1) {
mTiltVector[i] = 1f;
} else if (mTiltVector[i] < -1) {
mTiltVector[i] = -1f;
}
}
return mTiltVector;
}
/**
* Pulls out the rotation vector from a {@link SensorEvent}, with a maximum length
* vector of four elements to avoid potential compatibility issues.
*
* @param event the sensor event
* @return the events rotation vector, potentially truncated
*/
@NonNull
@VisibleForTesting
float[] getRotationVectorFromSensorEvent(@NonNull SensorEvent event) {
if (event.values.length > 4) {
// On some Samsung devices SensorManager.getRotationMatrixFromVector
// appears to throw an exception if rotation vector has length > 4.
// For the purposes of this class the first 4 values of the
// rotation vector are sufficient (see crbug.com/335298 for details).
if (mTruncatedRotationVector == null) {
mTruncatedRotationVector = new float[4];
}
System.arraycopy(event.values, 0, mTruncatedRotationVector, 0, 4);
return mTruncatedRotationVector;
} else {
return event.values;
}
}
/**
* Sets the target direction used for angle deltas to determine tilt.
*
* @param values a rotation vector (presumably from a ROTATION_VECTOR sensor)
*/
protected void setTargetVector(float[] values) {
SensorManager.getRotationMatrixFromVector(mTargetMatrix, values);
mTargeted = true;
}
/**
* Resets the state of the SensorInterpreter, removing any target direction used for angle
* deltas to determine tilt.
*/
public void reset() {
mTargeted = false;
}
/**
* Determines the tilt sensitivity of the SensorInterpreter.
*
* @return the tilt sensitivity
*/
public float getTiltSensitivity() {
return mTiltSensitivity;
}
/**
* Sets the new sensitivity that the SensorInterpreter will scale tilt calculations by. If this
* sensitivity is above 1, the interpreter will have to clamp percentages to 100% and -100% at
* the tilt extremes.
*
* @param tiltSensitivity the new tilt sensitivity
*/
public void setTiltSensitivity(float tiltSensitivity) {
if (tiltSensitivity <= 0) {
throw new IllegalArgumentException("Tilt sensitivity must be positive");
}
mTiltSensitivity = tiltSensitivity;
}
}
| apache-2.0 |
ruspl-afed/dbeaver | plugins/org.jkiss.dbeaver.ext.oracle/src/org/jkiss/dbeaver/ext/oracle/tools/OracleScriptExecuteWizard.java | 4679 | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
* Copyright (C) 2011-2012 Eugene Fradkin (eugene.fradkin@gmail.com)
*
* 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.jkiss.dbeaver.ext.oracle.tools;
import org.eclipse.osgi.util.NLS;
import org.jkiss.dbeaver.ext.oracle.OracleMessages;
import org.jkiss.dbeaver.ext.oracle.model.OracleConstants;
import org.jkiss.dbeaver.ext.oracle.model.OracleDataSource;
import org.jkiss.dbeaver.ext.oracle.model.dict.OracleConnectionType;
import org.jkiss.dbeaver.ext.oracle.oci.OCIUtils;
import org.jkiss.dbeaver.ext.oracle.oci.OracleHomeDescriptor;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.dbeaver.ui.dialogs.tools.AbstractScriptExecuteWizard;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
class OracleScriptExecuteWizard extends AbstractScriptExecuteWizard<OracleDataSource,OracleDataSource> {
private OracleScriptExecuteWizardPageSettings mainPage;
public OracleScriptExecuteWizard(OracleDataSource oracleSchema)
{
super(Collections.singleton(oracleSchema), OracleMessages.tools_script_execute_wizard_page_name);
this.mainPage = new OracleScriptExecuteWizardPageSettings(this);
}
@Override
public void addPages()
{
addPage(mainPage);
super.addPages();
}
@Override
public void fillProcessParameters(List<String> cmd, OracleDataSource arg) throws IOException
{
String sqlPlusExec = RuntimeUtils.getNativeBinaryName("sqlplus"); //$NON-NLS-1$
File sqlPlusBinary = new File(getClientHome().getHomePath(), "bin/" + sqlPlusExec); //$NON-NLS-1$
if (!sqlPlusBinary.exists()) {
sqlPlusBinary = new File(getClientHome().getHomePath(), sqlPlusExec);
}
if (!sqlPlusBinary.exists()) {
throw new IOException(NLS.bind(OracleMessages.tools_script_execute_wizard_error_sqlplus_not_found, getClientHome().getDisplayName()));
}
String dumpPath = sqlPlusBinary.getAbsolutePath();
cmd.add(dumpPath);
}
@Override
public OracleHomeDescriptor findServerHome(String clientHomeId)
{
return OCIUtils.getOraHome(clientHomeId);
}
@Override
public Collection<OracleDataSource> getRunInfo() {
return getDatabaseObjects();
}
@Override
protected List<String> getCommandLine(OracleDataSource arg) throws IOException
{
List<String> cmd = new ArrayList<>();
fillProcessParameters(cmd, arg);
DBPConnectionConfiguration conInfo = getConnectionInfo();
String url;
if ("TNS".equals(conInfo.getProviderProperty(OracleConstants.PROP_CONNECTION_TYPE))) { //$NON-NLS-1$
url = conInfo.getServerName();
}
else {
boolean isSID = OracleConnectionType.SID.name().equals(conInfo.getProviderProperty(OracleConstants.PROP_SID_SERVICE));
String port = conInfo.getHostPort();
if (isSID) {
url = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=" + conInfo.getHostName() + ")(Port=" + port + "))(CONNECT_DATA=(SID=" + conInfo.getDatabaseName() + ")))";
} else {
url = "//" + conInfo.getHostName() + (port != null ? ":" + port : "") + "/" + conInfo.getDatabaseName(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
final String role = conInfo.getProviderProperty(OracleConstants.PROP_INTERNAL_LOGON);
if (role != null) {
url += (" AS " + role);
}
cmd.add(conInfo.getUserName() + "/" + conInfo.getUserPassword() + "@" + url); //$NON-NLS-1$ //$NON-NLS-2$
/*
if (toolWizard.isVerbose()) {
cmd.add("-v");
}
cmd.add("-q");
cmd.add(toolWizard.getDatabaseObjects().getName());
*/
return cmd;
}
}
| apache-2.0 |
google/schemaorg-java | src/main/java/com/google/schemaorg/core/Painting.java | 24692 | /*
* Copyright 2016 Google Inc. 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 com.google.schemaorg.core;
import com.google.schemaorg.JsonLdContext;
import com.google.schemaorg.SchemaOrgType;
import com.google.schemaorg.core.datatype.Date;
import com.google.schemaorg.core.datatype.DateTime;
import com.google.schemaorg.core.datatype.Integer;
import com.google.schemaorg.core.datatype.Number;
import com.google.schemaorg.core.datatype.Text;
import com.google.schemaorg.core.datatype.URL;
import com.google.schemaorg.goog.PopularityScoreSpecification;
import javax.annotation.Nullable;
/** Interface of <a href="http://schema.org/Painting}">http://schema.org/Painting}</a>. */
public interface Painting extends CreativeWork {
/** Builder interface of <a href="http://schema.org/Painting}">http://schema.org/Painting}</a>. */
public interface Builder extends CreativeWork.Builder {
@Override
Builder addJsonLdContext(@Nullable JsonLdContext context);
@Override
Builder addJsonLdContext(@Nullable JsonLdContext.Builder context);
@Override
Builder setJsonLdId(@Nullable String value);
@Override
Builder setJsonLdReverse(String property, Thing obj);
@Override
Builder setJsonLdReverse(String property, Thing.Builder builder);
/** Add a value to property about. */
Builder addAbout(Thing value);
/** Add a value to property about. */
Builder addAbout(Thing.Builder value);
/** Add a value to property about. */
Builder addAbout(String value);
/** Add a value to property accessibilityAPI. */
Builder addAccessibilityAPI(Text value);
/** Add a value to property accessibilityAPI. */
Builder addAccessibilityAPI(String value);
/** Add a value to property accessibilityControl. */
Builder addAccessibilityControl(Text value);
/** Add a value to property accessibilityControl. */
Builder addAccessibilityControl(String value);
/** Add a value to property accessibilityFeature. */
Builder addAccessibilityFeature(Text value);
/** Add a value to property accessibilityFeature. */
Builder addAccessibilityFeature(String value);
/** Add a value to property accessibilityHazard. */
Builder addAccessibilityHazard(Text value);
/** Add a value to property accessibilityHazard. */
Builder addAccessibilityHazard(String value);
/** Add a value to property accountablePerson. */
Builder addAccountablePerson(Person value);
/** Add a value to property accountablePerson. */
Builder addAccountablePerson(Person.Builder value);
/** Add a value to property accountablePerson. */
Builder addAccountablePerson(String value);
/** Add a value to property additionalType. */
Builder addAdditionalType(URL value);
/** Add a value to property additionalType. */
Builder addAdditionalType(String value);
/** Add a value to property aggregateRating. */
Builder addAggregateRating(AggregateRating value);
/** Add a value to property aggregateRating. */
Builder addAggregateRating(AggregateRating.Builder value);
/** Add a value to property aggregateRating. */
Builder addAggregateRating(String value);
/** Add a value to property alternateName. */
Builder addAlternateName(Text value);
/** Add a value to property alternateName. */
Builder addAlternateName(String value);
/** Add a value to property alternativeHeadline. */
Builder addAlternativeHeadline(Text value);
/** Add a value to property alternativeHeadline. */
Builder addAlternativeHeadline(String value);
/** Add a value to property associatedMedia. */
Builder addAssociatedMedia(MediaObject value);
/** Add a value to property associatedMedia. */
Builder addAssociatedMedia(MediaObject.Builder value);
/** Add a value to property associatedMedia. */
Builder addAssociatedMedia(String value);
/** Add a value to property audience. */
Builder addAudience(Audience value);
/** Add a value to property audience. */
Builder addAudience(Audience.Builder value);
/** Add a value to property audience. */
Builder addAudience(String value);
/** Add a value to property audio. */
Builder addAudio(AudioObject value);
/** Add a value to property audio. */
Builder addAudio(AudioObject.Builder value);
/** Add a value to property audio. */
Builder addAudio(String value);
/** Add a value to property author. */
Builder addAuthor(Organization value);
/** Add a value to property author. */
Builder addAuthor(Organization.Builder value);
/** Add a value to property author. */
Builder addAuthor(Person value);
/** Add a value to property author. */
Builder addAuthor(Person.Builder value);
/** Add a value to property author. */
Builder addAuthor(String value);
/** Add a value to property award. */
Builder addAward(Text value);
/** Add a value to property award. */
Builder addAward(String value);
/** Add a value to property awards. */
Builder addAwards(Text value);
/** Add a value to property awards. */
Builder addAwards(String value);
/** Add a value to property character. */
Builder addCharacter(Person value);
/** Add a value to property character. */
Builder addCharacter(Person.Builder value);
/** Add a value to property character. */
Builder addCharacter(String value);
/** Add a value to property citation. */
Builder addCitation(CreativeWork value);
/** Add a value to property citation. */
Builder addCitation(CreativeWork.Builder value);
/** Add a value to property citation. */
Builder addCitation(Text value);
/** Add a value to property citation. */
Builder addCitation(String value);
/** Add a value to property comment. */
Builder addComment(Comment value);
/** Add a value to property comment. */
Builder addComment(Comment.Builder value);
/** Add a value to property comment. */
Builder addComment(String value);
/** Add a value to property commentCount. */
Builder addCommentCount(Integer value);
/** Add a value to property commentCount. */
Builder addCommentCount(String value);
/** Add a value to property contentLocation. */
Builder addContentLocation(Place value);
/** Add a value to property contentLocation. */
Builder addContentLocation(Place.Builder value);
/** Add a value to property contentLocation. */
Builder addContentLocation(String value);
/** Add a value to property contentRating. */
Builder addContentRating(Text value);
/** Add a value to property contentRating. */
Builder addContentRating(String value);
/** Add a value to property contributor. */
Builder addContributor(Organization value);
/** Add a value to property contributor. */
Builder addContributor(Organization.Builder value);
/** Add a value to property contributor. */
Builder addContributor(Person value);
/** Add a value to property contributor. */
Builder addContributor(Person.Builder value);
/** Add a value to property contributor. */
Builder addContributor(String value);
/** Add a value to property copyrightHolder. */
Builder addCopyrightHolder(Organization value);
/** Add a value to property copyrightHolder. */
Builder addCopyrightHolder(Organization.Builder value);
/** Add a value to property copyrightHolder. */
Builder addCopyrightHolder(Person value);
/** Add a value to property copyrightHolder. */
Builder addCopyrightHolder(Person.Builder value);
/** Add a value to property copyrightHolder. */
Builder addCopyrightHolder(String value);
/** Add a value to property copyrightYear. */
Builder addCopyrightYear(Number value);
/** Add a value to property copyrightYear. */
Builder addCopyrightYear(String value);
/** Add a value to property creator. */
Builder addCreator(Organization value);
/** Add a value to property creator. */
Builder addCreator(Organization.Builder value);
/** Add a value to property creator. */
Builder addCreator(Person value);
/** Add a value to property creator. */
Builder addCreator(Person.Builder value);
/** Add a value to property creator. */
Builder addCreator(String value);
/** Add a value to property dateCreated. */
Builder addDateCreated(Date value);
/** Add a value to property dateCreated. */
Builder addDateCreated(DateTime value);
/** Add a value to property dateCreated. */
Builder addDateCreated(String value);
/** Add a value to property dateModified. */
Builder addDateModified(Date value);
/** Add a value to property dateModified. */
Builder addDateModified(DateTime value);
/** Add a value to property dateModified. */
Builder addDateModified(String value);
/** Add a value to property datePublished. */
Builder addDatePublished(Date value);
/** Add a value to property datePublished. */
Builder addDatePublished(String value);
/** Add a value to property description. */
Builder addDescription(Text value);
/** Add a value to property description. */
Builder addDescription(String value);
/** Add a value to property discussionUrl. */
Builder addDiscussionUrl(URL value);
/** Add a value to property discussionUrl. */
Builder addDiscussionUrl(String value);
/** Add a value to property editor. */
Builder addEditor(Person value);
/** Add a value to property editor. */
Builder addEditor(Person.Builder value);
/** Add a value to property editor. */
Builder addEditor(String value);
/** Add a value to property educationalAlignment. */
Builder addEducationalAlignment(AlignmentObject value);
/** Add a value to property educationalAlignment. */
Builder addEducationalAlignment(AlignmentObject.Builder value);
/** Add a value to property educationalAlignment. */
Builder addEducationalAlignment(String value);
/** Add a value to property educationalUse. */
Builder addEducationalUse(Text value);
/** Add a value to property educationalUse. */
Builder addEducationalUse(String value);
/** Add a value to property encoding. */
Builder addEncoding(MediaObject value);
/** Add a value to property encoding. */
Builder addEncoding(MediaObject.Builder value);
/** Add a value to property encoding. */
Builder addEncoding(String value);
/** Add a value to property encodings. */
Builder addEncodings(MediaObject value);
/** Add a value to property encodings. */
Builder addEncodings(MediaObject.Builder value);
/** Add a value to property encodings. */
Builder addEncodings(String value);
/** Add a value to property exampleOfWork. */
Builder addExampleOfWork(CreativeWork value);
/** Add a value to property exampleOfWork. */
Builder addExampleOfWork(CreativeWork.Builder value);
/** Add a value to property exampleOfWork. */
Builder addExampleOfWork(String value);
/** Add a value to property fileFormat. */
Builder addFileFormat(Text value);
/** Add a value to property fileFormat. */
Builder addFileFormat(String value);
/** Add a value to property genre. */
Builder addGenre(Text value);
/** Add a value to property genre. */
Builder addGenre(URL value);
/** Add a value to property genre. */
Builder addGenre(String value);
/** Add a value to property hasPart. */
Builder addHasPart(CreativeWork value);
/** Add a value to property hasPart. */
Builder addHasPart(CreativeWork.Builder value);
/** Add a value to property hasPart. */
Builder addHasPart(String value);
/** Add a value to property headline. */
Builder addHeadline(Text value);
/** Add a value to property headline. */
Builder addHeadline(String value);
/** Add a value to property image. */
Builder addImage(ImageObject value);
/** Add a value to property image. */
Builder addImage(ImageObject.Builder value);
/** Add a value to property image. */
Builder addImage(URL value);
/** Add a value to property image. */
Builder addImage(String value);
/** Add a value to property inLanguage. */
Builder addInLanguage(Language value);
/** Add a value to property inLanguage. */
Builder addInLanguage(Language.Builder value);
/** Add a value to property inLanguage. */
Builder addInLanguage(Text value);
/** Add a value to property inLanguage. */
Builder addInLanguage(String value);
/** Add a value to property interactionStatistic. */
Builder addInteractionStatistic(InteractionCounter value);
/** Add a value to property interactionStatistic. */
Builder addInteractionStatistic(InteractionCounter.Builder value);
/** Add a value to property interactionStatistic. */
Builder addInteractionStatistic(String value);
/** Add a value to property interactivityType. */
Builder addInteractivityType(Text value);
/** Add a value to property interactivityType. */
Builder addInteractivityType(String value);
/** Add a value to property isBasedOnUrl. */
Builder addIsBasedOnUrl(URL value);
/** Add a value to property isBasedOnUrl. */
Builder addIsBasedOnUrl(String value);
/** Add a value to property isFamilyFriendly. */
Builder addIsFamilyFriendly(Boolean value);
/** Add a value to property isFamilyFriendly. */
Builder addIsFamilyFriendly(String value);
/** Add a value to property isPartOf. */
Builder addIsPartOf(CreativeWork value);
/** Add a value to property isPartOf. */
Builder addIsPartOf(CreativeWork.Builder value);
/** Add a value to property isPartOf. */
Builder addIsPartOf(String value);
/** Add a value to property keywords. */
Builder addKeywords(Text value);
/** Add a value to property keywords. */
Builder addKeywords(String value);
/** Add a value to property learningResourceType. */
Builder addLearningResourceType(Text value);
/** Add a value to property learningResourceType. */
Builder addLearningResourceType(String value);
/** Add a value to property license. */
Builder addLicense(CreativeWork value);
/** Add a value to property license. */
Builder addLicense(CreativeWork.Builder value);
/** Add a value to property license. */
Builder addLicense(URL value);
/** Add a value to property license. */
Builder addLicense(String value);
/** Add a value to property locationCreated. */
Builder addLocationCreated(Place value);
/** Add a value to property locationCreated. */
Builder addLocationCreated(Place.Builder value);
/** Add a value to property locationCreated. */
Builder addLocationCreated(String value);
/** Add a value to property mainEntity. */
Builder addMainEntity(Thing value);
/** Add a value to property mainEntity. */
Builder addMainEntity(Thing.Builder value);
/** Add a value to property mainEntity. */
Builder addMainEntity(String value);
/** Add a value to property mainEntityOfPage. */
Builder addMainEntityOfPage(CreativeWork value);
/** Add a value to property mainEntityOfPage. */
Builder addMainEntityOfPage(CreativeWork.Builder value);
/** Add a value to property mainEntityOfPage. */
Builder addMainEntityOfPage(URL value);
/** Add a value to property mainEntityOfPage. */
Builder addMainEntityOfPage(String value);
/** Add a value to property mentions. */
Builder addMentions(Thing value);
/** Add a value to property mentions. */
Builder addMentions(Thing.Builder value);
/** Add a value to property mentions. */
Builder addMentions(String value);
/** Add a value to property name. */
Builder addName(Text value);
/** Add a value to property name. */
Builder addName(String value);
/** Add a value to property offers. */
Builder addOffers(Offer value);
/** Add a value to property offers. */
Builder addOffers(Offer.Builder value);
/** Add a value to property offers. */
Builder addOffers(String value);
/** Add a value to property position. */
Builder addPosition(Integer value);
/** Add a value to property position. */
Builder addPosition(Text value);
/** Add a value to property position. */
Builder addPosition(String value);
/** Add a value to property potentialAction. */
Builder addPotentialAction(Action value);
/** Add a value to property potentialAction. */
Builder addPotentialAction(Action.Builder value);
/** Add a value to property potentialAction. */
Builder addPotentialAction(String value);
/** Add a value to property producer. */
Builder addProducer(Organization value);
/** Add a value to property producer. */
Builder addProducer(Organization.Builder value);
/** Add a value to property producer. */
Builder addProducer(Person value);
/** Add a value to property producer. */
Builder addProducer(Person.Builder value);
/** Add a value to property producer. */
Builder addProducer(String value);
/** Add a value to property provider. */
Builder addProvider(Organization value);
/** Add a value to property provider. */
Builder addProvider(Organization.Builder value);
/** Add a value to property provider. */
Builder addProvider(Person value);
/** Add a value to property provider. */
Builder addProvider(Person.Builder value);
/** Add a value to property provider. */
Builder addProvider(String value);
/** Add a value to property publication. */
Builder addPublication(PublicationEvent value);
/** Add a value to property publication. */
Builder addPublication(PublicationEvent.Builder value);
/** Add a value to property publication. */
Builder addPublication(String value);
/** Add a value to property publisher. */
Builder addPublisher(Organization value);
/** Add a value to property publisher. */
Builder addPublisher(Organization.Builder value);
/** Add a value to property publisher. */
Builder addPublisher(Person value);
/** Add a value to property publisher. */
Builder addPublisher(Person.Builder value);
/** Add a value to property publisher. */
Builder addPublisher(String value);
/** Add a value to property publishingPrinciples. */
Builder addPublishingPrinciples(URL value);
/** Add a value to property publishingPrinciples. */
Builder addPublishingPrinciples(String value);
/** Add a value to property recordedAt. */
Builder addRecordedAt(Event value);
/** Add a value to property recordedAt. */
Builder addRecordedAt(Event.Builder value);
/** Add a value to property recordedAt. */
Builder addRecordedAt(String value);
/** Add a value to property releasedEvent. */
Builder addReleasedEvent(PublicationEvent value);
/** Add a value to property releasedEvent. */
Builder addReleasedEvent(PublicationEvent.Builder value);
/** Add a value to property releasedEvent. */
Builder addReleasedEvent(String value);
/** Add a value to property review. */
Builder addReview(Review value);
/** Add a value to property review. */
Builder addReview(Review.Builder value);
/** Add a value to property review. */
Builder addReview(String value);
/** Add a value to property reviews. */
Builder addReviews(Review value);
/** Add a value to property reviews. */
Builder addReviews(Review.Builder value);
/** Add a value to property reviews. */
Builder addReviews(String value);
/** Add a value to property sameAs. */
Builder addSameAs(URL value);
/** Add a value to property sameAs. */
Builder addSameAs(String value);
/** Add a value to property schemaVersion. */
Builder addSchemaVersion(Text value);
/** Add a value to property schemaVersion. */
Builder addSchemaVersion(URL value);
/** Add a value to property schemaVersion. */
Builder addSchemaVersion(String value);
/** Add a value to property sourceOrganization. */
Builder addSourceOrganization(Organization value);
/** Add a value to property sourceOrganization. */
Builder addSourceOrganization(Organization.Builder value);
/** Add a value to property sourceOrganization. */
Builder addSourceOrganization(String value);
/** Add a value to property text. */
Builder addText(Text value);
/** Add a value to property text. */
Builder addText(String value);
/** Add a value to property thumbnailUrl. */
Builder addThumbnailUrl(URL value);
/** Add a value to property thumbnailUrl. */
Builder addThumbnailUrl(String value);
/** Add a value to property timeRequired. */
Builder addTimeRequired(Duration value);
/** Add a value to property timeRequired. */
Builder addTimeRequired(Duration.Builder value);
/** Add a value to property timeRequired. */
Builder addTimeRequired(String value);
/** Add a value to property translator. */
Builder addTranslator(Organization value);
/** Add a value to property translator. */
Builder addTranslator(Organization.Builder value);
/** Add a value to property translator. */
Builder addTranslator(Person value);
/** Add a value to property translator. */
Builder addTranslator(Person.Builder value);
/** Add a value to property translator. */
Builder addTranslator(String value);
/** Add a value to property typicalAgeRange. */
Builder addTypicalAgeRange(Text value);
/** Add a value to property typicalAgeRange. */
Builder addTypicalAgeRange(String value);
/** Add a value to property url. */
Builder addUrl(URL value);
/** Add a value to property url. */
Builder addUrl(String value);
/** Add a value to property version. */
Builder addVersion(Number value);
/** Add a value to property version. */
Builder addVersion(String value);
/** Add a value to property video. */
Builder addVideo(VideoObject value);
/** Add a value to property video. */
Builder addVideo(VideoObject.Builder value);
/** Add a value to property video. */
Builder addVideo(String value);
/** Add a value to property workExample. */
Builder addWorkExample(CreativeWork value);
/** Add a value to property workExample. */
Builder addWorkExample(CreativeWork.Builder value);
/** Add a value to property workExample. */
Builder addWorkExample(String value);
/** Add a value to property detailedDescription. */
Builder addDetailedDescription(Article value);
/** Add a value to property detailedDescription. */
Builder addDetailedDescription(Article.Builder value);
/** Add a value to property detailedDescription. */
Builder addDetailedDescription(String value);
/** Add a value to property popularityScore. */
Builder addPopularityScore(PopularityScoreSpecification value);
/** Add a value to property popularityScore. */
Builder addPopularityScore(PopularityScoreSpecification.Builder value);
/** Add a value to property popularityScore. */
Builder addPopularityScore(String value);
/**
* Add a value to property.
*
* @param name The property name.
* @param value The value of the property.
*/
Builder addProperty(String name, SchemaOrgType value);
/**
* Add a value to property.
*
* @param name The property name.
* @param builder The schema.org object builder for the property value.
*/
Builder addProperty(String name, Thing.Builder builder);
/**
* Add a value to property.
*
* @param name The property name.
* @param value The string value of the property.
*/
Builder addProperty(String name, String value);
/** Build a {@link Painting} object. */
Painting build();
}
}
| apache-2.0 |
akirakw/asakusafw-compiler | compiler-project/optimizer/src/main/java/com/asakusafw/lang/compiler/optimizer/OperatorEstimate.java | 3204 | /**
* Copyright 2011-2016 Asakusa Framework Team.
*
* 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.asakusafw.lang.compiler.optimizer;
import com.asakusafw.lang.compiler.model.graph.Operator;
import com.asakusafw.lang.compiler.model.graph.OperatorInput;
import com.asakusafw.lang.compiler.model.graph.OperatorOutput;
/**
* Estimated information of {@link Operator}s.
*/
public interface OperatorEstimate {
/**
* Represents that data size is not sure.
*/
double UNKNOWN_SIZE = Double.NaN;
/**
* Represents unknown estimate.
*/
OperatorEstimate UNKNOWN = new OperatorEstimate() {
@Override
public double getSize(OperatorOutput port) {
return UNKNOWN_SIZE;
}
@Override
public double getSize(OperatorInput port) {
return UNKNOWN_SIZE;
}
@Override
public <T> T getAttribute(Class<T> attributeType) {
return null;
}
@Override
public <T> T getAttribute(OperatorOutput port, Class<T> attributeType) {
return null;
}
@Override
public <T> T getAttribute(OperatorInput port, Class<T> attributeType) {
return null;
}
};
/**
* Returns the estimated size for the target input.
* @param port the target port
* @return the estimated size in bytes, or {@code NaN} if it is not sure
*/
double getSize(OperatorInput port);
/**
* Returns the estimated size for the target output.
* @param port the target port
* @return the estimated size in bytes, or {@code NaN} if it is not sure
*/
double getSize(OperatorOutput port);
/**
* Returns an attribute of the operator.
* @param <T> the attribute type
* @param attributeType the attribute type
* @return the related attribute value, or {@code null} if there is no such an attribute
*/
<T> T getAttribute(Class<T> attributeType);
/**
* Returns an attribute of the target input port.
* @param <T> the attribute type
* @param port the target port
* @param attributeType the attribute type
* @return the related attribute value, or {@code null} if there is no such an attribute
*/
<T> T getAttribute(OperatorInput port, Class<T> attributeType);
/**
* Returns an attribute of the target output port.
* @param <T> the attribute type
* @param port the target port
* @param attributeType the attribute type
* @return the related attribute value, or {@code null} if there is no such an attribute
*/
<T> T getAttribute(OperatorOutput port, Class<T> attributeType);
}
| apache-2.0 |
yifzhang/web | web-server/src/main/java/com/peiliping/web/server/subscriber/SubscriberFilter.java | 1874 | package com.peiliping.web.server.subscriber;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.peiliping.web.server.subscriber.constants.MessageAction;
public class SubscriberFilter implements Filter {
protected static Logger log = LoggerFactory.getLogger(SubscriberFilter.class);
public static final String URI = "subscriber";
private static final String PARAM_ID = "topicId";
private static final String PARAM_ACTION = "action";
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest)request;
String id = req.getParameter(PARAM_ID);
Subscriber s = Subscriber.getSubscriber(id);
buildResponse(response, s==null ? "ERROR" : (s.getDataAndNotify(MessageAction.getMessageAction(Integer.valueOf(req.getParameter(PARAM_ACTION))))? "OK" : "ERROR"));
}
public static void buildResponse(ServletResponse response,String result) throws IOException{
response.setContentType("text/html;charset=UTF-8");
PrintWriter writer = response.getWriter();
writer.println(result);
}
@Override
public void destroy() { }
}
/*
<filter>
<filter-name>SubscriberFilter</filter-name>
<filter-class>com.peiliping.web.server.subscriber.SubscriberFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SubscriberFilter</filter-name>
<url-pattern>/subscriber</url-pattern>
</filter-mapping>
*/ | apache-2.0 |
lee-tammy/CodeU-Summer-2017 | src/codeu/chat/client/commandline/Chat.java | 33418 | // 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 codeu.chat.client.commandline;
import codeu.chat.client.core.Context;
import codeu.chat.client.core.ConversationContext;
import codeu.chat.client.core.MessageContext;
import codeu.chat.client.core.UserContext;
import codeu.chat.common.InterestStatus;
import codeu.chat.common.InterestType;
import codeu.chat.common.ServerInfo;
import codeu.chat.common.User;
import codeu.chat.common.UserType;
import codeu.chat.util.Duration;
import codeu.chat.util.Scheduled;
import codeu.chat.util.Time;
import codeu.chat.util.Tokenizer;
import codeu.chat.util.Uuid;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
public final class Chat {
// PANELS
//
// We are going to use a stack of panels to track where in the application
// we are. The command will always be routed to the panel at the top of the
// stack. When a command wants to go to another panel, it will add a new
// panel to the top of the stack. When a command wants to go to the previous
// panel all it needs to do is pop the top panel.
private final Stack<Panel> panels = new Stack<>();
// Handle timers every 50 millisecond.
public static final int TIMER_WAIT_TIME = 50;
// Refresh messages every 5000 milliseconds.
public static final int MESSAGE_REFRESH_RATE = 5000;
// The time when the conversation was last updated.
private Time lastUpdate = Time.minTime();
private Context context;
public Chat(Context context) {
this.context = context;
this.panels.push(createRootPanel(context));
this.startHandlingTimers();
}
// HANDLE COMMAND
//
// Take a single line of input and parse a command from it. If the system
// is willing to take another command, the function will return true. If
// the system wants to exit, the function will return false.
//
public boolean handleCommand(String line) throws IOException {
final List<String> args = new ArrayList<>();
final Tokenizer tokenizer = new Tokenizer(line);
for (String token = tokenizer.next(); token != null; token = tokenizer.next()) {
args.add(token);
}
if (args.size() == 0) {
// nothing was actually passed in, trying to get the first command
// by calling args.get(0) will make the program crash
return false;
}
final String command = args.get(0);
args.remove(0);
// Because "exit" and "back" are applicable to every panel, handle
// those commands here to avoid having to implement them for each
// panel.
if ("exit".equals(command)) {
// The user does not want to process any more commands
return false;
}
// Do not allow the root panel to be removed.
if ("back".equals(command) && panels.size() > 1) {
panels.pop();
return true;
}
if (panels.peek().handleCommand(command, args)) {
// the command was handled
return true;
}
// If we get to here it means that the command was not correctly handled
// so we should let the user know. Still return true as we want to continue
// processing future commands.
System.out.println("ERROR: Unsupported command");
return true;
}
public void startHandlingTimers() {
new Thread() {
public void run() {
while (true) {
Panel current = panels.peek();
current.handleTimeEvent(Time.now());
try {
Thread.sleep(TIMER_WAIT_TIME);
} catch (InterruptedException ex) {
System.err.println(ex);
}
}
}
}.start();
}
// CREATE ROOT PANEL
//
// Create a panel for the root of the application. Root in this context means
// the first panel and the only panel that should always be at the bottom of
// the panels stack.
//
// The root panel is for commands that require no specific contextual
// information.
// This is before a user has signed in. Most commands handled by the root
// panel
// will be user selection focused.
//
private Panel createRootPanel(final Context context) {
final Panel panel = new Panel();
// HELP
//
// Add a command to print a list of all commands and their description when
// the user for "help" while on the root panel.
//
panel.register(
"help",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
System.out.println("ROOT MODE");
System.out.println(" u-list");
System.out.println(" List all users.");
System.out.println(" u-add <name>");
System.out.println(" Add a new user with the given name.");
System.out.println(" u-sign-in <name>");
System.out.println(" Sign in as the user with the given name.");
System.out.println(" info");
System.out.println(" Get server info.");
System.out.println(" Show the server information.");
System.out.println(" exit");
System.out.println(" Exit the program.");
}
});
panel.register(
"info",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final ServerInfo info = context.getInfo();
if (info == null) {
System.out.format("ERROR: Failed to retrieve version info", args);
} else {
// Print the server info to the user in a pretty way
// Print the server info to the user in a pretty way
System.out.println("Server Information:");
System.out.format(" Start Time : %s\n", info.startTime.toString());
System.out.format(" Time now : %s\n", Time.now());
System.out.format(
" Duration : %s sec\n",
(Time.duration(info.startTime, Time.now()).inMs() / 1000));
System.out.println("Version: " + info.version);
}
}
});
// U-LIST (user list)
//
// Add a command to print all users registered on the server when the user
// enters "u-list" while on the root panel.
//
panel.register(
"u-list",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
for (final UserContext user : context.allUsers()) {
System.out.format("USER %s (UUID:%s)\n", user.user.name, user.user.id);
}
}
});
// U-ADD (add user)
//
// Add a command to add and sign-in as a new user when the user enters
// "u-add" while on the root panel.
//
panel.register(
"u-add",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final String name = args.size() > 0 ? args.get(0).trim() : "";
if (name.length() > 0) {
if (findUser(name, context) != null) {
System.out.println("ERROR: Username already taken");
}
if (context.create(name) == null) {
System.out.println("ERROR: Failed to create new user");
}
} else {
System.out.println("ERROR: Missing <username>");
}
}
});
// U-SIGN-IN (sign in user)
//
// Add a command to sign-in as a user when the user enters "u-sign-in"
// while on the root panel.
//
panel.register(
"u-sign-in",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final String name = args.size() > 0 ? args.get(0).trim() : "";
if (name.length() > 0) {
final UserContext user = findUser(name, context);
if (user == null) {
System.out.format("ERROR: Failed to sign in as '%s'\n", name);
} else {
panels.push(createUserPanel(user));
}
} else {
System.out.println("ERROR: Missing <username>");
}
}
// Find the first user with the given name and return a user context
// for that user. If no user is found, the function will return null.
});
// Now that the panel has all its commands registered, return the panel
// so that it can be used.
return panel;
}
private UserContext findUser(String name, Context context) {
for (final UserContext user : context.allUsers()) {
if (user.user.name.equals(name)) {
return user;
}
}
return null;
}
private User userById(Uuid id, Context context) {
for (final UserContext user : context.allUsers()) {
if (user.user.id.equals(id)) {
return user.user;
}
}
return null;
}
private ConversationContext find(String title, UserContext user) {
for (final ConversationContext conversation : user.conversations()) {
if (title.equals(conversation.conversation.title)) {
return conversation;
}
}
return null;
}
private boolean hasAccess(Uuid user, ConversationContext cc) {
Map<Uuid, UserType> hm = cc.getConversationPermission();
return hm.containsKey(user);
}
private Panel createUserPanel(final UserContext user) {
final Panel panel = new Panel();
// HELP
//
// Add a command that will print a list of all commands and their
// descriptions when the user enters "help" while on the user panel.
//
panel.register(
"help",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
System.out.println("USER MODE");
System.out.println(" c-list");
System.out.println(
" List all conversations that the current user can interact with.");
System.out.println(" c-add <title> <default permission>");
System.out.println(
" Add a new conversation with the given title and join it as the current user. ");
System.out.println(" Specify default member/owner permission when a user is added");
System.out.println(" c-remove <title>");
System.out.println(
" Remove a conversation with the given title (Must"
+ " be the creator to remove).");
System.out.println(" c-join <title>");
System.out.println(" Join the conversation as the current user.");
System.out.println(" c-leave <title> <optional: username>");
System.out.println(" Leave the conversation as the current user. If user is creator,");
System.out.println(" type username after title to promote a user to creator access type.");
System.out.println(" If optional username is empty, the conversation will be deleted.");
System.out.println(" i-add <u for user or c for conversation> <username or title>.");
System.out.println(" Get updates on conversations and users.");
System.out.println(
" i-remove <u for user or c for conversation>" + " <username or title>.");
System.out.println(" Remove interest");
System.out.println(" status-update");
System.out.println(" Get status of interests");
System.out.println(" info");
System.out.println(" Display all info for the current user");
System.out.println(" back");
System.out.println(" Go back to ROOT MODE.");
System.out.println(" exit");
System.out.println(" Exit the program.");
}
});
// C-LIST (list conversations)
//
// Add a command that will print all conversations when the user enters
// "c-list" while on the user panel.
//
panel.register(
"c-list",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
for (final ConversationContext conversation : user.conversations()) {
if (hasAccess(user.user.id, conversation)) {
System.out.format(
"CONVERSATION %s (UUID:%s)\n",
conversation.conversation.title, conversation.conversation.id);
}
}
}
});
// C-ADD (add conversation)
//
// Add a command that will create and join a new conversation when the user
// enters "c-add" while on the user panel.
//
panel.register(
"c-add",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final String name = args.size() > 0 ? args.get(0).trim() : "";
String defaultAccess = args.size() > 1 ? args.get(1).trim() : "";
UserType access = null;
switch (defaultAccess) {
case "M":
access = UserType.MEMBER;
break;
case "O":
access = UserType.OWNER;
break;
default:
System.out.println(
"ERROR: Please provide valid default access type. 'M' for member or 'O' for owner");
return;
}
if (name.isEmpty()){
System.out.println("ERROR: Missing <title>");
return;
}
if (find(name, user) != null) {
System.out.println("ERROR: Conversation name already taken");
return;
}
final ConversationContext conversation = user.start(name, access);
if (conversation == null) {
System.out.println("ERROR: Failed to create new conversation");
}
}
});
// C-REMOVE (remove conversation)
//
// Add a command that will remove a conversation when the creator enters
// "c-remove" while on the user panel.
//
panel.register(
"c-remove",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final String name = args.size() > 0 ? args.get(0).trim() : "";
if (name.isEmpty()) {
System.out.println("ERROR: Missing <title>");
return;
}
ConversationContext conversation = find(name, user);
if (conversation == null) {
System.out.println("ERROR: Conversation does not exist");
return;
}
Map<Uuid, UserType> permissions = conversation.getConversationPermission();
UserType requester = permissions.get(user.user.id);
if (requester == null || requester != UserType.CREATOR) {
System.out.println("ERROR: You do not have permission to remove this conversation.");
return;
}
user.stop(conversation.conversation);
}
});
// C-JOIN (join conversation)
//
// Add a command that will join a conversation when the user enters
// "c-join" while on the user panel.
//
panel.register(
"c-join",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final String name = args.size() > 0 ? args.get(0).trim() : "";
if (name.length() > 0) {
final ConversationContext conversation = find(name, user);
if (conversation == null) {
System.out.format("ERROR: No conversation with name '%s'\n", name);
} else {
if (hasAccess(user.user.id, conversation)) {
panels.push(createConversationPanel(conversation));
} else {
System.out.println(
"ERROR: You do not currently have access to this conversation.");
}
}
} else {
System.out.println("ERROR: Missing <title>");
}
}
});
// C-LEAVE (leave conversation)
//
// Add command that will leave the conversation when the user enters
// "c-leave" while on the user panel. If the user is a creator, they have
// the option to delete the conversation or promote another user to creator
// access type
//
panel.register("c-leave", new Panel.Command(){
public void invoke(List<String> args){
final String title = args.size() > 0 ? args.get(0).trim() : "";
if(title.isEmpty()){
System.out.println("ERROR: Missing <title>");
return;
}
ConversationContext conversation = find(title, user);
if(conversation == null){
System.out.println("ERROR: Conversation does not exist.");
return;
}
Map<Uuid, UserType> permissions = conversation.getConversationPermission();
UserType requester = permissions.get(user.user.id);
if(requester == null){
System.out.println("ERROR: You are not in the conversation.");
return;
}
if(requester != UserType.CREATOR){
conversation.leave(user.user.id);
return;
}
final String name = args.size() == 2 ? args.get(1).trim() : "";
if(name.isEmpty()){
user.stop(conversation.conversation);
return;
}
UserContext username = findUser(name, context);
if(username == null){
System.out.println("ERROR: User does not exist.");
return;
}
UserType newCreator = permissions.get(username.user.id);
if(newCreator == null){
System.out.println("ERROR: User is not in the conversation.");
return;
}
conversation.changeAccess(username.user.id, UserType.CREATOR);
conversation.leave(user.user.id);
}
});
// I-ADD (adds an interest)
//
// Adds a command that will allow the user to add users and conversations
// as interests
//
panel.register(
"i-add",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
InterestType type = InterestType.USER;
if (args.size() == 2) {
final UserContext userInterest = findUser(args.get(1), context);
final Uuid userId = user.user.id;
final ConversationContext convoInterest = find(args.get(1), user);
if (args.get(0).equals("u")) {
type = InterestType.USER;
if (userInterest != null) {
user.getController().newInterest(userId, userInterest.user.id, type);
} else {
System.out.format("ERROR: '%s' does not exist", args.get(1));
}
} else if (args.get(0).equals("c")) {
if (convoInterest != null) {
type = InterestType.CONVERSATION;
user.getController().newInterest(userId, convoInterest.conversation.id, type);
} else {
System.out.format("ERROR: '%s' does not exist", args.get(1));
}
} else {
System.out.println("ERROR: Wrong format");
return;
}
} else {
System.out.println("ERROR: Wrong format");
}
}
});
// I-REMOVE (removes an interest)
//
// Adds a command that will allow the user to remove users and
// conversations as interests
//
panel.register(
"i-remove",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
if (args.size() == 2) {
final UserContext userInterest = findUser(args.get(1), context);
final ConversationContext convoInterest = find(args.get(1), user);
final Uuid userId = user.user.id;
if (args.get(0).equals("u")) {
if (userInterest != null) {
user.getController().removeInterest(userId, userInterest.user.id);
} else {
System.out.format("ERROR: '%s' does not exist", args.get(1));
}
} else if (args.get(0).equals("c")) {
if (convoInterest != null) {
user.getController().removeInterest(userId, convoInterest.conversation.id);
} else {
System.out.format("ERROR: '%s' does not exist", args.get(1));
}
} else {
System.out.println("ERROR: Wrong format");
return;
}
} else {
System.out.println("ERROR: Wrong format");
}
}
});
// STATUS-UPDATE (status update)
//
// Adds a command that will report the status updates of the interests
//
panel.register(
"status-update",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
Collection<InterestStatus> allInterests = user.getController().statusUpdate(user);
if (allInterests != null && !allInterests.isEmpty()) {
System.out.println("STATUS UPDATE");
System.out.println("===============");
for (InterestStatus interest : allInterests) {
if (interest.type == InterestType.CONVERSATION) {
System.out.format(
"Number of unread messages in conversation %s: '%d'\n",
interest.name, interest.unreadMessages);
} else {
System.out.format(
"Number of new conversations by user %s: '%d'\n",
interest.name, interest.newConversations.size());
for (int j = 0; j < interest.newConversations.size(); j++) {
System.out.println(" " + interest.newConversations.get(j));
}
System.out.format(
"Number of conversations the user %s contributed to: '%d'\n",
interest.name, interest.addedConversations.size());
for (int k = 0; k < interest.addedConversations.size(); k++) {
System.out.println(" " + interest.addedConversations.get(k));
}
}
System.out.println("===============");
}
}
}
});
// INFO
//
// Add a command that will print info about the current context when the
// user enters "info" while on the user panel.
//
panel.register(
"info",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
System.out.println("User Info:");
System.out.format(" Name : %s\n", user.user.name);
System.out.format(" Id : UUID:%s\n", user.user.id);
}
});
// Now that the panel has all its commands registered, return the panel
// so that it can be used.
return panel;
}
private void listMessages(final ConversationContext conversation, List<String> args) {
if (hasAccess(conversation.getUser(), conversation)) {
System.out.println("--- start of conversation ---");
for (MessageContext message = conversation.firstMessage();
message != null;
message = message.next()) {
System.out.println();
System.out.format("USER : %s\n", message.message.author);
System.out.format("SENT : %s\n", message.message.creation);
System.out.println();
System.out.println(message.message.content);
System.out.println();
}
System.out.println("--- end of conversation ---");
} else {
System.out.println("ERROR: you no longer have access to this conversation");
}
}
private Panel createConversationPanel(final ConversationContext conversation) {
final Panel panel = new Panel();
// HELP
//
// Add a command that will print all the commands and their descriptions
// when the user enters "help" while on the conversation panel.
//
panel.register(
"help",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
System.out.println("CONVERSATION MODE");
System.out.println(" m-list");
System.out.println(" List all messages in the current conversation.");
System.out.println(" m-add <message>");
System.out.println(
" Add a new message to the current conversation as " + "the current user.");
System.out.println(" u-add <user> <M for member or O for owner> ");
System.out.println(
" Add a user to the current conversation and"
+ " declare their membership. Second argument is option if"
+ " default membership is desired.");
System.out.println(" u-remove <user>");
System.out.println(" Remove a user from the current conversation.");
System.out.println(" modify-access <user> <accessType>");
System.out.println(" Change permissions of user. <userType> is O for owner,");
System.out.println(" M for member, and R for remove");
System.out.println(" u-list");
System.out.println(" list all users and their access levels");
System.out.println(" info");
System.out.println(" Display all info about the current conversation.");
System.out.println(" back");
System.out.println(" Go back to USER MODE.");
System.out.println(" exit");
System.out.println(" Exit the program.");
}
});
// List messages automatically every 5 seconds.
panel.register(
new Duration(MESSAGE_REFRESH_RATE),
new Scheduled.Action() {
@Override
public void invoke() {
// Get the time before sending the has new message request.
Time now = Time.now();
if (conversation.hasNewMessage(lastUpdate)) {
listMessages(conversation, null);
System.out.print(">>> ");
}
lastUpdate = now;
}
});
// M-LIST (list messages)
//
// Add a command to print all messages in the current conversation when the
// user enters "m-list" while on the conversation panel.
//
panel.register(
"m-list",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
lastUpdate = Time.now();
listMessages(conversation, args);
}
});
// M-ADD (add message)
//
// Add a command to add a new message to the current conversation when the
// user enters "m-add" while on the conversation panel.
//
panel.register(
"m-add",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
String message = args.size() > 0 ? args.get(0) : "";
for (int i = 1; i < args.size(); i++) {
message += " " + args.get(i);
}
if (message.length() < 0) {
System.out.println("ERROR: Messages must contain text");
}
if (hasAccess(conversation.getUser(), conversation)) conversation.add(message);
else {
System.out.println("ERROR: you no longer have access to this conversation");
}
}
});
// INFO
//
// Add a command to print info about the current conversation when the user
// enters "info" while on the conversation panel.
//
panel.register(
"info",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
System.out.println("Conversation Info:");
System.out.format(" Title : %s\n", conversation.conversation.title);
System.out.format(" Id : UUID:%s\n", conversation.conversation.id);
System.out.format(" Owner : %s\n", conversation.conversation.creator);
}
});
panel.register(
"modify-access",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
if (args.size() >= 2) {
User targetUser = findUser(args.get(0).trim(), context).user;
String accessType = args.get(1).trim();
UserType access = null;
switch (accessType) {
case "M":
access = UserType.MEMBER;
break;
case "O":
access = UserType.OWNER;
break;
case "R":
access = UserType.NOTSET;
break;
default:
System.out.println("ERROR: Please provide valid access type");
return;
}
if (targetUser == null) {
System.out.println("ERROR: Could not find user");
return;
}
if (conversation.changeAccess(targetUser.id, access)) {
System.out.println("Access was modified successfully");
} else {
System.out.println(
"ERROR: Couldn't modify target's access. Check your privileges and try again");
}
} else {
System.out.println("ERROR: Please provide the right number of arguments");
}
}
});
// U-ADD
//
// Adds a user to current conversation
//
panel.register(
"u-add",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
final int argSize = args.size();
if (argSize == 2 || argSize == 1) {
final UserContext addUser = findUser(args.get(0), context);
final String arg2 = args.size() == 2 ? args.get(1).trim() : "";
UserType memberBit = UserType.NOTSET;
if (addUser != null) {
if (argSize == 2) {
switch (arg2) {
case "M":
memberBit = UserType.MEMBER;
break;
case "O":
memberBit = UserType.OWNER;
break;
default:
System.out.print("ERROR: Invalid access type");
}
}
String message = conversation.addUser(addUser.user.id, memberBit);
System.out.print(message);
} else {
System.out.print("ERROR: User does not exist");
}
} else {
System.out.print("ERROR: Wrong format");
}
System.out.println();
}
});
// U-REMOVE
//
// Removes a user to current conversation
//
panel.register(
"u-remove",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
if (args.size() == 1) {
final UserContext removeUser = findUser(args.get(0), context);
if (removeUser != null) {
String message = conversation.removeUser(removeUser.user.id);
System.out.print(message);
} else {
System.out.print("ERROR: User does not exist");
}
} else {
System.out.print("ERROR: Wrong format");
}
System.out.println();
}
});
// U-LIST
//
// List all users and their access level in a conversation
panel.register(
"u-list",
new Panel.Command() {
@Override
public void invoke(List<String> args) {
Map<Uuid, UserType> map = conversation.getConversationPermission();
Set<Uuid> uuids = map.keySet();
Iterator<Uuid> iter = uuids.iterator();
while (iter.hasNext()) {
Uuid id = iter.next();
User user = userById(id, context);
System.out.format("USER %s (UUID:%s)\n", user.name, user.id);
System.out.println("Permission: " + map.get(id));
}
}
});
// Now that the panel has all its commands registered, return the panel
// so that it can be used.
return panel;
}
}
| apache-2.0 |
GwtMaterialDesign/gwt-material-demo | src/main/java/gwt/material/design/demo/client/application/addins/bubble/BubbleModule.java | 1027 | package gwt.material.design.demo.client.application.addins.bubble;
/*
* #%L
* GwtMaterial
* %%
* Copyright (C) 2015 - 2016 GwtMaterialDesign
* %%
* 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%
*/
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
public class BubbleModule extends AbstractPresenterModule {
@Override
protected void configure() {
bindPresenter(BubblePresenter.class, BubblePresenter.MyView.class, BubbleView.class, BubblePresenter.MyProxy.class);
}
}
| apache-2.0 |
mikewalch/accumulo | server/base/src/test/java/org/apache/accumulo/server/security/handler/ZKAuthenticatorTest.java | 3429 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses 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 org.apache.accumulo.server.security.handler;
import java.util.Set;
import java.util.TreeSet;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.ByteArraySet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;
public class ZKAuthenticatorTest extends TestCase {
private static final Logger log = LoggerFactory.getLogger(ZKAuthenticatorTest.class);
public void testPermissionIdConversions() {
for (SystemPermission s : SystemPermission.values())
assertTrue(s.equals(SystemPermission.getPermissionById(s.getId())));
for (TablePermission s : TablePermission.values())
assertTrue(s.equals(TablePermission.getPermissionById(s.getId())));
}
public void testAuthorizationConversion() {
ByteArraySet auths = new ByteArraySet();
for (int i = 0; i < 300; i += 3)
auths.add(Integer.toString(i).getBytes());
Authorizations converted = new Authorizations(auths);
byte[] test = ZKSecurityTool.convertAuthorizations(converted);
Authorizations test2 = ZKSecurityTool.convertAuthorizations(test);
assertTrue(auths.size() == test2.size());
for (byte[] s : auths) {
assertTrue(test2.contains(s));
}
}
public void testSystemConversion() {
Set<SystemPermission> perms = new TreeSet<>();
for (SystemPermission s : SystemPermission.values())
perms.add(s);
Set<SystemPermission> converted = ZKSecurityTool.convertSystemPermissions(ZKSecurityTool.convertSystemPermissions(perms));
assertTrue(perms.size() == converted.size());
for (SystemPermission s : perms)
assertTrue(converted.contains(s));
}
public void testTableConversion() {
Set<TablePermission> perms = new TreeSet<>();
for (TablePermission s : TablePermission.values())
perms.add(s);
Set<TablePermission> converted = ZKSecurityTool.convertTablePermissions(ZKSecurityTool.convertTablePermissions(perms));
assertTrue(perms.size() == converted.size());
for (TablePermission s : perms)
assertTrue(converted.contains(s));
}
public void testEncryption() {
byte[] rawPass = "myPassword".getBytes();
byte[] storedBytes;
try {
storedBytes = ZKSecurityTool.createPass(rawPass);
assertTrue(ZKSecurityTool.checkPass(rawPass, storedBytes));
} catch (AccumuloException e) {
log.error("{}", e.getMessage(), e);
assertTrue(false);
}
}
}
| apache-2.0 |
equella/Equella | autotest/Tests/src/main/java/com/tle/webtests/pageobject/generic/component/ThickboxPopup.java | 560 | package com.tle.webtests.pageobject.generic.component;
import com.tle.webtests.pageobject.AbstractPage;
public class ThickboxPopup<T extends AbstractPage<T>> extends AbstractPage<T> {
private final T wrappedPage;
public ThickboxPopup(T wrappedPage) {
super(wrappedPage.getContext());
this.wrappedPage = wrappedPage;
}
@Override
public void checkLoaded() throws Error {
driver.switchTo().frame("TB_iframeContent");
wrappedPage.checkLoaded();
}
@Override
public T get() {
super.get();
return wrappedPage.get();
}
}
| apache-2.0 |
rainbowbreeze/hackathons | 130720-hackitaly/TechnogymRT/src/it/rainbowbreeze/technogym/realtime/comm/RoomStateDataRequestInitializer.java | 3567 | /*
* 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.
*/
/*
* This code was generated by https://code.google.com/p/google-apis-client-generator/
* (build: 2013-06-05 16:09:48 UTC)
* on 2013-06-13 at 02:01:15 UTC
* Modify at your own risk.
*/
package it.rainbowbreeze.technogym.realtime.comm;
/**
* Businesscard request initializer for setting properties like key and userIp.
*
* <p>
* The simplest usage is to use it to set the key parameter:
* </p>
*
* <pre>
public static final GoogleClientRequestInitializer KEY_INITIALIZER =
new BusinesscardRequestInitializer(KEY);
* </pre>
*
* <p>
* There is also a constructor to set both the key and userIp parameters:
* </p>
*
* <pre>
public static final GoogleClientRequestInitializer INITIALIZER =
new BusinesscardRequestInitializer(KEY, USER_IP);
* </pre>
*
* <p>
* If you want to implement custom logic, extend it like this:
* </p>
*
* <pre>
public static class MyRequestInitializer extends BusinesscardRequestInitializer {
{@literal @}Override
public void initializeBusinesscardRequest(BusinesscardRequest{@literal <}?{@literal >} request)
throws IOException {
// custom logic
}
}
* </pre>
*
* <p>
* Finally, to set the key and userIp parameters and insert custom logic, extend it like this:
* </p>
*
* <pre>
public static class MyRequestInitializer2 extends BusinesscardRequestInitializer {
public MyKeyRequestInitializer() {
super(KEY, USER_IP);
}
{@literal @}Override
public void initializeBusinesscardRequest(BusinesscardRequest{@literal <}?{@literal >} request)
throws IOException {
// custom logic
}
}
* </pre>
*
* <p>
* Subclasses should be thread-safe.
* </p>
*
* @since 1.12
*/
public class RoomStateDataRequestInitializer extends com.google.api.client.googleapis.services.json.CommonGoogleJsonClientRequestInitializer {
public RoomStateDataRequestInitializer() {
super();
}
/**
* @param key API key or {@code null} to leave it unchanged
*/
public RoomStateDataRequestInitializer(String key) {
super(key);
}
/**
* @param key API key or {@code null} to leave it unchanged
* @param userIp user IP or {@code null} to leave it unchanged
*/
public RoomStateDataRequestInitializer(String key, String userIp) {
super(key, userIp);
}
@Override
public final void initializeJsonRequest(com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest<?> request) throws java.io.IOException {
super.initializeJsonRequest(request);
initializeRoomStateDataRequest((RoomStateDataRequest<?>) request);
}
/**
* Initializes Businesscard request.
*
* <p>
* Default implementation does nothing. Called from
* {@link #initializeJsonRequest(com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest)}.
* </p>
*
* @throws java.io.IOException I/O exception
*/
protected void initializeRoomStateDataRequest(RoomStateDataRequest<?> request) throws java.io.IOException {
}
}
| apache-2.0 |
matttproud/groningen | src/test/java/org/arbeitspferde/groningen/PipelineRestorerTest.java | 2709 | package org.arbeitspferde.groningen;
import static org.easymock.EasyMock.anyBoolean;
import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import com.google.common.collect.Lists;
import junit.framework.TestCase;
import org.arbeitspferde.groningen.Datastore.DatastoreException;
import org.arbeitspferde.groningen.config.ConfigManager;
import org.arbeitspferde.groningen.config.GroningenConfig;
import org.arbeitspferde.groningen.experimentdb.ExperimentDb;
/**
* Test for {@link PipelineRestorer}.
*/
public class PipelineRestorerTest extends TestCase {
private static final int SHARD_INDEX = 1;
private PipelineManager pipelineManagerMock;
private Datastore dataStoreMock;
private PipelineIdGenerator pipelineIdGeneratorMock;
private PipelineRestorer pipelineRestorer;
@Override
public void setUp() throws Exception {
super.setUp();
dataStoreMock = createMock(Datastore.class);
pipelineManagerMock = createMock(PipelineManager.class);
pipelineIdGeneratorMock = createMock(PipelineIdGenerator.class);
pipelineRestorer = new PipelineRestorer(SHARD_INDEX, dataStoreMock, pipelineManagerMock,
pipelineIdGeneratorMock);
}
public void testCorrectlyFiltersOutOtherShards() throws DatastoreException {
expect(dataStoreMock.listPipelinesIds()).andReturn(Lists.newArrayList(
new PipelineId("local0"), new PipelineId("local1"), new PipelineId("local2")));
expect(pipelineIdGeneratorMock.shardIndexForPipelineId(
eq(new PipelineId("local0")))).andReturn(0);
expect(pipelineIdGeneratorMock.shardIndexForPipelineId(
eq(new PipelineId("local1")))).andReturn(1);
expect(pipelineIdGeneratorMock.shardIndexForPipelineId(
eq(new PipelineId("local2")))).andReturn(2);
PipelineState pipelineState = new PipelineState(new PipelineId("local1"),
createNiceMock(GroningenConfig.class), createNiceMock(ExperimentDb.class));
expect(dataStoreMock.getPipelines(eq(Lists.newArrayList(new PipelineId("local1")))))
.andReturn(Lists.newArrayList(pipelineState));
expect(pipelineManagerMock.restorePipeline(eq(pipelineState), anyObject(ConfigManager.class),
anyBoolean())).andReturn(new PipelineId("local1"));
replay(pipelineManagerMock, dataStoreMock, pipelineIdGeneratorMock);
pipelineRestorer.restorePipelines();
verify(pipelineManagerMock, dataStoreMock, pipelineIdGeneratorMock);
}
}
| apache-2.0 |
aws/aws-sdk-java | aws-java-sdk-opensearch/src/main/java/com/amazonaws/services/opensearch/model/GetPackageVersionHistoryRequest.java | 7480 | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.opensearch.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
* <p>
* Container for the request parameters to the <code> <a>GetPackageVersionHistory</a> </code> operation.
* </p>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetPackageVersionHistoryRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* Returns an audit history of package versions.
* </p>
*/
private String packageID;
/**
* <p>
* Limits results to a maximum number of package versions.
* </p>
*/
private Integer maxResults;
/**
* <p>
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If provided,
* returns results for the next page.
* </p>
*/
private String nextToken;
/**
* <p>
* Returns an audit history of package versions.
* </p>
*
* @param packageID
* Returns an audit history of package versions.
*/
public void setPackageID(String packageID) {
this.packageID = packageID;
}
/**
* <p>
* Returns an audit history of package versions.
* </p>
*
* @return Returns an audit history of package versions.
*/
public String getPackageID() {
return this.packageID;
}
/**
* <p>
* Returns an audit history of package versions.
* </p>
*
* @param packageID
* Returns an audit history of package versions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetPackageVersionHistoryRequest withPackageID(String packageID) {
setPackageID(packageID);
return this;
}
/**
* <p>
* Limits results to a maximum number of package versions.
* </p>
*
* @param maxResults
* Limits results to a maximum number of package versions.
*/
public void setMaxResults(Integer maxResults) {
this.maxResults = maxResults;
}
/**
* <p>
* Limits results to a maximum number of package versions.
* </p>
*
* @return Limits results to a maximum number of package versions.
*/
public Integer getMaxResults() {
return this.maxResults;
}
/**
* <p>
* Limits results to a maximum number of package versions.
* </p>
*
* @param maxResults
* Limits results to a maximum number of package versions.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetPackageVersionHistoryRequest withMaxResults(Integer maxResults) {
setMaxResults(maxResults);
return this;
}
/**
* <p>
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If provided,
* returns results for the next page.
* </p>
*
* @param nextToken
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If
* provided, returns results for the next page.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If provided,
* returns results for the next page.
* </p>
*
* @return Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If
* provided, returns results for the next page.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If provided,
* returns results for the next page.
* </p>
*
* @param nextToken
* Used for pagination. Only necessary if a previous API call includes a non-null NextToken value. If
* provided, returns results for the next page.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetPackageVersionHistoryRequest withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getPackageID() != null)
sb.append("PackageID: ").append(getPackageID()).append(",");
if (getMaxResults() != null)
sb.append("MaxResults: ").append(getMaxResults()).append(",");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetPackageVersionHistoryRequest == false)
return false;
GetPackageVersionHistoryRequest other = (GetPackageVersionHistoryRequest) obj;
if (other.getPackageID() == null ^ this.getPackageID() == null)
return false;
if (other.getPackageID() != null && other.getPackageID().equals(this.getPackageID()) == false)
return false;
if (other.getMaxResults() == null ^ this.getMaxResults() == null)
return false;
if (other.getMaxResults() != null && other.getMaxResults().equals(this.getMaxResults()) == false)
return false;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPackageID() == null) ? 0 : getPackageID().hashCode());
hashCode = prime * hashCode + ((getMaxResults() == null) ? 0 : getMaxResults().hashCode());
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
return hashCode;
}
@Override
public GetPackageVersionHistoryRequest clone() {
return (GetPackageVersionHistoryRequest) super.clone();
}
}
| apache-2.0 |
Bibliome/bibliome-java-utils | src/main/java/fr/inra/maiage/bibliome/util/pattern/tabular/expression/DefaultMatchRegexp.java | 1141 | /*
Copyright 2016, 2017 Institut National de la Recherche Agronomique
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 fr.inra.maiage.bibliome.util.pattern.tabular.expression;
import java.util.List;
import java.util.regex.Pattern;
import fr.inra.maiage.bibliome.util.pattern.tabular.TabularContext;
public class DefaultMatchRegexp extends AbstractBooleanExpression {
private final Pattern pattern;
public DefaultMatchRegexp(Pattern pattern) {
super();
this.pattern = pattern;
}
@Override
public boolean getBoolean(TabularContext context, List<String> columns) {
return context.getConstantFilter().acceptRegex(columns, pattern);
}
}
| apache-2.0 |
ice-coffee/EIM | src/csdn/shimiso/eim/activity/im/AChatActivity.java | 3876 | package csdn.shimiso.eim.activity.im;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.packet.Message;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import csdn.shimiso.eim.activity.ActivitySupport;
import csdn.shimiso.eim.comm.Constant;
import csdn.shimiso.eim.manager.MessageManager;
import csdn.shimiso.eim.manager.NoticeManager;
import csdn.shimiso.eim.manager.XmppConnectionManager;
import csdn.shimiso.eim.model.IMMessage;
import csdn.shimiso.eim.model.Notice;
import csdn.shimiso.eim.util.DateUtil;
/**
*
* ÁÄÌì¶Ô»°.
*
* @author shimiso
*/
public abstract class AChatActivity extends ActivitySupport {
private Chat chat = null;
private List<IMMessage> message_pool = null;
protected String to;// ÁÄÌìÈË
private static int pageSize = 10;
private List<Notice> noticeList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
to = getIntent().getStringExtra("to");
if (to == null)
return;
chat = XmppConnectionManager.getInstance().getConnection()
.getChatManager().createChat(to, null);
}
@Override
protected void onPause() {
unregisterReceiver(receiver);
super.onPause();
}
@Override
protected void onResume() {
// µÚÒ»´Î²éѯ
message_pool = MessageManager.getInstance(context)
.getMessageListByFrom(to, 1, pageSize);
if (null != message_pool && message_pool.size() > 0)
Collections.sort(message_pool);
IntentFilter filter = new IntentFilter();
filter.addAction(Constant.NEW_MESSAGE_ACTION);
registerReceiver(receiver, filter);
// ¸üÐÂijÈËËùÓÐ֪ͨ
NoticeManager.getInstance(context).updateStatusByFrom(to, Notice.READ);
super.onResume();
}
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (Constant.NEW_MESSAGE_ACTION.equals(action)) {
IMMessage message = intent
.getParcelableExtra(IMMessage.IMMESSAGE_KEY);
message_pool.add(message);
receiveNewMessage(message);
refreshMessage(message_pool);
}
}
};
protected abstract void receiveNewMessage(IMMessage message);
protected abstract void refreshMessage(List<IMMessage> messages);
protected List<IMMessage> getMessages() {
return message_pool;
}
/**
* ·¢ËÍÏûÏ¢
* @param messageContent
* @throws Exception
*/
protected void sendMessage(String messageContent) throws Exception {
String time = DateUtil.date2Str(Calendar.getInstance(),
Constant.MS_FORMART);
/* ÏûÏ¢·¢ËÍ */
Message message = new Message();
message.setProperty(IMMessage.KEY_TIME, time);
message.setBody(messageContent);
chat.sendMessage(message);
/* ÏûÏ¢ÁбíˢР*/
IMMessage newMessage = new IMMessage();
newMessage.setMsgType(1);
newMessage.setFromSubJid(chat.getParticipant());
newMessage.setContent(messageContent);
newMessage.setTime(time);
//newMessage.setPath(path);
message_pool.add(newMessage);
MessageManager.getInstance(context).saveIMMessage(newMessage);
// MChatManager.message_pool.add(newMessage);
// Ë¢ÐÂÊÓͼ
refreshMessage(message_pool);
}
/**
* Ï»¬¼ÓÔØÐÅÏ¢,true ·µ»Ø³É¹¦£¬false Êý¾ÝÒѾȫ²¿¼ÓÔØ£¬È«²¿²éÍêÁË£¬
*
* @param message
*/
protected Boolean addNewMessage() {
List<IMMessage> newMsgList = MessageManager.getInstance(context)
.getMessageListByFrom(to, message_pool.size(), pageSize);
if (newMsgList != null && newMsgList.size() > 0) {
message_pool.addAll(newMsgList);
Collections.sort(message_pool);
return true;
}
return false;
}
protected void resh() {
// Ë¢ÐÂÊÓͼ
refreshMessage(message_pool);
}
}
| apache-2.0 |
Overruler/retired-apache-sources | lucene-2.9.4/src/java/org/apache/lucene/analysis/Token.java | 31174 | package org.apache.lucene.analysis;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses 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.
*/
import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
import org.apache.lucene.analysis.tokenattributes.FlagsAttribute;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.TermAttribute;
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
import org.apache.lucene.index.Payload;
import org.apache.lucene.index.TermPositions; // for javadoc
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Attribute;
import org.apache.lucene.util.AttributeImpl;
/**
A Token is an occurrence of a term from the text of a field. It consists of
a term's text, the start and end offset of the term in the text of the field,
and a type string.
<p>
The start and end offsets permit applications to re-associate a token with
its source text, e.g., to display highlighted query terms in a document
browser, or to show matching text fragments in a <abbr title="KeyWord In Context">KWIC</abbr>
display, etc.
<p>
The type is a string, assigned by a lexical analyzer
(a.k.a. tokenizer), naming the lexical or syntactic class that the token
belongs to. For example an end of sentence marker token might be implemented
with type "eos". The default token type is "word".
<p>
A Token can optionally have metadata (a.k.a. Payload) in the form of a variable
length byte array. Use {@link TermPositions#getPayloadLength()} and
{@link TermPositions#getPayload(byte[], int)} to retrieve the payloads from the index.
<br><br>
<p><b>NOTE:</b> As of 2.9, Token implements all {@link Attribute} interfaces
that are part of core Lucene and can be found in the {@code tokenattributes} subpackage.
Even though it is not necessary to use Token anymore, with the new TokenStream API it can
be used as convenience class that implements all {@link Attribute}s, which is especially useful
to easily switch from the old to the new TokenStream API.
<br><br>
<p><b>NOTE:</b> As of 2.3, Token stores the term text
internally as a malleable char[] termBuffer instead of
String termText. The indexing code and core tokenizers
have been changed to re-use a single Token instance, changing
its buffer and other fields in-place as the Token is
processed. This provides substantially better indexing
performance as it saves the GC cost of new'ing a Token and
String for every term. The APIs that accept String
termText are still available but a warning about the
associated performance cost has been added (below). The
{@link #termText()} method has been deprecated.</p>
<p>Tokenizers and TokenFilters should try to re-use a Token
instance when possible for best performance, by
implementing the {@link TokenStream#incrementToken()} API.
Failing that, to create a new Token you should first use
one of the constructors that starts with null text. To load
the token from a char[] use {@link #setTermBuffer(char[], int, int)}.
To load from a String use {@link #setTermBuffer(String)} or {@link #setTermBuffer(String, int, int)}.
Alternatively you can get the Token's termBuffer by calling either {@link #termBuffer()},
if you know that your text is shorter than the capacity of the termBuffer
or {@link #resizeTermBuffer(int)}, if there is any possibility
that you may need to grow the buffer. Fill in the characters of your term into this
buffer, with {@link String#getChars(int, int, char[], int)} if loading from a string,
or with {@link System#arraycopy(Object, int, Object, int, int)}, and finally call {@link #setTermLength(int)} to
set the length of the term text. See <a target="_top"
href="https://issues.apache.org/jira/browse/LUCENE-969">LUCENE-969</a>
for details.</p>
<p>Typical Token reuse patterns:
<ul>
<li> Copying text from a string (type is reset to {@link #DEFAULT_TYPE} if not specified):<br/>
<pre>
return reusableToken.reinit(string, startOffset, endOffset[, type]);
</pre>
</li>
<li> Copying some text from a string (type is reset to {@link #DEFAULT_TYPE} if not specified):<br/>
<pre>
return reusableToken.reinit(string, 0, string.length(), startOffset, endOffset[, type]);
</pre>
</li>
</li>
<li> Copying text from char[] buffer (type is reset to {@link #DEFAULT_TYPE} if not specified):<br/>
<pre>
return reusableToken.reinit(buffer, 0, buffer.length, startOffset, endOffset[, type]);
</pre>
</li>
<li> Copying some text from a char[] buffer (type is reset to {@link #DEFAULT_TYPE} if not specified):<br/>
<pre>
return reusableToken.reinit(buffer, start, end - start, startOffset, endOffset[, type]);
</pre>
</li>
<li> Copying from one one Token to another (type is reset to {@link #DEFAULT_TYPE} if not specified):<br/>
<pre>
return reusableToken.reinit(source.termBuffer(), 0, source.termLength(), source.startOffset(), source.endOffset()[, source.type()]);
</pre>
</li>
</ul>
A few things to note:
<ul>
<li>clear() initializes all of the fields to default values. This was changed in contrast to Lucene 2.4, but should affect no one.</li>
<li>Because <code>TokenStreams</code> can be chained, one cannot assume that the <code>Token's</code> current type is correct.</li>
<li>The startOffset and endOffset represent the start and offset in the source text, so be careful in adjusting them.</li>
<li>When caching a reusable token, clone it. When injecting a cached token into a stream that can be reset, clone it again.</li>
</ul>
</p>
@see org.apache.lucene.index.Payload
*/
public class Token extends AttributeImpl
implements Cloneable, TermAttribute, TypeAttribute, PositionIncrementAttribute,
FlagsAttribute, OffsetAttribute, PayloadAttribute {
public static final String DEFAULT_TYPE = "word";
private static int MIN_BUFFER_SIZE = 10;
/** @deprecated We will remove this when we remove the
* deprecated APIs */
private String termText;
/**
* Characters for the term text.
* @deprecated This will be made private. Instead, use:
* {@link #termBuffer()},
* {@link #setTermBuffer(char[], int, int)},
* {@link #setTermBuffer(String)}, or
* {@link #setTermBuffer(String, int, int)}
*/
char[] termBuffer;
/**
* Length of term text in the buffer.
* @deprecated This will be made private. Instead, use:
* {@link #termLength()}, or @{link setTermLength(int)}.
*/
int termLength;
/**
* Start in source text.
* @deprecated This will be made private. Instead, use:
* {@link #startOffset()}, or @{link setStartOffset(int)}.
*/
int startOffset;
/**
* End in source text.
* @deprecated This will be made private. Instead, use:
* {@link #endOffset()}, or @{link setEndOffset(int)}.
*/
int endOffset;
/**
* The lexical type of the token.
* @deprecated This will be made private. Instead, use:
* {@link #type()}, or @{link setType(String)}.
*/
String type = DEFAULT_TYPE;
private int flags;
/**
* @deprecated This will be made private. Instead, use:
* {@link #getPayload()}, or @{link setPayload(Payload)}.
*/
Payload payload;
/**
* @deprecated This will be made private. Instead, use:
* {@link #getPositionIncrement()}, or @{link setPositionIncrement(String)}.
*/
int positionIncrement = 1;
/** Constructs a Token will null text. */
public Token() {
}
/** Constructs a Token with null text and start & end
* offsets.
* @param start start offset in the source text
* @param end end offset in the source text */
public Token(int start, int end) {
startOffset = start;
endOffset = end;
}
/** Constructs a Token with null text and start & end
* offsets plus the Token type.
* @param start start offset in the source text
* @param end end offset in the source text
* @param typ the lexical type of this Token */
public Token(int start, int end, String typ) {
startOffset = start;
endOffset = end;
type = typ;
}
/**
* Constructs a Token with null text and start & end
* offsets plus flags. NOTE: flags is EXPERIMENTAL.
* @param start start offset in the source text
* @param end end offset in the source text
* @param flags The bits to set for this token
*/
public Token(int start, int end, int flags) {
startOffset = start;
endOffset = end;
this.flags = flags;
}
/** Constructs a Token with the given term text, and start
* & end offsets. The type defaults to "word."
* <b>NOTE:</b> for better indexing speed you should
* instead use the char[] termBuffer methods to set the
* term text.
* @param text term text
* @param start start offset
* @param end end offset
*/
public Token(String text, int start, int end) {
termText = text;
startOffset = start;
endOffset = end;
}
/** Constructs a Token with the given text, start and end
* offsets, & type. <b>NOTE:</b> for better indexing
* speed you should instead use the char[] termBuffer
* methods to set the term text.
* @param text term text
* @param start start offset
* @param end end offset
* @param typ token type
*/
public Token(String text, int start, int end, String typ) {
termText = text;
startOffset = start;
endOffset = end;
type = typ;
}
/**
* Constructs a Token with the given text, start and end
* offsets, & type. <b>NOTE:</b> for better indexing
* speed you should instead use the char[] termBuffer
* methods to set the term text.
* @param text
* @param start
* @param end
* @param flags token type bits
*/
public Token(String text, int start, int end, int flags) {
termText = text;
startOffset = start;
endOffset = end;
this.flags = flags;
}
/**
* Constructs a Token with the given term buffer (offset
* & length), start and end
* offsets
* @param startTermBuffer
* @param termBufferOffset
* @param termBufferLength
* @param start
* @param end
*/
public Token(char[] startTermBuffer, int termBufferOffset, int termBufferLength, int start, int end) {
setTermBuffer(startTermBuffer, termBufferOffset, termBufferLength);
startOffset = start;
endOffset = end;
}
/** Set the position increment. This determines the position of this token
* relative to the previous Token in a {@link TokenStream}, used in phrase
* searching.
*
* <p>The default value is one.
*
* <p>Some common uses for this are:<ul>
*
* <li>Set it to zero to put multiple terms in the same position. This is
* useful if, e.g., a word has multiple stems. Searches for phrases
* including either stem will match. In this case, all but the first stem's
* increment should be set to zero: the increment of the first instance
* should be one. Repeating a token with an increment of zero can also be
* used to boost the scores of matches on that token.
*
* <li>Set it to values greater than one to inhibit exact phrase matches.
* If, for example, one does not want phrases to match across removed stop
* words, then one could build a stop word filter that removes stop words and
* also sets the increment to the number of stop words removed before each
* non-stop word. Then exact phrase queries will only match when the terms
* occur with no intervening stop words.
*
* </ul>
* @param positionIncrement the distance from the prior term
* @see org.apache.lucene.index.TermPositions
*/
public void setPositionIncrement(int positionIncrement) {
if (positionIncrement < 0)
throw new IllegalArgumentException
("Increment must be zero or greater: " + positionIncrement);
this.positionIncrement = positionIncrement;
}
/** Returns the position increment of this Token.
* @see #setPositionIncrement
*/
public int getPositionIncrement() {
return positionIncrement;
}
/** Sets the Token's term text. <b>NOTE:</b> for better
* indexing speed you should instead use the char[]
* termBuffer methods to set the term text.
* @deprecated use {@link #setTermBuffer(char[], int, int)} or
* {@link #setTermBuffer(String)} or
* {@link #setTermBuffer(String, int, int)}.
*/
public void setTermText(String text) {
termText = text;
termBuffer = null;
}
/** Returns the Token's term text.
*
* @deprecated This method now has a performance penalty
* because the text is stored internally in a char[]. If
* possible, use {@link #termBuffer()} and {@link
* #termLength()} directly instead. If you really need a
* String, use {@link #term()}</b>
*/
public final String termText() {
if (termText == null && termBuffer != null)
termText = new String(termBuffer, 0, termLength);
return termText;
}
/** Returns the Token's term text.
*
* This method has a performance penalty
* because the text is stored internally in a char[]. If
* possible, use {@link #termBuffer()} and {@link
* #termLength()} directly instead. If you really need a
* String, use this method, which is nothing more than
* a convenience call to <b>new String(token.termBuffer(), 0, token.termLength())</b>
*/
public final String term() {
if (termText != null)
return termText;
initTermBuffer();
return new String(termBuffer, 0, termLength);
}
/** Copies the contents of buffer, starting at offset for
* length characters, into the termBuffer array.
* @param buffer the buffer to copy
* @param offset the index in the buffer of the first character to copy
* @param length the number of characters to copy
*/
public final void setTermBuffer(char[] buffer, int offset, int length) {
termText = null;
growTermBuffer(length);
System.arraycopy(buffer, offset, termBuffer, 0, length);
termLength = length;
}
/** Copies the contents of buffer into the termBuffer array.
* @param buffer the buffer to copy
*/
public final void setTermBuffer(String buffer) {
termText = null;
final int length = buffer.length();
growTermBuffer(length);
buffer.getChars(0, length, termBuffer, 0);
termLength = length;
}
/** Copies the contents of buffer, starting at offset and continuing
* for length characters, into the termBuffer array.
* @param buffer the buffer to copy
* @param offset the index in the buffer of the first character to copy
* @param length the number of characters to copy
*/
public final void setTermBuffer(String buffer, int offset, int length) {
assert offset <= buffer.length();
assert offset + length <= buffer.length();
termText = null;
growTermBuffer(length);
buffer.getChars(offset, offset + length, termBuffer, 0);
termLength = length;
}
/** Returns the internal termBuffer character array which
* you can then directly alter. If the array is too
* small for your token, use {@link
* #resizeTermBuffer(int)} to increase it. After
* altering the buffer be sure to call {@link
* #setTermLength} to record the number of valid
* characters that were placed into the termBuffer. */
public final char[] termBuffer() {
initTermBuffer();
return termBuffer;
}
/** Grows the termBuffer to at least size newSize, preserving the
* existing content. Note: If the next operation is to change
* the contents of the term buffer use
* {@link #setTermBuffer(char[], int, int)},
* {@link #setTermBuffer(String)}, or
* {@link #setTermBuffer(String, int, int)}
* to optimally combine the resize with the setting of the termBuffer.
* @param newSize minimum size of the new termBuffer
* @return newly created termBuffer with length >= newSize
*/
public char[] resizeTermBuffer(int newSize) {
if (termBuffer == null) {
// The buffer is always at least MIN_BUFFER_SIZE
newSize = newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : newSize;
//Preserve termText
if (termText != null) {
final int ttLen = termText.length();
newSize = newSize < ttLen ? ttLen : newSize;
termBuffer = new char[ArrayUtil.getNextSize(newSize)];
termText.getChars(0, termText.length(), termBuffer, 0);
termText = null;
} else { // no term Text, the first allocation
termBuffer = new char[ArrayUtil.getNextSize(newSize)];
}
} else {
if(termBuffer.length < newSize){
// Not big enough; create a new array with slight
// over allocation and preserve content
final char[] newCharBuffer = new char[ArrayUtil.getNextSize(newSize)];
System.arraycopy(termBuffer, 0, newCharBuffer, 0, termBuffer.length);
termBuffer = newCharBuffer;
}
}
return termBuffer;
}
/** Allocates a buffer char[] of at least newSize, without preserving the existing content.
* its always used in places that set the content
* @param newSize minimum size of the buffer
*/
private void growTermBuffer(int newSize) {
if (termBuffer == null) {
// The buffer is always at least MIN_BUFFER_SIZE
termBuffer = new char[ArrayUtil.getNextSize(newSize < MIN_BUFFER_SIZE ? MIN_BUFFER_SIZE : newSize)];
} else {
if(termBuffer.length < newSize){
// Not big enough; create a new array with slight
// over allocation:
termBuffer = new char[ArrayUtil.getNextSize(newSize)];
}
}
}
// TODO: once we remove the deprecated termText() method
// and switch entirely to char[] termBuffer we don't need
// to use this method anymore, only for late init of the buffer
private void initTermBuffer() {
if (termBuffer == null) {
if (termText == null) {
termBuffer = new char[ArrayUtil.getNextSize(MIN_BUFFER_SIZE)];
termLength = 0;
} else {
int length = termText.length();
if (length < MIN_BUFFER_SIZE) length = MIN_BUFFER_SIZE;
termBuffer = new char[ArrayUtil.getNextSize(length)];
termLength = termText.length();
termText.getChars(0, termText.length(), termBuffer, 0);
termText = null;
}
} else {
termText = null;
}
}
/** Return number of valid characters (length of the term)
* in the termBuffer array. */
public final int termLength() {
initTermBuffer();
return termLength;
}
/** Set number of valid characters (length of the term) in
* the termBuffer array. Use this to truncate the termBuffer
* or to synchronize with external manipulation of the termBuffer.
* Note: to grow the size of the array,
* use {@link #resizeTermBuffer(int)} first.
* @param length the truncated length
*/
public final void setTermLength(int length) {
initTermBuffer();
if (length > termBuffer.length)
throw new IllegalArgumentException("length " + length + " exceeds the size of the termBuffer (" + termBuffer.length + ")");
termLength = length;
}
/** Returns this Token's starting offset, the position of the first character
corresponding to this token in the source text.
Note that the difference between endOffset() and startOffset() may not be
equal to termText.length(), as the term text may have been altered by a
stemmer or some other filter. */
public final int startOffset() {
return startOffset;
}
/** Set the starting offset.
@see #startOffset() */
public void setStartOffset(int offset) {
this.startOffset = offset;
}
/** Returns this Token's ending offset, one greater than the position of the
last character corresponding to this token in the source text. The length
of the token in the source text is (endOffset - startOffset). */
public final int endOffset() {
return endOffset;
}
/** Set the ending offset.
@see #endOffset() */
public void setEndOffset(int offset) {
this.endOffset = offset;
}
/** Set the starting and ending offset.
@see #startOffset() and #endOffset()*/
public void setOffset(int startOffset, int endOffset) {
this.startOffset = startOffset;
this.endOffset = endOffset;
}
/** Returns this Token's lexical type. Defaults to "word". */
public final String type() {
return type;
}
/** Set the lexical type.
@see #type() */
public final void setType(String type) {
this.type = type;
}
/**
* EXPERIMENTAL: While we think this is here to stay, we may want to change it to be a long.
* <p/>
*
* Get the bitset for any bits that have been set. This is completely distinct from {@link #type()}, although they do share similar purposes.
* The flags can be used to encode information about the token for use by other {@link org.apache.lucene.analysis.TokenFilter}s.
*
*
* @return The bits
*/
public int getFlags() {
return flags;
}
/**
* @see #getFlags()
*/
public void setFlags(int flags) {
this.flags = flags;
}
/**
* Returns this Token's payload.
*/
public Payload getPayload() {
return this.payload;
}
/**
* Sets this Token's payload.
*/
public void setPayload(Payload payload) {
this.payload = payload;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append('(');
initTermBuffer();
if (termBuffer == null)
sb.append("null");
else
sb.append(termBuffer, 0, termLength);
sb.append(',').append(startOffset).append(',').append(endOffset);
if (!type.equals("word"))
sb.append(",type=").append(type);
if (positionIncrement != 1)
sb.append(",posIncr=").append(positionIncrement);
sb.append(')');
return sb.toString();
}
/** Resets the term text, payload, flags, and positionIncrement,
* startOffset, endOffset and token type to default.
*/
public void clear() {
payload = null;
// Leave termBuffer to allow re-use
termLength = 0;
termText = null;
positionIncrement = 1;
flags = 0;
startOffset = endOffset = 0;
type = DEFAULT_TYPE;
}
public Object clone() {
Token t = (Token)super.clone();
// Do a deep clone
if (termBuffer != null) {
t.termBuffer = new char[this.termLength];
System.arraycopy(this.termBuffer, 0, t.termBuffer, 0, this.termLength);
}
if (payload != null) {
t.payload = (Payload) payload.clone();
}
return t;
}
/** Makes a clone, but replaces the term buffer &
* start/end offset in the process. This is more
* efficient than doing a full clone (and then calling
* setTermBuffer) because it saves a wasted copy of the old
* termBuffer. */
public Token clone(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
final Token t = new Token(newTermBuffer, newTermOffset, newTermLength, newStartOffset, newEndOffset);
t.positionIncrement = positionIncrement;
t.flags = flags;
t.type = type;
if (payload != null)
t.payload = (Payload) payload.clone();
return t;
}
public boolean equals(Object obj) {
if (obj == this)
return true;
if (obj instanceof Token) {
Token other = (Token) obj;
initTermBuffer();
other.initTermBuffer();
if (termLength == other.termLength &&
startOffset == other.startOffset &&
endOffset == other.endOffset &&
flags == other.flags &&
positionIncrement == other.positionIncrement &&
subEqual(type, other.type) &&
subEqual(payload, other.payload)) {
for(int i=0;i<termLength;i++)
if (termBuffer[i] != other.termBuffer[i])
return false;
return true;
} else
return false;
} else
return false;
}
private boolean subEqual(Object o1, Object o2) {
if (o1 == null)
return o2 == null;
else
return o1.equals(o2);
}
public int hashCode() {
initTermBuffer();
int code = termLength;
code = code * 31 + startOffset;
code = code * 31 + endOffset;
code = code * 31 + flags;
code = code * 31 + positionIncrement;
code = code * 31 + type.hashCode();
code = (payload == null ? code : code * 31 + payload.hashCode());
code = code * 31 + ArrayUtil.hashCode(termBuffer, 0, termLength);
return code;
}
// like clear() but doesn't clear termBuffer/text
private void clearNoTermBuffer() {
payload = null;
positionIncrement = 1;
flags = 0;
startOffset = endOffset = 0;
type = DEFAULT_TYPE;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(char[], int, int)},
* {@link #setStartOffset},
* {@link #setEndOffset},
* {@link #setType}
* @return this Token instance */
public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
clearNoTermBuffer();
payload = null;
positionIncrement = 1;
setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = newType;
return this;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(char[], int, int)},
* {@link #setStartOffset},
* {@link #setEndOffset}
* {@link #setType} on Token.DEFAULT_TYPE
* @return this Token instance */
public Token reinit(char[] newTermBuffer, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
clearNoTermBuffer();
setTermBuffer(newTermBuffer, newTermOffset, newTermLength);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = DEFAULT_TYPE;
return this;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(String)},
* {@link #setStartOffset},
* {@link #setEndOffset}
* {@link #setType}
* @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset, String newType) {
clearNoTermBuffer();
setTermBuffer(newTerm);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = newType;
return this;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(String, int, int)},
* {@link #setStartOffset},
* {@link #setEndOffset}
* {@link #setType}
* @return this Token instance */
public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset, String newType) {
clearNoTermBuffer();
setTermBuffer(newTerm, newTermOffset, newTermLength);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = newType;
return this;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(String)},
* {@link #setStartOffset},
* {@link #setEndOffset}
* {@link #setType} on Token.DEFAULT_TYPE
* @return this Token instance */
public Token reinit(String newTerm, int newStartOffset, int newEndOffset) {
clearNoTermBuffer();
setTermBuffer(newTerm);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = DEFAULT_TYPE;
return this;
}
/** Shorthand for calling {@link #clear},
* {@link #setTermBuffer(String, int, int)},
* {@link #setStartOffset},
* {@link #setEndOffset}
* {@link #setType} on Token.DEFAULT_TYPE
* @return this Token instance */
public Token reinit(String newTerm, int newTermOffset, int newTermLength, int newStartOffset, int newEndOffset) {
clearNoTermBuffer();
setTermBuffer(newTerm, newTermOffset, newTermLength);
startOffset = newStartOffset;
endOffset = newEndOffset;
type = DEFAULT_TYPE;
return this;
}
/**
* Copy the prototype token's fields into this one. Note: Payloads are shared.
* @param prototype
*/
public void reinit(Token prototype) {
prototype.initTermBuffer();
setTermBuffer(prototype.termBuffer, 0, prototype.termLength);
positionIncrement = prototype.positionIncrement;
flags = prototype.flags;
startOffset = prototype.startOffset;
endOffset = prototype.endOffset;
type = prototype.type;
payload = prototype.payload;
}
/**
* Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
* @param prototype
* @param newTerm
*/
public void reinit(Token prototype, String newTerm) {
setTermBuffer(newTerm);
positionIncrement = prototype.positionIncrement;
flags = prototype.flags;
startOffset = prototype.startOffset;
endOffset = prototype.endOffset;
type = prototype.type;
payload = prototype.payload;
}
/**
* Copy the prototype token's fields into this one, with a different term. Note: Payloads are shared.
* @param prototype
* @param newTermBuffer
* @param offset
* @param length
*/
public void reinit(Token prototype, char[] newTermBuffer, int offset, int length) {
setTermBuffer(newTermBuffer, offset, length);
positionIncrement = prototype.positionIncrement;
flags = prototype.flags;
startOffset = prototype.startOffset;
endOffset = prototype.endOffset;
type = prototype.type;
payload = prototype.payload;
}
public void copyTo(AttributeImpl target) {
if (target instanceof Token) {
final Token to = (Token) target;
to.reinit(this);
// reinit shares the payload, so clone it:
if (payload !=null) {
to.payload = (Payload) payload.clone();
}
// remove the following optimization in 3.0 when old TokenStream API removed:
} else if (target instanceof TokenWrapper) {
((TokenWrapper) target).delegate = (Token) this.clone();
} else {
initTermBuffer();
((TermAttribute) target).setTermBuffer(termBuffer, 0, termLength);
((OffsetAttribute) target).setOffset(startOffset, endOffset);
((PositionIncrementAttribute) target).setPositionIncrement(positionIncrement);
((PayloadAttribute) target).setPayload((payload == null) ? null : (Payload) payload.clone());
((FlagsAttribute) target).setFlags(flags);
((TypeAttribute) target).setType(type);
}
}
}
| apache-2.0 |
nafae/developer | modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201409/cm/BidSource.java | 2678 | /**
* BidSource.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.adwords.axis.v201409.cm;
public class BidSource implements java.io.Serializable {
private java.lang.String _value_;
private static java.util.HashMap _table_ = new java.util.HashMap();
// Constructor
protected BidSource(java.lang.String value) {
_value_ = value;
_table_.put(_value_,this);
}
public static final java.lang.String _ADGROUP = "ADGROUP";
public static final java.lang.String _CRITERION = "CRITERION";
public static final BidSource ADGROUP = new BidSource(_ADGROUP);
public static final BidSource CRITERION = new BidSource(_CRITERION);
public java.lang.String getValue() { return _value_;}
public static BidSource fromValue(java.lang.String value)
throws java.lang.IllegalArgumentException {
BidSource enumeration = (BidSource)
_table_.get(value);
if (enumeration==null) throw new java.lang.IllegalArgumentException();
return enumeration;
}
public static BidSource fromString(java.lang.String value)
throws java.lang.IllegalArgumentException {
return fromValue(value);
}
public boolean equals(java.lang.Object obj) {return (obj == this);}
public int hashCode() { return toString().hashCode();}
public java.lang.String toString() { return _value_;}
public java.lang.Object readResolve() throws java.io.ObjectStreamException { return fromValue(_value_);}
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumSerializer(
_javaType, _xmlType);
}
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.EnumDeserializer(
_javaType, _xmlType);
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(BidSource.class);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("https://adwords.google.com/api/adwords/cm/v201409", "BidSource"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
}
| apache-2.0 |
consulo/consulo | modules/base/lang-impl/src/main/java/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceCompletionImpl.java | 4888 | /*
* Copyright 2000-2013 JetBrains s.r.o.
*
* 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.intellij.psi.impl.source.resolve.reference.impl.providers;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFileSystemItem;
import com.intellij.psi.PsiNamedElement;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.ArrayUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.FilteringProcessor;
import consulo.ide.IconDescriptorUpdaters;
import consulo.ui.image.Image;
import consulo.util.collection.HashingStrategy;
import consulo.util.collection.Sets;
import jakarta.inject.Singleton;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* @author yole
*/
@Singleton
public class FileReferenceCompletionImpl extends FileReferenceCompletion {
private static final HashingStrategy<PsiElement> VARIANTS_HASHING_STRATEGY = new HashingStrategy<PsiElement>() {
@Override
public int hashCode(final PsiElement object) {
if (object instanceof PsiNamedElement) {
final String name = ((PsiNamedElement)object).getName();
if (name != null) {
return name.hashCode();
}
}
return object.hashCode();
}
@Override
public boolean equals(final PsiElement o1, final PsiElement o2) {
if (o1 instanceof PsiNamedElement && o2 instanceof PsiNamedElement) {
return Comparing.equal(((PsiNamedElement)o1).getName(), ((PsiNamedElement)o2).getName());
}
return o1.equals(o2);
}
};
@Override
public Object[] getFileReferenceCompletionVariants(final FileReference reference) {
final String s = reference.getText();
if (s != null && s.equals("/")) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final CommonProcessors.CollectUniquesProcessor<PsiFileSystemItem> collector =
new CommonProcessors.CollectUniquesProcessor<PsiFileSystemItem>();
final PsiElementProcessor<PsiFileSystemItem> processor = new PsiElementProcessor<PsiFileSystemItem>() {
@Override
public boolean execute(@Nonnull PsiFileSystemItem fileSystemItem) {
return new FilteringProcessor<PsiFileSystemItem>(reference.getFileReferenceSet().getReferenceCompletionFilter(), collector).process(
FileReference.getOriginalFile(fileSystemItem));
}
};
for (PsiFileSystemItem context : reference.getContexts()) {
for (final PsiElement child : context.getChildren()) {
if (child instanceof PsiFileSystemItem) {
processor.execute((PsiFileSystemItem)child);
}
}
}
final Set<PsiElement> set = Sets.newHashSet(collector.getResults(), VARIANTS_HASHING_STRATEGY);
final PsiElement[] candidates = PsiUtilCore.toPsiElementArray(set);
final Object[] variants = new Object[candidates.length];
for (int i = 0; i < candidates.length; i++) {
PsiElement candidate = candidates[i];
Object item = reference.createLookupItem(candidate);
if (item == null) {
item = FileInfoManager.getFileLookupItem(candidate);
}
variants[i] = item;
}
if (!reference.getFileReferenceSet().isUrlEncoded()) {
return variants;
}
List<Object> encodedVariants = new ArrayList<Object>(variants.length);
for (int i = 0; i < candidates.length; i++) {
final PsiElement element = candidates[i];
if (element instanceof PsiNamedElement) {
final PsiNamedElement psiElement = (PsiNamedElement)element;
String name = psiElement.getName();
final String encoded = reference.encode(name, psiElement);
if (encoded == null) continue;
if (!encoded.equals(name)) {
final Image icon = IconDescriptorUpdaters.getIcon(psiElement, Iconable.ICON_FLAG_READ_STATUS | Iconable.ICON_FLAG_VISIBILITY);
LookupElementBuilder item = FileInfoManager.getFileLookupItem(candidates[i], encoded, icon);
encodedVariants.add(item.withTailText(" (" + name + ")"));
}
else {
encodedVariants.add(variants[i]);
}
}
}
return ArrayUtil.toObjectArray(encodedVariants);
}
}
| apache-2.0 |
parabuzzle/toobs | Toobs/PresFramework/src/main/java/org/toobsframework/pres/chart/ChartNotFoundException.java | 336 | package org.toobsframework.pres.chart;
import org.toobsframework.exception.BaseException;
public class ChartNotFoundException extends BaseException {
private static final long serialVersionUID = 1L;
public ChartNotFoundException(String chartId) {
super("Component with Id " + chartId + " not found in registry");
}
}
| apache-2.0 |
barmintor/fcrepo4 | fcrepo-kernel/src/main/java/org/fcrepo/kernel/rdf/impl/FixityRdfContext.java | 4793 | /**
* Copyright 2013 DuraSpace, 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 org.fcrepo.kernel.rdf.impl;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.ImmutableSet.builder;
import static com.hp.hpl.jena.graph.NodeFactory.createLiteral;
import static com.hp.hpl.jena.graph.NodeFactory.createURI;
import static com.hp.hpl.jena.graph.Triple.create;
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createResource;
import static com.hp.hpl.jena.rdf.model.ResourceFactory.createTypedLiteral;
import static org.fcrepo.kernel.RdfLexicon.HAS_COMPUTED_CHECKSUM;
import static org.fcrepo.kernel.RdfLexicon.HAS_COMPUTED_SIZE;
import static org.fcrepo.kernel.RdfLexicon.HAS_FIXITY_RESULT;
import static org.fcrepo.kernel.RdfLexicon.HAS_FIXITY_STATE;
import static org.fcrepo.kernel.RdfLexicon.HAS_LOCATION;
import static org.fcrepo.kernel.RdfLexicon.IS_FIXITY_RESULT_OF;
import java.util.Calendar;
import java.util.Iterator;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import org.fcrepo.kernel.rdf.GraphSubjects;
import org.fcrepo.kernel.services.LowLevelStorageService;
import org.fcrepo.kernel.utils.FixityResult;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterators;
import com.hp.hpl.jena.graph.Triple;
/**
* An {@link RdfStream} containing information about the fixity of a
* {@link Node}.
*
* @author ajs6f
* @date Oct 15, 2013
*/
public class FixityRdfContext extends NodeRdfContext {
/**
* Ordinary constructor.
*
* @param node
* @param graphSubjects
* @param lowLevelStorageService
* @param blobs
* @throws RepositoryException
*/
public FixityRdfContext(final Node node, final GraphSubjects graphSubjects,
final LowLevelStorageService lowLevelStorageService,
final Iterable<FixityResult> blobs) throws RepositoryException {
super(node, graphSubjects, lowLevelStorageService);
concat(Iterators.concat(Iterators.transform(blobs.iterator(),
new Function<FixityResult, Iterator<Triple>>() {
@Override
public Iterator<Triple> apply(final FixityResult blob) {
final com.hp.hpl.jena.graph.Node resultSubject =
createURI(subject().getURI() + "/fixity/"
+ Calendar.getInstance().getTimeInMillis());
final ImmutableSet.Builder<Triple> b = builder();
try {
b.add(create(resultSubject, IS_FIXITY_RESULT_OF
.asNode(), graphSubjects.getGraphSubject(
node).asNode()));
b.add(create(graphSubjects.getGraphSubject(node)
.asNode(), HAS_FIXITY_RESULT.asNode(),
resultSubject));
b.add(create(resultSubject, HAS_LOCATION.asNode(),
createResource(blob.getStoreIdentifier())
.asNode()));
for (final FixityResult.FixityState state : blob.status) {
b.add(create(resultSubject, HAS_FIXITY_STATE
.asNode(), createLiteral(state
.toString())));
}
final String checksum =
blob.computedChecksum.toString();
b.add(create(resultSubject, HAS_COMPUTED_CHECKSUM
.asNode(), createURI(checksum)));
b.add(create(resultSubject, HAS_COMPUTED_SIZE
.asNode(), createTypedLiteral(blob.computedSize)
.asNode()));
return b.build().iterator();
} catch (final RepositoryException e) {
throw propagate(e);
}
}
})));
}
}
| apache-2.0 |
axbaretto/beam | runners/spark/src/main/java/org/apache/beam/runners/spark/coders/BeamSparkRunnerRegistrator.java | 3355 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses 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 org.apache.beam.runners.spark.coders;
import com.esotericsoftware.kryo.Kryo;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import org.apache.beam.runners.spark.io.MicrobatchSource;
import org.apache.beam.runners.spark.stateful.SparkGroupAlsoByWindowViaWindowSet.StateAndTimers;
import org.apache.beam.runners.spark.translation.GroupCombineFunctions;
import org.apache.beam.runners.spark.translation.GroupNonMergingWindowsFunctions.WindowedKey;
import org.apache.beam.runners.spark.util.ByteArray;
import org.apache.beam.sdk.transforms.windowing.PaneInfo;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.TupleTag;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.HashBasedTable;
import org.apache.spark.serializer.KryoRegistrator;
import scala.collection.mutable.WrappedArray;
/**
* Custom {@link KryoRegistrator}s for Beam's Spark runner needs and registering used class in spark
* translation for better serialization performance. This is not the default serialization
* mechanism.
*
* <p>To use it you must enable the Kryo based serializer using {@code spark.serializer} with value
* {@code org.apache.spark.serializer.KryoSerializer} and register this class via Spark {@code
* spark.kryo.registrator} configuration.
*/
public class BeamSparkRunnerRegistrator implements KryoRegistrator {
@Override
public void registerClasses(Kryo kryo) {
// MicrobatchSource is serialized as data and may not be Kryo-serializable.
kryo.register(MicrobatchSource.class, new StatelessJavaSerializer());
kryo.register(
GroupCombineFunctions.SerializableAccumulator.class,
new GroupCombineFunctions.KryoAccumulatorSerializer());
kryo.register(WrappedArray.ofRef.class);
kryo.register(Object[].class);
kryo.register(ByteArray.class);
kryo.register(StateAndTimers.class);
kryo.register(TupleTag.class);
kryo.register(ArrayList.class);
kryo.register(LinkedHashMap.class);
kryo.register(HashBasedTable.class);
kryo.register(KV.class);
kryo.register(PaneInfo.class);
kryo.register(WindowedKey.class);
try {
kryo.register(
Class.forName(
"org.apache.beam.vendor.guava.v20_0.com.google.common.collect.HashBasedTable$Factory"));
kryo.register(
Class.forName("org.apache.beam.sdk.util.WindowedValue$TimestampedValueInGlobalWindow"));
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Unable to register classes with kryo.", e);
}
}
}
| apache-2.0 |
telstra/open-kilda | src-java/base-topology/base-storm-topology/src/main/java/org/openkilda/wfm/share/zk/ZooKeeperBolt.java | 3814 | /* Copyright 2020 Telstra Open Source
*
* 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.openkilda.wfm.share.zk;
import org.openkilda.bluegreen.LifecycleEvent;
import org.openkilda.bluegreen.ZkClient;
import org.openkilda.bluegreen.ZkStateTracker;
import org.openkilda.bluegreen.ZkWriter;
import org.openkilda.config.ZookeeperConfig;
import org.openkilda.wfm.AbstractBolt;
import org.apache.storm.topology.OutputFieldsDeclarer;
import org.apache.storm.tuple.Tuple;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
/**
* This bolt is responsible for writing data into ZooKeeper.
*/
public class ZooKeeperBolt extends AbstractBolt {
public static final String BOLT_ID = "zookeeper.bolt";
public static final String FIELD_ID_STATE = "lifecycle.state";
public static final String FIELD_ID_CONTEXT = AbstractBolt.FIELD_ID_CONTEXT;
private final String id;
private final String serviceName;
private final String connectionString;
private final long reconnectDelayMs;
private final int expectedState;
private Instant zooKeeperConnectionTimestamp = Instant.MIN;
private transient ZkWriter zkWriter;
private transient ZkStateTracker zkStateTracker;
public ZooKeeperBolt(String id, String serviceName, ZookeeperConfig zookeeperConfig, int expectedState) {
this.id = id;
this.serviceName = serviceName;
this.connectionString = zookeeperConfig.getConnectString();
this.reconnectDelayMs = zookeeperConfig.getReconnectDelay();
this.expectedState = expectedState;
}
protected boolean isZooKeeperConnectTimeoutPassed() {
return zooKeeperConnectionTimestamp.plus(10, ChronoUnit.SECONDS)
.isBefore(Instant.now());
}
@Override
protected void handleInput(Tuple input) throws Exception {
if (!zkWriter.isConnectedAndValidated()) {
if (isZooKeeperConnectTimeoutPassed()) {
zkWriter.safeRefreshConnection();
zooKeeperConnectionTimestamp = Instant.now();
}
}
try {
LifecycleEvent event = (LifecycleEvent) input.getValueByField(FIELD_ID_STATE);
if (event != null) {
log.info("Handling lifecycle event {} for component {} with id {} from {}",
event, serviceName, id, input.getSourceComponent());
zkStateTracker.processLifecycleEvent(event);
} else {
log.error("Received null value as a lifecycle-event");
}
} catch (Exception e) {
log.error("Failed to process event: {}", e.getMessage(), e);
}
}
@Override
protected void init() {
initZk();
}
private void initZk() {
zkWriter = ZkWriter.builder().id(id).serviceName(serviceName)
.connectionRefreshInterval(ZkClient.DEFAULT_CONNECTION_REFRESH_INTERVAL)
.connectionString(connectionString)
.reconnectDelayMs(reconnectDelayMs)
.expectedState(expectedState).build();
zkWriter.initAndWaitConnection();
zkStateTracker = new ZkStateTracker(zkWriter);
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
}
}
| apache-2.0 |
OpenVnmrJ/OpenVnmrJ | src/vnmrj/src/vnmr/bo/VTabPage.java | 1590 | /*
* Copyright (C) 2015 University of Oregon
*
* You may distribute under the terms of either the GNU General Public
* License or the Apache License, as specified in the LICENSE file.
*
* For more information, see the LICENSE file.
*/
package vnmr.bo;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;
import java.io.*;
import javax.swing.*;
import vnmr.util.*;
import vnmr.ui.*;
import vnmr.ui.shuf.*;
import vnmr.templates.*;
import javax.swing.border.Border;
public class VTabPage extends VGroup
{
public VTabPage(SessionShare sshare, ButtonIF vif, String typ) {
super(sshare,vif,typ);
}
public String getAttribute(int attr) {
switch (attr) {
case TYPE:
return type;
case TAB:
return null;
default:
return super.getAttribute(attr);
}
}
public void setAttribute(int attr, String c) {
switch (attr) {
case LABEL:
if(getEditMode()){
Container p=getParent();
if(p instanceof JTabbedPane){
JTabbedPane tp=(JTabbedPane)p;
int i=tp.indexOfTab(title);
if(i>=0)
tp.setTitleAt(i,c);
}
}
title = c;
break;
default:
super.setAttribute(attr,c);
}
}
public Object[][] getAttributes() { return attributes; }
private final static Object[][] attributes = {
{new Integer(LABEL), "Tab label "}
};
}
| apache-2.0 |
ChiangC/FMTech | GooglePlay6.0.5/app/src/main/java/com/google/android/gms/people/internal/zzg.java | 228355 | package com.google.android.gms.people.internal;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import android.os.RemoteException;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.common.data.DataHolderCreator;
import com.google.android.gms.common.internal.zzq;
import com.google.android.gms.common.internal.zzq.zza;
import com.google.android.gms.common.server.FavaDiagnosticsEntity;
import com.google.android.gms.people.identity.internal.AccountToken;
import com.google.android.gms.people.identity.internal.ParcelableGetOptions;
import com.google.android.gms.people.identity.internal.ParcelableListOptions;
import com.google.android.gms.people.identity.internal.zzi;
import com.google.android.gms.people.identity.internal.zzj;
import com.google.android.gms.people.model.AvatarReference;
import com.google.android.gms.people.model.ParcelableAvatarReference;
import java.util.ArrayList;
import java.util.List;
public abstract interface zzg
extends IInterface
{
public abstract boolean isSyncToContactsEnabled()
throws RemoteException;
public abstract Bundle zza(zzf paramzzf, boolean paramBoolean, String paramString1, String paramString2, int paramInt)
throws RemoteException;
public abstract Bundle zza(String paramString1, String paramString2, long paramLong, boolean paramBoolean)
throws RemoteException;
public abstract Bundle zza(String paramString1, String paramString2, long paramLong, boolean paramBoolean1, boolean paramBoolean2)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, DataHolder paramDataHolder, int paramInt1, int paramInt2, long paramLong)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, AccountToken paramAccountToken, ParcelableListOptions paramParcelableListOptions)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, AvatarReference paramAvatarReference, ParcelableLoadImageOptions paramParcelableLoadImageOptions)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, String paramString, int paramInt)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, String paramString1, String paramString2, Bundle paramBundle)
throws RemoteException;
public abstract zzq zza(zzf paramzzf, String paramString1, String paramString2, boolean paramBoolean1, String paramString3, String paramString4, int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean2)
throws RemoteException;
public abstract void zza(zzf paramzzf, long paramLong, boolean paramBoolean)
throws RemoteException;
public abstract void zza(zzf paramzzf, Bundle paramBundle)
throws RemoteException;
public abstract void zza(zzf paramzzf, AccountToken paramAccountToken, List<String> paramList, ParcelableGetOptions paramParcelableGetOptions)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString, int paramInt1, int paramInt2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, int paramInt1, int paramInt2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, Uri paramUri)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, Uri paramUri, boolean paramBoolean)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4, boolean paramBoolean)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean, int paramInt2, int paramInt3, String paramString4)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, String paramString4, boolean paramBoolean2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, String paramString4, boolean paramBoolean2, int paramInt4, int paramInt5)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4, int paramInt, String paramString5)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt, boolean paramBoolean, long paramLong)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2, int paramInt3)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2, int paramInt3, int paramInt4)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList1, List<String> paramList2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList1, List<String> paramList2, FavaDiagnosticsEntity paramFavaDiagnosticsEntity)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt1, int paramInt2)
throws RemoteException;
public abstract void zza(zzf paramzzf, String paramString, boolean paramBoolean, String[] paramArrayOfString)
throws RemoteException;
public abstract void zza(zzf paramzzf, boolean paramBoolean1, boolean paramBoolean2, String paramString1, String paramString2)
throws RemoteException;
public abstract void zza(zzf paramzzf, boolean paramBoolean1, boolean paramBoolean2, String paramString1, String paramString2, int paramInt)
throws RemoteException;
public abstract void zzaQ(boolean paramBoolean)
throws RemoteException;
public abstract Bundle zzac(String paramString1, String paramString2)
throws RemoteException;
public abstract Bundle zzad(String paramString1, String paramString2)
throws RemoteException;
public abstract zzq zzb(zzf paramzzf, long paramLong, boolean paramBoolean)
throws RemoteException;
public abstract zzq zzb(zzf paramzzf, String paramString)
throws RemoteException;
public abstract zzq zzb(zzf paramzzf, String paramString, int paramInt1, int paramInt2)
throws RemoteException;
public abstract zzq zzb(zzf paramzzf, String paramString1, String paramString2, int paramInt1, int paramInt2)
throws RemoteException;
public abstract void zzb(zzf paramzzf, Bundle paramBundle)
throws RemoteException;
public abstract void zzb(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException;
public abstract void zzb(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException;
public abstract void zzb(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4)
throws RemoteException;
public abstract void zzb(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean)
throws RemoteException;
public abstract Bundle zzc(String paramString1, String paramString2, long paramLong)
throws RemoteException;
public abstract zzq zzc(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException;
public abstract void zzc(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException;
public abstract Bundle zzp(Uri paramUri)
throws RemoteException;
public static abstract class zza
extends Binder
implements zzg
{
public static zzg zzfT(IBinder paramIBinder)
{
if (paramIBinder == null) {
return null;
}
IInterface localIInterface = paramIBinder.queryLocalInterface("com.google.android.gms.people.internal.IPeopleService");
if ((localIInterface != null) && ((localIInterface instanceof zzg))) {
return (zzg)localIInterface;
}
return new zza(paramIBinder);
}
public boolean onTransact(int paramInt1, Parcel paramParcel1, Parcel paramParcel2, int paramInt2)
throws RemoteException
{
switch (paramInt1)
{
default:
return super.onTransact(paramInt1, paramParcel1, paramParcel2, paramInt2);
case 1598968902:
paramParcel2.writeString("com.google.android.gms.people.internal.IPeopleService");
return true;
case 2:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf30 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
boolean bool30;
if (paramParcel1.readInt() != 0)
{
bool30 = true;
if (paramParcel1.readInt() == 0) {
break label567;
}
}
for (boolean bool31 = true;; bool31 = false)
{
zza(localzzf30, bool30, bool31, paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
bool30 = false;
break;
}
case 305:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf29 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
boolean bool28;
if (paramParcel1.readInt() != 0)
{
bool28 = true;
if (paramParcel1.readInt() == 0) {
break label642;
}
}
for (boolean bool29 = true;; bool29 = false)
{
zza(localzzf29, bool28, bool29, paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
bool28 = false;
break;
}
case 3:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 4:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf28 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str59 = paramParcel1.readString();
String str60 = paramParcel1.readString();
String str61 = paramParcel1.readString();
ArrayList localArrayList7 = paramParcel1.createStringArrayList();
int i11 = paramParcel1.readInt();
if (paramParcel1.readInt() != 0) {}
for (boolean bool27 = true;; bool27 = false)
{
zza(localzzf28, str59, str60, str61, localArrayList7, i11, bool27, paramParcel1.readLong());
paramParcel2.writeNoException();
return true;
}
case 5:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
case 6:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf27 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
long l4 = paramParcel1.readLong();
if (paramParcel1.readInt() != 0) {}
for (boolean bool26 = true;; bool26 = false)
{
zza(localzzf27, l4, bool26);
paramParcel2.writeNoException();
return true;
}
case 7:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf26 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str56 = paramParcel1.readString();
String str57 = paramParcel1.readString();
String str58 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool25 = true;; bool25 = false)
{
zza(localzzf26, str56, str57, str58, bool25);
paramParcel2.writeNoException();
return true;
}
case 603:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf25 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str53 = paramParcel1.readString();
String str54 = paramParcel1.readString();
String str55 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool24 = true;; bool24 = false)
{
zzb(localzzf25, str53, str54, str55, bool24);
paramParcel2.writeNoException();
return true;
}
case 8:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
Uri localUri3;
if (paramParcel1.readInt() != 0)
{
localUri3 = (Uri)Uri.CREATOR.createFromParcel(paramParcel1);
Bundle localBundle10 = zzp(localUri3);
paramParcel2.writeNoException();
if (localBundle10 == null) {
break label1070;
}
paramParcel2.writeInt(1);
localBundle10.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
localUri3 = null;
break;
paramParcel2.writeInt(0);
}
case 9:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf24 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str50 = paramParcel1.readString();
String str51 = paramParcel1.readString();
String str52 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool23 = true;; bool23 = false)
{
zza(localzzf24, str50, str51, str52, bool23, paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
}
case 201:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf23 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str47 = paramParcel1.readString();
String str48 = paramParcel1.readString();
String str49 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool22 = true;; bool22 = false)
{
zza(localzzf23, str47, str48, str49, bool22, paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
}
case 202:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf22 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str44 = paramParcel1.readString();
String str45 = paramParcel1.readString();
String str46 = paramParcel1.readString();
int i10 = paramParcel1.readInt();
if (paramParcel1.readInt() != 0) {}
for (boolean bool21 = true;; bool21 = false)
{
zza(localzzf22, str44, str45, str46, i10, bool21, paramParcel1.readInt(), paramParcel1.readInt(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
}
case 203:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf21 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str40 = paramParcel1.readString();
String str41 = paramParcel1.readString();
String str42 = paramParcel1.readString();
int i7 = paramParcel1.readInt();
boolean bool19;
int i8;
int i9;
String str43;
if (paramParcel1.readInt() != 0)
{
bool19 = true;
i8 = paramParcel1.readInt();
i9 = paramParcel1.readInt();
str43 = paramParcel1.readString();
if (paramParcel1.readInt() == 0) {
break label1430;
}
}
for (boolean bool20 = true;; bool20 = false)
{
zza(localzzf21, str40, str41, str42, i7, bool19, i8, i9, str43, bool20);
paramParcel2.writeNoException();
return true;
bool19 = false;
break;
}
case 402:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf20 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str36 = paramParcel1.readString();
String str37 = paramParcel1.readString();
String str38 = paramParcel1.readString();
int i4 = paramParcel1.readInt();
boolean bool17;
int i5;
int i6;
String str39;
if (paramParcel1.readInt() != 0)
{
bool17 = true;
i5 = paramParcel1.readInt();
i6 = paramParcel1.readInt();
str39 = paramParcel1.readString();
if (paramParcel1.readInt() == 0) {
break label1557;
}
}
for (boolean bool18 = true;; bool18 = false)
{
zza(localzzf20, str36, str37, str38, i4, bool17, i5, i6, str39, bool18, paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
bool17 = false;
break;
}
case 10:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf19 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str35 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool16 = true;; bool16 = false)
{
zza(localzzf19, str35, bool16, paramParcel1.createStringArray());
paramParcel2.writeNoException();
return true;
}
case 11:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf18 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
boolean bool15;
if (paramParcel1.readInt() != 0)
{
bool15 = true;
Bundle localBundle9 = zza(localzzf18, bool15, paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
if (localBundle9 == null) {
break label1696;
}
paramParcel2.writeInt(1);
localBundle9.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
bool15 = false;
break;
paramParcel2.writeInt(0);
}
case 12:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
Bundle localBundle8 = zzac(paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
if (localBundle8 != null)
{
paramParcel2.writeInt(1);
localBundle8.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
paramParcel2.writeInt(0);
}
case 13:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf17 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str33 = paramParcel1.readString();
String str34 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (Uri localUri2 = (Uri)Uri.CREATOR.createFromParcel(paramParcel1);; localUri2 = null)
{
zza(localzzf17, str33, str34, localUri2);
paramParcel2.writeNoException();
return true;
}
case 14:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.createStringArrayList(), paramParcel1.createStringArrayList());
paramParcel2.writeNoException();
return true;
case 15:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
if (paramParcel1.readInt() != 0) {}
for (boolean bool14 = true;; bool14 = false)
{
zzaQ(bool14);
paramParcel2.writeNoException();
return true;
}
case 16:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
boolean bool13 = isSyncToContactsEnabled();
paramParcel2.writeNoException();
if (bool13) {}
for (int i3 = 1;; i3 = 0)
{
paramParcel2.writeInt(i3);
return true;
}
case 17:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
Bundle localBundle7 = zzad(paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
if (localBundle7 != null)
{
paramParcel2.writeInt(1);
localBundle7.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
paramParcel2.writeInt(0);
}
case 18:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf16 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str31 = paramParcel1.readString();
String str32 = paramParcel1.readString();
Uri localUri1;
if (paramParcel1.readInt() != 0)
{
localUri1 = (Uri)Uri.CREATOR.createFromParcel(paramParcel1);
if (paramParcel1.readInt() == 0) {
break label2077;
}
}
for (boolean bool12 = true;; bool12 = false)
{
zza(localzzf16, str31, str32, localUri1, bool12);
paramParcel2.writeNoException();
return true;
localUri1 = null;
break;
}
case 19:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf15 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str27 = paramParcel1.readString();
String str28 = paramParcel1.readString();
String str29 = paramParcel1.readString();
int i2 = paramParcel1.readInt();
String str30 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool11 = true;; bool11 = false)
{
zza(localzzf15, str27, str28, str29, i2, str30, bool11);
paramParcel2.writeNoException();
return true;
}
case 20:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
Bundle localBundle6 = zzc(paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readLong());
paramParcel2.writeNoException();
if (localBundle6 != null)
{
paramParcel2.writeInt(1);
localBundle6.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
paramParcel2.writeInt(0);
}
case 21:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf14 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str24 = paramParcel1.readString();
String str25 = paramParcel1.readString();
String str26 = paramParcel1.readString();
ArrayList localArrayList6 = paramParcel1.createStringArrayList();
int i1 = paramParcel1.readInt();
if (paramParcel1.readInt() != 0) {}
for (boolean bool10 = true;; bool10 = false)
{
zza(localzzf14, str24, str25, str26, localArrayList6, i1, bool10, paramParcel1.readLong(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
}
case 401:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf13 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str21 = paramParcel1.readString();
String str22 = paramParcel1.readString();
String str23 = paramParcel1.readString();
ArrayList localArrayList5 = paramParcel1.createStringArrayList();
int n = paramParcel1.readInt();
if (paramParcel1.readInt() != 0) {}
for (boolean bool9 = true;; bool9 = false)
{
zza(localzzf13, str21, str22, str23, localArrayList5, n, bool9, paramParcel1.readLong(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
}
case 404:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf12 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str18 = paramParcel1.readString();
String str19 = paramParcel1.readString();
String str20 = paramParcel1.readString();
ArrayList localArrayList4 = paramParcel1.createStringArrayList();
int m = paramParcel1.readInt();
if (paramParcel1.readInt() != 0) {}
for (boolean bool8 = true;; bool8 = false)
{
zza(localzzf12, str18, str19, str20, localArrayList4, m, bool8, paramParcel1.readLong(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
}
case 22:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 23:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf11 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str15 = paramParcel1.readString();
String str16 = paramParcel1.readString();
String str17 = paramParcel1.readString();
ArrayList localArrayList2 = paramParcel1.createStringArrayList();
ArrayList localArrayList3 = paramParcel1.createStringArrayList();
if (paramParcel1.readInt() != 0) {}
for (FavaDiagnosticsEntity localFavaDiagnosticsEntity = com.google.android.gms.common.server.zza.zzbe(paramParcel1);; localFavaDiagnosticsEntity = null)
{
zza(localzzf11, str15, str16, str17, localArrayList2, localArrayList3, localFavaDiagnosticsEntity);
paramParcel2.writeNoException();
return true;
}
case 24:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 25:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 403:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
case 26:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
String str13 = paramParcel1.readString();
String str14 = paramParcel1.readString();
long l3 = paramParcel1.readLong();
boolean bool7;
if (paramParcel1.readInt() != 0)
{
bool7 = true;
Bundle localBundle5 = zza(str13, str14, l3, bool7);
paramParcel2.writeNoException();
if (localBundle5 == null) {
break label2831;
}
paramParcel2.writeInt(1);
localBundle5.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
bool7 = false;
break;
paramParcel2.writeInt(0);
}
case 205:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
String str11 = paramParcel1.readString();
String str12 = paramParcel1.readString();
long l2 = paramParcel1.readLong();
boolean bool5;
boolean bool6;
if (paramParcel1.readInt() != 0)
{
bool5 = true;
if (paramParcel1.readInt() == 0) {
break label2928;
}
bool6 = true;
Bundle localBundle4 = zza(str11, str12, l2, bool5, bool6);
paramParcel2.writeNoException();
if (localBundle4 == null) {
break label2934;
}
paramParcel2.writeInt(1);
localBundle4.writeToParcel(paramParcel2, 1);
}
for (;;)
{
return true;
bool5 = false;
break;
bool6 = false;
break label2883;
paramParcel2.writeInt(0);
}
case 101:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 102:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzc(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 27:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 701:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf10 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str7 = paramParcel1.readString();
String str8 = paramParcel1.readString();
String str9 = paramParcel1.readString();
String str10 = paramParcel1.readString();
if (paramParcel1.readInt() != 0) {}
for (boolean bool4 = true;; bool4 = false)
{
zza(localzzf10, str7, str8, str9, str10, bool4);
paramParcel2.writeNoException();
return true;
}
case 28:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.createStringArrayList());
paramParcel2.writeNoException();
return true;
case 29:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
case 204:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 301:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
return true;
case 302:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf9 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
if (paramParcel1.readInt() != 0) {}
for (Bundle localBundle3 = (Bundle)Bundle.CREATOR.createFromParcel(paramParcel1);; localBundle3 = null)
{
zza(localzzf9, localBundle3);
paramParcel2.writeNoException();
return true;
}
case 303:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readString());
paramParcel2.writeNoException();
return true;
case 304:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf8 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
if (paramParcel1.readInt() != 0) {}
for (Bundle localBundle2 = (Bundle)Bundle.CREATOR.createFromParcel(paramParcel1);; localBundle2 = null)
{
zzb(localzzf8, localBundle2);
paramParcel2.writeNoException();
return true;
}
case 501:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf7 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
AccountToken localAccountToken2;
ArrayList localArrayList1;
if (paramParcel1.readInt() != 0)
{
localAccountToken2 = com.google.android.gms.people.identity.internal.zza.zzhG(paramParcel1);
localArrayList1 = paramParcel1.createStringArrayList();
if (paramParcel1.readInt() == 0) {
break label3506;
}
}
for (ParcelableGetOptions localParcelableGetOptions = zzi.zzhH(paramParcel1);; localParcelableGetOptions = null)
{
zza(localzzf7, localAccountToken2, localArrayList1, localParcelableGetOptions);
paramParcel2.writeNoException();
return true;
localAccountToken2 = null;
break;
}
case 502:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzq localzzq11 = zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
if (localzzq11 != null) {}
for (IBinder localIBinder11 = localzzq11.asBinder();; localIBinder11 = null)
{
paramParcel2.writeStrongBinder(localIBinder11);
return true;
}
case 503:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf6 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
long l1 = paramParcel1.readLong();
boolean bool3;
zzq localzzq10;
if (paramParcel1.readInt() != 0)
{
bool3 = true;
localzzq10 = zzb(localzzf6, l1, bool3);
paramParcel2.writeNoException();
if (localzzq10 == null) {
break label3650;
}
}
for (IBinder localIBinder10 = localzzq10.asBinder();; localIBinder10 = null)
{
paramParcel2.writeStrongBinder(localIBinder10);
return true;
bool3 = false;
break;
}
case 504:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzq localzzq9 = zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString());
paramParcel2.writeNoException();
if (localzzq9 != null) {}
for (IBinder localIBinder9 = localzzq9.asBinder();; localIBinder9 = null)
{
paramParcel2.writeStrongBinder(localIBinder9);
return true;
}
case 505:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzq localzzq8 = zzb(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt(), paramParcel1.readInt());
paramParcel2.writeNoException();
if (localzzq8 != null) {}
for (IBinder localIBinder8 = localzzq8.asBinder();; localIBinder8 = null)
{
paramParcel2.writeStrongBinder(localIBinder8);
return true;
}
case 506:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzq localzzq7 = zzc(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
if (localzzq7 != null) {}
for (IBinder localIBinder7 = localzzq7.asBinder();; localIBinder7 = null)
{
paramParcel2.writeStrongBinder(localIBinder7);
return true;
}
case 507:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf5 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str3 = paramParcel1.readString();
String str4 = paramParcel1.readString();
boolean bool1;
boolean bool2;
zzq localzzq6;
if (paramParcel1.readInt() != 0)
{
bool1 = true;
String str5 = paramParcel1.readString();
String str6 = paramParcel1.readString();
int i = paramParcel1.readInt();
int j = paramParcel1.readInt();
int k = paramParcel1.readInt();
if (paramParcel1.readInt() == 0) {
break label3976;
}
bool2 = true;
localzzq6 = zza(localzzf5, str3, str4, bool1, str5, str6, i, j, k, bool2);
paramParcel2.writeNoException();
if (localzzq6 == null) {
break label3982;
}
}
for (IBinder localIBinder6 = localzzq6.asBinder();; localIBinder6 = null)
{
paramParcel2.writeStrongBinder(localIBinder6);
return true;
bool1 = false;
break;
bool2 = false;
break label3918;
}
case 508:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf4 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
AvatarReference localAvatarReference;
ParcelableLoadImageOptions localParcelableLoadImageOptions;
zzq localzzq5;
if (paramParcel1.readInt() != 0)
{
localAvatarReference = ParcelableAvatarReference.createFromParcel(paramParcel1);
if (paramParcel1.readInt() == 0) {
break label4081;
}
localParcelableLoadImageOptions = zzk.zziX(paramParcel1);
localzzq5 = zza(localzzf4, localAvatarReference, localParcelableLoadImageOptions);
paramParcel2.writeNoException();
if (localzzq5 == null) {
break label4087;
}
}
for (IBinder localIBinder5 = localzzq5.asBinder();; localIBinder5 = null)
{
paramParcel2.writeStrongBinder(localIBinder5);
return true;
localAvatarReference = null;
break;
localParcelableLoadImageOptions = null;
break label4037;
}
case 509:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzq localzzq4 = zza(zzf.zza.zzfS(paramParcel1.readStrongBinder()), paramParcel1.readString(), paramParcel1.readInt());
paramParcel2.writeNoException();
if (localzzq4 != null) {}
for (IBinder localIBinder4 = localzzq4.asBinder();; localIBinder4 = null)
{
paramParcel2.writeStrongBinder(localIBinder4);
return true;
}
case 601:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf3 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
AccountToken localAccountToken1;
ParcelableListOptions localParcelableListOptions;
zzq localzzq3;
if (paramParcel1.readInt() != 0)
{
localAccountToken1 = com.google.android.gms.people.identity.internal.zza.zzhG(paramParcel1);
if (paramParcel1.readInt() == 0) {
break label4245;
}
localParcelableListOptions = zzj.zzhI(paramParcel1);
localzzq3 = zza(localzzf3, localAccountToken1, localParcelableListOptions);
paramParcel2.writeNoException();
if (localzzq3 == null) {
break label4251;
}
}
for (IBinder localIBinder3 = localzzq3.asBinder();; localIBinder3 = null)
{
paramParcel2.writeStrongBinder(localIBinder3);
return true;
localAccountToken1 = null;
break;
localParcelableListOptions = null;
break label4201;
}
case 602:
label567:
label2883:
label2928:
label2934:
label4087:
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
label642:
label1070:
label3506:
label3650:
label3918:
label4081:
zzf localzzf2 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
label1430:
label1696:
label4037:
label4201:
DataHolder localDataHolder;
label1557:
label2077:
zzq localzzq2;
label2831:
label4245:
label4251:
if (paramParcel1.readInt() != 0)
{
localDataHolder = DataHolderCreator.createFromParcel(paramParcel1);
localzzq2 = zza(localzzf2, localDataHolder, paramParcel1.readInt(), paramParcel1.readInt(), paramParcel1.readLong());
paramParcel2.writeNoException();
if (localzzq2 == null) {
break label4343;
}
}
label3976:
label3982:
label4343:
for (IBinder localIBinder2 = localzzq2.asBinder();; localIBinder2 = null)
{
paramParcel2.writeStrongBinder(localIBinder2);
return true;
localDataHolder = null;
break;
}
}
paramParcel1.enforceInterface("com.google.android.gms.people.internal.IPeopleService");
zzf localzzf1 = zzf.zza.zzfS(paramParcel1.readStrongBinder());
String str1 = paramParcel1.readString();
String str2 = paramParcel1.readString();
Bundle localBundle1;
zzq localzzq1;
if (paramParcel1.readInt() != 0)
{
localBundle1 = (Bundle)Bundle.CREATOR.createFromParcel(paramParcel1);
localzzq1 = zza(localzzf1, str1, str2, localBundle1);
paramParcel2.writeNoException();
if (localzzq1 == null) {
break label4443;
}
}
label4443:
for (IBinder localIBinder1 = localzzq1.asBinder();; localIBinder1 = null)
{
paramParcel2.writeStrongBinder(localIBinder1);
return true;
localBundle1 = null;
break;
}
}
private static final class zza
implements zzg
{
private IBinder zzop;
zza(IBinder paramIBinder)
{
this.zzop = paramIBinder;
}
public final IBinder asBinder()
{
return this.zzop;
}
public final boolean isSyncToContactsEnabled()
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
this.zzop.transact(16, localParcel1, localParcel2, 0);
localParcel2.readException();
int i = localParcel2.readInt();
boolean bool = false;
if (i != 0) {
bool = true;
}
return bool;
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
/* Error */
public final Bundle zza(zzf paramzzf, boolean paramBoolean, String paramString1, String paramString2, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +120 -> 138
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: iconst_0
// 37: istore 10
// 39: iload_2
// 40: ifeq +6 -> 46
// 43: iconst_1
// 44: istore 10
// 46: aload 6
// 48: iload 10
// 50: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 53: aload 6
// 55: aload_3
// 56: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 59: aload 6
// 61: aload 4
// 63: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 66: aload 6
// 68: iload 5
// 70: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 73: aload_0
// 74: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 77: bipush 11
// 79: aload 6
// 81: aload 7
// 83: iconst_0
// 84: invokeinterface 39 5 0
// 89: pop
// 90: aload 7
// 92: invokevirtual 42 android/os/Parcel:readException ()V
// 95: aload 7
// 97: invokevirtual 46 android/os/Parcel:readInt ()I
// 100: istore 12
// 102: aconst_null
// 103: astore 13
// 105: iload 12
// 107: ifeq +18 -> 125
// 110: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 113: aload 7
// 115: invokeinterface 77 2 0
// 120: checkcast 67 android/os/Bundle
// 123: astore 13
// 125: aload 7
// 127: invokevirtual 49 android/os/Parcel:recycle ()V
// 130: aload 6
// 132: invokevirtual 49 android/os/Parcel:recycle ()V
// 135: aload 13
// 137: areturn
// 138: aconst_null
// 139: astore 9
// 141: goto -112 -> 29
// 144: astore 8
// 146: aload 7
// 148: invokevirtual 49 android/os/Parcel:recycle ()V
// 151: aload 6
// 153: invokevirtual 49 android/os/Parcel:recycle ()V
// 156: aload 8
// 158: athrow
// Local variable table:
// start length slot name signature
// 0 159 0 this zza
// 0 159 1 paramzzf zzf
// 0 159 2 paramBoolean boolean
// 0 159 3 paramString1 String
// 0 159 4 paramString2 String
// 0 159 5 paramInt int
// 3 149 6 localParcel1 Parcel
// 8 139 7 localParcel2 Parcel
// 144 13 8 localObject Object
// 27 113 9 localIBinder IBinder
// 37 12 10 i int
// 100 6 12 j int
// 103 33 13 localBundle Bundle
// Exception table:
// from to target type
// 10 17 144 finally
// 21 29 144 finally
// 29 36 144 finally
// 46 102 144 finally
// 110 125 144 finally
}
/* Error */
public final Bundle zza(String paramString1, String paramString2, long paramLong, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload 6
// 19: aload_1
// 20: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 23: aload 6
// 25: aload_2
// 26: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 29: aload 6
// 31: lload_3
// 32: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 35: iconst_0
// 36: istore 9
// 38: iload 5
// 40: ifeq +6 -> 46
// 43: iconst_1
// 44: istore 9
// 46: aload 6
// 48: iload 9
// 50: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 53: aload_0
// 54: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 57: bipush 26
// 59: aload 6
// 61: aload 7
// 63: iconst_0
// 64: invokeinterface 39 5 0
// 69: pop
// 70: aload 7
// 72: invokevirtual 42 android/os/Parcel:readException ()V
// 75: aload 7
// 77: invokevirtual 46 android/os/Parcel:readInt ()I
// 80: ifeq +31 -> 111
// 83: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 86: aload 7
// 88: invokeinterface 77 2 0
// 93: checkcast 67 android/os/Bundle
// 96: astore 11
// 98: aload 7
// 100: invokevirtual 49 android/os/Parcel:recycle ()V
// 103: aload 6
// 105: invokevirtual 49 android/os/Parcel:recycle ()V
// 108: aload 11
// 110: areturn
// 111: aconst_null
// 112: astore 11
// 114: goto -16 -> 98
// 117: astore 8
// 119: aload 7
// 121: invokevirtual 49 android/os/Parcel:recycle ()V
// 124: aload 6
// 126: invokevirtual 49 android/os/Parcel:recycle ()V
// 129: aload 8
// 131: athrow
// Local variable table:
// start length slot name signature
// 0 132 0 this zza
// 0 132 1 paramString1 String
// 0 132 2 paramString2 String
// 0 132 3 paramLong long
// 0 132 5 paramBoolean boolean
// 3 122 6 localParcel1 Parcel
// 8 112 7 localParcel2 Parcel
// 117 13 8 localObject Object
// 36 13 9 i int
// 96 17 11 localBundle Bundle
// Exception table:
// from to target type
// 10 35 117 finally
// 46 98 117 finally
}
/* Error */
public final Bundle zza(String paramString1, String paramString2, long paramLong, boolean paramBoolean1, boolean paramBoolean2)
throws RemoteException
{
// Byte code:
// 0: iconst_1
// 1: istore 7
// 3: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 6: astore 8
// 8: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 11: astore 9
// 13: aload 8
// 15: ldc 29
// 17: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 20: aload 8
// 22: aload_1
// 23: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 26: aload 8
// 28: aload_2
// 29: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 32: aload 8
// 34: lload_3
// 35: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 38: iload 5
// 40: ifeq +85 -> 125
// 43: iload 7
// 45: istore 11
// 47: aload 8
// 49: iload 11
// 51: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 54: iload 6
// 56: ifeq +75 -> 131
// 59: aload 8
// 61: iload 7
// 63: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 66: aload_0
// 67: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 70: sipush 205
// 73: aload 8
// 75: aload 9
// 77: iconst_0
// 78: invokeinterface 39 5 0
// 83: pop
// 84: aload 9
// 86: invokevirtual 42 android/os/Parcel:readException ()V
// 89: aload 9
// 91: invokevirtual 46 android/os/Parcel:readInt ()I
// 94: ifeq +43 -> 137
// 97: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 100: aload 9
// 102: invokeinterface 77 2 0
// 107: checkcast 67 android/os/Bundle
// 110: astore 13
// 112: aload 9
// 114: invokevirtual 49 android/os/Parcel:recycle ()V
// 117: aload 8
// 119: invokevirtual 49 android/os/Parcel:recycle ()V
// 122: aload 13
// 124: areturn
// 125: iconst_0
// 126: istore 11
// 128: goto -81 -> 47
// 131: iconst_0
// 132: istore 7
// 134: goto -75 -> 59
// 137: aconst_null
// 138: astore 13
// 140: goto -28 -> 112
// 143: astore 10
// 145: aload 9
// 147: invokevirtual 49 android/os/Parcel:recycle ()V
// 150: aload 8
// 152: invokevirtual 49 android/os/Parcel:recycle ()V
// 155: aload 10
// 157: athrow
// Local variable table:
// start length slot name signature
// 0 158 0 this zza
// 0 158 1 paramString1 String
// 0 158 2 paramString2 String
// 0 158 3 paramLong long
// 0 158 5 paramBoolean1 boolean
// 0 158 6 paramBoolean2 boolean
// 1 132 7 i int
// 6 145 8 localParcel1 Parcel
// 11 135 9 localParcel2 Parcel
// 143 13 10 localObject Object
// 45 82 11 j int
// 110 29 13 localBundle Bundle
// Exception table:
// from to target type
// 13 38 143 finally
// 47 54 143 finally
// 59 112 143 finally
}
/* Error */
public final zzq zza(zzf paramzzf, DataHolder paramDataHolder, int paramInt1, int paramInt2, long paramLong)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +101 -> 119
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload_2
// 37: ifnull +88 -> 125
// 40: aload 7
// 42: iconst_1
// 43: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 46: aload_2
// 47: aload 7
// 49: iconst_0
// 50: invokevirtual 90 com/google/android/gms/common/data/DataHolder:writeToParcel (Landroid/os/Parcel;I)V
// 53: aload 7
// 55: iload_3
// 56: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 59: aload 7
// 61: iload 4
// 63: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 66: aload 7
// 68: lload 5
// 70: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 73: aload_0
// 74: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 77: sipush 602
// 80: aload 7
// 82: aload 8
// 84: iconst_0
// 85: invokeinterface 39 5 0
// 90: pop
// 91: aload 8
// 93: invokevirtual 42 android/os/Parcel:readException ()V
// 96: aload 8
// 98: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 101: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 104: astore 12
// 106: aload 8
// 108: invokevirtual 49 android/os/Parcel:recycle ()V
// 111: aload 7
// 113: invokevirtual 49 android/os/Parcel:recycle ()V
// 116: aload 12
// 118: areturn
// 119: aconst_null
// 120: astore 10
// 122: goto -93 -> 29
// 125: aload 7
// 127: iconst_0
// 128: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 131: goto -78 -> 53
// 134: astore 9
// 136: aload 8
// 138: invokevirtual 49 android/os/Parcel:recycle ()V
// 141: aload 7
// 143: invokevirtual 49 android/os/Parcel:recycle ()V
// 146: aload 9
// 148: athrow
// Local variable table:
// start length slot name signature
// 0 149 0 this zza
// 0 149 1 paramzzf zzf
// 0 149 2 paramDataHolder DataHolder
// 0 149 3 paramInt1 int
// 0 149 4 paramInt2 int
// 0 149 5 paramLong long
// 3 139 7 localParcel1 Parcel
// 8 129 8 localParcel2 Parcel
// 134 13 9 localObject Object
// 27 94 10 localIBinder IBinder
// 104 13 12 localzzq zzq
// Exception table:
// from to target type
// 10 17 134 finally
// 21 29 134 finally
// 29 36 134 finally
// 40 53 134 finally
// 53 106 134 finally
// 125 131 134 finally
}
public final zzq zza(zzf paramzzf, AccountToken paramAccountToken, ParcelableListOptions paramParcelableListOptions)
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
label146:
for (;;)
{
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
IBinder localIBinder;
if (paramzzf != null)
{
localIBinder = paramzzf.asBinder();
localParcel1.writeStrongBinder(localIBinder);
if (paramAccountToken != null)
{
localParcel1.writeInt(1);
paramAccountToken.writeToParcel(localParcel1, 0);
if (paramParcelableListOptions == null) {
break label146;
}
localParcel1.writeInt(1);
paramParcelableListOptions.writeToParcel(localParcel1, 0);
this.zzop.transact(601, localParcel1, localParcel2, 0);
localParcel2.readException();
zzq localzzq = zzq.zza.zzck(localParcel2.readStrongBinder());
return localzzq;
}
}
else
{
localIBinder = null;
continue;
}
localParcel1.writeInt(0);
continue;
localParcel1.writeInt(0);
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
}
public final zzq zza(zzf paramzzf, AvatarReference paramAvatarReference, ParcelableLoadImageOptions paramParcelableLoadImageOptions)
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
label146:
for (;;)
{
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
IBinder localIBinder;
if (paramzzf != null)
{
localIBinder = paramzzf.asBinder();
localParcel1.writeStrongBinder(localIBinder);
if (paramAvatarReference != null)
{
localParcel1.writeInt(1);
paramAvatarReference.writeToParcel(localParcel1, 0);
if (paramParcelableLoadImageOptions == null) {
break label146;
}
localParcel1.writeInt(1);
paramParcelableLoadImageOptions.writeToParcel(localParcel1, 0);
this.zzop.transact(508, localParcel1, localParcel2, 0);
localParcel2.readException();
zzq localzzq = zzq.zza.zzck(localParcel2.readStrongBinder());
return localzzq;
}
}
else
{
localIBinder = null;
continue;
}
localParcel1.writeInt(0);
continue;
localParcel1.writeInt(0);
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
}
/* Error */
public final zzq zza(zzf paramzzf, String paramString, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 4
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 5
// 10: aload 4
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +76 -> 94
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 7
// 29: aload 4
// 31: aload 7
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 4
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 4
// 44: iload_3
// 45: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: sipush 509
// 55: aload 4
// 57: aload 5
// 59: iconst_0
// 60: invokeinterface 39 5 0
// 65: pop
// 66: aload 5
// 68: invokevirtual 42 android/os/Parcel:readException ()V
// 71: aload 5
// 73: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 76: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 79: astore 9
// 81: aload 5
// 83: invokevirtual 49 android/os/Parcel:recycle ()V
// 86: aload 4
// 88: invokevirtual 49 android/os/Parcel:recycle ()V
// 91: aload 9
// 93: areturn
// 94: aconst_null
// 95: astore 7
// 97: goto -68 -> 29
// 100: astore 6
// 102: aload 5
// 104: invokevirtual 49 android/os/Parcel:recycle ()V
// 107: aload 4
// 109: invokevirtual 49 android/os/Parcel:recycle ()V
// 112: aload 6
// 114: athrow
// Local variable table:
// start length slot name signature
// 0 115 0 this zza
// 0 115 1 paramzzf zzf
// 0 115 2 paramString String
// 0 115 3 paramInt int
// 3 105 4 localParcel1 Parcel
// 8 95 5 localParcel2 Parcel
// 100 13 6 localObject Object
// 27 69 7 localIBinder IBinder
// 79 13 9 localzzq zzq
// Exception table:
// from to target type
// 10 17 100 finally
// 21 29 100 finally
// 29 81 100 finally
}
/* Error */
public final zzq zza(zzf paramzzf, String paramString1, String paramString2, Bundle paramBundle)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +95 -> 113
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 4
// 50: ifnull +69 -> 119
// 53: aload 5
// 55: iconst_1
// 56: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 59: aload 4
// 61: aload 5
// 63: iconst_0
// 64: invokevirtual 116 android/os/Bundle:writeToParcel (Landroid/os/Parcel;I)V
// 67: aload_0
// 68: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 71: sipush 1201
// 74: aload 5
// 76: aload 6
// 78: iconst_0
// 79: invokeinterface 39 5 0
// 84: pop
// 85: aload 6
// 87: invokevirtual 42 android/os/Parcel:readException ()V
// 90: aload 6
// 92: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 95: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 98: astore 10
// 100: aload 6
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 5
// 107: invokevirtual 49 android/os/Parcel:recycle ()V
// 110: aload 10
// 112: areturn
// 113: aconst_null
// 114: astore 8
// 116: goto -87 -> 29
// 119: aload 5
// 121: iconst_0
// 122: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 125: goto -58 -> 67
// 128: astore 7
// 130: aload 6
// 132: invokevirtual 49 android/os/Parcel:recycle ()V
// 135: aload 5
// 137: invokevirtual 49 android/os/Parcel:recycle ()V
// 140: aload 7
// 142: athrow
// Local variable table:
// start length slot name signature
// 0 143 0 this zza
// 0 143 1 paramzzf zzf
// 0 143 2 paramString1 String
// 0 143 3 paramString2 String
// 0 143 4 paramBundle Bundle
// 3 133 5 localParcel1 Parcel
// 8 123 6 localParcel2 Parcel
// 128 13 7 localObject Object
// 27 88 8 localIBinder IBinder
// 98 13 10 localzzq zzq
// Exception table:
// from to target type
// 10 17 128 finally
// 21 29 128 finally
// 29 48 128 finally
// 53 67 128 finally
// 67 100 128 finally
// 119 125 128 finally
}
/* Error */
public final zzq zza(zzf paramzzf, String paramString1, String paramString2, boolean paramBoolean1, String paramString3, String paramString4, int paramInt1, int paramInt2, int paramInt3, boolean paramBoolean2)
throws RemoteException
{
// Byte code:
// 0: iconst_1
// 1: istore 11
// 3: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 6: astore 12
// 8: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 11: astore 13
// 13: aload 12
// 15: ldc 29
// 17: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 20: aload_1
// 21: ifnull +139 -> 160
// 24: aload_1
// 25: invokeinterface 55 1 0
// 30: astore 15
// 32: aload 12
// 34: aload 15
// 36: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 39: aload 12
// 41: aload_2
// 42: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 45: aload 12
// 47: aload_3
// 48: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 51: iload 4
// 53: ifeq +113 -> 166
// 56: iload 11
// 58: istore 16
// 60: aload 12
// 62: iload 16
// 64: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 67: aload 12
// 69: aload 5
// 71: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 74: aload 12
// 76: aload 6
// 78: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 81: aload 12
// 83: iload 7
// 85: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 88: aload 12
// 90: iload 8
// 92: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 95: aload 12
// 97: iload 9
// 99: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 102: iload 10
// 104: ifeq +68 -> 172
// 107: aload 12
// 109: iload 11
// 111: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 114: aload_0
// 115: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 118: sipush 507
// 121: aload 12
// 123: aload 13
// 125: iconst_0
// 126: invokeinterface 39 5 0
// 131: pop
// 132: aload 13
// 134: invokevirtual 42 android/os/Parcel:readException ()V
// 137: aload 13
// 139: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 142: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 145: astore 18
// 147: aload 13
// 149: invokevirtual 49 android/os/Parcel:recycle ()V
// 152: aload 12
// 154: invokevirtual 49 android/os/Parcel:recycle ()V
// 157: aload 18
// 159: areturn
// 160: aconst_null
// 161: astore 15
// 163: goto -131 -> 32
// 166: iconst_0
// 167: istore 16
// 169: goto -109 -> 60
// 172: iconst_0
// 173: istore 11
// 175: goto -68 -> 107
// 178: astore 14
// 180: aload 13
// 182: invokevirtual 49 android/os/Parcel:recycle ()V
// 185: aload 12
// 187: invokevirtual 49 android/os/Parcel:recycle ()V
// 190: aload 14
// 192: athrow
// Local variable table:
// start length slot name signature
// 0 193 0 this zza
// 0 193 1 paramzzf zzf
// 0 193 2 paramString1 String
// 0 193 3 paramString2 String
// 0 193 4 paramBoolean1 boolean
// 0 193 5 paramString3 String
// 0 193 6 paramString4 String
// 0 193 7 paramInt1 int
// 0 193 8 paramInt2 int
// 0 193 9 paramInt3 int
// 0 193 10 paramBoolean2 boolean
// 1 173 11 i int
// 6 180 12 localParcel1 Parcel
// 11 170 13 localParcel2 Parcel
// 178 13 14 localObject Object
// 30 132 15 localIBinder IBinder
// 58 110 16 j int
// 145 13 18 localzzq zzq
// Exception table:
// from to target type
// 13 20 178 finally
// 24 32 178 finally
// 32 51 178 finally
// 60 102 178 finally
// 107 147 178 finally
}
/* Error */
public final void zza(zzf paramzzf, long paramLong, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +75 -> 93
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: lload_2
// 39: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 42: iconst_0
// 43: istore 9
// 45: iload 4
// 47: ifeq +6 -> 53
// 50: iconst_1
// 51: istore 9
// 53: aload 5
// 55: iload 9
// 57: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 60: aload_0
// 61: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 64: bipush 6
// 66: aload 5
// 68: aload 6
// 70: iconst_0
// 71: invokeinterface 39 5 0
// 76: pop
// 77: aload 6
// 79: invokevirtual 42 android/os/Parcel:readException ()V
// 82: aload 6
// 84: invokevirtual 49 android/os/Parcel:recycle ()V
// 87: aload 5
// 89: invokevirtual 49 android/os/Parcel:recycle ()V
// 92: return
// 93: aconst_null
// 94: astore 8
// 96: goto -67 -> 29
// 99: astore 7
// 101: aload 6
// 103: invokevirtual 49 android/os/Parcel:recycle ()V
// 106: aload 5
// 108: invokevirtual 49 android/os/Parcel:recycle ()V
// 111: aload 7
// 113: athrow
// Local variable table:
// start length slot name signature
// 0 114 0 this zza
// 0 114 1 paramzzf zzf
// 0 114 2 paramLong long
// 0 114 4 paramBoolean boolean
// 3 104 5 localParcel1 Parcel
// 8 94 6 localParcel2 Parcel
// 99 13 7 localObject Object
// 27 68 8 localIBinder IBinder
// 43 13 9 i int
// Exception table:
// from to target type
// 10 17 99 finally
// 21 29 99 finally
// 29 42 99 finally
// 53 82 99 finally
}
/* Error */
public final void zza(zzf paramzzf, Bundle paramBundle)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_1
// 16: ifnull +64 -> 80
// 19: aload_1
// 20: invokeinterface 55 1 0
// 25: astore 6
// 27: aload_3
// 28: aload 6
// 30: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 33: aload_2
// 34: ifnull +52 -> 86
// 37: aload_3
// 38: iconst_1
// 39: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 42: aload_2
// 43: aload_3
// 44: iconst_0
// 45: invokevirtual 116 android/os/Bundle:writeToParcel (Landroid/os/Parcel;I)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: sipush 302
// 55: aload_3
// 56: aload 4
// 58: iconst_0
// 59: invokeinterface 39 5 0
// 64: pop
// 65: aload 4
// 67: invokevirtual 42 android/os/Parcel:readException ()V
// 70: aload 4
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload_3
// 76: invokevirtual 49 android/os/Parcel:recycle ()V
// 79: return
// 80: aconst_null
// 81: astore 6
// 83: goto -56 -> 27
// 86: aload_3
// 87: iconst_0
// 88: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 91: goto -43 -> 48
// 94: astore 5
// 96: aload 4
// 98: invokevirtual 49 android/os/Parcel:recycle ()V
// 101: aload_3
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 5
// 107: athrow
// Local variable table:
// start length slot name signature
// 0 108 0 this zza
// 0 108 1 paramzzf zzf
// 0 108 2 paramBundle Bundle
// 3 99 3 localParcel1 Parcel
// 7 90 4 localParcel2 Parcel
// 94 12 5 localObject Object
// 25 57 6 localIBinder IBinder
// Exception table:
// from to target type
// 9 15 94 finally
// 19 27 94 finally
// 27 33 94 finally
// 37 48 94 finally
// 48 70 94 finally
// 86 91 94 finally
}
public final void zza(zzf paramzzf, AccountToken paramAccountToken, List<String> paramList, ParcelableGetOptions paramParcelableGetOptions)
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
label142:
for (;;)
{
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
IBinder localIBinder;
if (paramzzf != null)
{
localIBinder = paramzzf.asBinder();
localParcel1.writeStrongBinder(localIBinder);
if (paramAccountToken != null)
{
localParcel1.writeInt(1);
paramAccountToken.writeToParcel(localParcel1, 0);
localParcel1.writeStringList(paramList);
if (paramParcelableGetOptions == null) {
break label142;
}
localParcel1.writeInt(1);
paramParcelableGetOptions.writeToParcel(localParcel1, 0);
this.zzop.transact(501, localParcel1, localParcel2, 0);
localParcel2.readException();
}
}
else
{
localIBinder = null;
continue;
}
localParcel1.writeInt(0);
continue;
localParcel1.writeInt(0);
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
}
/* Error */
public final void zza(zzf paramzzf, String paramString)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_1
// 16: ifnull +53 -> 69
// 19: aload_1
// 20: invokeinterface 55 1 0
// 25: astore 6
// 27: aload_3
// 28: aload 6
// 30: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 33: aload_3
// 34: aload_2
// 35: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 38: aload_0
// 39: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 42: bipush 24
// 44: aload_3
// 45: aload 4
// 47: iconst_0
// 48: invokeinterface 39 5 0
// 53: pop
// 54: aload 4
// 56: invokevirtual 42 android/os/Parcel:readException ()V
// 59: aload 4
// 61: invokevirtual 49 android/os/Parcel:recycle ()V
// 64: aload_3
// 65: invokevirtual 49 android/os/Parcel:recycle ()V
// 68: return
// 69: aconst_null
// 70: astore 6
// 72: goto -45 -> 27
// 75: astore 5
// 77: aload 4
// 79: invokevirtual 49 android/os/Parcel:recycle ()V
// 82: aload_3
// 83: invokevirtual 49 android/os/Parcel:recycle ()V
// 86: aload 5
// 88: athrow
// Local variable table:
// start length slot name signature
// 0 89 0 this zza
// 0 89 1 paramzzf zzf
// 0 89 2 paramString String
// 3 80 3 localParcel1 Parcel
// 7 71 4 localParcel2 Parcel
// 75 12 5 localObject Object
// 25 46 6 localIBinder IBinder
// Exception table:
// from to target type
// 9 15 75 finally
// 19 27 75 finally
// 27 59 75 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString, int paramInt1, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +69 -> 87
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: iload_3
// 45: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 48: aload 5
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: iconst_5
// 60: aload 5
// 62: aload 6
// 64: iconst_0
// 65: invokeinterface 39 5 0
// 70: pop
// 71: aload 6
// 73: invokevirtual 42 android/os/Parcel:readException ()V
// 76: aload 6
// 78: invokevirtual 49 android/os/Parcel:recycle ()V
// 81: aload 5
// 83: invokevirtual 49 android/os/Parcel:recycle ()V
// 86: return
// 87: aconst_null
// 88: astore 8
// 90: goto -61 -> 29
// 93: astore 7
// 95: aload 6
// 97: invokevirtual 49 android/os/Parcel:recycle ()V
// 100: aload 5
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 7
// 107: athrow
// Local variable table:
// start length slot name signature
// 0 108 0 this zza
// 0 108 1 paramzzf zzf
// 0 108 2 paramString String
// 0 108 3 paramInt1 int
// 0 108 4 paramInt2 int
// 3 98 5 localParcel1 Parcel
// 8 88 6 localParcel2 Parcel
// 93 13 7 localObject Object
// 27 62 8 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 93 finally
// 21 29 93 finally
// 29 76 93 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 4
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 5
// 10: aload 4
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +63 -> 81
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 7
// 29: aload 4
// 31: aload 7
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 4
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 4
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: bipush 25
// 54: aload 4
// 56: aload 5
// 58: iconst_0
// 59: invokeinterface 39 5 0
// 64: pop
// 65: aload 5
// 67: invokevirtual 42 android/os/Parcel:readException ()V
// 70: aload 5
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload 4
// 77: invokevirtual 49 android/os/Parcel:recycle ()V
// 80: return
// 81: aconst_null
// 82: astore 7
// 84: goto -55 -> 29
// 87: astore 6
// 89: aload 5
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload 4
// 96: invokevirtual 49 android/os/Parcel:recycle ()V
// 99: aload 6
// 101: athrow
// Local variable table:
// start length slot name signature
// 0 102 0 this zza
// 0 102 1 paramzzf zzf
// 0 102 2 paramString1 String
// 0 102 3 paramString2 String
// 3 92 4 localParcel1 Parcel
// 8 82 5 localParcel2 Parcel
// 87 13 6 localObject Object
// 27 56 7 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 87 finally
// 21 29 87 finally
// 29 70 87 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +71 -> 89
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 5
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: sipush 403
// 62: aload 5
// 64: aload 6
// 66: iconst_0
// 67: invokeinterface 39 5 0
// 72: pop
// 73: aload 6
// 75: invokevirtual 42 android/os/Parcel:readException ()V
// 78: aload 6
// 80: invokevirtual 49 android/os/Parcel:recycle ()V
// 83: aload 5
// 85: invokevirtual 49 android/os/Parcel:recycle ()V
// 88: return
// 89: aconst_null
// 90: astore 8
// 92: goto -63 -> 29
// 95: astore 7
// 97: aload 6
// 99: invokevirtual 49 android/os/Parcel:recycle ()V
// 102: aload 5
// 104: invokevirtual 49 android/os/Parcel:recycle ()V
// 107: aload 7
// 109: athrow
// Local variable table:
// start length slot name signature
// 0 110 0 this zza
// 0 110 1 paramzzf zzf
// 0 110 2 paramString1 String
// 0 110 3 paramString2 String
// 0 110 4 paramInt int
// 3 100 5 localParcel1 Parcel
// 8 90 6 localParcel2 Parcel
// 95 13 7 localObject Object
// 27 64 8 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 95 finally
// 21 29 95 finally
// 29 78 95 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, int paramInt1, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +77 -> 95
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload 6
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: aload_0
// 63: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 66: bipush 29
// 68: aload 6
// 70: aload 7
// 72: iconst_0
// 73: invokeinterface 39 5 0
// 78: pop
// 79: aload 7
// 81: invokevirtual 42 android/os/Parcel:readException ()V
// 84: aload 7
// 86: invokevirtual 49 android/os/Parcel:recycle ()V
// 89: aload 6
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: return
// 95: aconst_null
// 96: astore 9
// 98: goto -69 -> 29
// 101: astore 8
// 103: aload 7
// 105: invokevirtual 49 android/os/Parcel:recycle ()V
// 108: aload 6
// 110: invokevirtual 49 android/os/Parcel:recycle ()V
// 113: aload 8
// 115: athrow
// Local variable table:
// start length slot name signature
// 0 116 0 this zza
// 0 116 1 paramzzf zzf
// 0 116 2 paramString1 String
// 0 116 3 paramString2 String
// 0 116 4 paramInt1 int
// 0 116 5 paramInt2 int
// 3 106 6 localParcel1 Parcel
// 8 96 7 localParcel2 Parcel
// 101 13 8 localObject Object
// 27 70 9 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 101 finally
// 21 29 101 finally
// 29 84 101 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, Uri paramUri)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +82 -> 100
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 4
// 50: ifnull +56 -> 106
// 53: aload 5
// 55: iconst_1
// 56: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 59: aload 4
// 61: aload 5
// 63: iconst_0
// 64: invokevirtual 136 android/net/Uri:writeToParcel (Landroid/os/Parcel;I)V
// 67: aload_0
// 68: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 71: bipush 13
// 73: aload 5
// 75: aload 6
// 77: iconst_0
// 78: invokeinterface 39 5 0
// 83: pop
// 84: aload 6
// 86: invokevirtual 42 android/os/Parcel:readException ()V
// 89: aload 6
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload 5
// 96: invokevirtual 49 android/os/Parcel:recycle ()V
// 99: return
// 100: aconst_null
// 101: astore 8
// 103: goto -74 -> 29
// 106: aload 5
// 108: iconst_0
// 109: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 112: goto -45 -> 67
// 115: astore 7
// 117: aload 6
// 119: invokevirtual 49 android/os/Parcel:recycle ()V
// 122: aload 5
// 124: invokevirtual 49 android/os/Parcel:recycle ()V
// 127: aload 7
// 129: athrow
// Local variable table:
// start length slot name signature
// 0 130 0 this zza
// 0 130 1 paramzzf zzf
// 0 130 2 paramString1 String
// 0 130 3 paramString2 String
// 0 130 4 paramUri Uri
// 3 120 5 localParcel1 Parcel
// 8 110 6 localParcel2 Parcel
// 115 13 7 localObject Object
// 27 75 8 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 115 finally
// 21 29 115 finally
// 29 48 115 finally
// 53 67 115 finally
// 67 89 115 finally
// 106 112 115 finally
}
public final void zza(zzf paramzzf, String paramString1, String paramString2, Uri paramUri, boolean paramBoolean)
throws RemoteException
{
int i = 1;
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
for (;;)
{
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
IBinder localIBinder;
if (paramzzf != null)
{
localIBinder = paramzzf.asBinder();
localParcel1.writeStrongBinder(localIBinder);
localParcel1.writeString(paramString1);
localParcel1.writeString(paramString2);
if (paramUri != null)
{
localParcel1.writeInt(1);
paramUri.writeToParcel(localParcel1, 0);
break label149;
localParcel1.writeInt(i);
this.zzop.transact(18, localParcel1, localParcel2, 0);
localParcel2.readException();
}
}
else
{
localIBinder = null;
continue;
}
localParcel1.writeInt(0);
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
label149:
while (!paramBoolean)
{
i = 0;
break;
}
}
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +71 -> 89
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 5
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: sipush 204
// 62: aload 5
// 64: aload 6
// 66: iconst_0
// 67: invokeinterface 39 5 0
// 72: pop
// 73: aload 6
// 75: invokevirtual 42 android/os/Parcel:readException ()V
// 78: aload 6
// 80: invokevirtual 49 android/os/Parcel:recycle ()V
// 83: aload 5
// 85: invokevirtual 49 android/os/Parcel:recycle ()V
// 88: return
// 89: aconst_null
// 90: astore 8
// 92: goto -63 -> 29
// 95: astore 7
// 97: aload 6
// 99: invokevirtual 49 android/os/Parcel:recycle ()V
// 102: aload 5
// 104: invokevirtual 49 android/os/Parcel:recycle ()V
// 107: aload 7
// 109: athrow
// Local variable table:
// start length slot name signature
// 0 110 0 this zza
// 0 110 1 paramzzf zzf
// 0 110 2 paramString1 String
// 0 110 3 paramString2 String
// 0 110 4 paramString3 String
// 3 100 5 localParcel1 Parcel
// 8 90 6 localParcel2 Parcel
// 95 13 7 localObject Object
// 27 64 8 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 95 finally
// 21 29 95 finally
// 29 78 95 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +83 -> 101
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 7
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 7
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 7
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 7
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: aload 7
// 64: aload 6
// 66: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 69: aload_0
// 70: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 73: iconst_3
// 74: aload 7
// 76: aload 8
// 78: iconst_0
// 79: invokeinterface 39 5 0
// 84: pop
// 85: aload 8
// 87: invokevirtual 42 android/os/Parcel:readException ()V
// 90: aload 8
// 92: invokevirtual 49 android/os/Parcel:recycle ()V
// 95: aload 7
// 97: invokevirtual 49 android/os/Parcel:recycle ()V
// 100: return
// 101: aconst_null
// 102: astore 10
// 104: goto -75 -> 29
// 107: astore 9
// 109: aload 8
// 111: invokevirtual 49 android/os/Parcel:recycle ()V
// 114: aload 7
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: aload 9
// 121: athrow
// Local variable table:
// start length slot name signature
// 0 122 0 this zza
// 0 122 1 paramzzf zzf
// 0 122 2 paramString1 String
// 0 122 3 paramString2 String
// 0 122 4 paramString3 String
// 0 122 5 paramInt int
// 0 122 6 paramString4 String
// 3 112 7 localParcel1 Parcel
// 8 102 8 localParcel2 Parcel
// 107 13 9 localObject Object
// 27 76 10 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 107 finally
// 21 29 107 finally
// 29 90 107 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 8
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 9
// 10: aload 8
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +102 -> 120
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 11
// 29: aload 8
// 31: aload 11
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 8
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 8
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 8
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 8
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: aload 8
// 64: aload 6
// 66: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 69: iconst_0
// 70: istore 12
// 72: iload 7
// 74: ifeq +6 -> 80
// 77: iconst_1
// 78: istore 12
// 80: aload 8
// 82: iload 12
// 84: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 87: aload_0
// 88: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 91: bipush 19
// 93: aload 8
// 95: aload 9
// 97: iconst_0
// 98: invokeinterface 39 5 0
// 103: pop
// 104: aload 9
// 106: invokevirtual 42 android/os/Parcel:readException ()V
// 109: aload 9
// 111: invokevirtual 49 android/os/Parcel:recycle ()V
// 114: aload 8
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: return
// 120: aconst_null
// 121: astore 11
// 123: goto -94 -> 29
// 126: astore 10
// 128: aload 9
// 130: invokevirtual 49 android/os/Parcel:recycle ()V
// 133: aload 8
// 135: invokevirtual 49 android/os/Parcel:recycle ()V
// 138: aload 10
// 140: athrow
// Local variable table:
// start length slot name signature
// 0 141 0 this zza
// 0 141 1 paramzzf zzf
// 0 141 2 paramString1 String
// 0 141 3 paramString2 String
// 0 141 4 paramString3 String
// 0 141 5 paramInt int
// 0 141 6 paramString4 String
// 0 141 7 paramBoolean boolean
// 3 131 8 localParcel1 Parcel
// 8 121 9 localParcel2 Parcel
// 126 13 10 localObject Object
// 27 95 11 localIBinder IBinder
// 70 13 12 i int
// Exception table:
// from to target type
// 10 17 126 finally
// 21 29 126 finally
// 29 69 126 finally
// 80 109 126 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean, int paramInt2, int paramInt3, String paramString4)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 10
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 11
// 10: aload 10
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +117 -> 135
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 13
// 29: aload 10
// 31: aload 13
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 10
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 10
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 10
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 10
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: iconst_0
// 63: istore 14
// 65: iload 6
// 67: ifeq +6 -> 73
// 70: iconst_1
// 71: istore 14
// 73: aload 10
// 75: iload 14
// 77: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 80: aload 10
// 82: iload 7
// 84: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 87: aload 10
// 89: iload 8
// 91: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 94: aload 10
// 96: aload 9
// 98: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 101: aload_0
// 102: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 105: sipush 202
// 108: aload 10
// 110: aload 11
// 112: iconst_0
// 113: invokeinterface 39 5 0
// 118: pop
// 119: aload 11
// 121: invokevirtual 42 android/os/Parcel:readException ()V
// 124: aload 11
// 126: invokevirtual 49 android/os/Parcel:recycle ()V
// 129: aload 10
// 131: invokevirtual 49 android/os/Parcel:recycle ()V
// 134: return
// 135: aconst_null
// 136: astore 13
// 138: goto -109 -> 29
// 141: astore 12
// 143: aload 11
// 145: invokevirtual 49 android/os/Parcel:recycle ()V
// 148: aload 10
// 150: invokevirtual 49 android/os/Parcel:recycle ()V
// 153: aload 12
// 155: athrow
// Local variable table:
// start length slot name signature
// 0 156 0 this zza
// 0 156 1 paramzzf zzf
// 0 156 2 paramString1 String
// 0 156 3 paramString2 String
// 0 156 4 paramString3 String
// 0 156 5 paramInt1 int
// 0 156 6 paramBoolean boolean
// 0 156 7 paramInt2 int
// 0 156 8 paramInt3 int
// 0 156 9 paramString4 String
// 3 146 10 localParcel1 Parcel
// 8 136 11 localParcel2 Parcel
// 141 13 12 localObject Object
// 27 110 13 localIBinder IBinder
// 63 13 14 i int
// Exception table:
// from to target type
// 10 17 141 finally
// 21 29 141 finally
// 29 62 141 finally
// 73 124 141 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, String paramString4, boolean paramBoolean2)
throws RemoteException
{
// Byte code:
// 0: iconst_1
// 1: istore 11
// 3: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 6: astore 12
// 8: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 11: astore 13
// 13: aload 12
// 15: ldc 29
// 17: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 20: aload_1
// 21: ifnull +127 -> 148
// 24: aload_1
// 25: invokeinterface 55 1 0
// 30: astore 15
// 32: aload 12
// 34: aload 15
// 36: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 39: aload 12
// 41: aload_2
// 42: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 45: aload 12
// 47: aload_3
// 48: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 51: aload 12
// 53: aload 4
// 55: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 58: aload 12
// 60: iload 5
// 62: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 65: iload 6
// 67: ifeq +87 -> 154
// 70: iload 11
// 72: istore 16
// 74: aload 12
// 76: iload 16
// 78: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 81: aload 12
// 83: iload 7
// 85: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 88: aload 12
// 90: iload 8
// 92: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 95: aload 12
// 97: aload 9
// 99: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 102: iload 10
// 104: ifeq +56 -> 160
// 107: aload 12
// 109: iload 11
// 111: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 114: aload_0
// 115: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 118: sipush 203
// 121: aload 12
// 123: aload 13
// 125: iconst_0
// 126: invokeinterface 39 5 0
// 131: pop
// 132: aload 13
// 134: invokevirtual 42 android/os/Parcel:readException ()V
// 137: aload 13
// 139: invokevirtual 49 android/os/Parcel:recycle ()V
// 142: aload 12
// 144: invokevirtual 49 android/os/Parcel:recycle ()V
// 147: return
// 148: aconst_null
// 149: astore 15
// 151: goto -119 -> 32
// 154: iconst_0
// 155: istore 16
// 157: goto -83 -> 74
// 160: iconst_0
// 161: istore 11
// 163: goto -56 -> 107
// 166: astore 14
// 168: aload 13
// 170: invokevirtual 49 android/os/Parcel:recycle ()V
// 173: aload 12
// 175: invokevirtual 49 android/os/Parcel:recycle ()V
// 178: aload 14
// 180: athrow
// Local variable table:
// start length slot name signature
// 0 181 0 this zza
// 0 181 1 paramzzf zzf
// 0 181 2 paramString1 String
// 0 181 3 paramString2 String
// 0 181 4 paramString3 String
// 0 181 5 paramInt1 int
// 0 181 6 paramBoolean1 boolean
// 0 181 7 paramInt2 int
// 0 181 8 paramInt3 int
// 0 181 9 paramString4 String
// 0 181 10 paramBoolean2 boolean
// 1 161 11 i int
// 6 168 12 localParcel1 Parcel
// 11 158 13 localParcel2 Parcel
// 166 13 14 localObject Object
// 30 120 15 localIBinder IBinder
// 72 84 16 j int
// Exception table:
// from to target type
// 13 20 166 finally
// 24 32 166 finally
// 32 65 166 finally
// 74 102 166 finally
// 107 137 166 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt1, boolean paramBoolean1, int paramInt2, int paramInt3, String paramString4, boolean paramBoolean2, int paramInt4, int paramInt5)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 13
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 14
// 10: aload 13
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +143 -> 161
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 16
// 29: aload 13
// 31: aload 16
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 13
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 13
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 13
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 13
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: iload 6
// 64: ifeq +103 -> 167
// 67: iconst_1
// 68: istore 17
// 70: aload 13
// 72: iload 17
// 74: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 77: aload 13
// 79: iload 7
// 81: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 84: aload 13
// 86: iload 8
// 88: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 91: aload 13
// 93: aload 9
// 95: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 98: iload 10
// 100: ifeq +73 -> 173
// 103: iconst_1
// 104: istore 18
// 106: aload 13
// 108: iload 18
// 110: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 113: aload 13
// 115: iload 11
// 117: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 120: aload 13
// 122: iload 12
// 124: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 127: aload_0
// 128: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 131: sipush 402
// 134: aload 13
// 136: aload 14
// 138: iconst_0
// 139: invokeinterface 39 5 0
// 144: pop
// 145: aload 14
// 147: invokevirtual 42 android/os/Parcel:readException ()V
// 150: aload 14
// 152: invokevirtual 49 android/os/Parcel:recycle ()V
// 155: aload 13
// 157: invokevirtual 49 android/os/Parcel:recycle ()V
// 160: return
// 161: aconst_null
// 162: astore 16
// 164: goto -135 -> 29
// 167: iconst_0
// 168: istore 17
// 170: goto -100 -> 70
// 173: iconst_0
// 174: istore 18
// 176: goto -70 -> 106
// 179: astore 15
// 181: aload 14
// 183: invokevirtual 49 android/os/Parcel:recycle ()V
// 186: aload 13
// 188: invokevirtual 49 android/os/Parcel:recycle ()V
// 191: aload 15
// 193: athrow
// Local variable table:
// start length slot name signature
// 0 194 0 this zza
// 0 194 1 paramzzf zzf
// 0 194 2 paramString1 String
// 0 194 3 paramString2 String
// 0 194 4 paramString3 String
// 0 194 5 paramInt1 int
// 0 194 6 paramBoolean1 boolean
// 0 194 7 paramInt2 int
// 0 194 8 paramInt3 int
// 0 194 9 paramString4 String
// 0 194 10 paramBoolean2 boolean
// 0 194 11 paramInt4 int
// 0 194 12 paramInt5 int
// 3 184 13 localParcel1 Parcel
// 8 174 14 localParcel2 Parcel
// 179 13 15 localObject Object
// 27 136 16 localIBinder IBinder
// 68 101 17 i int
// 104 71 18 j int
// Exception table:
// from to target type
// 10 17 179 finally
// 21 29 179 finally
// 29 62 179 finally
// 70 98 179 finally
// 106 150 179 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +77 -> 95
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 6
// 57: aload 5
// 59: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 62: aload_0
// 63: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 66: bipush 27
// 68: aload 6
// 70: aload 7
// 72: iconst_0
// 73: invokeinterface 39 5 0
// 78: pop
// 79: aload 7
// 81: invokevirtual 42 android/os/Parcel:readException ()V
// 84: aload 7
// 86: invokevirtual 49 android/os/Parcel:recycle ()V
// 89: aload 6
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: return
// 95: aconst_null
// 96: astore 9
// 98: goto -69 -> 29
// 101: astore 8
// 103: aload 7
// 105: invokevirtual 49 android/os/Parcel:recycle ()V
// 108: aload 6
// 110: invokevirtual 49 android/os/Parcel:recycle ()V
// 113: aload 8
// 115: athrow
// Local variable table:
// start length slot name signature
// 0 116 0 this zza
// 0 116 1 paramzzf zzf
// 0 116 2 paramString1 String
// 0 116 3 paramString2 String
// 0 116 4 paramString3 String
// 0 116 5 paramString4 String
// 3 106 6 localParcel1 Parcel
// 8 96 7 localParcel2 Parcel
// 101 13 8 localObject Object
// 27 70 9 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 101 finally
// 21 29 101 finally
// 29 84 101 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4, int paramInt, String paramString5)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 8
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 9
// 10: aload 8
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +92 -> 110
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 11
// 29: aload 8
// 31: aload 11
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 8
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 8
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 8
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 8
// 57: aload 5
// 59: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 62: aload 8
// 64: iload 6
// 66: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 69: aload 8
// 71: aload 7
// 73: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 76: aload_0
// 77: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 80: sipush 303
// 83: aload 8
// 85: aload 9
// 87: iconst_0
// 88: invokeinterface 39 5 0
// 93: pop
// 94: aload 9
// 96: invokevirtual 42 android/os/Parcel:readException ()V
// 99: aload 9
// 101: invokevirtual 49 android/os/Parcel:recycle ()V
// 104: aload 8
// 106: invokevirtual 49 android/os/Parcel:recycle ()V
// 109: return
// 110: aconst_null
// 111: astore 11
// 113: goto -84 -> 29
// 116: astore 10
// 118: aload 9
// 120: invokevirtual 49 android/os/Parcel:recycle ()V
// 123: aload 8
// 125: invokevirtual 49 android/os/Parcel:recycle ()V
// 128: aload 10
// 130: athrow
// Local variable table:
// start length slot name signature
// 0 131 0 this zza
// 0 131 1 paramzzf zzf
// 0 131 2 paramString1 String
// 0 131 3 paramString2 String
// 0 131 4 paramString3 String
// 0 131 5 paramString4 String
// 0 131 6 paramInt int
// 0 131 7 paramString5 String
// 3 121 8 localParcel1 Parcel
// 8 111 9 localParcel2 Parcel
// 116 13 10 localObject Object
// 27 85 11 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 116 finally
// 21 29 116 finally
// 29 99 116 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, String paramString4, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +96 -> 114
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 7
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 7
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 7
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 7
// 57: aload 5
// 59: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 62: iconst_0
// 63: istore 11
// 65: iload 6
// 67: ifeq +6 -> 73
// 70: iconst_1
// 71: istore 11
// 73: aload 7
// 75: iload 11
// 77: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 80: aload_0
// 81: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 84: sipush 701
// 87: aload 7
// 89: aload 8
// 91: iconst_0
// 92: invokeinterface 39 5 0
// 97: pop
// 98: aload 8
// 100: invokevirtual 42 android/os/Parcel:readException ()V
// 103: aload 8
// 105: invokevirtual 49 android/os/Parcel:recycle ()V
// 108: aload 7
// 110: invokevirtual 49 android/os/Parcel:recycle ()V
// 113: return
// 114: aconst_null
// 115: astore 10
// 117: goto -88 -> 29
// 120: astore 9
// 122: aload 8
// 124: invokevirtual 49 android/os/Parcel:recycle ()V
// 127: aload 7
// 129: invokevirtual 49 android/os/Parcel:recycle ()V
// 132: aload 9
// 134: athrow
// Local variable table:
// start length slot name signature
// 0 135 0 this zza
// 0 135 1 paramzzf zzf
// 0 135 2 paramString1 String
// 0 135 3 paramString2 String
// 0 135 4 paramString3 String
// 0 135 5 paramString4 String
// 0 135 6 paramBoolean boolean
// 3 125 7 localParcel1 Parcel
// 8 115 8 localParcel2 Parcel
// 120 13 9 localObject Object
// 27 89 10 localIBinder IBinder
// 63 13 11 i int
// Exception table:
// from to target type
// 10 17 120 finally
// 21 29 120 finally
// 29 62 120 finally
// 73 103 120 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +77 -> 95
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 6
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload_0
// 63: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 66: bipush 28
// 68: aload 6
// 70: aload 7
// 72: iconst_0
// 73: invokeinterface 39 5 0
// 78: pop
// 79: aload 7
// 81: invokevirtual 42 android/os/Parcel:readException ()V
// 84: aload 7
// 86: invokevirtual 49 android/os/Parcel:recycle ()V
// 89: aload 6
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: return
// 95: aconst_null
// 96: astore 9
// 98: goto -69 -> 29
// 101: astore 8
// 103: aload 7
// 105: invokevirtual 49 android/os/Parcel:recycle ()V
// 108: aload 6
// 110: invokevirtual 49 android/os/Parcel:recycle ()V
// 113: aload 8
// 115: athrow
// Local variable table:
// start length slot name signature
// 0 116 0 this zza
// 0 116 1 paramzzf zzf
// 0 116 2 paramString1 String
// 0 116 3 paramString2 String
// 0 116 4 paramString3 String
// 0 116 5 paramList List<String>
// 3 106 6 localParcel1 Parcel
// 8 96 7 localParcel2 Parcel
// 101 13 8 localObject Object
// 27 70 9 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 101 finally
// 21 29 101 finally
// 29 84 101 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt, boolean paramBoolean, long paramLong)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 10
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 11
// 10: aload 10
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +108 -> 126
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 13
// 29: aload 10
// 31: aload 13
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 10
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 10
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 10
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 10
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 10
// 64: iload 6
// 66: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 69: iconst_0
// 70: istore 14
// 72: iload 7
// 74: ifeq +6 -> 80
// 77: iconst_1
// 78: istore 14
// 80: aload 10
// 82: iload 14
// 84: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 87: aload 10
// 89: lload 8
// 91: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 94: aload_0
// 95: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 98: iconst_4
// 99: aload 10
// 101: aload 11
// 103: iconst_0
// 104: invokeinterface 39 5 0
// 109: pop
// 110: aload 11
// 112: invokevirtual 42 android/os/Parcel:readException ()V
// 115: aload 11
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: aload 10
// 122: invokevirtual 49 android/os/Parcel:recycle ()V
// 125: return
// 126: aconst_null
// 127: astore 13
// 129: goto -100 -> 29
// 132: astore 12
// 134: aload 11
// 136: invokevirtual 49 android/os/Parcel:recycle ()V
// 139: aload 10
// 141: invokevirtual 49 android/os/Parcel:recycle ()V
// 144: aload 12
// 146: athrow
// Local variable table:
// start length slot name signature
// 0 147 0 this zza
// 0 147 1 paramzzf zzf
// 0 147 2 paramString1 String
// 0 147 3 paramString2 String
// 0 147 4 paramString3 String
// 0 147 5 paramList List<String>
// 0 147 6 paramInt int
// 0 147 7 paramBoolean boolean
// 0 147 8 paramLong long
// 3 137 10 localParcel1 Parcel
// 8 127 11 localParcel2 Parcel
// 132 13 12 localObject Object
// 27 101 13 localIBinder IBinder
// 70 13 14 i int
// Exception table:
// from to target type
// 10 17 132 finally
// 21 29 132 finally
// 29 69 132 finally
// 80 115 132 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 12
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 13
// 10: aload 12
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +120 -> 138
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 15
// 29: aload 12
// 31: aload 15
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 12
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 12
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 12
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 12
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 12
// 64: iload 6
// 66: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 69: iload 7
// 71: ifeq +73 -> 144
// 74: iconst_1
// 75: istore 16
// 77: aload 12
// 79: iload 16
// 81: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 84: aload 12
// 86: lload 8
// 88: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 91: aload 12
// 93: aload 10
// 95: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 98: aload 12
// 100: iload 11
// 102: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 105: aload_0
// 106: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 109: bipush 21
// 111: aload 12
// 113: aload 13
// 115: iconst_0
// 116: invokeinterface 39 5 0
// 121: pop
// 122: aload 13
// 124: invokevirtual 42 android/os/Parcel:readException ()V
// 127: aload 13
// 129: invokevirtual 49 android/os/Parcel:recycle ()V
// 132: aload 12
// 134: invokevirtual 49 android/os/Parcel:recycle ()V
// 137: return
// 138: aconst_null
// 139: astore 15
// 141: goto -112 -> 29
// 144: iconst_0
// 145: istore 16
// 147: goto -70 -> 77
// 150: astore 14
// 152: aload 13
// 154: invokevirtual 49 android/os/Parcel:recycle ()V
// 157: aload 12
// 159: invokevirtual 49 android/os/Parcel:recycle ()V
// 162: aload 14
// 164: athrow
// Local variable table:
// start length slot name signature
// 0 165 0 this zza
// 0 165 1 paramzzf zzf
// 0 165 2 paramString1 String
// 0 165 3 paramString2 String
// 0 165 4 paramString3 String
// 0 165 5 paramList List<String>
// 0 165 6 paramInt1 int
// 0 165 7 paramBoolean boolean
// 0 165 8 paramLong long
// 0 165 10 paramString4 String
// 0 165 11 paramInt2 int
// 3 155 12 localParcel1 Parcel
// 8 145 13 localParcel2 Parcel
// 150 13 14 localObject Object
// 27 113 15 localIBinder IBinder
// 75 71 16 i int
// Exception table:
// from to target type
// 10 17 150 finally
// 21 29 150 finally
// 29 69 150 finally
// 77 127 150 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2, int paramInt3)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 13
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 14
// 10: aload 13
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +128 -> 146
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 16
// 29: aload 13
// 31: aload 16
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 13
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 13
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 13
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 13
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 13
// 64: iload 6
// 66: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 69: iload 7
// 71: ifeq +81 -> 152
// 74: iconst_1
// 75: istore 17
// 77: aload 13
// 79: iload 17
// 81: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 84: aload 13
// 86: lload 8
// 88: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 91: aload 13
// 93: aload 10
// 95: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 98: aload 13
// 100: iload 11
// 102: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 105: aload 13
// 107: iload 12
// 109: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 112: aload_0
// 113: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 116: sipush 401
// 119: aload 13
// 121: aload 14
// 123: iconst_0
// 124: invokeinterface 39 5 0
// 129: pop
// 130: aload 14
// 132: invokevirtual 42 android/os/Parcel:readException ()V
// 135: aload 14
// 137: invokevirtual 49 android/os/Parcel:recycle ()V
// 140: aload 13
// 142: invokevirtual 49 android/os/Parcel:recycle ()V
// 145: return
// 146: aconst_null
// 147: astore 16
// 149: goto -120 -> 29
// 152: iconst_0
// 153: istore 17
// 155: goto -78 -> 77
// 158: astore 15
// 160: aload 14
// 162: invokevirtual 49 android/os/Parcel:recycle ()V
// 165: aload 13
// 167: invokevirtual 49 android/os/Parcel:recycle ()V
// 170: aload 15
// 172: athrow
// Local variable table:
// start length slot name signature
// 0 173 0 this zza
// 0 173 1 paramzzf zzf
// 0 173 2 paramString1 String
// 0 173 3 paramString2 String
// 0 173 4 paramString3 String
// 0 173 5 paramList List<String>
// 0 173 6 paramInt1 int
// 0 173 7 paramBoolean boolean
// 0 173 8 paramLong long
// 0 173 10 paramString4 String
// 0 173 11 paramInt2 int
// 0 173 12 paramInt3 int
// 3 163 13 localParcel1 Parcel
// 8 153 14 localParcel2 Parcel
// 158 13 15 localObject Object
// 27 121 16 localIBinder IBinder
// 75 79 17 i int
// Exception table:
// from to target type
// 10 17 158 finally
// 21 29 158 finally
// 29 69 158 finally
// 77 135 158 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList, int paramInt1, boolean paramBoolean, long paramLong, String paramString4, int paramInt2, int paramInt3, int paramInt4)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 14
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 15
// 10: aload 14
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +135 -> 153
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 17
// 29: aload 14
// 31: aload 17
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 14
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 14
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 14
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 14
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 14
// 64: iload 6
// 66: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 69: iload 7
// 71: ifeq +88 -> 159
// 74: iconst_1
// 75: istore 18
// 77: aload 14
// 79: iload 18
// 81: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 84: aload 14
// 86: lload 8
// 88: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 91: aload 14
// 93: aload 10
// 95: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 98: aload 14
// 100: iload 11
// 102: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 105: aload 14
// 107: iload 12
// 109: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 112: aload 14
// 114: iload 13
// 116: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 119: aload_0
// 120: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 123: sipush 404
// 126: aload 14
// 128: aload 15
// 130: iconst_0
// 131: invokeinterface 39 5 0
// 136: pop
// 137: aload 15
// 139: invokevirtual 42 android/os/Parcel:readException ()V
// 142: aload 15
// 144: invokevirtual 49 android/os/Parcel:recycle ()V
// 147: aload 14
// 149: invokevirtual 49 android/os/Parcel:recycle ()V
// 152: return
// 153: aconst_null
// 154: astore 17
// 156: goto -127 -> 29
// 159: iconst_0
// 160: istore 18
// 162: goto -85 -> 77
// 165: astore 16
// 167: aload 15
// 169: invokevirtual 49 android/os/Parcel:recycle ()V
// 172: aload 14
// 174: invokevirtual 49 android/os/Parcel:recycle ()V
// 177: aload 16
// 179: athrow
// Local variable table:
// start length slot name signature
// 0 180 0 this zza
// 0 180 1 paramzzf zzf
// 0 180 2 paramString1 String
// 0 180 3 paramString2 String
// 0 180 4 paramString3 String
// 0 180 5 paramList List<String>
// 0 180 6 paramInt1 int
// 0 180 7 paramBoolean boolean
// 0 180 8 paramLong long
// 0 180 10 paramString4 String
// 0 180 11 paramInt2 int
// 0 180 12 paramInt3 int
// 0 180 13 paramInt4 int
// 3 170 14 localParcel1 Parcel
// 8 160 15 localParcel2 Parcel
// 165 13 16 localObject Object
// 27 128 17 localIBinder IBinder
// 75 86 18 i int
// Exception table:
// from to target type
// 10 17 165 finally
// 21 29 165 finally
// 29 69 165 finally
// 77 142 165 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList1, List<String> paramList2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +84 -> 102
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 7
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 7
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 7
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 7
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 7
// 64: aload 6
// 66: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 69: aload_0
// 70: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 73: bipush 14
// 75: aload 7
// 77: aload 8
// 79: iconst_0
// 80: invokeinterface 39 5 0
// 85: pop
// 86: aload 8
// 88: invokevirtual 42 android/os/Parcel:readException ()V
// 91: aload 8
// 93: invokevirtual 49 android/os/Parcel:recycle ()V
// 96: aload 7
// 98: invokevirtual 49 android/os/Parcel:recycle ()V
// 101: return
// 102: aconst_null
// 103: astore 10
// 105: goto -76 -> 29
// 108: astore 9
// 110: aload 8
// 112: invokevirtual 49 android/os/Parcel:recycle ()V
// 115: aload 7
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: aload 9
// 122: athrow
// Local variable table:
// start length slot name signature
// 0 123 0 this zza
// 0 123 1 paramzzf zzf
// 0 123 2 paramString1 String
// 0 123 3 paramString2 String
// 0 123 4 paramString3 String
// 0 123 5 paramList1 List<String>
// 0 123 6 paramList2 List<String>
// 3 113 7 localParcel1 Parcel
// 8 103 8 localParcel2 Parcel
// 108 13 9 localObject Object
// 27 77 10 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 108 finally
// 21 29 108 finally
// 29 91 108 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, List<String> paramList1, List<String> paramList2, FavaDiagnosticsEntity paramFavaDiagnosticsEntity)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 8
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 9
// 10: aload 8
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +103 -> 121
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 11
// 29: aload 8
// 31: aload 11
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 8
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 8
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 8
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 8
// 57: aload 5
// 59: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 62: aload 8
// 64: aload 6
// 66: invokevirtual 124 android/os/Parcel:writeStringList (Ljava/util/List;)V
// 69: aload 7
// 71: ifnull +56 -> 127
// 74: aload 8
// 76: iconst_1
// 77: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 80: aload 7
// 82: aload 8
// 84: iconst_0
// 85: invokevirtual 156 com/google/android/gms/common/server/FavaDiagnosticsEntity:writeToParcel (Landroid/os/Parcel;I)V
// 88: aload_0
// 89: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 92: bipush 23
// 94: aload 8
// 96: aload 9
// 98: iconst_0
// 99: invokeinterface 39 5 0
// 104: pop
// 105: aload 9
// 107: invokevirtual 42 android/os/Parcel:readException ()V
// 110: aload 9
// 112: invokevirtual 49 android/os/Parcel:recycle ()V
// 115: aload 8
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: return
// 121: aconst_null
// 122: astore 11
// 124: goto -95 -> 29
// 127: aload 8
// 129: iconst_0
// 130: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 133: goto -45 -> 88
// 136: astore 10
// 138: aload 9
// 140: invokevirtual 49 android/os/Parcel:recycle ()V
// 143: aload 8
// 145: invokevirtual 49 android/os/Parcel:recycle ()V
// 148: aload 10
// 150: athrow
// Local variable table:
// start length slot name signature
// 0 151 0 this zza
// 0 151 1 paramzzf zzf
// 0 151 2 paramString1 String
// 0 151 3 paramString2 String
// 0 151 4 paramString3 String
// 0 151 5 paramList1 List<String>
// 0 151 6 paramList2 List<String>
// 0 151 7 paramFavaDiagnosticsEntity FavaDiagnosticsEntity
// 3 141 8 localParcel1 Parcel
// 8 131 9 localParcel2 Parcel
// 136 13 10 localObject Object
// 27 96 11 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 136 finally
// 21 29 136 finally
// 29 69 136 finally
// 74 88 136 finally
// 88 110 136 finally
// 127 133 136 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +88 -> 106
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: iconst_0
// 56: istore 10
// 58: iload 5
// 60: ifeq +6 -> 66
// 63: iconst_1
// 64: istore 10
// 66: aload 6
// 68: iload 10
// 70: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 73: aload_0
// 74: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 77: bipush 7
// 79: aload 6
// 81: aload 7
// 83: iconst_0
// 84: invokeinterface 39 5 0
// 89: pop
// 90: aload 7
// 92: invokevirtual 42 android/os/Parcel:readException ()V
// 95: aload 7
// 97: invokevirtual 49 android/os/Parcel:recycle ()V
// 100: aload 6
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: return
// 106: aconst_null
// 107: astore 9
// 109: goto -80 -> 29
// 112: astore 8
// 114: aload 7
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: aload 6
// 121: invokevirtual 49 android/os/Parcel:recycle ()V
// 124: aload 8
// 126: athrow
// Local variable table:
// start length slot name signature
// 0 127 0 this zza
// 0 127 1 paramzzf zzf
// 0 127 2 paramString1 String
// 0 127 3 paramString2 String
// 0 127 4 paramString3 String
// 0 127 5 paramBoolean boolean
// 3 117 6 localParcel1 Parcel
// 8 107 7 localParcel2 Parcel
// 112 13 8 localObject Object
// 27 81 9 localIBinder IBinder
// 56 13 10 i int
// Exception table:
// from to target type
// 10 17 112 finally
// 21 29 112 finally
// 29 55 112 finally
// 66 95 112 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +95 -> 113
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 7
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 7
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 7
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: iconst_0
// 56: istore 11
// 58: iload 5
// 60: ifeq +6 -> 66
// 63: iconst_1
// 64: istore 11
// 66: aload 7
// 68: iload 11
// 70: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 73: aload 7
// 75: iload 6
// 77: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 80: aload_0
// 81: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 84: bipush 9
// 86: aload 7
// 88: aload 8
// 90: iconst_0
// 91: invokeinterface 39 5 0
// 96: pop
// 97: aload 8
// 99: invokevirtual 42 android/os/Parcel:readException ()V
// 102: aload 8
// 104: invokevirtual 49 android/os/Parcel:recycle ()V
// 107: aload 7
// 109: invokevirtual 49 android/os/Parcel:recycle ()V
// 112: return
// 113: aconst_null
// 114: astore 10
// 116: goto -87 -> 29
// 119: astore 9
// 121: aload 8
// 123: invokevirtual 49 android/os/Parcel:recycle ()V
// 126: aload 7
// 128: invokevirtual 49 android/os/Parcel:recycle ()V
// 131: aload 9
// 133: athrow
// Local variable table:
// start length slot name signature
// 0 134 0 this zza
// 0 134 1 paramzzf zzf
// 0 134 2 paramString1 String
// 0 134 3 paramString2 String
// 0 134 4 paramString3 String
// 0 134 5 paramBoolean boolean
// 0 134 6 paramInt int
// 3 124 7 localParcel1 Parcel
// 8 114 8 localParcel2 Parcel
// 119 13 9 localObject Object
// 27 88 10 localIBinder IBinder
// 56 13 11 i int
// Exception table:
// from to target type
// 10 17 119 finally
// 21 29 119 finally
// 29 55 119 finally
// 66 102 119 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean, int paramInt1, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 8
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 9
// 10: aload 8
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +103 -> 121
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 11
// 29: aload 8
// 31: aload 11
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 8
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 8
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 8
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: iconst_0
// 56: istore 12
// 58: iload 5
// 60: ifeq +6 -> 66
// 63: iconst_1
// 64: istore 12
// 66: aload 8
// 68: iload 12
// 70: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 73: aload 8
// 75: iload 6
// 77: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 80: aload 8
// 82: iload 7
// 84: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 87: aload_0
// 88: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 91: sipush 201
// 94: aload 8
// 96: aload 9
// 98: iconst_0
// 99: invokeinterface 39 5 0
// 104: pop
// 105: aload 9
// 107: invokevirtual 42 android/os/Parcel:readException ()V
// 110: aload 9
// 112: invokevirtual 49 android/os/Parcel:recycle ()V
// 115: aload 8
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: return
// 121: aconst_null
// 122: astore 11
// 124: goto -95 -> 29
// 127: astore 10
// 129: aload 9
// 131: invokevirtual 49 android/os/Parcel:recycle ()V
// 134: aload 8
// 136: invokevirtual 49 android/os/Parcel:recycle ()V
// 139: aload 10
// 141: athrow
// Local variable table:
// start length slot name signature
// 0 142 0 this zza
// 0 142 1 paramzzf zzf
// 0 142 2 paramString1 String
// 0 142 3 paramString2 String
// 0 142 4 paramString3 String
// 0 142 5 paramBoolean boolean
// 0 142 6 paramInt1 int
// 0 142 7 paramInt2 int
// 3 132 8 localParcel1 Parcel
// 8 122 9 localParcel2 Parcel
// 127 13 10 localObject Object
// 27 96 11 localIBinder IBinder
// 56 13 12 i int
// Exception table:
// from to target type
// 10 17 127 finally
// 21 29 127 finally
// 29 55 127 finally
// 66 110 127 finally
}
/* Error */
public final void zza(zzf paramzzf, String paramString, boolean paramBoolean, String[] paramArrayOfString)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +81 -> 99
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: iconst_0
// 43: istore 9
// 45: iload_3
// 46: ifeq +6 -> 52
// 49: iconst_1
// 50: istore 9
// 52: aload 5
// 54: iload 9
// 56: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 59: aload 5
// 61: aload 4
// 63: invokevirtual 164 android/os/Parcel:writeStringArray ([Ljava/lang/String;)V
// 66: aload_0
// 67: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 70: bipush 10
// 72: aload 5
// 74: aload 6
// 76: iconst_0
// 77: invokeinterface 39 5 0
// 82: pop
// 83: aload 6
// 85: invokevirtual 42 android/os/Parcel:readException ()V
// 88: aload 6
// 90: invokevirtual 49 android/os/Parcel:recycle ()V
// 93: aload 5
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: return
// 99: aconst_null
// 100: astore 8
// 102: goto -73 -> 29
// 105: astore 7
// 107: aload 6
// 109: invokevirtual 49 android/os/Parcel:recycle ()V
// 112: aload 5
// 114: invokevirtual 49 android/os/Parcel:recycle ()V
// 117: aload 7
// 119: athrow
// Local variable table:
// start length slot name signature
// 0 120 0 this zza
// 0 120 1 paramzzf zzf
// 0 120 2 paramString String
// 0 120 3 paramBoolean boolean
// 0 120 4 paramArrayOfString String[]
// 3 110 5 localParcel1 Parcel
// 8 100 6 localParcel2 Parcel
// 105 13 7 localObject Object
// 27 74 8 localIBinder IBinder
// 43 12 9 i int
// Exception table:
// from to target type
// 10 17 105 finally
// 21 29 105 finally
// 29 42 105 finally
// 52 88 105 finally
}
/* Error */
public final void zza(zzf paramzzf, boolean paramBoolean1, boolean paramBoolean2, String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: iconst_1
// 1: istore 6
// 3: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 6: astore 7
// 8: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 11: astore 8
// 13: aload 7
// 15: ldc 29
// 17: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 20: aload_1
// 21: ifnull +90 -> 111
// 24: aload_1
// 25: invokeinterface 55 1 0
// 30: astore 10
// 32: aload 7
// 34: aload 10
// 36: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 39: iload_2
// 40: ifeq +77 -> 117
// 43: iload 6
// 45: istore 11
// 47: aload 7
// 49: iload 11
// 51: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 54: iload_3
// 55: ifeq +68 -> 123
// 58: aload 7
// 60: iload 6
// 62: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 65: aload 7
// 67: aload 4
// 69: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 72: aload 7
// 74: aload 5
// 76: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 79: aload_0
// 80: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 83: iconst_2
// 84: aload 7
// 86: aload 8
// 88: iconst_0
// 89: invokeinterface 39 5 0
// 94: pop
// 95: aload 8
// 97: invokevirtual 42 android/os/Parcel:readException ()V
// 100: aload 8
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 7
// 107: invokevirtual 49 android/os/Parcel:recycle ()V
// 110: return
// 111: aconst_null
// 112: astore 10
// 114: goto -82 -> 32
// 117: iconst_0
// 118: istore 11
// 120: goto -73 -> 47
// 123: iconst_0
// 124: istore 6
// 126: goto -68 -> 58
// 129: astore 9
// 131: aload 8
// 133: invokevirtual 49 android/os/Parcel:recycle ()V
// 136: aload 7
// 138: invokevirtual 49 android/os/Parcel:recycle ()V
// 141: aload 9
// 143: athrow
// Local variable table:
// start length slot name signature
// 0 144 0 this zza
// 0 144 1 paramzzf zzf
// 0 144 2 paramBoolean1 boolean
// 0 144 3 paramBoolean2 boolean
// 0 144 4 paramString1 String
// 0 144 5 paramString2 String
// 1 124 6 i int
// 6 131 7 localParcel1 Parcel
// 11 121 8 localParcel2 Parcel
// 129 13 9 localObject Object
// 30 83 10 localIBinder IBinder
// 45 74 11 j int
// Exception table:
// from to target type
// 13 20 129 finally
// 24 32 129 finally
// 32 39 129 finally
// 47 54 129 finally
// 58 100 129 finally
}
/* Error */
public final void zza(zzf paramzzf, boolean paramBoolean1, boolean paramBoolean2, String paramString1, String paramString2, int paramInt)
throws RemoteException
{
// Byte code:
// 0: iconst_1
// 1: istore 7
// 3: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 6: astore 8
// 8: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 11: astore 9
// 13: aload 8
// 15: ldc 29
// 17: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 20: aload_1
// 21: ifnull +99 -> 120
// 24: aload_1
// 25: invokeinterface 55 1 0
// 30: astore 11
// 32: aload 8
// 34: aload 11
// 36: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 39: iload_2
// 40: ifeq +86 -> 126
// 43: iload 7
// 45: istore 12
// 47: aload 8
// 49: iload 12
// 51: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 54: iload_3
// 55: ifeq +77 -> 132
// 58: aload 8
// 60: iload 7
// 62: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 65: aload 8
// 67: aload 4
// 69: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 72: aload 8
// 74: aload 5
// 76: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 79: aload 8
// 81: iload 6
// 83: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 86: aload_0
// 87: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 90: sipush 305
// 93: aload 8
// 95: aload 9
// 97: iconst_0
// 98: invokeinterface 39 5 0
// 103: pop
// 104: aload 9
// 106: invokevirtual 42 android/os/Parcel:readException ()V
// 109: aload 9
// 111: invokevirtual 49 android/os/Parcel:recycle ()V
// 114: aload 8
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: return
// 120: aconst_null
// 121: astore 11
// 123: goto -91 -> 32
// 126: iconst_0
// 127: istore 12
// 129: goto -82 -> 47
// 132: iconst_0
// 133: istore 7
// 135: goto -77 -> 58
// 138: astore 10
// 140: aload 9
// 142: invokevirtual 49 android/os/Parcel:recycle ()V
// 145: aload 8
// 147: invokevirtual 49 android/os/Parcel:recycle ()V
// 150: aload 10
// 152: athrow
// Local variable table:
// start length slot name signature
// 0 153 0 this zza
// 0 153 1 paramzzf zzf
// 0 153 2 paramBoolean1 boolean
// 0 153 3 paramBoolean2 boolean
// 0 153 4 paramString1 String
// 0 153 5 paramString2 String
// 0 153 6 paramInt int
// 1 133 7 i int
// 6 140 8 localParcel1 Parcel
// 11 130 9 localParcel2 Parcel
// 138 13 10 localObject Object
// 30 92 11 localIBinder IBinder
// 45 83 12 j int
// Exception table:
// from to target type
// 13 20 138 finally
// 24 32 138 finally
// 32 39 138 finally
// 47 54 138 finally
// 58 109 138 finally
}
public final void zzaQ(boolean paramBoolean)
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
int i = 0;
if (paramBoolean) {
i = 1;
}
localParcel1.writeInt(i);
this.zzop.transact(15, localParcel1, localParcel2, 0);
localParcel2.readException();
return;
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
/* Error */
public final Bundle zzac(String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_3
// 16: aload_1
// 17: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 20: aload_3
// 21: aload_2
// 22: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 25: aload_0
// 26: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 29: bipush 12
// 31: aload_3
// 32: aload 4
// 34: iconst_0
// 35: invokeinterface 39 5 0
// 40: pop
// 41: aload 4
// 43: invokevirtual 42 android/os/Parcel:readException ()V
// 46: aload 4
// 48: invokevirtual 46 android/os/Parcel:readInt ()I
// 51: ifeq +30 -> 81
// 54: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 57: aload 4
// 59: invokeinterface 77 2 0
// 64: checkcast 67 android/os/Bundle
// 67: astore 7
// 69: aload 4
// 71: invokevirtual 49 android/os/Parcel:recycle ()V
// 74: aload_3
// 75: invokevirtual 49 android/os/Parcel:recycle ()V
// 78: aload 7
// 80: areturn
// 81: aconst_null
// 82: astore 7
// 84: goto -15 -> 69
// 87: astore 5
// 89: aload 4
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload_3
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: aload 5
// 100: athrow
// Local variable table:
// start length slot name signature
// 0 101 0 this zza
// 0 101 1 paramString1 String
// 0 101 2 paramString2 String
// 3 92 3 localParcel1 Parcel
// 7 83 4 localParcel2 Parcel
// 87 12 5 localObject Object
// 67 16 7 localBundle Bundle
// Exception table:
// from to target type
// 9 69 87 finally
}
/* Error */
public final Bundle zzad(String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_3
// 16: aload_1
// 17: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 20: aload_3
// 21: aload_2
// 22: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 25: aload_0
// 26: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 29: bipush 17
// 31: aload_3
// 32: aload 4
// 34: iconst_0
// 35: invokeinterface 39 5 0
// 40: pop
// 41: aload 4
// 43: invokevirtual 42 android/os/Parcel:readException ()V
// 46: aload 4
// 48: invokevirtual 46 android/os/Parcel:readInt ()I
// 51: ifeq +30 -> 81
// 54: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 57: aload 4
// 59: invokeinterface 77 2 0
// 64: checkcast 67 android/os/Bundle
// 67: astore 7
// 69: aload 4
// 71: invokevirtual 49 android/os/Parcel:recycle ()V
// 74: aload_3
// 75: invokevirtual 49 android/os/Parcel:recycle ()V
// 78: aload 7
// 80: areturn
// 81: aconst_null
// 82: astore 7
// 84: goto -15 -> 69
// 87: astore 5
// 89: aload 4
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload_3
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: aload 5
// 100: athrow
// Local variable table:
// start length slot name signature
// 0 101 0 this zza
// 0 101 1 paramString1 String
// 0 101 2 paramString2 String
// 3 92 3 localParcel1 Parcel
// 7 83 4 localParcel2 Parcel
// 87 12 5 localObject Object
// 67 16 7 localBundle Bundle
// Exception table:
// from to target type
// 9 69 87 finally
}
/* Error */
public final zzq zzb(zzf paramzzf, long paramLong, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +88 -> 106
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: lload_2
// 39: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 42: iconst_0
// 43: istore 9
// 45: iload 4
// 47: ifeq +6 -> 53
// 50: iconst_1
// 51: istore 9
// 53: aload 5
// 55: iload 9
// 57: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 60: aload_0
// 61: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 64: sipush 503
// 67: aload 5
// 69: aload 6
// 71: iconst_0
// 72: invokeinterface 39 5 0
// 77: pop
// 78: aload 6
// 80: invokevirtual 42 android/os/Parcel:readException ()V
// 83: aload 6
// 85: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 88: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 91: astore 11
// 93: aload 6
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: aload 5
// 100: invokevirtual 49 android/os/Parcel:recycle ()V
// 103: aload 11
// 105: areturn
// 106: aconst_null
// 107: astore 8
// 109: goto -80 -> 29
// 112: astore 7
// 114: aload 6
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: aload 5
// 121: invokevirtual 49 android/os/Parcel:recycle ()V
// 124: aload 7
// 126: athrow
// Local variable table:
// start length slot name signature
// 0 127 0 this zza
// 0 127 1 paramzzf zzf
// 0 127 2 paramLong long
// 0 127 4 paramBoolean boolean
// 3 117 5 localParcel1 Parcel
// 8 107 6 localParcel2 Parcel
// 112 13 7 localObject Object
// 27 81 8 localIBinder IBinder
// 43 13 9 i int
// 91 13 11 localzzq zzq
// Exception table:
// from to target type
// 10 17 112 finally
// 21 29 112 finally
// 29 42 112 finally
// 53 93 112 finally
}
/* Error */
public final zzq zzb(zzf paramzzf, String paramString)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_1
// 16: ifnull +66 -> 82
// 19: aload_1
// 20: invokeinterface 55 1 0
// 25: astore 6
// 27: aload_3
// 28: aload 6
// 30: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 33: aload_3
// 34: aload_2
// 35: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 38: aload_0
// 39: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 42: sipush 504
// 45: aload_3
// 46: aload 4
// 48: iconst_0
// 49: invokeinterface 39 5 0
// 54: pop
// 55: aload 4
// 57: invokevirtual 42 android/os/Parcel:readException ()V
// 60: aload 4
// 62: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 65: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 68: astore 8
// 70: aload 4
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload_3
// 76: invokevirtual 49 android/os/Parcel:recycle ()V
// 79: aload 8
// 81: areturn
// 82: aconst_null
// 83: astore 6
// 85: goto -58 -> 27
// 88: astore 5
// 90: aload 4
// 92: invokevirtual 49 android/os/Parcel:recycle ()V
// 95: aload_3
// 96: invokevirtual 49 android/os/Parcel:recycle ()V
// 99: aload 5
// 101: athrow
// Local variable table:
// start length slot name signature
// 0 102 0 this zza
// 0 102 1 paramzzf zzf
// 0 102 2 paramString String
// 3 93 3 localParcel1 Parcel
// 7 84 4 localParcel2 Parcel
// 88 12 5 localObject Object
// 25 59 6 localIBinder IBinder
// 68 12 8 localzzq zzq
// Exception table:
// from to target type
// 9 15 88 finally
// 19 27 88 finally
// 27 70 88 finally
}
/* Error */
public final zzq zzb(zzf paramzzf, String paramString, int paramInt1, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +83 -> 101
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: iload_3
// 45: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 48: aload 5
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: sipush 502
// 62: aload 5
// 64: aload 6
// 66: iconst_0
// 67: invokeinterface 39 5 0
// 72: pop
// 73: aload 6
// 75: invokevirtual 42 android/os/Parcel:readException ()V
// 78: aload 6
// 80: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 83: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 86: astore 10
// 88: aload 6
// 90: invokevirtual 49 android/os/Parcel:recycle ()V
// 93: aload 5
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: aload 10
// 100: areturn
// 101: aconst_null
// 102: astore 8
// 104: goto -75 -> 29
// 107: astore 7
// 109: aload 6
// 111: invokevirtual 49 android/os/Parcel:recycle ()V
// 114: aload 5
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: aload 7
// 121: athrow
// Local variable table:
// start length slot name signature
// 0 122 0 this zza
// 0 122 1 paramzzf zzf
// 0 122 2 paramString String
// 0 122 3 paramInt1 int
// 0 122 4 paramInt2 int
// 3 112 5 localParcel1 Parcel
// 8 102 6 localParcel2 Parcel
// 107 13 7 localObject Object
// 27 76 8 localIBinder IBinder
// 86 13 10 localzzq zzq
// Exception table:
// from to target type
// 10 17 107 finally
// 21 29 107 finally
// 29 88 107 finally
}
/* Error */
public final zzq zzb(zzf paramzzf, String paramString1, String paramString2, int paramInt1, int paramInt2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +90 -> 108
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload 6
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: aload_0
// 63: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 66: sipush 505
// 69: aload 6
// 71: aload 7
// 73: iconst_0
// 74: invokeinterface 39 5 0
// 79: pop
// 80: aload 7
// 82: invokevirtual 42 android/os/Parcel:readException ()V
// 85: aload 7
// 87: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 90: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 93: astore 11
// 95: aload 7
// 97: invokevirtual 49 android/os/Parcel:recycle ()V
// 100: aload 6
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 11
// 107: areturn
// 108: aconst_null
// 109: astore 9
// 111: goto -82 -> 29
// 114: astore 8
// 116: aload 7
// 118: invokevirtual 49 android/os/Parcel:recycle ()V
// 121: aload 6
// 123: invokevirtual 49 android/os/Parcel:recycle ()V
// 126: aload 8
// 128: athrow
// Local variable table:
// start length slot name signature
// 0 129 0 this zza
// 0 129 1 paramzzf zzf
// 0 129 2 paramString1 String
// 0 129 3 paramString2 String
// 0 129 4 paramInt1 int
// 0 129 5 paramInt2 int
// 3 119 6 localParcel1 Parcel
// 8 109 7 localParcel2 Parcel
// 114 13 8 localObject Object
// 27 83 9 localIBinder IBinder
// 93 13 11 localzzq zzq
// Exception table:
// from to target type
// 10 17 114 finally
// 21 29 114 finally
// 29 95 114 finally
}
/* Error */
public final void zzb(zzf paramzzf, Bundle paramBundle)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore_3
// 4: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 7: astore 4
// 9: aload_3
// 10: ldc 29
// 12: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 15: aload_1
// 16: ifnull +64 -> 80
// 19: aload_1
// 20: invokeinterface 55 1 0
// 25: astore 6
// 27: aload_3
// 28: aload 6
// 30: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 33: aload_2
// 34: ifnull +52 -> 86
// 37: aload_3
// 38: iconst_1
// 39: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 42: aload_2
// 43: aload_3
// 44: iconst_0
// 45: invokevirtual 116 android/os/Bundle:writeToParcel (Landroid/os/Parcel;I)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: sipush 304
// 55: aload_3
// 56: aload 4
// 58: iconst_0
// 59: invokeinterface 39 5 0
// 64: pop
// 65: aload 4
// 67: invokevirtual 42 android/os/Parcel:readException ()V
// 70: aload 4
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload_3
// 76: invokevirtual 49 android/os/Parcel:recycle ()V
// 79: return
// 80: aconst_null
// 81: astore 6
// 83: goto -56 -> 27
// 86: aload_3
// 87: iconst_0
// 88: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 91: goto -43 -> 48
// 94: astore 5
// 96: aload 4
// 98: invokevirtual 49 android/os/Parcel:recycle ()V
// 101: aload_3
// 102: invokevirtual 49 android/os/Parcel:recycle ()V
// 105: aload 5
// 107: athrow
// Local variable table:
// start length slot name signature
// 0 108 0 this zza
// 0 108 1 paramzzf zzf
// 0 108 2 paramBundle Bundle
// 3 99 3 localParcel1 Parcel
// 7 90 4 localParcel2 Parcel
// 94 12 5 localObject Object
// 25 57 6 localIBinder IBinder
// Exception table:
// from to target type
// 9 15 94 finally
// 19 27 94 finally
// 27 33 94 finally
// 37 48 94 finally
// 48 70 94 finally
// 86 91 94 finally
}
/* Error */
public final void zzb(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 4
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 5
// 10: aload 4
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +63 -> 81
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 7
// 29: aload 4
// 31: aload 7
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 4
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 4
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: bipush 101
// 54: aload 4
// 56: aload 5
// 58: iconst_0
// 59: invokeinterface 39 5 0
// 64: pop
// 65: aload 5
// 67: invokevirtual 42 android/os/Parcel:readException ()V
// 70: aload 5
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload 4
// 77: invokevirtual 49 android/os/Parcel:recycle ()V
// 80: return
// 81: aconst_null
// 82: astore 7
// 84: goto -55 -> 29
// 87: astore 6
// 89: aload 5
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload 4
// 96: invokevirtual 49 android/os/Parcel:recycle ()V
// 99: aload 6
// 101: athrow
// Local variable table:
// start length slot name signature
// 0 102 0 this zza
// 0 102 1 paramzzf zzf
// 0 102 2 paramString1 String
// 0 102 3 paramString2 String
// 3 92 4 localParcel1 Parcel
// 8 82 5 localParcel2 Parcel
// 87 13 6 localObject Object
// 27 56 7 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 87 finally
// 21 29 87 finally
// 29 70 87 finally
}
/* Error */
public final void zzb(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +71 -> 89
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 5
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: sipush 301
// 62: aload 5
// 64: aload 6
// 66: iconst_0
// 67: invokeinterface 39 5 0
// 72: pop
// 73: aload 6
// 75: invokevirtual 42 android/os/Parcel:readException ()V
// 78: aload 6
// 80: invokevirtual 49 android/os/Parcel:recycle ()V
// 83: aload 5
// 85: invokevirtual 49 android/os/Parcel:recycle ()V
// 88: return
// 89: aconst_null
// 90: astore 8
// 92: goto -63 -> 29
// 95: astore 7
// 97: aload 6
// 99: invokevirtual 49 android/os/Parcel:recycle ()V
// 102: aload 5
// 104: invokevirtual 49 android/os/Parcel:recycle ()V
// 107: aload 7
// 109: athrow
// Local variable table:
// start length slot name signature
// 0 110 0 this zza
// 0 110 1 paramzzf zzf
// 0 110 2 paramString1 String
// 0 110 3 paramString2 String
// 0 110 4 paramInt int
// 3 100 5 localParcel1 Parcel
// 8 90 6 localParcel2 Parcel
// 95 13 7 localObject Object
// 27 64 8 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 95 finally
// 21 29 95 finally
// 29 78 95 finally
}
/* Error */
public final void zzb(zzf paramzzf, String paramString1, String paramString2, String paramString3, int paramInt, String paramString4)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 7
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 8
// 10: aload 7
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +84 -> 102
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 10
// 29: aload 7
// 31: aload 10
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 7
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 7
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 7
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: aload 7
// 57: iload 5
// 59: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 62: aload 7
// 64: aload 6
// 66: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 69: aload_0
// 70: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 73: bipush 22
// 75: aload 7
// 77: aload 8
// 79: iconst_0
// 80: invokeinterface 39 5 0
// 85: pop
// 86: aload 8
// 88: invokevirtual 42 android/os/Parcel:readException ()V
// 91: aload 8
// 93: invokevirtual 49 android/os/Parcel:recycle ()V
// 96: aload 7
// 98: invokevirtual 49 android/os/Parcel:recycle ()V
// 101: return
// 102: aconst_null
// 103: astore 10
// 105: goto -76 -> 29
// 108: astore 9
// 110: aload 8
// 112: invokevirtual 49 android/os/Parcel:recycle ()V
// 115: aload 7
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: aload 9
// 122: athrow
// Local variable table:
// start length slot name signature
// 0 123 0 this zza
// 0 123 1 paramzzf zzf
// 0 123 2 paramString1 String
// 0 123 3 paramString2 String
// 0 123 4 paramString3 String
// 0 123 5 paramInt int
// 0 123 6 paramString4 String
// 3 113 7 localParcel1 Parcel
// 8 103 8 localParcel2 Parcel
// 108 13 9 localObject Object
// 27 77 10 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 108 finally
// 21 29 108 finally
// 29 91 108 finally
}
/* Error */
public final void zzb(zzf paramzzf, String paramString1, String paramString2, String paramString3, boolean paramBoolean)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 6
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 7
// 10: aload 6
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +89 -> 107
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 9
// 29: aload 6
// 31: aload 9
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 6
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 6
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 6
// 50: aload 4
// 52: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 55: iconst_0
// 56: istore 10
// 58: iload 5
// 60: ifeq +6 -> 66
// 63: iconst_1
// 64: istore 10
// 66: aload 6
// 68: iload 10
// 70: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 73: aload_0
// 74: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 77: sipush 603
// 80: aload 6
// 82: aload 7
// 84: iconst_0
// 85: invokeinterface 39 5 0
// 90: pop
// 91: aload 7
// 93: invokevirtual 42 android/os/Parcel:readException ()V
// 96: aload 7
// 98: invokevirtual 49 android/os/Parcel:recycle ()V
// 101: aload 6
// 103: invokevirtual 49 android/os/Parcel:recycle ()V
// 106: return
// 107: aconst_null
// 108: astore 9
// 110: goto -81 -> 29
// 113: astore 8
// 115: aload 7
// 117: invokevirtual 49 android/os/Parcel:recycle ()V
// 120: aload 6
// 122: invokevirtual 49 android/os/Parcel:recycle ()V
// 125: aload 8
// 127: athrow
// Local variable table:
// start length slot name signature
// 0 128 0 this zza
// 0 128 1 paramzzf zzf
// 0 128 2 paramString1 String
// 0 128 3 paramString2 String
// 0 128 4 paramString3 String
// 0 128 5 paramBoolean boolean
// 3 118 6 localParcel1 Parcel
// 8 108 7 localParcel2 Parcel
// 113 13 8 localObject Object
// 27 82 9 localIBinder IBinder
// 56 13 10 i int
// Exception table:
// from to target type
// 10 17 113 finally
// 21 29 113 finally
// 29 55 113 finally
// 66 96 113 finally
}
/* Error */
public final Bundle zzc(String paramString1, String paramString2, long paramLong)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload 5
// 19: aload_1
// 20: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 23: aload 5
// 25: aload_2
// 26: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 29: aload 5
// 31: lload_3
// 32: invokevirtual 82 android/os/Parcel:writeLong (J)V
// 35: aload_0
// 36: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 39: bipush 20
// 41: aload 5
// 43: aload 6
// 45: iconst_0
// 46: invokeinterface 39 5 0
// 51: pop
// 52: aload 6
// 54: invokevirtual 42 android/os/Parcel:readException ()V
// 57: aload 6
// 59: invokevirtual 46 android/os/Parcel:readInt ()I
// 62: ifeq +31 -> 93
// 65: getstatic 71 android/os/Bundle:CREATOR Landroid/os/Parcelable$Creator;
// 68: aload 6
// 70: invokeinterface 77 2 0
// 75: checkcast 67 android/os/Bundle
// 78: astore 9
// 80: aload 6
// 82: invokevirtual 49 android/os/Parcel:recycle ()V
// 85: aload 5
// 87: invokevirtual 49 android/os/Parcel:recycle ()V
// 90: aload 9
// 92: areturn
// 93: aconst_null
// 94: astore 9
// 96: goto -16 -> 80
// 99: astore 7
// 101: aload 6
// 103: invokevirtual 49 android/os/Parcel:recycle ()V
// 106: aload 5
// 108: invokevirtual 49 android/os/Parcel:recycle ()V
// 111: aload 7
// 113: athrow
// Local variable table:
// start length slot name signature
// 0 114 0 this zza
// 0 114 1 paramString1 String
// 0 114 2 paramString2 String
// 0 114 3 paramLong long
// 3 104 5 localParcel1 Parcel
// 8 94 6 localParcel2 Parcel
// 99 13 7 localObject Object
// 78 17 9 localBundle Bundle
// Exception table:
// from to target type
// 10 80 99 finally
}
/* Error */
public final zzq zzc(zzf paramzzf, String paramString1, String paramString2, int paramInt)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 5
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 6
// 10: aload 5
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +83 -> 101
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 8
// 29: aload 5
// 31: aload 8
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 5
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 5
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload 5
// 50: iload 4
// 52: invokevirtual 62 android/os/Parcel:writeInt (I)V
// 55: aload_0
// 56: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 59: sipush 506
// 62: aload 5
// 64: aload 6
// 66: iconst_0
// 67: invokeinterface 39 5 0
// 72: pop
// 73: aload 6
// 75: invokevirtual 42 android/os/Parcel:readException ()V
// 78: aload 6
// 80: invokevirtual 93 android/os/Parcel:readStrongBinder ()Landroid/os/IBinder;
// 83: invokestatic 99 com/google/android/gms/common/internal/zzq$zza:zzck (Landroid/os/IBinder;)Lcom/google/android/gms/common/internal/zzq;
// 86: astore 10
// 88: aload 6
// 90: invokevirtual 49 android/os/Parcel:recycle ()V
// 93: aload 5
// 95: invokevirtual 49 android/os/Parcel:recycle ()V
// 98: aload 10
// 100: areturn
// 101: aconst_null
// 102: astore 8
// 104: goto -75 -> 29
// 107: astore 7
// 109: aload 6
// 111: invokevirtual 49 android/os/Parcel:recycle ()V
// 114: aload 5
// 116: invokevirtual 49 android/os/Parcel:recycle ()V
// 119: aload 7
// 121: athrow
// Local variable table:
// start length slot name signature
// 0 122 0 this zza
// 0 122 1 paramzzf zzf
// 0 122 2 paramString1 String
// 0 122 3 paramString2 String
// 0 122 4 paramInt int
// 3 112 5 localParcel1 Parcel
// 8 102 6 localParcel2 Parcel
// 107 13 7 localObject Object
// 27 76 8 localIBinder IBinder
// 86 13 10 localzzq zzq
// Exception table:
// from to target type
// 10 17 107 finally
// 21 29 107 finally
// 29 88 107 finally
}
/* Error */
public final void zzc(zzf paramzzf, String paramString1, String paramString2)
throws RemoteException
{
// Byte code:
// 0: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 3: astore 4
// 5: invokestatic 27 android/os/Parcel:obtain ()Landroid/os/Parcel;
// 8: astore 5
// 10: aload 4
// 12: ldc 29
// 14: invokevirtual 33 android/os/Parcel:writeInterfaceToken (Ljava/lang/String;)V
// 17: aload_1
// 18: ifnull +63 -> 81
// 21: aload_1
// 22: invokeinterface 55 1 0
// 27: astore 7
// 29: aload 4
// 31: aload 7
// 33: invokevirtual 58 android/os/Parcel:writeStrongBinder (Landroid/os/IBinder;)V
// 36: aload 4
// 38: aload_2
// 39: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 42: aload 4
// 44: aload_3
// 45: invokevirtual 65 android/os/Parcel:writeString (Ljava/lang/String;)V
// 48: aload_0
// 49: getfield 15 com/google/android/gms/people/internal/zzg$zza$zza:zzop Landroid/os/IBinder;
// 52: bipush 102
// 54: aload 4
// 56: aload 5
// 58: iconst_0
// 59: invokeinterface 39 5 0
// 64: pop
// 65: aload 5
// 67: invokevirtual 42 android/os/Parcel:readException ()V
// 70: aload 5
// 72: invokevirtual 49 android/os/Parcel:recycle ()V
// 75: aload 4
// 77: invokevirtual 49 android/os/Parcel:recycle ()V
// 80: return
// 81: aconst_null
// 82: astore 7
// 84: goto -55 -> 29
// 87: astore 6
// 89: aload 5
// 91: invokevirtual 49 android/os/Parcel:recycle ()V
// 94: aload 4
// 96: invokevirtual 49 android/os/Parcel:recycle ()V
// 99: aload 6
// 101: athrow
// Local variable table:
// start length slot name signature
// 0 102 0 this zza
// 0 102 1 paramzzf zzf
// 0 102 2 paramString1 String
// 0 102 3 paramString2 String
// 3 92 4 localParcel1 Parcel
// 8 82 5 localParcel2 Parcel
// 87 13 6 localObject Object
// 27 56 7 localIBinder IBinder
// Exception table:
// from to target type
// 10 17 87 finally
// 21 29 87 finally
// 29 70 87 finally
}
public final Bundle zzp(Uri paramUri)
throws RemoteException
{
Parcel localParcel1 = Parcel.obtain();
Parcel localParcel2 = Parcel.obtain();
for (;;)
{
try
{
localParcel1.writeInterfaceToken("com.google.android.gms.people.internal.IPeopleService");
if (paramUri != null)
{
localParcel1.writeInt(1);
paramUri.writeToParcel(localParcel1, 0);
this.zzop.transact(8, localParcel1, localParcel2, 0);
localParcel2.readException();
if (localParcel2.readInt() != 0)
{
localBundle = (Bundle)Bundle.CREATOR.createFromParcel(localParcel2);
return localBundle;
}
}
else
{
localParcel1.writeInt(0);
continue;
}
Bundle localBundle = null;
}
finally
{
localParcel2.recycle();
localParcel1.recycle();
}
}
}
}
}
}
/* Location: F:\apktool\apktool\Google_Play_Store6.0.5\classes-dex2jar.jar
* Qualified Name: com.google.android.gms.people.internal.zzg
* JD-Core Version: 0.7.0.1
*/ | apache-2.0 |
TribeMedia/aura | aura-impl/src/test/java/org/auraframework/impl/root/parser/handler/BaseAccessAttributeTest.java | 26147 | /*
* Copyright (C) 2013 salesforce.com, 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 org.auraframework.impl.root.parser.handler;
import java.util.ArrayList;
import org.auraframework.def.ApplicationDef;
import org.auraframework.def.ComponentDef;
import org.auraframework.def.DefDescriptor;
import org.auraframework.def.Definition;
import org.auraframework.def.EventDef;
import org.auraframework.def.InterfaceDef;
import org.auraframework.def.LibraryDef;
import org.auraframework.def.TokensDef;
import org.auraframework.impl.AuraImplTestCase;
import org.auraframework.impl.parser.ParserFactory;
import org.auraframework.system.AuraContext.Access;
import org.auraframework.system.AuraContext.Authentication;
import org.auraframework.system.Parser;
import org.auraframework.system.Parser.Format;
import org.auraframework.system.Source;
import org.auraframework.test.source.StringSourceLoader;
import org.auraframework.throwable.quickfix.InvalidAccessValueException;
import org.auraframework.throwable.quickfix.InvalidDefinitionException;
public abstract class BaseAccessAttributeTest extends AuraImplTestCase {
public BaseAccessAttributeTest(String name) {
super(name);
}
public void testDefaultAccess() throws Exception {
testCase = TestCase.DEFAULT;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testEmptyAccess() throws Exception {
testCase = TestCase.EMPTY;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testInvalidAccess() throws Exception {
testCase = TestCase.INVALID;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testInvalidAccessDynamic() throws Exception {
testCase = TestCase.INVALID;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testInvalidValidAccess() throws Exception {
ArrayList<String> failures = new ArrayList<>();
for (Access access : Access.values()) {
testCase = getTestCase(access, "INVALID");
testNamespace = TestNamespace.System;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + access.toString());
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
public void testInvalidValidAuthentication() throws Exception {
ArrayList<String> failures = new ArrayList<>();
for (Authentication authentication : Authentication.values()) {
testCase = getTestCase(authentication, "INVALID");
testNamespace = TestNamespace.System;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + authentication.toString());
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
public void testAccessValueAndStaticMethod() throws Exception {
testCase = TestCase.VALUE_METHOD;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testStaticMethodAndAuthentication() throws Exception {
testCase = TestCase.METHOD_AUTHENTICATION;
testNamespace = TestNamespace.System;
runTestCase();
}
public void testSimpleAccessInSystemNamespace() throws Exception {
verifySimpleAccess(TestNamespace.System, false);
}
public void testSimpleAccessDynamicInSystemNamespace() throws Exception {
verifySimpleAccess(TestNamespace.System, true);
}
public void testCombinationAccessInSystemNamespace() throws Exception {
verifyCombinationAccess(TestNamespace.System);
}
public void testSimpleAuthenticationInSystemNamespace() throws Exception {
verifySimpleAuthentication(TestNamespace.System, false);
}
public void testSimpleAuthenticationDynamicInSystemNamespace() throws Exception {
verifySimpleAuthentication(TestNamespace.System, true);
}
public void testCombinationAuthenticationInSystemNamespace() throws Exception {
verifyCombinationAuthentication(TestNamespace.System);
}
public void testAccessAuthenticationInSystemNamespace() throws Exception {
verifyAccessAuthentication(TestNamespace.System);
}
public void testSimpleAccessInCustomNamespace() throws Exception {
verifySimpleAccess(TestNamespace.Custom, false);
}
public void testSimpleAccessDynamicInCustomNamespace() throws Exception {
verifySimpleAccess(TestNamespace.Custom, true);
}
public void testCombinationAccessInCustomNamespace() throws Exception {
verifyCombinationAccess(TestNamespace.Custom);
}
public void testSimpleAuthenticationInCustomNamespace() throws Exception {
verifySimpleAuthentication(TestNamespace.Custom, false);
}
public void testSimpleAuthenticationDynamicInCustomNamespace() throws Exception {
verifySimpleAuthentication(TestNamespace.Custom, true);
}
public void testCombinationAuthenticationInCustomNamespace() throws Exception {
verifyCombinationAuthentication(TestNamespace.Custom);
}
public void testAccessAuthenticationInCustomNamespace() throws Exception {
verifyAccessAuthentication(TestNamespace.Custom);
}
private void verifySimpleAccess(TestNamespace namespace, boolean isDynamic) throws Exception {
ArrayList<String> failures = new ArrayList<>();
for (Access access : Access.values()) {
if(!(isDynamic && access == Access.PRIVATE)){ // TODO W-2085835
testCase = getTestCase(access, isDynamic);
testNamespace = namespace;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + access.toString());
}
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
private void verifyCombinationAccess(TestNamespace namespace) throws Exception {
ArrayList<String> failures = new ArrayList<>();
Access[] accessValues = Access.values();
for (int i = 0; i < accessValues.length-1; i++) {
for (int j = i+1; j < accessValues.length; j++) {
testCase = getTestCase(accessValues[i], accessValues[j]);
testNamespace = namespace;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + accessValues[i].toString() + " , " + accessValues[j].toString());
}
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
private void verifySimpleAuthentication(TestNamespace namespace, boolean isDynamic) throws Exception {
ArrayList<String> failures = new ArrayList<>();
for (Authentication authentication : Authentication.values()) {
testCase = getTestCase(authentication, isDynamic);
testNamespace = namespace;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + authentication.toString());
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
private void verifyCombinationAuthentication(TestNamespace namespace) throws Exception {
testCase = TestCase.AUTHENTICATED_UNAUTHENTICATED;
testNamespace = namespace;
runTestCase();
}
private void verifyAccessAuthentication(TestNamespace namespace) throws Exception {
ArrayList<String> failures = new ArrayList<>();
Access[] accessValues = Access.values();
Authentication[] authenticationValues = Authentication.values();
for (int i = 0; i < accessValues.length; i++) {
for (int j = 0; j < authenticationValues.length; j++) {
testCase = getTestCase(accessValues[i], authenticationValues[j]);
testNamespace = namespace;
if(testCase != null){
try{
runTestCase();
}
catch(Throwable e) {
failures.add(e.getMessage());
}
}
else{
failures.add("TestCase not found for Access: " + accessValues[i].toString() + "," + authenticationValues[j].toString());
}
}
}
if(!failures.isEmpty()){
String message = "";
for(int i = 0; i < failures.size(); i++){
message += failures.get(i);
if(i != failures.size() - 1){
message += ", ";
}
}
fail("Test failed because: " + message);
}
}
protected <D extends Definition> void runTestCase() throws Exception{
try{
@SuppressWarnings("unchecked")
DefDescriptor<D> descriptor = (DefDescriptor<D>)getAuraTestingUtil().addSourceAutoCleanup(getDefClass(),
getResourceSource(), getDefDescriptorName(),
(testNamespace == TestNamespace.System? true: false));
Source<D> source = StringSourceLoader.getInstance().getSource(descriptor);
@SuppressWarnings("unchecked")
Parser<D> parser = (Parser<D>)ParserFactory.getParser(Format.XML, descriptor.getDefType());
Definition def = parser.parse(descriptor, source);
def.validateDefinition();
//def.validateReferences();
//descriptor.getDef();
if (!isValidTestCase()) {
fail("Should have thrown Exception for access: " + getAccess());
}
} catch (InvalidAccessValueException e) {
if(isValidTestCase()){
fail("Should not have thrown Exception for access: " + getAccess());
}
} catch (InvalidDefinitionException e) {
if(isValidTestCase()){
fail("Should not have thrown Exception for access: " + getAccess());
}
}
}
private String getDefDescriptorName() {
String name = null;
String namespace = StringSourceLoader.DEFAULT_NAMESPACE;
if(testNamespace == TestNamespace.Custom){
namespace = StringSourceLoader.DEFAULT_CUSTOM_NAMESPACE;
}
switch(testResource){
case Application:
name = namespace + ":testapplication";
break;
case Component:
name = namespace + ":testcomponent";
break;
case Interface:
name = namespace + ":testinterface";
break;
case Attribute:
name = namespace + ":testcomponent";
break;
case Event:
case RegisterEvent:
name = namespace + ":testevent";
break;
case Tokens:
name = namespace + ":testtokens";
break;
case Module:
name = namespace + ":testmodule";
break;
}
return name;
}
private Class<? extends Definition> getDefClass(){
Class<? extends Definition> classDef = null;
switch(testResource){
case Application:
classDef = ApplicationDef.class;
break;
case Component:
classDef = ComponentDef.class;
break;
case Interface:
classDef = InterfaceDef.class;
break;
case Attribute:
classDef = ComponentDef.class;
break;
case Event:
classDef = EventDef.class;
break;
case Module:
classDef = LibraryDef.class;
break;
case Tokens:
classDef = TokensDef.class;
break;
case RegisterEvent:
classDef = ComponentDef.class;
}
return classDef;
}
private String getResourceSource(){
String resource = testResource.toString().toLowerCase();
String access = getAccess();
String source = null;
if(testResource == TestResource.Application ||
testResource == TestResource.Component ||
testResource == TestResource.Interface){
source = "<aura:"+resource+" " + (access!= null?"access='" +access+ "'" : "") + " /> ";
}
else if(testResource == TestResource.Attribute){
source = "<aura:component>";
source += "<aura:attribute name='testattribute' type='String' " + (access!= null?"access='" +access+ "'" : "") + " />";
source += "</aura:component> ";
}
else if(testResource == TestResource.Event){
source = "<aura:event type='COMPONENT' " + (access!= null?"access='" +access+ "'" : "") + " />";
}
else if(testResource == TestResource.Tokens){
source = "<aura:tokens " + (access!= null?"access='" + access+ "'" : "") + " />";
}
else if(testResource == TestResource.RegisterEvent){
source = "<aura:component>";
source += "<aura:registerEvent name='testevent' type='ui:keydown' description='For QA' " + (access!= null?"access='" +access+ "'" : "") + " />";
source += "</aura:component> ";
}
return source;
}
private String getAccess(){
StringBuffer access = new StringBuffer();
if(testCase == TestCase.DEFAULT){
return null;
}
if(testCase == TestCase.EMPTY){
return "";
}
if(testCase == TestCase.INVALID){
return "BLAH";
}
if(testCase == TestCase.INVALID_DYNAMIC){
return "org.auraframework.impl.test.util.TestAccessMethods.invalid";
}
if(testCase == TestCase.AUTHENTICATED_UNAUTHENTICATED){
return "AUTHENTICATED,UNAUTHENTICATED";
}
if(testCase == TestCase.VALUE_METHOD){
return "GLOBAL,org.auraframework.impl.test.util.TestAccessMethods.allowGlobal";
}
if(testCase == TestCase.METHOD_AUTHENTICATION){
return "org.auraframework.impl.test.util.TestAccessMethods.allowGlobal,AUTHENTICATED";
}
if(testCase.toString().contains("INVALID")){
access.append("BLAH,");
}
boolean isDynamic = false;
if(testCase.toString().endsWith("DYNAMIC")){
isDynamic = true;
}
if(testCase.toString().contains("GLOBAL")){
if(!isDynamic){
access.append("GLOBAL,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowGlobal";
}
}
if(testCase.toString().contains("PUBLIC")){
if(!isDynamic){
access.append("PUBLIC,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowPublic";
}
}
if(testCase.toString().contains("PRIVATE")){
if(!isDynamic){
access.append("PRIVATE,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowPrivate";
}
}
if(testCase.toString().contains("INTERNAL")){
if(!isDynamic){
access.append("INTERNAL,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowInternal";
}
}
if(testCase.toString().contains("UNAUTHENTICATED")){
if(!isDynamic){
access.append("UNAUTHENTICATED,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowUnAuthenticated";
}
}
else{
if(testCase.toString().contains("AUTHENTICATED")){
if(!isDynamic){
access.append("AUTHENTICATED,");
}
else{
return "org.auraframework.impl.test.util.TestAccessMethods.allowAuthenticated";
}
}
}
int index = access.lastIndexOf(",");
if(index == access.length()-1){
access.deleteCharAt(index);
}
return access.toString();
}
private boolean isValidTestCase(){
String access = getAccess();
if(access == null){
return true;
}
if(access == "" || access.equals("BLAH")
|| access.equals("AUTHENTICATED,UNAUTHENTICATED")
|| access.equals("org.auraframework.impl.test.util.TestAccessMethods.invalid")
|| access.equals("org.auraframework.impl.test.util.TestAccessMethods.allowAuthenticated")
|| access.equals("org.auraframework.impl.test.util.TestAccessMethods.allowUnAuthenticated")
|| access.equals("GLOBAL,org.auraframework.impl.test.util.TestAccessMethods.allowGlobal")){
return false;
}
String[] accessValues;
if(access.startsWith("org.auraframework.impl.test.util.TestAccessMethods.")){
String[] vals = access.split("\\.");
String val = vals[vals.length-1];
accessValues = new String[]{val.toUpperCase()};
}
else{
accessValues = access.split(",");
}
for(int i = 0; i < accessValues.length; i++){
switch (testResource) {
case Application:
if(testNamespace == TestNamespace.System){
if(accessValues[i].contains("PRIVATE") || accessValues[i].contains("BLAH")){
return false;
}
}
else{
if(!accessValues[i].equals("GLOBAL") && !accessValues[i].equals("PUBLIC")){
return false;
}
}
break;
case Component:
case Interface:
if(testNamespace == TestNamespace.System){
if(accessValues[i].contains("PRIVATE") || accessValues[i].contains("AUTHENTICATED") || accessValues[i].contains("BLAH")){
return false;
}
}
else{
if(!accessValues[i].equals("GLOBAL") && !accessValues[i].equals("PUBLIC")){
return false;
}
}
break;
default:
if(testNamespace == TestNamespace.System){
if(accessValues[i].contains("AUTHENTICATED") || accessValues[i].contains("BLAH")){
return false;
}
}
else{
if(!accessValues[i].equals("GLOBAL") && !accessValues[i].equals("PUBLIC") && !accessValues[i].equals("PRIVATE")){
return false;
}
}
}
}
if(accessValues.length == 2){
if(access.contains("GLOBAL")){
if(access.contains("PUBLIC") || access.contains("PRIVATE") || access.contains("INTERNAL")){
return false;
}
}
if(access.contains("PUBLIC")){
if(access.contains("PRIVATE") || access.contains("INTERNAL")){
return false;
}
}
if(access.contains("PRIVATE") && access.contains("INTERNAL")){
return false;
}
}
return true;
}
protected TestCase getTestCase(Access access, boolean isDynamic) {
try{
String accessVal = access.toString();
if(isDynamic){
accessVal += "_DYNAMIC";
}
return TestCase.valueOf(accessVal);
}
catch(Exception e){
return null;
}
}
private TestCase getTestCase(Access access, String prefix) {
try{
String accessVal = prefix + "_" + access.toString();
return TestCase.valueOf(accessVal);
}
catch(Exception e){
return null;
}
}
private TestCase getTestCase(Access access1, Access access2) {
try{
return TestCase.valueOf(access1.toString() + "_" + access2.toString());
}
catch(Exception e1){
try{
return TestCase.valueOf(access2.toString() + "_" + access1.toString());
}
catch(Exception e2){
return null;
}
}
}
private TestCase getTestCase(Authentication authentication, boolean isDynamic) {
try{
String accessVal = authentication.toString();
if(isDynamic){
accessVal += "_DYNAMIC";
}
return TestCase.valueOf(accessVal);
}
catch(Exception e){
return null;
}
}
private TestCase getTestCase(Authentication authentication, String prefix) {
try{
String accessVal = prefix + "_" + authentication.toString();
return TestCase.valueOf(accessVal);
}
catch(Exception e){
return null;
}
}
private TestCase getTestCase(Access access, Authentication authentication) {
try{
return TestCase.valueOf(access.toString() + "_" + authentication.toString());
}
catch(Exception e1){
return null;
}
}
protected TestCase testCase;
protected TestResource testResource;
protected TestNamespace testNamespace;
protected enum TestResource {Application, Component, Interface, Attribute, Event, Tokens, RegisterEvent, Module};
protected enum TestNamespace {System, Custom};
private enum TestCase {EMPTY, DEFAULT, INVALID, GLOBAL, PUBLIC, PRIVATE, INTERNAL, AUTHENTICATED, UNAUTHENTICATED,
INVALID_DYNAMIC, GLOBAL_DYNAMIC, PUBLIC_DYNAMIC, PRIVATE_DYNAMIC, INTERNAL_DYNAMIC, AUTHENTICATED_DYNAMIC, UNAUTHENTICATED_DYNAMIC,
GLOBAL_AUTHENTICATED, GLOBAL_UNAUTHENTICATED,
PUBLIC_AUTHENTICATED, PUBLIC_UNAUTHENTICATED,
PRIVATE_AUTHENTICATED, PRIVATE_UNAUTHENTICATED,
INTERNAL_AUTHENTICATED, INTERNAL_UNAUTHENTICATED,
GLOBAL_PUBLIC, GLOBAL_PRIVATE, GLOBAL_INTERNAL,
PUBLIC_PRIVATE, PUBLIC_INTERNAL,
PRIVATE_INTERNAL,
AUTHENTICATED_UNAUTHENTICATED,
VALUE_METHOD, METHOD_AUTHENTICATION,
INVALID_GLOBAL, INVALID_PUBLIC, INVALID_PRIVATE, INVALID_INTERNAL, INVALID_AUTHENTICATED, INVALID_UNAUTHENTICATED};
}
| apache-2.0 |
lesaint/experimenting-annotation-processing | experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation1/sub1/Class_5815.java | 151 | package fr.javatronic.blog.massive.annotation1.sub1;
import fr.javatronic.blog.processor.Annotation_001;
@Annotation_001
public class Class_5815 {
}
| apache-2.0 |
vito16/shop | src/main/java/com/vito16/shop/repository/OrderRepository.java | 718 | package com.vito16.shop.repository;
import com.vito16.shop.model.Order;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
/**
*
* @author Vito
* @email zhouwentao16@gmail.com
* @date 2013-7-9
*
*/
@Repository
public interface OrderRepository extends JpaRepository<Order, Integer> {
@Query("from Order o where o.user.id=?1")
Page<Order> findByUserId(Integer id, Pageable pageable);
@Query("select count(o.id) from Order o where o.user.id=?1")
long countByUserId(Integer userId);
}
| apache-2.0 |
lumongo/lumongo | lumongo-client/src/main/java/org/lumongo/client/result/GetNumberOfDocsResult.java | 1460 | package org.lumongo.client.result;
import org.lumongo.cluster.message.Lumongo.GetNumberOfDocsResponse;
import org.lumongo.cluster.message.Lumongo.SegmentCountResponse;
import java.util.List;
public class GetNumberOfDocsResult extends Result {
private GetNumberOfDocsResponse getNumberOfDocsResponse;
public GetNumberOfDocsResult(GetNumberOfDocsResponse getNumberOfDocsResponse) {
this.getNumberOfDocsResponse = getNumberOfDocsResponse;
}
public long getNumberOfDocs() {
return getNumberOfDocsResponse.getNumberOfDocs();
}
public int getSegmentCountResponseCount() {
return getNumberOfDocsResponse.getSegmentCountResponseCount();
}
public List<SegmentCountResponse> getSegmentCountResponses() {
return getNumberOfDocsResponse.getSegmentCountResponseList();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{\n \"numberOfDocs\": ");
sb.append(getNumberOfDocs());
sb.append(",\n \"segmentCounts\": [");
for (SegmentCountResponse scr : getSegmentCountResponses()) {
sb.append("\n {\n \"segmentNumber\": ");
sb.append(scr.getSegmentNumber());
sb.append(",\n \"numberOfDocs\": ");
sb.append(scr.getNumberOfDocs());
sb.append("\n },");
}
if (getSegmentCountResponseCount() != 0) {
sb.setLength(sb.length() - 1);
}
sb.append("\n ],\n \"commandTimeMs\": ");
sb.append(getCommandTimeMs());
sb.append("\n}\n");
return sb.toString();
}
}
| apache-2.0 |
integrated/jakarta-slide-server | maven/jakarta-slide-kernel/src/main/java/org/apache/slide/search/basic/expression/GenericBasicExpression.java | 1494 | /*
* $Header: /var/chroot/cvs/cvs/factsheetDesigner/extern/jakarta-slide-server-src-2.1-iPlus Edit/src/share/org/apache/slide/search/basic/expression/GenericBasicExpression.java,v 1.2 2006-01-22 22:49:05 peter-cvs Exp $
* $Revision: 1.2 $
* $Date: 2006-01-22 22:49:05 $
*
* ====================================================================
*
* Copyright 2002-2004 The Apache Software Foundation
*
* 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.apache.slide.search.basic.expression;
import org.apache.slide.search.InvalidQueryException;
import org.jdom.Element;
/**
* GenericBasicExpression.java
*
*/
public abstract class GenericBasicExpression extends BasicExpression {
/**
* constructor. Only called by the conrecte expressions
*
* @param e the jdom element representing this expression.
*/
protected GenericBasicExpression (Element e) throws InvalidQueryException{
super (e);
}
}
| apache-2.0 |
capitalone/Hydrograph | hydrograph.engine/hydrograph.engine.transformation/src/test/java/hydrograph/engine/transformation/standardfunctions/StringFunctionTest.java | 2774 | /*******************************************************************************
* Copyright 2016 Capital One Services, LLC and Bitwise, 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 hydrograph.engine.transformation.standardfunctions;
import org.junit.Assert;
import org.junit.Test;
import java.math.BigDecimal;
/**
* The Class StringFunctionTest.
*
* @author Bitwise
*/
public class StringFunctionTest {
@Test
public void testNumericString() {
boolean result1 = StringFunctions.isNumeric("abcds");
boolean result2 = StringFunctions.isNumeric("sneha123");
boolean result3 = StringFunctions.isNumeric("12345");
boolean result4 = StringFunctions.isNumeric("0000");
Assert.assertEquals(result1, false);
Assert.assertEquals(result2, false);
Assert.assertEquals(result3, true);
Assert.assertEquals(result4, true);
}
@Test
public void testAlphabeticString() {
boolean result1 = StringFunctions.isAlphabetic("abcds");
boolean result2 = StringFunctions.isAlphabetic("sneha123");
boolean result3 = StringFunctions.isAlphabetic("12345");
boolean result4 = StringFunctions.isAlphabetic("0000");
Assert.assertEquals(result1, true);
Assert.assertEquals(result2, false);
Assert.assertEquals(result3, false);
Assert.assertEquals(result4, false);
}
@Test
public void testStringToHexCoversion() {
String result1 = StringFunctions.toHex("abc");
String result2 = StringFunctions.toHex("ABC");
String result3 = StringFunctions.toHex("0123");
Assert.assertEquals(result1, "616263");
Assert.assertEquals(result2, "414243");
Assert.assertEquals(result3, "30313233");
}
@Test
public void testStringStartsWith() {
boolean result1 = StringFunctions.startsWith("abc", "a");
boolean result2 = StringFunctions.startsWith("$12131231", "$1213");
boolean result3 = StringFunctions.startsWith("a12312ada", "a21");
Assert.assertEquals(result1, true);
Assert.assertEquals(result2, true);
Assert.assertEquals(result3, false);
}
}
| apache-2.0 |
jentfoo/aws-sdk-java | aws-java-sdk-eks/src/main/java/com/amazonaws/services/eks/model/Certificate.java | 5125 | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.eks.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* An object representing the <code>certificate-authority-data</code> for your cluster.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/eks-2017-11-01/Certificate" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Certificate implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
* </p>
*/
private String data;
/**
* <p>
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
* </p>
*
* @param data
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
*/
public void setData(String data) {
this.data = data;
}
/**
* <p>
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
* </p>
*
* @return The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
*/
public String getData() {
return this.data;
}
/**
* <p>
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
* </p>
*
* @param data
* The Base64-encoded certificate data required to communicate with your cluster. Add this to the
* <code>certificate-authority-data</code> section of the <code>kubeconfig</code> file for your cluster.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Certificate withData(String data) {
setData(data);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getData() != null)
sb.append("Data: ").append(getData());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Certificate == false)
return false;
Certificate other = (Certificate) obj;
if (other.getData() == null ^ this.getData() == null)
return false;
if (other.getData() != null && other.getData().equals(this.getData()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getData() == null) ? 0 : getData().hashCode());
return hashCode;
}
@Override
public Certificate clone() {
try {
return (Certificate) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.eks.model.transform.CertificateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| apache-2.0 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBDeleteExpression.java | 12284 | /*
* Copyright 2011-2022 Amazon.com, Inc. or its affiliates. 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://aws.amazon.com/apache2.0
*
* This file 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.amazonaws.services.dynamodbv2.datamodeling;
import java.util.HashMap;
import java.util.Map;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.ConditionalOperator;
import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest;
import com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue;
/**
* Enables adding options to a delete operation.
* For example, you may want to delete only if an attribute has a particular value.
* @see DynamoDBMapper#delete(Object, DynamoDBDeleteExpression)
*/
public class DynamoDBDeleteExpression {
/** Optional expected attributes */
private Map<String, ExpectedAttributeValue> expectedAttributes;
/** The logical operator on the expected attribute conditions */
private String conditionalOperator;
/**
* A condition that must be satisfied in order for a conditional
* DeleteItem to succeed.
*/
private String conditionExpression;
/**
* One or more substitution variables for simplifying complex
* expressions.
*/
private java.util.Map<String,String> expressionAttributeNames;
/**
* One or more values that can be substituted in an expression.
*/
private java.util.Map<String,AttributeValue> expressionAttributeValues;
/**
* Gets the map of attribute names to expected attribute values to check on delete.
*
* @return The map of attribute names to expected attribute value conditions to check on delete
*/
public Map<String, ExpectedAttributeValue> getExpected() {
return expectedAttributes;
}
/**
* Sets the expected condition to the map of attribute names to expected attribute values given.
*
* @param expectedAttributes
* The map of attribute names to expected attribute value conditions to check on delete
*/
public void setExpected(Map<String, ExpectedAttributeValue> expectedAttributes) {
this.expectedAttributes = expectedAttributes;
}
/**
* Sets the expected condition to the map of attribute names to expected
* attribute values given and returns a pointer to this object for
* method-chaining.
*
* @param expectedAttributes
* The map of attribute names to expected attribute value
* conditions to check on delete
*/
public DynamoDBDeleteExpression withExpected(Map<String, ExpectedAttributeValue> expectedAttributes) {
setExpected(expectedAttributes);
return this;
}
/**
* Adds one entry to the expected conditions and returns a pointer to this
* object for method-chaining.
*
* @param attributeName
* The name of the attribute.
* @param expected
* The expected attribute value.
*/
public DynamoDBDeleteExpression withExpectedEntry(String attributeName, ExpectedAttributeValue expected) {
if (expectedAttributes == null) {
expectedAttributes = new HashMap<String,ExpectedAttributeValue>();
}
expectedAttributes.put(attributeName, expected);
return this;
}
/**
* Returns the logical operator on the expected attribute conditions of this
* delete operation.
*/
public String getConditionalOperator() {
return conditionalOperator;
}
/**
* Sets the logical operator on the expected attribute conditions of this
* delete operation.
*/
public void setConditionalOperator(String conditionalOperator) {
this.conditionalOperator = conditionalOperator;
}
/**
* Sets the logical operator on the expected attribute conditions of this
* delete operation and returns a pointer to this object for
* method-chaining.
*/
public DynamoDBDeleteExpression withConditionalOperator(String conditionalOperator) {
setConditionalOperator(conditionalOperator);
return this;
}
/**
* Sets the logical operator on the expected attribute conditions of this
* delete operation.
*/
public void setConditionalOperator(ConditionalOperator conditionalOperator) {
setConditionalOperator(conditionalOperator.toString());
}
/**
* Sets the logical operator on the expected attribute conditions of this
* delete operation and returns a pointer to this object for
* method-chaining.
*/
public DynamoDBDeleteExpression withConditionalOperator(ConditionalOperator conditionalOperator) {
return withConditionalOperator(conditionalOperator.toString());
}
/**
* A condition that must be satisfied in order for a conditional DeleteItem
* to succeed.
*
* @see DeleteItemRequest#getConditionExpression()
*/
public String getConditionExpression() {
return conditionExpression;
}
/**
* A condition that must be satisfied in order for a conditional DeleteItem
* to succeed.
*
* @see DeleteItemRequest#setConditionExpression()
*/
public void setConditionExpression(String conditionExpression) {
this.conditionExpression = conditionExpression;
}
/**
* A condition that must be satisfied in order for a conditional DeleteItem
* to succeed.
*
* @return A reference to this updated object so that method calls can be
* chained together.
*
* @see DeleteItemRequest#withConditionExpression(String)
*/
public DynamoDBDeleteExpression withConditionExpression(
String conditionExpression) {
this.conditionExpression = conditionExpression;
return this;
}
/**
* One or more substitution variables for simplifying complex expressions.
*
* @return One or more substitution variables for simplifying complex
* expressions.
* @see DeleteItemRequest#getExpressionAttributeNames()
*/
public java.util.Map<String, String> getExpressionAttributeNames() {
return expressionAttributeNames;
}
/**
* One or more substitution variables for simplifying complex expressions.
*
* @param expressionAttributeNames
* One or more substitution variables for simplifying complex
* expressions.
* @see DeleteItemRequest#setExpressionAttributeNames(Map)
*/
public void setExpressionAttributeNames(
java.util.Map<String, String> expressionAttributeNames) {
this.expressionAttributeNames = expressionAttributeNames;
}
/**
* One or more substitution variables for simplifying complex expressions.
*
* @param expressionAttributeNames
* One or more substitution variables for simplifying complex
* expressions.
*
* @return A reference to this updated object so that method calls can be
* chained together.
* @see DeleteItemRequest#withExpressionAttributeNames(Map)
*/
public DynamoDBDeleteExpression withExpressionAttributeNames(
java.util.Map<String, String> expressionAttributeNames) {
setExpressionAttributeNames(expressionAttributeNames);
return this;
}
/**
* One or more substitution variables for simplifying complex expressions.
* The method adds a new key-value pair into ExpressionAttributeNames
* parameter, and returns a reference to this object so that method calls
* can be chained together.
*
* @param key
* The key of the entry to be added into
* ExpressionAttributeNames.
* @param value
* The corresponding value of the entry to be added into
* ExpressionAttributeNames.
*
* @see DeleteItemRequest#addExpressionAttributeNamesEntry(String, String)
*/
public DynamoDBDeleteExpression addExpressionAttributeNamesEntry(
String key, String value) {
if (null == this.expressionAttributeNames) {
this.expressionAttributeNames = new java.util.HashMap<String, String>();
}
if (this.expressionAttributeNames.containsKey(key))
throw new IllegalArgumentException("Duplicated keys ("
+ key.toString() + ") are provided.");
this.expressionAttributeNames.put(key, value);
return this;
}
/**
* Removes all the entries added into ExpressionAttributeNames.
* <p>
* Returns a reference to this object so that method calls can be chained
* together.
*/
public DynamoDBDeleteExpression clearExpressionAttributeNamesEntries() {
this.expressionAttributeNames = null;
return this;
}
/**
* One or more values that can be substituted in an expression.
*
* @return One or more values that can be substituted in an expression.
* @see DeleteItemRequest#getExpressionAttributeValues()
*/
public java.util.Map<String, AttributeValue> getExpressionAttributeValues() {
return expressionAttributeValues;
}
/**
* One or more values that can be substituted in an expression.
*
* @param expressionAttributeValues
* One or more values that can be substituted in an expression.
*
* @see DeleteItemRequest#setExpressionAttributeValues(Map)
*/
public void setExpressionAttributeValues(
java.util.Map<String, AttributeValue> expressionAttributeValues) {
this.expressionAttributeValues = expressionAttributeValues;
}
/**
* One or more values that can be substituted in an expression.
*
* @param expressionAttributeValues
* One or more values that can be substituted in an expression.
*
* @return A reference to this updated object so that method calls can be
* chained together.
* @see DeleteItemRequest#withExpressionAttributeValues(Map)
*/
public DynamoDBDeleteExpression withExpressionAttributeValues(
java.util.Map<String, AttributeValue> expressionAttributeValues) {
setExpressionAttributeValues(expressionAttributeValues);
return this;
}
/**
* One or more values that can be substituted in an expression. The method
* adds a new key-value pair into ExpressionAttributeValues parameter, and
* returns a reference to this object so that method calls can be chained
* together.
*
* @param key
* The key of the entry to be added into
* ExpressionAttributeValues.
* @param value
* The corresponding value of the entry to be added into
* ExpressionAttributeValues.
*
* @see DeleteItemRequest#addExpressionAttributeValuesEntry(String,
* AttributeValue)
*/
public DynamoDBDeleteExpression addExpressionAttributeValuesEntry(
String key, AttributeValue value) {
if (null == this.expressionAttributeValues) {
this.expressionAttributeValues = new java.util.HashMap<String, AttributeValue>();
}
if (this.expressionAttributeValues.containsKey(key))
throw new IllegalArgumentException("Duplicated keys ("
+ key.toString() + ") are provided.");
this.expressionAttributeValues.put(key, value);
return this;
}
/**
* Removes all the entries added into ExpressionAttributeValues.
* <p>
* Returns a reference to this object so that method calls can be chained
* together.
*/
public DynamoDBDeleteExpression clearExpressionAttributeValuesEntries() {
this.expressionAttributeValues = null;
return this;
}
}
| apache-2.0 |
ConSol/sakuli | src/integration-test/src/test/java/org/sakuli/integration/services/forwarder/gearman/GearmanTestCaseTemplateOutputBuilderIntegrationTest.java | 19351 | /*
* Sakuli - Testing and Monitoring-Tool for Websites and common UIs.
*
* Copyright 2013 - 2018 the original author or 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 org.sakuli.integration.services.forwarder.gearman;
import org.apache.commons.io.FileUtils;
import org.joda.time.DateTime;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.sakuli.BaseTest;
import org.sakuli.builder.TestCaseExampleBuilder;
import org.sakuli.builder.TestCaseStepExampleBuilder;
import org.sakuli.datamodel.TestCase;
import org.sakuli.datamodel.TestSuite;
import org.sakuli.datamodel.properties.SakuliProperties;
import org.sakuli.datamodel.state.TestCaseState;
import org.sakuli.datamodel.state.TestCaseStepState;
import org.sakuli.exceptions.SakuliCheckedException;
import org.sakuli.integration.IntegrationTest;
import org.sakuli.services.forwarder.ScreenshotDiv;
import org.sakuli.services.forwarder.ScreenshotDivConverter;
import org.sakuli.services.forwarder.gearman.GearmanProperties;
import org.sakuli.services.forwarder.gearman.GearmanTemplateOutputBuilder;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;
import static org.mockito.ArgumentMatchers.notNull;
import static org.mockito.Mockito.doReturn;
/**
* @author Georgi Todorov
*/
@Test(groups = IntegrationTest.GROUP)
public class GearmanTestCaseTemplateOutputBuilderIntegrationTest extends BaseTest {
private static final String TESTSUITE_ID = "example_xfce";
private static final String DEFAULT_SERVICE_TYPE = "passive";
private static final String DEFAULT_NAGIOS_HOST = "my.nagios.host";
private static final String DEFAULT_NAGIOS_CHECK_COMMMAND = "check_sakuli";
@InjectMocks
@Spy
private GearmanTemplateOutputBuilder testling;
@Mock
private ScreenshotDivConverter screenshotDivConverter;
@Mock
private GearmanProperties gearmanProperties;
@Mock
private SakuliProperties sakuliProperties;
@BeforeMethod
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
doReturn(getTemplatePath()).when(sakuliProperties).getForwarderTemplateFolder();
doReturn(TESTSUITE_ID).when(gearmanProperties).getNagiosServiceDescription();
doReturn(DEFAULT_SERVICE_TYPE).when(gearmanProperties).getServiceType();
doReturn(DEFAULT_NAGIOS_HOST).when(gearmanProperties).getNagiosHost();
doReturn(DEFAULT_NAGIOS_CHECK_COMMMAND).when(gearmanProperties).getNagiosCheckCommand();
TestSuite testSuite = new TestSuite();
testSuite.setId(TESTSUITE_ID);
doReturn(testSuite).when(testling).getCurrentTestSuite();
doReturn(null).when(testling).getCurrentTestCase();
}
private String getTemplatePath() {
// If not available execute test via `mvn test-compile` to extract the file dependencies
return getResource("common/config/templates");
}
private String getOutputPath() {
return getResource("output", this.getClass());
}
private String loadExpectedOutput(String testCaseName) throws IOException {
return FileUtils.readFileToString(Paths.get(getOutputPath() + File.separator + "TestCase_" + testCaseName + ".txt").toFile());
}
@Test
public void testOK() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.OK)
.withWarningTime(20)
.withCriticalTime(30)
.withStartDate(new DateTime(1970, 1, 1, 10, 30, 0).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 30, 14, 20).toDate())
.withId("case1")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Test_Sahi_landing_page")
.withWarningTime(5)
.withStartDate(new DateTime(1970, 1, 1, 10, 30, 0).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 160).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Calculation")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 30, 7, 290).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 30, 0, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 30, 1, 500).toDate())
.buildExample()
)
)
.buildExample();
String output = testling.createOutput(testCase);
Assert.assertEquals(output, loadExpectedOutput(TestCaseState.OK.name()));
}
@Test
public void testWarnInStep() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.WARNING_IN_STEP)
.withWarningTime(20)
.withCriticalTime(30)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 33, 430).toDate())
.withId("case2")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Test_Sahi_landing_page_(case2)")
.withWarningTime(5)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 0, 930).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.WARNING)
.withName("Calculation_(case2)")
.withWarningTime(1)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 7, 20).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 30).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 1, 420).toDate())
.buildExample()
)
)
.buildExample();
String output = testling.createOutput(testCase);
Assert.assertEquals(output, loadExpectedOutput(TestCaseState.WARNING_IN_STEP.name()));
}
@Test
public void testCritInStep() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.CRITICAL_IN_STEP)
.withWarningTime(20)
.withCriticalTime(30)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 33, 430).toDate())
.withId("case2")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Test_Sahi_landing_page_(case2)")
.withWarningTime(5)
.withCriticalTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 0, 930).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.WARNING)
.withName("Calculation_(case2)")
.withWarningTime(1)
.withCriticalTime(2)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 7, 20).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor_(case2)")
.withWarningTime(10)
.withCriticalTime(20)
.withStartDate(new DateTime(1970, 1, 1, 10, 31, 0, 30).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 31, 1, 420).toDate())
.buildExample()
)
)
.buildExample();
String output = testling.createOutput(testCase);
Assert.assertEquals(output, loadExpectedOutput(TestCaseState.CRITICAL_IN_STEP.name()));
}
@Test
public void testWarnInCase() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.WARNING)
.withWarningTime(2)
.withCriticalTime(30)
.withStartDate(new DateTime(1970, 1, 1, 10, 34, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 34, 33, 540).toDate())
.withId("case2")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Test_Sahi_landing_page_(case2)")
.withWarningTime(5)
.withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 34, 0, 940).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Calculation_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 34, 7, 140).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 34, 0, 30).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 34, 1, 390).toDate())
.buildExample()
)
)
.buildExample();
String output = testling.createOutput(testCase);
Assert.assertEquals(output, loadExpectedOutput(TestCaseState.WARNING.name()));
}
@Test
public void testCritInCase() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.CRITICAL)
.withWarningTime(2)
.withCriticalTime(3)
.withStartDate(new DateTime(1970, 1, 1, 10, 35, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 35, 33, 700).toDate())
.withId("case2")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Test_Sahi_landing_page_(case2)")
.withWarningTime(5)
.withStartDate(new DateTime(1970, 1, 1, 10, 35, 0).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 80).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Calculation_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 35, 7, 120).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 35, 0, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 35, 1, 440).toDate())
.buildExample()
)
)
.buildExample();
String output = testling.createOutput(testCase);
String expected = loadExpectedOutput(TestCaseState.CRITICAL.name());
Assert.assertEquals(output, expected);
Assert.assertEquals(output.getBytes(), expected.getBytes());
}
@Test
public void testException() throws Exception {
TestCase testCase = new TestCaseExampleBuilder()
.withState(TestCaseState.ERRORS)
.withWarningTime(20)
.withCriticalTime(30)
.withStartDate(new DateTime(1970, 1, 1, 10, 36, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 36, 23, 550).toDate())
.withId("case2")
.withTestCaseSteps(
Arrays.asList(
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.ERRORS)
.withName("Test_Sahi_landing_page_(case2)")
.withWarningTime(5)
.withStartDate(new DateTime(1970, 1, 1, 10, 36, 0).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 36, 1, 50).toDate())
.withException(new SakuliCheckedException("_highlight(_link(\"xSL Manager\")); TypeError: el is undefined Sahi.prototype._highlight@http://sahi.example.com/_s_/spr/concat.js:1210:9 @http://sahi.example.com/_s_/spr/concat.js line 3607 > eval:1:1 Sahi.prototype.ex@http://sahi.example.com/_s_/spr/concat.js:3607:9 Sahi.prototype.ex@http://sahi.example.com/_s_/spr/sakuli/inject.js:46:12 @http://sahi.example.com/_s_/spr/concat.js:3373:5 <a href='/_s_/dyn/Log_getBrowserScript?href=/root/sakuli/example_test_suites/example_xfce/case2/sakuli_demo.js&n=1210'><b>Click for browser script</b></a>"))
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Calculation_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 36, 10).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 36, 17, 30).toDate())
.buildExample(),
new TestCaseStepExampleBuilder()
.withState(TestCaseStepState.OK)
.withName("Editor_(case2)")
.withWarningTime(10)
.withStartDate(new DateTime(1970, 1, 1, 10, 36, 20).toDate())
.withStopDate(new DateTime(1970, 1, 1, 10, 36, 21, 390).toDate())
.buildExample()
)
)
.buildExample();
ScreenshotDiv screenshotDiv = new ScreenshotDiv();
screenshotDiv.setId("sakuli_screenshot243575009");
screenshotDiv.setFormat("jpg");
screenshotDiv.setBase64screenshot("/9j/4AAQSkZJRgABAgAAAQABAAD9k=");
doReturn(screenshotDiv).when(screenshotDivConverter).convert(notNull(Exception.class));
String output = testling.createOutput(testCase);
Assert.assertEquals(output, loadExpectedOutput(TestCaseState.ERRORS.name()));
}
}
| apache-2.0 |
dump247/aws-sdk-java | aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/model/transform/PasswordPolicyStaxUnmarshaller.java | 5283 | /*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.identitymanagement.model.transform;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.stream.events.XMLEvent;
import com.amazonaws.services.identitymanagement.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.MapEntry;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
/**
* PasswordPolicy StAX Unmarshaller
*/
public class PasswordPolicyStaxUnmarshaller implements
Unmarshaller<PasswordPolicy, StaxUnmarshallerContext> {
public PasswordPolicy unmarshall(StaxUnmarshallerContext context)
throws Exception {
PasswordPolicy passwordPolicy = new PasswordPolicy();
int originalDepth = context.getCurrentDepth();
int targetDepth = originalDepth + 1;
if (context.isStartOfDocument())
targetDepth += 1;
while (true) {
XMLEvent xmlEvent = context.nextEvent();
if (xmlEvent.isEndDocument())
return passwordPolicy;
if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
if (context
.testExpression("MinimumPasswordLength", targetDepth)) {
passwordPolicy
.setMinimumPasswordLength(IntegerStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("RequireSymbols", targetDepth)) {
passwordPolicy.setRequireSymbols(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("RequireNumbers", targetDepth)) {
passwordPolicy.setRequireNumbers(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("RequireUppercaseCharacters",
targetDepth)) {
passwordPolicy
.setRequireUppercaseCharacters(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("RequireLowercaseCharacters",
targetDepth)) {
passwordPolicy
.setRequireLowercaseCharacters(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("AllowUsersToChangePassword",
targetDepth)) {
passwordPolicy
.setAllowUsersToChangePassword(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("ExpirePasswords", targetDepth)) {
passwordPolicy.setExpirePasswords(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("MaxPasswordAge", targetDepth)) {
passwordPolicy.setMaxPasswordAge(IntegerStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("PasswordReusePrevention",
targetDepth)) {
passwordPolicy
.setPasswordReusePrevention(IntegerStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
if (context.testExpression("HardExpiry", targetDepth)) {
passwordPolicy.setHardExpiry(BooleanStaxUnmarshaller
.getInstance().unmarshall(context));
continue;
}
} else if (xmlEvent.isEndElement()) {
if (context.getCurrentDepth() < originalDepth) {
return passwordPolicy;
}
}
}
}
private static PasswordPolicyStaxUnmarshaller instance;
public static PasswordPolicyStaxUnmarshaller getInstance() {
if (instance == null)
instance = new PasswordPolicyStaxUnmarshaller();
return instance;
}
}
| apache-2.0 |
massx1/syncope | core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/Logger.java | 1190 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses 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 org.apache.syncope.core.persistence.api.entity;
import org.apache.syncope.common.lib.types.LoggerLevel;
import org.apache.syncope.common.lib.types.LoggerType;
public interface Logger extends Entity<String> {
void setKey(String name);
LoggerLevel getLevel();
void setLevel(LoggerLevel level);
LoggerType getType();
void setType(LoggerType type);
}
| apache-2.0 |
8090boy/gomall.la | legendshop_payment/src/java/com/legendshop/payment/helper/AlipayAccount.java | 2330 | /*
*
* LegendShop 多用户商城系统
*
* 版权所有,并保留所有权利。
*
*/
package com.legendshop.payment.helper;
import com.legendshop.util.Arith;
/**
* 分润帐号 type :1 按百分比,2 实收
*
* LegendShop 版权所有 2009-2011,并保留所有权利。
*
* ----------------------------------------------------------------------------
* 提示:在未取得LegendShop商业授权之前,您不能将本软件应用于商业用途,否则LegendShop将保留追究的权力。
* ----------------------------------------------------------------------------.
*/
public class AlipayAccount {
/** The account. */
private String account;
/** The money. */
private Double money;
/** The type. */
private int type;
/**
* Gets the account info.
*
* @param totalCash
* 订单总数
* @param memo
* the memo
* @return the account info
*/
public String getAccountInfo(Double totalCash, String memo) {
// royalty_parameters = "111@126.com^0.01^分润备注一|222@126.com^0.01^分润备注二"
// 备注是seller_email
StringBuffer sb = new StringBuffer();
sb.append(account).append("^").append(calculteCash(totalCash)).append("^").append(memo).append("|");
return sb.toString();
}
/**
* Calculte cash.
*
* @param totalCash
* the total cash
* @return the double
*/
private Double calculteCash(Double totalCash) {
Double result = null;
if (1 == type) {
result = Arith.mul(totalCash, money);
} else {
result = money;
}
return result;
}
/**
* Gets the account.
*
* @return the account
*/
public String getAccount() {
return account;
}
/**
* Sets the account.
*
* @param account
* the new account
*/
public void setAccount(String account) {
this.account = account;
}
/**
* Gets the money.
*
* @return the money
*/
public Double getMoney() {
return money;
}
/**
* Sets the money.
*
* @param money
* the new money
*/
public void setMoney(Double money) {
this.money = money;
}
/**
* Gets the type.
*
* @return the type
*/
public int getType() {
return type;
}
/**
* Sets the type.
*
* @param type
* the new type
*/
public void setType(int type) {
this.type = type;
}
}
| apache-2.0 |
vuzzan/openclinic | src/org/apache/http/pool/PoolEntryCallback.java | 1524 | /*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses 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.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.http.pool;
/**
* Pool entry callabck.
*
* @param <T> the route type that represents the opposite endpoint of a pooled
* connection.
* @param <C> the connection type.
* @since 4.3
*/
public interface PoolEntryCallback<T, C> {
void process(PoolEntry<T, C> entry);
}
| apache-2.0 |
frincon/openeos | modules/org.openeos.services.security/src/main/java/org/openeos/services/security/SecurityManagerService.java | 764 | /**
* Copyright 2014 Fernando Rincon Martin <frm.rincon@gmail.com>
*
* 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.openeos.services.security;
public interface SecurityManagerService {
public Principal getAuthenticatedPrincipal();
}
| apache-2.0 |