repo_name stringlengths 5 108 | path stringlengths 6 333 | size stringlengths 1 6 | content stringlengths 4 977k | license stringclasses 15 values |
|---|---|---|---|---|
relimited/HearthSim | src/main/java/com/hearthsim/card/basic/spell/Assassinate.java | 1275 | package com.hearthsim.card.basic.spell;
import com.hearthsim.card.spellcard.SpellTargetableCard;
import com.hearthsim.event.effect.EffectCharacter;
import com.hearthsim.event.filter.FilterCharacter;
import com.hearthsim.event.filter.FilterCharacterTargetedSpell;
public class Assassinate extends SpellTargetableCard {
/**
* Constructor
*
* @param hasBeenUsed Whether the card has already been used or not
*/
@Deprecated
public Assassinate(boolean hasBeenUsed) {
this();
this.hasBeenUsed = hasBeenUsed;
}
/**
* Constructor
*
* Defaults to hasBeenUsed = false
*/
public Assassinate() {
super();
}
@Override
public FilterCharacter getTargetableFilter() {
return FilterCharacterTargetedSpell.ENEMY_MINIONS;
}
/**
*
* Use the card on the given target
*
* This card destroys an enemy minion.
*
*
*
* @param side
* @param boardState The BoardState before this card has performed its action. It will be manipulated and returned.
*
* @return The boardState is manipulated and returned
*/
@Override
public EffectCharacter getTargetableEffect() {
return EffectCharacter.DESTROY;
}
}
| mit |
kbase/transform | src/us/kbase/kbaseenigmametals/Matrix2DMetadata.java | 3403 |
package us.kbase.kbaseenigmametals;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* <p>Original spec-file type: Matrix2DMetadata</p>
* <pre>
* Metadata for data matrix
* </pre>
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
"row_metadata",
"column_metadata",
"matrix_metadata"
})
public class Matrix2DMetadata {
@JsonProperty("row_metadata")
private Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> rowMetadata;
@JsonProperty("column_metadata")
private Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> columnMetadata;
@JsonProperty("matrix_metadata")
private List<us.kbase.kbaseenigmametals.PropertyValue> matrixMetadata;
private Map<java.lang.String, Object> additionalProperties = new HashMap<java.lang.String, Object>();
@JsonProperty("row_metadata")
public Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> getRowMetadata() {
return rowMetadata;
}
@JsonProperty("row_metadata")
public void setRowMetadata(Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> rowMetadata) {
this.rowMetadata = rowMetadata;
}
public Matrix2DMetadata withRowMetadata(Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> rowMetadata) {
this.rowMetadata = rowMetadata;
return this;
}
@JsonProperty("column_metadata")
public Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> getColumnMetadata() {
return columnMetadata;
}
@JsonProperty("column_metadata")
public void setColumnMetadata(Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> columnMetadata) {
this.columnMetadata = columnMetadata;
}
public Matrix2DMetadata withColumnMetadata(Map<String, List<us.kbase.kbaseenigmametals.PropertyValue>> columnMetadata) {
this.columnMetadata = columnMetadata;
return this;
}
@JsonProperty("matrix_metadata")
public List<us.kbase.kbaseenigmametals.PropertyValue> getMatrixMetadata() {
return matrixMetadata;
}
@JsonProperty("matrix_metadata")
public void setMatrixMetadata(List<us.kbase.kbaseenigmametals.PropertyValue> matrixMetadata) {
this.matrixMetadata = matrixMetadata;
}
public Matrix2DMetadata withMatrixMetadata(List<us.kbase.kbaseenigmametals.PropertyValue> matrixMetadata) {
this.matrixMetadata = matrixMetadata;
return this;
}
@JsonAnyGetter
public Map<java.lang.String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(java.lang.String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public java.lang.String toString() {
return ((((((((("Matrix2DMetadata"+" [rowMetadata=")+ rowMetadata)+", columnMetadata=")+ columnMetadata)+", matrixMetadata=")+ matrixMetadata)+", additionalProperties=")+ additionalProperties)+"]");
}
}
| mit |
bitcoin-solutions/multibit-hd | mbhd-swing/src/main/java/org/multibit/hd/ui/views/wizards/payments/ChoosePaymentRequestPanelModel.java | 471 | package org.multibit.hd.ui.views.wizards.payments;
import org.multibit.hd.ui.views.wizards.AbstractWizardPanelModel;
/**
* <p>Panel model to provide the following to "payments" wizard:</p>
* <ul>
* <li>Storage of state for the "choose payment request" panel</li>
* </ul>
*
* @since 0.0.1
*
*/
public class ChoosePaymentRequestPanelModel extends AbstractWizardPanelModel {
public ChoosePaymentRequestPanelModel(String panelName) {
super(panelName);
}
}
| mit |
joda17/Diorite-API | src/main/java/org/diorite/material/blocks/FenceGateMat.java | 993 | package org.diorite.material.blocks;
import org.diorite.BlockFace;
/**
* Representing fence gate blocks.
*/
public interface FenceGateMat extends DirectionalMat, OpenableMat
{
byte OPEN_FLAG = 0x4;
/**
* Returns one of gate sub-type based on facing direction and open state.
* It will never return null.
*
* @param face facing direction of gate.
* @param open if gate should be open.
*
* @return sub-type of gate
*/
FenceGateMat getType(BlockFace face, boolean open);
static byte combine(final BlockFace face, final boolean open)
{
byte result = open ? OPEN_FLAG : 0x0;
switch (face)
{
case WEST:
result |= 0x1;
break;
case NORTH:
result |= 0x2;
break;
case EAST:
result |= 0x3;
break;
default:
break;
}
return result;
}
}
| mit |
mbologna/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/Adapters.java | 2862 | package com.suse.salt.netapi.parser;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
/**
* Strict null rejecting primitive type adapters.
*/
public class Adapters {
public static final TypeAdapter<Double> DOUBLE = new TypeAdapter<Double>() {
@Override
public Double read(JsonReader in) throws IOException {
return in.nextDouble();
}
@Override
public void write(JsonWriter out, Double value) throws IOException {
if (value == null) {
throw new JsonParseException("null is not a valid value for double");
} else {
out.value(value);
}
}
};
public static final TypeAdapter<Long> LONG = new TypeAdapter<Long>() {
@Override
public Long read(JsonReader in) throws IOException {
return in.nextLong();
}
@Override
public void write(JsonWriter out, Long value) throws IOException {
if (value == null) {
throw new JsonParseException("null is not a valid value for long");
} else {
out.value(value);
}
}
};
public static final TypeAdapter<Integer> INTEGER = new TypeAdapter<Integer>() {
@Override
public Integer read(JsonReader in) throws IOException {
return in.nextInt();
}
@Override
public void write(JsonWriter out, Integer value) throws IOException {
if (value == null) {
throw new JsonParseException("null is not a valid value for int");
} else {
out.value(value);
}
}
};
public static final TypeAdapter<Boolean> BOOLEAN = new TypeAdapter<Boolean>() {
@Override
public Boolean read(JsonReader in) throws IOException {
return in.nextBoolean();
}
@Override
public void write(JsonWriter out, Boolean value) throws IOException {
if (value == null) {
throw new JsonParseException("null is not a valid value for boolean");
} else {
out.value(value);
}
}
};
public static final TypeAdapter<String> STRING = new TypeAdapter<String>() {
@Override
public String read(JsonReader in) throws IOException {
return in.nextString();
}
@Override
public void write(JsonWriter out, String value) throws IOException {
if (value == null) {
throw new JsonParseException("null is not a valid value for string");
} else {
out.value(value);
}
}
};
}
| mit |
devgateway/oc-explorer | persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/info/ClassFieldsExcelExport.java | 1085 | package org.devgateway.ocds.persistence.mongo.info;
import org.devgateway.ocds.persistence.mongo.excel.annotation.ExcelExport;
import java.lang.reflect.Field;
import java.util.Iterator;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
* Decorator class used to obtain only Excel Exportable fields (the ones annotated with {@link ExcelExport}
*
* @author idobre
* @since 6/7/16
*/
public final class ClassFieldsExcelExport implements ClassFields {
private final ClassFields original;
public ClassFieldsExcelExport(final ClassFields classFields) {
this.original = classFields;
}
@Override
public Iterator<Field> getFields() {
// cache the stream
final Iterable<Field> originalFields = () -> this.original.getFields();
// return only classes that are annotated with @ExcelExport
final Stream<Field> stream = StreamSupport.stream(originalFields.spliterator(), false)
.filter(field -> field.getAnnotation(ExcelExport.class) != null);
return stream.iterator();
}
}
| mit |
runqingz/umple | testbed/test/cruise/queued/statemachine/test/QueuedStateMachineTest_UnspecifiedReception.java | 13647 | package cruise.queued.statemachine.test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import org.junit.Assert;
import org.junit.Test;
public class QueuedStateMachineTest_UnspecifiedReception
{
@Test
public void numberOfMessagesInMessageType()
{
// compare the number of messages in MessageType is equal to the number of events in State Machine except timed events and auto-transition
Assert.assertEquals(9, AutomatedTellerMachine.MessageType.values().length);
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("cardInserted_M").equals(AutomatedTellerMachine.MessageType.cardInserted_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("maintain_M").equals(AutomatedTellerMachine.MessageType.maintain_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("isMaintained_M").equals(AutomatedTellerMachine.MessageType.isMaintained_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("cancel_M").equals(AutomatedTellerMachine.MessageType.cancel_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("validated_M").equals(AutomatedTellerMachine.MessageType.validated_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("select_M").equals(AutomatedTellerMachine.MessageType.select_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("selectAnotherTransiction_M").equals(AutomatedTellerMachine.MessageType.selectAnotherTransiction_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("finish_M").equals(AutomatedTellerMachine.MessageType.finish_M));
Assert.assertEquals(true, AutomatedTellerMachine.MessageType.valueOf("receiptPrinted_M").equals(AutomatedTellerMachine.MessageType.receiptPrinted_M));
}
@Test
public void processEvents() throws InterruptedException
{
AutomatedTellerMachine qsm = new AutomatedTellerMachine();
int numChecks;
//initial state is idle
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
//cardInserted is triggered: cardInserted is queued
qsm.cardInserted();
//cardInserted is dequeued and processed: transition to active
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.active) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
Assert.assertEquals("Card is read", qsm.getLog(0));
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//validated is triggered: validated is queued
qsm.validated();
//validated is dequeued and processed: transition to selecting
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.selecting) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.selecting, qsm.getSmActive());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//select is triggered: select is queued
qsm.select();
//select is dequeued and processed: transition to processing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.processing) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.processing, qsm.getSmActive());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//finish is triggered: finish is queued
qsm.finish();
//finish is dequeued and processed: transition to printing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.printing) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.printing, qsm.getSmActive());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//receiptPrinted is triggered: receiptPrinted is queued
qsm.receiptPrinted();
//receiptPrinted is dequeued and processed: transition to idle
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.idle) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//selectAnotherTransiction is triggered: selectAnotherTransiction is queued
qsm.selectAnotherTransiction();
//selectAnotherTransiction is dequeued: it is unspecified, unspecified method is called to handle this error
//transition to error1
//auto-transition to idle
numChecks=200; // we will check for a second
while(numChecks>0 && qsm.getSm().equals(AutomatedTellerMachine.Sm.idle)) {
if(!qsm.queue.messages.isEmpty()){
Thread.sleep(5);
numChecks--;
}
else
{
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
Assert.assertEquals(true, qsm.queue.messages.isEmpty());
break;
}
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//maintain is triggered: maintain is queued
qsm.maintain();
//maintain is dequeued and processed: transition to maintenance
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.maintenance) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.maintenance, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//isMaintained is triggered: isMaintained is queued
qsm.isMaintained();
//isMaintained is dequeued and processed: transition to idle
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.idle) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//cancel is triggered: cancel is queued
qsm.cancel();
//cancel is dequeued: it is unspecified, unspecified method is called to handle this error
//transition to error1
//auto-transition to idle
numChecks=200; // we will check for a second
while(numChecks>0 && qsm.getSm().equals(AutomatedTellerMachine.Sm.idle)) {
if(!qsm.queue.messages.isEmpty()){
Thread.sleep(5);
numChecks--;
}
else
{
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
Assert.assertEquals(true, qsm.queue.messages.isEmpty());
break;
}
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//cardInserted is triggered: cardInserted is queued
qsm.cardInserted();
//cardInserted is dequeued and processed: transition to active
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.active) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//select is triggered: select is queued
qsm.select();
Thread.sleep(10);
//select is dequeued: it is unspecified, unspecified method is called to handle this error
//transition to error2
//auto-transition to validating
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.validating) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
Assert.assertEquals(AutomatedTellerMachine.SmActive.validating, qsm.getSmActive());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//validated is triggered: validated is queued
qsm.validated();
//validated is dequeued and processed: transition to selecting
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.selecting) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
Assert.assertEquals(AutomatedTellerMachine.SmActive.selecting, qsm.getSmActive());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//select is triggered: select is queued
qsm.select();
//select is dequeued and processed: transition to processing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.processing) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.processing, qsm.getSmActive());
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//selectAnotherTransiction is triggered: selectAnotherTransiction is queued
qsm.selectAnotherTransiction();
//selectAnotherTransiction is dequeued and processed: transition to processing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.selecting) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.selecting, qsm.getSmActive());
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//select is triggered: select is queued
qsm.select();
//select is dequeued and processed: transition to processing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.processing) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.processing, qsm.getSmActive());
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//finish is triggered: finish is queued
qsm.finish();
//finish is dequeued and processed: transition to printing
numChecks=200; // we will check for a second
while(!qsm.getSmActive().equals(AutomatedTellerMachine.SmActive.printing) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.SmActive.printing, qsm.getSmActive());
Assert.assertEquals(AutomatedTellerMachine.Sm.active, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//receiptPrinted is triggered: receiptPrinted is queued
qsm.receiptPrinted();
//receiptPrinted is dequeued and processed: transition to idle
numChecks=200; // we will check for a second
while(!qsm.getSm().equals(AutomatedTellerMachine.Sm.idle) && numChecks>0) {
Thread.sleep(5);
numChecks--;
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//finish is triggered: finish is queued
qsm.finish();
//finish is dequeued: it is unspecified, unspecified method is called to handle this error
//transition to error1
//auto-transition to idle
numChecks=200; // we will check for a second
while(numChecks>0 && qsm.getSm().equals(AutomatedTellerMachine.Sm.idle)) {
if(!qsm.queue.messages.isEmpty()){
Thread.sleep(5);
numChecks--;
}
else
{
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
Assert.assertEquals(true, qsm.queue.messages.isEmpty());
break;
}
}
assertThat(numChecks, not(equalTo(0)));
Assert.assertEquals(AutomatedTellerMachine.Sm.idle, qsm.getSm());
// check if there is a message saved in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
//check that there is no events left in the queue
Assert.assertEquals(0, qsm.queue.messages.size());
}
} | mit |
Ariloum/jInstagram | src/test/java/org/jinstagram/entity/common/UserTest.java | 1790 | package org.jinstagram.entity.common;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com.google.gson.Gson;
public class UserTest {
private Gson GSON_PARSER = new Gson();
private static final String CAPTION_JSON_NULL = "{\"caption\": null}";
private static final String CAPTION_JSON_DATA = "{"
+ " \"created_time\": \"1296656006\",\n"
+ " \"text\": \"ã\u0083\u008Fã\u0083¼ã\u0083\u0088â\u0099¥ã\u0082¢ã\u0083\u0097ã\u0083ªå§\u008Bã\u0082\u0081ã\u0081¦ä½¿ã\u0081£ã\u0081¦ã\u0081¿ã\u0081\u009Fã\u0082\u0087(^^)\",\n"
+ " \"from\": {\n"
+ " \"username\": \"cocomiin\",\n"
+ " \"full_name\": \"\",\n"
+ " \"type\": \"user\",\n"
+ " \"id\": \"1127272\"\n"
+ " },\n"
+ " \"id\": \"26329105\"\n"
+ " }";
@Test
public void testCaptionEntity_Null() {
Caption caption;
caption = GSON_PARSER.fromJson(CAPTION_JSON_NULL, Caption.class);
assertNull(caption.getCreatedTime());
assertNull(caption.getFrom());
assertNull(caption.getId());
assertNull(caption.getText());
}
@Test
public void testCaptionEntity_WithData() {
Caption caption;
caption = GSON_PARSER.fromJson(CAPTION_JSON_DATA, Caption.class);
assertNotNull("'Caption' entity should not be null.", caption);
assertNotNull(caption.getCreatedTime());
assertNotNull(caption.getFrom());
assertNotNull(caption.getId());
assertNotNull(caption.getText());
}
}
| mit |
phil-lopreiato/the-blue-alliance-android | android/src/main/java/com/thebluealliance/androidclient/database/DatabaseWriter.java | 6091 | package com.thebluealliance.androidclient.database;
import com.thebluealliance.androidclient.database.writers.AwardListWriter;
import com.thebluealliance.androidclient.database.writers.AwardWriter;
import com.thebluealliance.androidclient.database.writers.DistrictListWriter;
import com.thebluealliance.androidclient.database.writers.DistrictTeamListWriter;
import com.thebluealliance.androidclient.database.writers.DistrictTeamWriter;
import com.thebluealliance.androidclient.database.writers.DistrictWriter;
import com.thebluealliance.androidclient.database.writers.EventDetailWriter;
import com.thebluealliance.androidclient.database.writers.EventListWriter;
import com.thebluealliance.androidclient.database.writers.EventTeamAndTeamListWriter;
import com.thebluealliance.androidclient.database.writers.EventTeamListWriter;
import com.thebluealliance.androidclient.database.writers.EventTeamWriter;
import com.thebluealliance.androidclient.database.writers.EventWriter;
import com.thebluealliance.androidclient.database.writers.MatchListWriter;
import com.thebluealliance.androidclient.database.writers.MatchWriter;
import com.thebluealliance.androidclient.database.writers.MediaListWriter;
import com.thebluealliance.androidclient.database.writers.MediaWriter;
import com.thebluealliance.androidclient.database.writers.TeamListWriter;
import com.thebluealliance.androidclient.database.writers.TeamWriter;
import com.thebluealliance.androidclient.database.writers.YearsParticipatedWriter;
import javax.inject.Inject;
import dagger.Lazy;
public class DatabaseWriter {
private final Lazy<AwardWriter> awardWriter;
private final Lazy<AwardListWriter> awardListWriter;
private final Lazy<DistrictWriter> districtWriter;
private final Lazy<DistrictListWriter> districtListWriter;
private final Lazy<DistrictTeamWriter> districtTeamWriter;
private final Lazy<DistrictTeamListWriter> districtTeamListWriter;
private final Lazy<EventWriter> eventWriter;
private final Lazy<EventListWriter> eventListWriter;
private final Lazy<EventTeamWriter> eventTeamWriter;
private final Lazy<EventTeamListWriter> eventTeamListWriter;
private final Lazy<MatchWriter> matchWriter;
private final Lazy<MatchListWriter> matchListWriter;
private final Lazy<MediaWriter> mediaWriter;
private final Lazy<MediaListWriter> mediaListWriter;
private final Lazy<TeamWriter> teamWriter;
private final Lazy<TeamListWriter> teamListWriter;
private final Lazy<YearsParticipatedWriter> yearsParticipatedWriter;
private final Lazy<EventTeamAndTeamListWriter> eventTeamAndTeamListWriter;
private final Lazy<EventDetailWriter> eventDetailWriter;
@Inject
public DatabaseWriter(
Lazy<AwardWriter> award,
Lazy<AwardListWriter> awardList,
Lazy<DistrictWriter> district,
Lazy<DistrictListWriter> districtList,
Lazy<DistrictTeamWriter> districtTeam,
Lazy<DistrictTeamListWriter> districtTeamList,
Lazy<EventWriter> event,
Lazy<EventListWriter> eventList,
Lazy<EventTeamWriter> eventTeam,
Lazy<EventTeamListWriter> eventTeamList,
Lazy<MatchWriter> match,
Lazy<MatchListWriter> matchList,
Lazy<MediaWriter> media,
Lazy<MediaListWriter> mediaList,
Lazy<TeamWriter> team,
Lazy<TeamListWriter> teamList,
Lazy<YearsParticipatedWriter> yearsParticipated,
Lazy<EventTeamAndTeamListWriter> eventTeamAndTeamList,
Lazy<EventDetailWriter> eventDetail) {
awardWriter = award;
awardListWriter = awardList;
districtWriter = district;
districtListWriter = districtList;
districtTeamWriter = districtTeam;
districtTeamListWriter = districtTeamList;
eventWriter = event;
eventListWriter = eventList;
eventTeamWriter = eventTeam;
eventTeamListWriter = eventTeamList;
matchWriter = match;
matchListWriter = matchList;
mediaWriter = media;
mediaListWriter = mediaList;
teamWriter = team;
teamListWriter = teamList;
yearsParticipatedWriter = yearsParticipated;
eventTeamAndTeamListWriter = eventTeamAndTeamList;
eventDetailWriter = eventDetail;
}
public Lazy<AwardWriter> getAwardWriter() {
return awardWriter;
}
public Lazy<AwardListWriter> getAwardListWriter() {
return awardListWriter;
}
public Lazy<DistrictWriter> getDistrictWriter() {
return districtWriter;
}
public Lazy<DistrictListWriter> getDistrictListWriter() {
return districtListWriter;
}
public Lazy<DistrictTeamWriter> getDistrictTeamWriter() {
return districtTeamWriter;
}
public Lazy<DistrictTeamListWriter> getDistrictTeamListWriter() {
return districtTeamListWriter;
}
public Lazy<EventWriter> getEventWriter() {
return eventWriter;
}
public Lazy<EventListWriter> getEventListWriter() {
return eventListWriter;
}
public Lazy<EventTeamWriter> getEventTeamWriter() {
return eventTeamWriter;
}
public Lazy<EventTeamListWriter> getEventTeamListWriter() {
return eventTeamListWriter;
}
public Lazy<MatchWriter> getMatchWriter() {
return matchWriter;
}
public Lazy<MatchListWriter> getMatchListWriter() {
return matchListWriter;
}
public Lazy<MediaWriter> getMediaWriter() {
return mediaWriter;
}
public Lazy<MediaListWriter> getMediaListWriter() {
return mediaListWriter;
}
public Lazy<TeamWriter> getTeamWriter() {
return teamWriter;
}
public Lazy<TeamListWriter> getTeamListWriter() {
return teamListWriter;
}
public Lazy<YearsParticipatedWriter> getYearsParticipatedWriter() {
return yearsParticipatedWriter;
}
public Lazy<EventTeamAndTeamListWriter> getEventTeamAndTeamListWriter() {
return eventTeamAndTeamListWriter;
}
public Lazy<EventDetailWriter> getEventDetailWriter() {
return eventDetailWriter;
}
} | mit |
gavinying/kura | kura/test/org.eclipse.kura.core.test/src/main/java/org/eclipse/kura/core/test/SystemAdminServiceTest.java | 1396 | /*******************************************************************************
* Copyright (c) 2011, 2016 Eurotech and/or its affiliates
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech
*******************************************************************************/
package org.eclipse.kura.core.test;
import org.eclipse.kura.system.SystemAdminService;
import org.eclipse.kura.test.annotation.TestTarget;
import org.junit.BeforeClass;
import org.junit.Test;
import junit.framework.TestCase;
public class SystemAdminServiceTest extends TestCase {
private static SystemAdminService sysAdminService = null;
@Override
@BeforeClass
public void setUp() {
}
protected void setSystemAdminService(SystemAdminService sas) {
sysAdminService = sas;
}
@TestTarget(targetPlatforms = { TestTarget.PLATFORM_ALL })
@Test
public void testServiceExists() {
assertNotNull(sysAdminService);
}
@TestTarget(targetPlatforms = { TestTarget.PLATFORM_ALL })
@Test
public void testGetUptime() {
String actual = sysAdminService.getUptime();
assertTrue(Long.parseLong(actual) > 0);
}
} | epl-1.0 |
TypeFox/che | plugins/plugin-java-debugger/che-plugin-java-debugger-server/src/main/java/org/eclipse/che/plugin/jdb/server/BreakPointComparator.java | 1214 | /*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.plugin.jdb.server;
import java.util.Comparator;
import org.eclipse.che.api.debug.shared.model.Breakpoint;
/**
* Helps to order breakpoints by name of location and line number.
*
* @author andrew00x
*/
public final class BreakPointComparator implements Comparator<Breakpoint> {
@Override
public int compare(Breakpoint o1, Breakpoint o2) {
String className1 = o1.getLocation().getTarget();
String className2 = o2.getLocation().getTarget();
if (className1 == null && className2 == null) {
return 0;
}
if (className1 == null) {
return 1;
}
if (className2 == null) {
return -1;
}
int result = className1.compareTo(className2);
if (result == 0) {
result = o1.getLocation().getLineNumber() - o2.getLocation().getLineNumber();
}
return result;
}
}
| epl-1.0 |
drbgfc/mdht | cda/plugins/org.openhealthtools.mdht.uml.hl7.vocab/src/org/openhealthtools/mdht/uml/hl7/vocab/ParticipationTargetSubject.java | 5431 | /*******************************************************************************
* Copyright (c) 2009, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.openhealthtools.mdht.uml.hl7.vocab;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Participation Target Subject</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
* @see org.openhealthtools.mdht.uml.hl7.vocab.VocabPackage#getParticipationTargetSubject()
* @model
* @generated
*/
public enum ParticipationTargetSubject implements Enumerator {
/**
* The '<em><b>SBJ</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SBJ_VALUE
* @generated
* @ordered
*/
SBJ(0, "SBJ", "SBJ"),
/**
* The '<em><b>SPC</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SPC_VALUE
* @generated
* @ordered
*/
SPC(1, "SPC", "SPC");
/**
* The '<em><b>SBJ</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SBJ</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SBJ
* @model
* @generated
* @ordered
*/
public static final int SBJ_VALUE = 0;
/**
* The '<em><b>SPC</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>SPC</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SPC
* @model
* @generated
* @ordered
*/
public static final int SPC_VALUE = 1;
/**
* An array of all the '<em><b>Participation Target Subject</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static final ParticipationTargetSubject[] VALUES_ARRAY = new ParticipationTargetSubject[] { SBJ, SPC, };
/**
* A public read-only list of all the '<em><b>Participation Target Subject</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<ParticipationTargetSubject> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
* Returns the '<em><b>Participation Target Subject</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static ParticipationTargetSubject get(String literal) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
ParticipationTargetSubject result = VALUES_ARRAY[i];
if (result.toString().equals(literal)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Participation Target Subject</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static ParticipationTargetSubject getByName(String name) {
for (int i = 0; i < VALUES_ARRAY.length; ++i) {
ParticipationTargetSubject result = VALUES_ARRAY[i];
if (result.getName().equals(name)) {
return result;
}
}
return null;
}
/**
* Returns the '<em><b>Participation Target Subject</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static ParticipationTargetSubject get(int value) {
switch (value) {
case SBJ_VALUE:
return SBJ;
case SPC_VALUE:
return SPC;
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final int value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String name;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private final String literal;
/**
* Only this class can construct instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private ParticipationTargetSubject(int value, String name, String literal) {
this.value = value;
this.name = name;
this.literal = literal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getValue() {
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLiteral() {
return literal;
}
/**
* Returns the literal value of the enumerator, which is its string representation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return literal;
}
} // ParticipationTargetSubject
| epl-1.0 |
kevinmcgoldrick/Tank | tools/script_filter/src/main/java/org/fife/ui/rsyntaxtextarea/TextEditorPane.java | 23922 | /*
* 11/25/2008
*
* TextEditorPane.java - A syntax highlighting text area that has knowledge of
* the file it is editing on disk.
* Copyright (C) 2008 Robert Futrell
* robert_futrell at users.sourceforge.net
* http://fifesoft.com/rsyntaxtextarea
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
package org.fife.ui.rsyntaxtextarea;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;
import org.fife.io.UnicodeReader;
import org.fife.io.UnicodeWriter;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.RTextAreaEditorKit;
/**
* An extension of {@link org.fife.ui.rsyntaxtextarea.RSyntaxTextArea} that adds information about the file being
* edited, such as:
*
* <ul>
* <li>Its name and location.
* <li>Is it dirty?
* <li>Is it read-only?
* <li>The last time it was loaded or saved to disk (local files only).
* <li>The file's encoding on disk.
* <li>Easy access to the line separator.
* </ul>
*
* Loading and saving is also built into the editor.
* <p>
* Both local and remote files (e.g. ftp) are supported. See the {@link FileLocation} class for more information.
*
* @author Robert Futrell
* @version 1.0
* @see FileLocation
*/
public class TextEditorPane extends RSyntaxTextArea implements
DocumentListener {
private static final long serialVersionUID = 1L;
public static final String FULL_PATH_PROPERTY = "TextEditorPane.fileFullPath";
public static final String DIRTY_PROPERTY = "TextEditorPane.dirty";
public static final String READ_ONLY_PROPERTY = "TextEditorPane.readOnly";
/**
* The location of the file being edited.
*/
private FileLocation loc;
/**
* The charset to use when reading or writing this file.
*/
private String charSet;
/**
* Whether the file should be treated as read-only.
*/
private boolean readOnly;
/**
* Whether the file is dirty.
*/
private boolean dirty;
/**
* The last time this file was modified on disk, for local files. For remote files, this value should always be
* {@link #LAST_MODIFIED_UNKNOWN}.
*/
private long lastSaveOrLoadTime;
/**
* The value returned by {@link #getLastSaveOrLoadTime()} for remote files.
*/
public static final long LAST_MODIFIED_UNKNOWN = 0;
/**
* The default name given to files if none is specified in a constructor.
*/
private static final String DEFAULT_FILE_NAME = "Untitled.txt";
/**
* Constructor. The file will be given a default name.
*/
public TextEditorPane() {
this(INSERT_MODE);
}
/**
* Constructor. The file will be given a default name.
*
* @param textMode
* Either <code>INSERT_MODE</code> or <code>OVERWRITE_MODE</code>.
*/
public TextEditorPane(int textMode) {
this(textMode, false);
}
/**
* Creates a new <code>TextEditorPane</code>. The file will be given a default name.
*
* @param textMode
* Either <code>INSERT_MODE</code> or <code>OVERWRITE_MODE</code>.
* @param wordWrapEnabled
* Whether or not to use word wrap in this pane.
*/
public TextEditorPane(int textMode, boolean wordWrapEnabled) {
super(textMode);
setLineWrap(wordWrapEnabled);
try {
init(null, null);
} catch (IOException ioe) { // Never happens
ioe.printStackTrace();
}
}
/**
* Creates a new <code>TextEditorPane</code>.
*
* @param textMode
* Either <code>INSERT_MODE</code> or <code>OVERWRITE_MODE</code>.
* @param wordWrapEnabled
* Whether or not to use word wrap in this pane.
* @param loc
* The location of the text file being edited. If this value is <code>null</code>, a file named
* "Untitled.txt" in the current directory is used.
* @throws IOException
* If an IO error occurs reading the file at <code>loc</code>. This of course won't happen if
* <code>loc</code> is <code>null</code>.
*/
public TextEditorPane(int textMode, boolean wordWrapEnabled,
FileLocation loc) throws IOException {
this(textMode, wordWrapEnabled, loc, null);
}
/**
* Creates a new <code>TextEditorPane</code>.
*
* @param textMode
* Either <code>INSERT_MODE</code> or <code>OVERWRITE_MODE</code>.
* @param wordWrapEnabled
* Whether or not to use word wrap in this pane.
* @param loc
* The location of the text file being edited. If this value is <code>null</code>, a file named
* "Untitled.txt" in the current directory is used. This file is displayed as empty even if it actually
* exists.
* @param defaultEnc
* The default encoding to use when opening the file, if the file is not Unicode. If this value is
* <code>null</code>, a system default value is used.
* @throws IOException
* If an IO error occurs reading the file at <code>loc</code>. This of course won't happen if
* <code>loc</code> is <code>null</code>.
*/
public TextEditorPane(int textMode, boolean wordWrapEnabled,
FileLocation loc, String defaultEnc) throws IOException {
super(textMode);
setLineWrap(wordWrapEnabled);
init(loc, defaultEnc);
}
/**
* Callback for when styles in the current document change. This method is never called.
*
* @param e
* The document event.
*/
public void changedUpdate(DocumentEvent e) {
}
/**
* Returns the default encoding for this operating system.
*
* @return The default encoding.
*/
private static final String getDefaultEncoding() {
// TODO: Change to "Charset.defaultCharset().name()" when 1.4 support
// is no longer needed.
// NOTE: The "file.encoding" property is not guaranteed to be set by
// the spec, so we cannot rely on it.
String encoding = System.getProperty("file.encoding");
if (encoding == null) {
try {
File f = File.createTempFile("rsta", null);
FileWriter w = new FileWriter(f);
encoding = w.getEncoding();
w.close();
f.deleteOnExit();// delete(); Keep FindBugs happy
} catch (IOException ioe) {
encoding = "US-ASCII";
}
}
return encoding;
}
/**
* Returns the encoding to use when reading or writing this file.
*
* @return The encoding.
* @see #setEncoding(String)
*/
public String getEncoding() {
return charSet;
}
/**
* Returns the full path to this document.
*
* @return The full path to the document.
*/
public String getFileFullPath() {
return loc.getFileFullPath();
}
/**
* Returns the file name of this document.
*
* @return The file name.
*/
public String getFileName() {
return loc.getFileName();
}
/**
* Returns the timestamp for when this file was last loaded or saved <em>by this editor pane</em>. If the file has
* been modified on disk by another process after it was loaded into this editor pane, this method will not return
* the actual file's last modified time.
* <p>
*
* For remote files, this method will always return {@link #LAST_MODIFIED_UNKNOWN}.
*
* @return The timestamp when this file was last loaded or saved by this editor pane, if it is a local file, or
* {@link #LAST_MODIFIED_UNKNOWN} if it is a remote file.
* @see #isModifiedOutsideEditor()
*/
public long getLastSaveOrLoadTime() {
return lastSaveOrLoadTime;
}
/**
* Returns the line separator used when writing this file (e.g. "<code>\n</code>", "<code>\r\n</code>", or "
* <code>\r</code>").
* <p>
*
* Note that this value is an <code>Object</code> and not a <code>String</code> as that is the way the
* {@link Document} interface defines its property values. If you always use {@link #setLineSeparator(String)} to
* modify this value, then the value returned from this method will always be a <code>String</code>.
*
* @return The line separator. If this value is <code>null</code>, then the system default line separator is used
* (usually the value of <code>System.getProperty("line.separator")</code>).
* @see #setLineSeparator(String)
* @see #setLineSeparator(String, boolean)
*/
public Object getLineSeparator() {
return getDocument().getProperty(
RTextAreaEditorKit.EndOfLineStringProperty);
}
/**
* Initializes this editor with the specified file location.
*
* @param loc
* The file location. If this is <code>null</code>, a default location is used and an empty file is
* displayed.
* @param defaultEnc
* The default encoding to use when opening the file, if the file is not Unicode. If this value is
* <code>null</code>, a system default value is used.
* @throws IOException
* If an IO error occurs reading from <code>loc</code>. If <code>loc</code> is <code>null</code>, this
* cannot happen.
*/
private void init(FileLocation loc, String defaultEnc) throws IOException {
if (loc == null) {
// Don't call load() just in case Untitled.txt actually exists,
// just to ensure there is no chance of an IOException being thrown
// in the default case.
this.loc = FileLocation.create(DEFAULT_FILE_NAME);
charSet = defaultEnc == null ? getDefaultEncoding() : defaultEnc;
// Ensure that line separator always has a value, even if the file
// does not exist (or is the "default" file). This makes life
// easier for host applications that want to display this value.
setLineSeparator(System.getProperty("line.separator"));
}
else {
load(loc, defaultEnc); // Sets this.loc
}
if (this.loc.isLocalAndExists()) {
File file = new File(this.loc.getFileFullPath());
lastSaveOrLoadTime = file.lastModified();
setReadOnly(!file.canWrite());
}
else {
lastSaveOrLoadTime = LAST_MODIFIED_UNKNOWN;
setReadOnly(false);
}
setDirty(false);
}
/**
* Callback for when text is inserted into the document.
*
* @param e
* Information on the insertion.
*/
public void insertUpdate(DocumentEvent e) {
if (!dirty) {
setDirty(true);
}
}
/**
* Returns whether or not the text in this editor has unsaved changes.
*
* @return Whether or not the text has unsaved changes.
*/
public boolean isDirty() {
return dirty;
}
/**
* Returns whether this file is a local file.
*
* @return Whether this is a local file.
*/
public boolean isLocal() {
return loc.isLocal();
}
/**
* Returns whether this is a local file that already exists.
*
* @return Whether this is a local file that already exists.
*/
public boolean isLocalAndExists() {
return loc.isLocalAndExists();
}
/**
* Returns whether the text file has been modified outside of this editor since the last load or save operation.
* Note that if this is a remote file, this method will always return <code>false</code>.
* <p>
*
* This method may be used by applications to implement a reloading feature, where the user is prompted to reload a
* file if it has been modified since their last open or save.
*
* @return Whether the text file has been modified outside of this editor.
* @see #getLastSaveOrLoadTime()
*/
public boolean isModifiedOutsideEditor() {
return loc.getActualLastModified() > getLastSaveOrLoadTime();
}
/**
* Returns whether or not the text area should be treated as read-only.
*
* @return Whether or not the text area should be treated as read-only.
* @see #setReadOnly(boolean)
*/
public boolean isReadOnly() {
return readOnly;
}
/**
* Loads the specified file in this editor.
*
* @param loc
* The location of the file to load. This cannot be <code>null</code>.
* @param defaultEnc
* The encoding to use when loading/saving the file. This encoding will only be used if the file is not
* Unicode. If this value is <code>null</code>, the system default encoding is used.
* @throws IOException
* If an IO error occurs.
* @see #save()
* @see #saveAs(FileLocation)
*/
public void load(FileLocation loc, String defaultEnc) throws IOException {
this.loc = loc;
// For new local files, just go with it.
if (loc.isLocal() && !loc.isLocalAndExists()) {
this.charSet = defaultEnc != null ? defaultEnc : getDefaultEncoding();
return;
}
// Old local files and remote files, load 'em up. UnicodeReader will
// check for BOMs and handle them correctly in all cases, then pass
// rest of stream down to InputStreamReader.
UnicodeReader ur = new UnicodeReader(loc.getInputStream(), defaultEnc);
charSet = ur.getEncoding();
// Remove listener so dirty flag doesn't get set when loading a file.
Document doc = getDocument();
doc.removeDocumentListener(this);
BufferedReader r = new BufferedReader(ur);
try {
read(r, null);
} finally {
doc.addDocumentListener(this);
r.close();
}
}
/**
* Reloads this file from disk. The file must exist for this operation to not throw an exception.
* <p>
*
* The file's "dirty" state will be set to <code>false</code> after this operation. If this is a local file, its
* "last modified" time is updated to reflect that of the actual file.
* <p>
*
* Note that if the file has been modified on disk, and is now a Unicode encoding when before it wasn't (or if it is
* a different Unicode now), this will cause this {@link TextEditorPane}'s encoding to change. Otherwise, the file's
* encoding will stay the same.
*
* @throws IOException
* If the file does not exist, or if an IO error occurs reading the file.
* @see #isLocalAndExists()
*/
public void reload() throws IOException {
String oldEncoding = getEncoding();
UnicodeReader ur = new UnicodeReader(loc.getInputStream(), oldEncoding);
String encoding = ur.getEncoding();
BufferedReader r = new BufferedReader(ur);
try {
read(r, null); // Dumps old contents.
} finally {
r.close();
}
setEncoding(encoding);
setDirty(false);
syncLastSaveOrLoadTimeToActualFile();
discardAllEdits(); // Prevent user from being able to undo the reload
}
/**
* Called whenever text is removed from this editor.
*
* @param e
* The document event.
*/
public void removeUpdate(DocumentEvent e) {
if (!dirty) {
setDirty(true);
}
}
/**
* Saves the file in its current encoding.
* <p>
*
* The text area's "dirty" state is set to <code>false</code>, and if this is a local file, its "last modified" time
* is updated.
*
* @throws IOException
* If an IO error occurs.
* @see #saveAs(FileLocation)
* @see #load(FileLocation, String)
*/
public void save() throws IOException {
saveImpl(loc);
setDirty(false);
syncLastSaveOrLoadTimeToActualFile();
}
/**
* Saves this file in a new local location. This method fires a property change event of type
* {@link #FULL_PATH_PROPERTY}.
*
* @param loc
* The location to save to.
* @throws IOException
* If an IO error occurs.
* @see #save()
* @see #load(FileLocation, String)
*/
public void saveAs(FileLocation loc) throws IOException {
saveImpl(loc);
// No exception thrown - we can "rename" the file.
String old = getFileFullPath();
this.loc = loc;
setDirty(false);
lastSaveOrLoadTime = loc.getActualLastModified();
firePropertyChange(FULL_PATH_PROPERTY, old, getFileFullPath());
}
/**
* Saves the text in this editor to the specified location.
*
* @param loc
* The location to save to.
* @throws IOException
* If an IO error occurs.
*/
private void saveImpl(FileLocation loc) throws IOException {
OutputStream out = loc.getOutputStream();
PrintWriter w = new PrintWriter(
new BufferedWriter(new UnicodeWriter(out, getEncoding())));
try {
write(w);
} finally {
w.close();
}
}
/**
* Sets whether or not this text in this editor has unsaved changes. This fires a property change event of type
* {@link #DIRTY_PROPERTY}.
*
* @param dirty
* Whether or not the text has beeen modified.
* @see #isDirty()
*/
private void setDirty(boolean dirty) {
if (this.dirty != dirty) {
this.dirty = dirty;
firePropertyChange(DIRTY_PROPERTY, !dirty, dirty);
}
}
/**
* Sets the document for this editor.
*
* @param doc
* The new document.
*/
public void setDocument(Document doc) {
Document old = getDocument();
if (old != null) {
old.removeDocumentListener(this);
}
super.setDocument(doc);
doc.addDocumentListener(this);
}
/**
* Sets the encoding to use when reading or writing this file. This method sets the editor's dirty flag when the
* encoding is changed.
*
* @param encoding
* The new encoding.
* @throws UnsupportedCharsetException
* If the encoding is not supported.
* @throws NullPointerException
* If <code>encoding</code> is <code>null</code>.
* @see #getEncoding()
*/
public void setEncoding(String encoding) {
if (encoding == null) {
throw new NullPointerException("encoding cannot be null");
}
else if (!Charset.isSupported(encoding)) {
throw new UnsupportedCharsetException(encoding);
}
if (charSet == null || !charSet.equals(encoding)) {
charSet = encoding;
setDirty(true);
}
}
/**
* Sets the line separator sequence to use when this file is saved (e.g. "<code>\n</code>", "<code>\r\n</code>" or "
* <code>\r</code>").
*
* Besides parameter checking, this method is preferred over <code>getDocument().putProperty()</code> because it
* sets the editor's dirty flag when the line separator is changed.
*
* @param separator
* The new line separator.
* @throws NullPointerException
* If <code>separator</code> is <code>null</code>.
* @throws IllegalArgumentException
* If <code>separator</code> is not one of "<code>\n</code>", "<code>\r\n</code>" or "<code>\r</code>".
* @see #getLineSeparator()
*/
public void setLineSeparator(String separator) {
setLineSeparator(separator, true);
}
/**
* Sets the line separator sequence to use when this file is saved (e.g. "<code>\n</code>", "<code>\r\n</code>" or "
* <code>\r</code>").
*
* Besides parameter checking, this method is preferred over <code>getDocument().putProperty()</code> because can
* set the editor's dirty flag when the line separator is changed.
*
* @param separator
* The new line separator.
* @param setDirty
* Whether the dirty flag should be set if the line separator is changed.
* @throws NullPointerException
* If <code>separator</code> is <code>null</code>.
* @throws IllegalArgumentException
* If <code>separator</code> is not one of "<code>\n</code>", "<code>\r\n</code>" or "<code>\r</code>".
* @see #getLineSeparator()
*/
public void setLineSeparator(String separator, boolean setDirty) {
if (separator == null) {
throw new NullPointerException("terminator cannot be null");
}
if (!"\r\n".equals(separator) && !"\n".equals(separator) &&
!"\r".equals(separator)) {
throw new IllegalArgumentException("Invalid line terminator");
}
Document doc = getDocument();
Object old = doc.getProperty(
RTextAreaEditorKit.EndOfLineStringProperty);
if (!separator.equals(old)) {
doc.putProperty(RTextAreaEditorKit.EndOfLineStringProperty,
separator);
if (setDirty) {
setDirty(true);
}
}
}
/**
* Sets whether or not this text area should be treated as read-only. This fires a property change event of type
* {@link #READ_ONLY_PROPERTY}.
*
* @param readOnly
* Whether or not the document is read-only.
* @see #isReadOnly()
*/
public void setReadOnly(boolean readOnly) {
if (this.readOnly != readOnly) {
this.readOnly = readOnly;
firePropertyChange(READ_ONLY_PROPERTY, !readOnly, readOnly);
}
}
/**
* Syncs this text area's "last saved or loaded" time to that of the file being edited, if that file is local and
* exists. If the file is remote or is local but does not yet exist, nothing happens.
* <p>
*
* You normally do not have to call this method, as the "last saved or loaded" time for {@link TextEditorPane}s is
* kept up-to-date internally during such operations as {@link #save()}, {@link #reload()}, etc.
*
* @see #getLastSaveOrLoadTime()
* @see #isModifiedOutsideEditor()
*/
public void syncLastSaveOrLoadTimeToActualFile() {
if (loc.isLocalAndExists()) {
lastSaveOrLoadTime = loc.getActualLastModified();
}
}
} | epl-1.0 |
ljshj/liveoak | modules/wildfly/src/main/java/io/liveoak/wildfly/LiveOakExtension.java | 2730 | package io.liveoak.wildfly;
import org.jboss.as.controller.Extension;
import org.jboss.as.controller.ExtensionContext;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.ReloadRequiredRemoveStepHandler;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.SubsystemRegistration;
import org.jboss.as.controller.descriptions.NonResolvingResourceDescriptionResolver;
import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver;
import org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler;
import org.jboss.as.controller.parsing.ExtensionParsingContext;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
import org.jboss.logging.Logger;
import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM;
/**
* @author Bob McWhirter
*/
public class LiveOakExtension implements Extension {
private static final Logger log = Logger.getLogger(LiveOakExtension.class);
/**
* The name space used for the {@code substystem} element
*/
public static final String NAMESPACE = "urn:liveoak:liveoak:1.0";
/**
* The name of our subsystem within the model.
*/
public static final String SUBSYSTEM_NAME = "liveoak";
private static final String RESOURCE_NAME = LiveOakExtension.class.getPackage().getName() + ".LocalDescriptions";
protected static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME);
public static StandardResourceDescriptionResolver getResolver(final String... keyPrefix) {
StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME);
for (String kp : keyPrefix) {
prefix.append('.').append(kp);
}
return new StandardResourceDescriptionResolver(prefix.toString(), RESOURCE_NAME, LiveOakExtension.class.getClassLoader(), true, false);
}
@Override
public void initializeParsers(ExtensionParsingContext context) {
context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE, LiveOakSubsystemParser.INSTANCE);
}
@Override
public void initialize(ExtensionContext context) {
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, 1, 0, 0);
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(LiveOakRootDefinition.INSTANCE);
//We always need to add a 'describe' operation
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
subsystem.registerXMLElementWriter(LiveOakSubsystemParser.INSTANCE);
log.debug("liveoak subsystem, activate!");
}
}
| epl-1.0 |
kaloyan-raev/che | plugins/plugin-docker/che-plugin-docker-client/src/main/java/org/eclipse/che/plugin/docker/client/DockerRegistryAuthResolver.java | 5412 | /*******************************************************************************
* Copyright (c) 2012-2016 Codenvy, S.A.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Codenvy, S.A. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.docker.client;
import com.google.inject.Inject;
import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.commons.json.JsonHelper;
import org.eclipse.che.plugin.docker.client.dto.AuthConfig;
import org.eclipse.che.plugin.docker.client.dto.AuthConfigs;
import java.util.Base64;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static com.google.common.collect.Sets.newHashSet;
/**
* Class for preparing auth header value for docker registry.
*
* @author Mykola Morhun
*/
public class DockerRegistryAuthResolver {
public static final Set<String> DEFAULT_REGISTRY_SYNONYMS = Collections.unmodifiableSet(newHashSet(null,
"",
"docker.io",
"index.docker.io",
"https://index.docker.io",
"https://index.docker.io/v1",
"https://index.docker.io/v1/"));
public static final String DEFAULT_REGISTRY = "https://index.docker.io/v1/";
private final InitialAuthConfig initialAuthConfig;
private final DockerRegistryDynamicAuthResolver dynamicAuthResolver;
@Inject
public DockerRegistryAuthResolver(InitialAuthConfig initialAuthConfig,
DockerRegistryDynamicAuthResolver dynamicAuthResolver) {
this.initialAuthConfig = initialAuthConfig;
this.dynamicAuthResolver = dynamicAuthResolver;
}
/**
* Looks for auth credentials for specified registry and encode it in base64.
* First searches in the passed params and then in the configured credentials.
* If nothing found, empty encoded json will be returned.
*
* @param registry
* registry to which API call will be applied
* @param paramAuthConfigs
* credentials for provided registry
* @return base64 encoded X-Registry-Auth header value
*/
public String getXRegistryAuthHeaderValue(@Nullable String registry, @Nullable AuthConfigs paramAuthConfigs) {
String normalizedRegistry = DEFAULT_REGISTRY_SYNONYMS.contains(registry) ? DEFAULT_REGISTRY : registry;
AuthConfig authConfig = null;
if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) {
authConfig = normalizeDockerHubRegistryUrl(paramAuthConfigs.getConfigs()).get(normalizedRegistry);
}
if (authConfig == null) {
authConfig = normalizeDockerHubRegistryUrl(initialAuthConfig.getAuthConfigs().getConfigs()).get(normalizedRegistry);
}
if (authConfig == null) {
authConfig = dynamicAuthResolver.getXRegistryAuth(registry);
}
String authConfigJson;
if (authConfig == null) {
// empty auth config
authConfigJson = "{}";
} else {
authConfigJson = JsonHelper.toJson(authConfig);
}
return Base64.getEncoder().encodeToString(authConfigJson.getBytes());
}
/**
* Builds list of auth configs.
* Adds auth configs from current API call and from initial auth config.
*
* @param paramAuthConfigs
* auth header values for provided registry
* @return base64 encoded X-Registry-Config header value
*/
public String getXRegistryConfigHeaderValue(@Nullable AuthConfigs paramAuthConfigs) {
Map<String, AuthConfig> authConfigs = new HashMap<>();
authConfigs.putAll(initialAuthConfig.getAuthConfigs().getConfigs());
if (paramAuthConfigs != null && paramAuthConfigs.getConfigs() != null) {
authConfigs.putAll(paramAuthConfigs.getConfigs());
}
authConfigs.putAll(dynamicAuthResolver.getXRegistryConfig());
authConfigs = normalizeDockerHubRegistryUrl(authConfigs);
return Base64.getEncoder().encodeToString(JsonHelper.toJson(authConfigs).getBytes());
}
private Map<String, AuthConfig> normalizeDockerHubRegistryUrl(Map<String, AuthConfig> authConfigs) {
if (authConfigs.containsKey("docker.io")) {
Map<String,AuthConfig> normalizedAuthConfigMap = new HashMap<>(authConfigs);
normalizedAuthConfigMap.put(DEFAULT_REGISTRY, normalizedAuthConfigMap.remove("docker.io"));
return normalizedAuthConfigMap;
}
return authConfigs;
}
}
| epl-1.0 |
rupenp/CoreNLP | src/edu/stanford/nlp/util/logging/VisibilityHandler.java | 3793 |
package edu.stanford.nlp.util.logging;
import edu.stanford.nlp.util.logging.Redwood.Record;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.List;
/**
* A filter for selecting which channels are visible. This class
* behaves as an "or" filter; that is, if any of the filters are considered
* valid, it allows the Record to proceed to the next handler.
*
* @author Gabor Angeli (angeli at cs.stanford)
*/
public class VisibilityHandler extends LogRecordHandler {
private enum State { SHOW_ALL, HIDE_ALL }
private VisibilityHandler.State defaultState = State.SHOW_ALL;
private final Set<Object> deltaPool = new HashSet<>(); // replacing with Generics.newHashSet() makes classloader go haywire?
public VisibilityHandler() { } // default is SHOW_ALL
public VisibilityHandler(Object[] channels) {
if (channels.length > 0) {
defaultState = State.HIDE_ALL;
Collections.addAll(deltaPool, channels);
}
}
/**
* Show all of the channels.
*/
public void showAll() {
this.defaultState = State.SHOW_ALL;
this.deltaPool.clear();
}
/**
* Show none of the channels
*/
public void hideAll() {
this.defaultState = State.HIDE_ALL;
this.deltaPool.clear();
}
/**
* Show all the channels currently being printed, in addition
* to a new one
* @param filter The channel to also show
* @return true if this channel was already being shown.
*/
public boolean alsoShow(Object filter) {
switch(this.defaultState){
case HIDE_ALL:
return this.deltaPool.add(filter);
case SHOW_ALL:
return this.deltaPool.remove(filter);
default:
throw new IllegalStateException("Unknown default state setting: " + this.defaultState);
}
}
/**
* Show all the channels currently being printed, with the exception
* of this new one
* @param filter The channel to also hide
* @return true if this channel was already being hidden.
*/
public boolean alsoHide(Object filter) {
switch(this.defaultState){
case HIDE_ALL:
return this.deltaPool.remove(filter);
case SHOW_ALL:
return this.deltaPool.add(filter);
default:
throw new IllegalStateException("Unknown default state setting: " + this.defaultState);
}
}
/** {@inheritDoc} */
@Override
public List<Record> handle(Record record) {
boolean isPrinting = false;
if(record.force()){
//--Case: Force Printing
isPrinting = true;
} else {
//--Case: Filter
switch (this.defaultState){
case HIDE_ALL:
//--Default False
for(Object tag : record.channels()){
if(this.deltaPool.contains(tag)){
isPrinting = true;
break;
}
}
break;
case SHOW_ALL:
//--Default True
if (!this.deltaPool.isEmpty()) { // Short-circuit for efficiency
boolean somethingSeen = false;
for (Object tag : record.channels()) {
if (this.deltaPool.contains(tag)) {
somethingSeen = true;
break;
}
}
isPrinting = !somethingSeen;
} else {
isPrinting = true;
}
break;
default:
throw new IllegalStateException("Unknown default state setting: " + this.defaultState);
}
}
//--Return
if(isPrinting){
return Collections.singletonList(record);
} else {
return EMPTY;
}
}
/** {@inheritDoc} */
@Override
public List<Record> signalStartTrack(Record signal) {
return EMPTY;
}
/** {@inheritDoc} */
@Override
public List<Record> signalEndTrack(int newDepth, long timeOfEnd) {
return EMPTY;
}
}
| gpl-2.0 |
nikoloz90/logs | fina-auditlog-simple5/src/main/java/net/fina/auditlog/core/repository/AuditLogLoadMongoRepository.java | 2746 | package net.fina.auditlog.core.repository;
import com.mongodb.*;
import net.fina.auditlog.core.domain.AuditLog;
import org.springframework.stereotype.Repository;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Repository
public class AuditLogLoadMongoRepository implements AuditLogLoadRepository {
public final static String DB_NAME = "fina_audit_log";
public final static String COLLECTION_NAME = "SYS_AUDIT_LOG";
@Override
public long count() {
long result = -1;
MongoClient mongoClient = null;
try {
mongoClient = new MongoClient();
DB db = mongoClient.getDB(DB_NAME);
DBCollection dbCollection = db.getCollection(COLLECTION_NAME);
result = dbCollection.count();
} catch (UnknownHostException e) {
e.printStackTrace();
} finally {
if (mongoClient != null) {
mongoClient.close();
}
}
return result;
}
@Override
public List<AuditLog> fetchPage(int start, int length) {
List<AuditLog> result = new ArrayList<>();
MongoClient mongoClient = null;
try {
mongoClient = new MongoClient();
DB db = mongoClient.getDB(DB_NAME);
DBCollection dbCollection = db.getCollection(COLLECTION_NAME);
DBCursor dbCursor = dbCollection.find();
dbCursor.skip(start).limit((length));
while (dbCursor.hasNext()) {
DBObject dbObject = dbCursor.next();
AuditLog auditLog = new AuditLog();
auditLog.setId((long) dbObject.get("id"));
auditLog.setActorId(dbObject.get("actorId").toString());
auditLog.setRelevanceTime((Date) dbObject.get("relevanceTime"));
auditLog.setEntityId(dbObject.get("entityId").toString());
auditLog.setEntityName(dbObject.get("entityName").toString());
auditLog.setEntityProperty(dbObject.get("entityProperty")
.toString());
auditLog.setEntityPropertyNewValue(dbObject.get(
"entityPropertyNewValue").toString());
auditLog.setEntityPropertyOldValue(dbObject.get(
"entityPropertyOldValue").toString());
auditLog.setOperationType((int) dbObject.get("operationType"));
result.add(auditLog);
}
} catch (UnknownHostException e) {
e.printStackTrace();
} finally {
if (mongoClient != null) {
mongoClient.close();
}
}
return result;
}
}
| gpl-2.0 |
joshmoore/openmicroscopy | components/tools/OmeroImporter/test/ome/formats/utests/WellProcessorTest.java | 2848 | package ome.formats.utests;
import ome.formats.OMEROMetadataStoreClient;
import ome.formats.model.BlitzInstanceProvider;
import ome.util.LSID;
import ome.xml.model.primitives.NonNegativeInteger;
import omero.api.ServiceFactoryPrx;
import omero.model.Plate;
import omero.model.Well;
import junit.framework.TestCase;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class WellProcessorTest extends TestCase
{
private OMEROMetadataStoreClient store;
private static final int PLATE_INDEX = 1;
private static final int WELL_INDEX = 1;
@BeforeMethod
protected void setUp() throws Exception
{
ServiceFactoryPrx sf = new TestServiceFactory().proxy();
store = new OMEROMetadataStoreClient();
store.initialize(sf);
store.setEnumerationProvider(new TestEnumerationProvider());
store.setInstanceProvider(
new BlitzInstanceProvider(store.getEnumerationProvider()));
store.setWellColumn(new NonNegativeInteger(0), PLATE_INDEX, WELL_INDEX);
store.setWellColumn(new NonNegativeInteger(1), PLATE_INDEX, WELL_INDEX + 1);
store.setWellColumn(new NonNegativeInteger(0), PLATE_INDEX + 1, WELL_INDEX);
store.setPlateName("setUp Plate", PLATE_INDEX + 1);
}
@Test
public void testWellExists()
{
assertEquals(3, store.countCachedContainers(Well.class, null));
assertEquals(1, store.countCachedContainers(Plate.class, null));
LSID wellLSID1 = new LSID(Well.class, PLATE_INDEX, WELL_INDEX);
LSID wellLSID2 = new LSID(Well.class, PLATE_INDEX, WELL_INDEX + 1);
LSID wellLSID3 = new LSID(Well.class, PLATE_INDEX + 1, WELL_INDEX);
LSID plateLSID1 = new LSID(Plate.class, PLATE_INDEX + 1);
Well well1 = (Well) store.getSourceObject(wellLSID1);
Well well2 = (Well) store.getSourceObject(wellLSID2);
Well well3 = (Well) store.getSourceObject(wellLSID3);
Plate plate1 = (Plate) store.getSourceObject(plateLSID1);
assertNotNull(well1);
assertNotNull(well2);
assertNotNull(well3);
assertNotNull(plate1);
assertEquals(0, well1.getColumn().getValue());
assertEquals(1, well2.getColumn().getValue());
assertEquals(0, well3.getColumn().getValue());
assertEquals("setUp Plate", plate1.getName().getValue());
}
@Test
public void testWellPostProcess()
{
store.postProcess();
assertEquals(3, store.countCachedContainers(Well.class, null));
assertEquals(2, store.countCachedContainers(Plate.class, null));
LSID plateLSID1 = new LSID(Plate.class, PLATE_INDEX);
LSID plateLSID2 = new LSID(Plate.class, PLATE_INDEX + 1);
Plate plate1 = (Plate) store.getSourceObject(plateLSID1);
Plate plate2 = (Plate) store.getSourceObject(plateLSID2);
assertNotNull(plate1);
assertNotNull(plate2);
assertEquals("Plate", plate1.getName().getValue());
assertEquals("setUp Plate", plate2.getName().getValue());
}
}
| gpl-2.0 |
matheusvervloet/DC-UFSCar-ES2-201601-Grupo3 | src/test/java/net/sf/jabref/logic/layout/format/CompositeFormatTest.java | 1244 | package net.sf.jabref.logic.layout.format;
import net.sf.jabref.logic.layout.LayoutFormatter;
import org.junit.Assert;
import org.junit.Test;
public class CompositeFormatTest {
@Test
public void testComposite() {
{
LayoutFormatter f = new CompositeFormat();
Assert.assertEquals("No Change", f.format("No Change"));
}
{
LayoutFormatter f = new CompositeFormat(new LayoutFormatter[] {
fieldText -> fieldText + fieldText,
fieldText -> "A" + fieldText,
fieldText -> "B" + fieldText});
Assert.assertEquals("BAff", f.format("f"));
}
LayoutFormatter f = new CompositeFormat(new AuthorOrgSci(),
new NoSpaceBetweenAbbreviations());
LayoutFormatter first = new AuthorOrgSci();
LayoutFormatter second = new NoSpaceBetweenAbbreviations();
Assert.assertEquals(second.format(first.format("John Flynn and Sabine Gartska")), f.format("John Flynn and Sabine Gartska"));
Assert.assertEquals(second.format(first.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee")), f.format("Sa Makridakis and Sa Ca Wheelwright and Va Ea McGee"));
}
}
| gpl-2.0 |
peteihis/ArtOfIllusion | ArtOfIllusion/src/artofillusion/animation/SkeletonTool.java | 14424 | /* Copyright (C) 1999-2009 by Peter Eastman
Changes copyright (C) 2020 by Maksim Khramov
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details. */
package artofillusion.animation;
import artofillusion.*;
import artofillusion.math.*;
import artofillusion.object.*;
import artofillusion.ui.*;
import buoy.event.*;
import buoy.widget.*;
import java.awt.*;
import java.text.*;
/** SkeletonTool is an EditingTool used for manipulating the skeletons of objects. */
public class SkeletonTool extends EditingTool
{
private static final int CLICK_TOL = 6;
private static final int HANDLE_SIZE = 4;
private static final int NO_HANDLES = 0;
private static final int UNLOCKED_HANDLES = 1;
private static final int ALL_HANDLES = 2;
private static int whichHandles = UNLOCKED_HANDLES;
private Point clickPoint;
private Vec3 clickPos, handlePos[];
private boolean hideHandle[], invertDragDir;
private int clickedHandle;
private IKSolver ik;
private Mesh oldMesh, mesh;
private UndoRecord undo;
private boolean allowCreating;
private String helpText;
public SkeletonTool(MeshEditorWindow fr, boolean allowCreating)
{
super(fr);
this.allowCreating = allowCreating;
initButton("skeleton");
clickedHandle = -1;
helpText = Translate.text(allowCreating ? "skeletonTool.helpText" : "skeletonTool.helpTextNoCreate");
}
@Override
public void activate()
{
super.activate();
theWindow.setHelpText(helpText);
}
@Override
public int whichClicks()
{
return ALL_CLICKS;
}
@Override
public String getToolTipText()
{
return Translate.text("skeletonTool.tipText");
}
/** Find the positions of all the degree-of-freedom handles. */
private void findHandlePositions(Mat4 objToScreen, Joint j, ViewerCanvas view)
{
if (j.parent == null || whichHandles == NO_HANDLES)
hideHandle = new boolean [] {true, true, true, true};
else if (whichHandles == UNLOCKED_HANDLES)
hideHandle = new boolean [] {j.angle1.fixed, j.angle2.fixed, j.length.fixed, j.twist.fixed};
else
hideHandle = new boolean [4];
double scale = 70.0/view.getScale();
handlePos = new Vec3 [] {new Vec3(0.0, scale, 0.0), new Vec3(scale, 0.0, 0.0),
new Vec3(0.0, 0.0, scale), new Vec3(-scale*0.6, -scale*0.6, scale*0.4)};
Vec3 jointPos = new Vec3(j.coords.getOrigin());
objToScreen.transform(jointPos);
int jointX = (int) jointPos.x;
int jointY = (int) jointPos.y;
for (int i = 0; i < hideHandle.length; i++)
{
if (hideHandle[i])
continue;
j.coords.fromLocal().transformDirection(handlePos[i]);
handlePos[i].add(j.coords.getOrigin());
objToScreen.transform(handlePos[i]);
int x = (int) handlePos[i].x;
int y = (int) handlePos[i].y;
if (x == jointX && y == jointY)
hideHandle[i] = true;
}
}
@Override
public void drawOverlay(ViewerCanvas view)
{
if (ik != null)
return;
MeshViewer mv = (MeshViewer) view;
int selected = mv.getSelectedJoint();
mesh = (oldMesh == null ? (Mesh) mv.getController().getObject().getObject() : oldMesh);
Skeleton s = mesh.getSkeleton();
Joint j = s.getJoint(selected);
if (j == null)
return;
Camera cam = mv.getCamera();
CoordinateSystem objCoords = mv.getDisplayCoordinates();
Mat4 objToScreen = cam.getWorldToScreen().times(objCoords.fromLocal());
if (clickedHandle == -1)
{
// Draw the handles for each degree of freedom.
findHandlePositions(objToScreen, j, view);
Vec3 jointPos = new Vec3(j.coords.getOrigin());
objToScreen.transform(jointPos);
int jointX = (int) jointPos.x;
int jointY = (int) jointPos.y;
for (int i = 0; i < hideHandle.length; i++)
{
if (hideHandle[i])
continue;
int x = (int) handlePos[i].x;
int y = (int) handlePos[i].y;
view.drawLine(new Point(jointX, jointY), new Point(x, y), Color.darkGray);
view.drawBox(x-HANDLE_SIZE/2, y-HANDLE_SIZE/2, HANDLE_SIZE, HANDLE_SIZE, ViewerCanvas.handleColor);
}
}
else if (clickedHandle < 2)
{
// Draw a circle to show the DOF being moved.
double len = j.length.pos;
Mat4 m1, m2;
if (clickedHandle == 0)
{
m1 = Mat4.zrotation(j.twist.pos*Math.PI/180.0);
m2 = j.parent.coords.fromLocal().times(Mat4.yrotation(j.angle2.pos*Math.PI/180.0));
}
else
{
m1 = Mat4.xrotation(j.angle1.pos*Math.PI/180.0).times(Mat4.zrotation(j.twist.pos*Math.PI/180.0));
m2 = j.parent.coords.fromLocal();
}
m2 = objToScreen.times(m2);
Point pos[] = new Point [64];
for (int i = 0; i < pos.length; i++)
{
double angle = i*2.0*Math.PI/pos.length;
Vec3 p = new Vec3(0.0, 0.0, len);
p = m1.timesDirection(p);
if (clickedHandle == 0)
p = m2.times(Mat4.xrotation(angle).timesDirection(p));
else
p = m2.times(Mat4.yrotation(angle).timesDirection(p));
pos[i] = new Point((int) p.x, (int) p.y);
}
for (int i = 1; i < pos.length; i++)
view.drawLine(new Point(pos[i-1].x, pos[i-1].y), new Point(pos[i].x, pos[i].y), Color.darkGray);
view.drawLine(new Point(pos[0].x, pos[0].y), new Point(pos[pos.length-1].x, pos[pos.length-1].y), Color.darkGray);
}
}
@Override
public void mousePressed(WidgetMouseEvent e, ViewerCanvas view)
{
MeshViewer mv = (MeshViewer) view;
ViewerCanvas allViews[] = ((MeshEditorWindow) theWindow).getAllViews();
mesh = (Mesh) mv.getController().getObject().getObject();
Skeleton s = mesh.getSkeleton();
Joint selectedJoint = s.getJoint(mv.getSelectedJoint());
Camera cam = mv.getCamera();
CoordinateSystem objCoords = mv.getDisplayCoordinates();
Mat4 objToScreen = cam.getWorldToScreen().times(objCoords.fromLocal());
clickPoint = e.getPoint();
if (e.isControlDown() && allowCreating)
{
// Create a new joint.
undo = new UndoRecord(theWindow, false, UndoRecord.COPY_OBJECT, mesh, mesh.duplicate());
Joint j, parent = s.getJoint(mv.getSelectedJoint());
if (parent == null)
{
double distToJoint = mv.getDistToPlane();
clickPos = cam.convertScreenToWorld(clickPoint, distToJoint);
objCoords.toLocal().transform(clickPos);
j = new Joint(new CoordinateSystem(clickPos, Vec3.vz(), Vec3.vy()), null, "Root "+s.getNextJointID());
j.angle1.fixed = j.angle2.fixed = true;
s.addJoint(j, -1);
}
else
{
double distToJoint = cam.getWorldToView().timesZ(parent.coords.getOrigin());
clickPos = cam.convertScreenToWorld(clickPoint, distToJoint);
objCoords.toLocal().transform(clickPos);
Vec3 zdir = clickPos.minus(parent.coords.getOrigin());
zdir.normalize();
Vec3 ydir = cam.getCameraCoordinates().getZDirection().cross(zdir);
ydir.normalize();
j = new Joint(new CoordinateSystem(clickPos, zdir, ydir), parent, "Bone "+s.getNextJointID());
s.addJoint(j, parent.id);
}
for (int k = 0; k < allViews.length; k++)
((MeshViewer) allViews[k]).setSelectedJoint(j.id);
boolean moving[] = new boolean [s.getNumJoints()];
moving[s.findJointIndex(j.id)] = true;
ik = new IKSolver(s, mv.getLockedJoints(), moving);
theWindow.updateImage();
theWindow.updateMenus();
oldMesh = (Mesh) mesh.duplicate();
return;
}
// See whether a handle was clicked.
if (selectedJoint != null)
{
findHandlePositions(objToScreen, selectedJoint, view);
for (int i = 0; i < hideHandle.length; i++)
{
if (!hideHandle[i] && Math.abs(handlePos[i].x-clickPoint.x) <= 0.5*CLICK_TOL && Math.abs(handlePos[i].y-clickPoint.y) <= 0.5*CLICK_TOL)
{
clickedHandle = i;
oldMesh = (Mesh) mesh.duplicate();
Vec2 jointPos = objToScreen.timesXY(selectedJoint.coords.getOrigin());
invertDragDir = (handlePos[i].x < jointPos.x);
theWindow.updateImage();
return;
}
}
}
// Determine which joint was clicked on.
Joint joint[] = s.getJoints();
int i;
for (i = 0; i < joint.length; i++)
{
Vec2 pos = objToScreen.timesXY(joint[i].coords.getOrigin());
if ((clickPoint.x > pos.x-CLICK_TOL) &&
(clickPoint.x < pos.x+CLICK_TOL) &&
(clickPoint.y > pos.y-CLICK_TOL) &&
(clickPoint.y < pos.y+CLICK_TOL))
break;
}
if (i == joint.length)
{
// No joint was clicked on, so deselect the selected joint.
for (int j = 0; j < allViews.length; j++)
((MeshViewer) allViews[j]).setSelectedJoint(-1);
theWindow.updateImage();
theWindow.updateMenus();
return;
}
if (e.isShiftDown())
{
// Toggle whether this joint is locked.
for (int j = 0; j < allViews.length; j++)
{
MeshViewer v = (MeshViewer) allViews[j];
if (v.isJointLocked(joint[i].id))
v.unlockJoint(joint[i].id);
else
v.lockJoint(joint[i].id);
}
theWindow.updateImage();
return;
}
// Make it the selected joint, and prepare to drag it.
for (int j = 0; j < allViews.length; j++)
((MeshViewer) allViews[j]).setSelectedJoint(joint[i].id);
clickPos = joint[i].coords.getOrigin();
theWindow.updateImage();
theWindow.updateMenus();
boolean moving[] = new boolean [s.getNumJoints()];
moving[s.findJointIndex(joint[i].id)] = true;
ik = new IKSolver(s, mv.getLockedJoints(), moving);
oldMesh = (Mesh) mesh.duplicate();
}
@Override
public void mouseDragged(final WidgetMouseEvent e, ViewerCanvas view)
{
final MeshViewer mv = (MeshViewer) view;
final CoordinateSystem objCoords = mv.getDisplayCoordinates();
final Camera cam = mv.getCamera();
final Mesh mesh = (Mesh) mv.getController().getObject().getObject();
final Skeleton s = mesh.getSkeleton();
final Joint selectedJoint = s.getJoint(mv.getSelectedJoint());
if (clickedHandle > -1)
{
// Adjust a single degree of freedom.
if (undo == null)
undo = new UndoRecord(getWindow(), false, UndoRecord.COPY_OBJECT, mesh, mesh.duplicate());
double dist = clickPoint.x-e.getPoint().x;
if (invertDragDir)
dist = -dist;
Joint origJoint = oldMesh.getSkeleton().getJoint(mv.getSelectedJoint());
Joint.DOF dof = null;
Joint.DOF origDof = null;
String name = null;
switch (clickedHandle)
{
case 0:
dof = selectedJoint.angle1;
origDof = origJoint.angle1;
dist *= 1.8/Math.PI;
name = "X Bend";
break;
case 1:
dof = selectedJoint.angle2;
origDof = origJoint.angle2;
dist *= -1.8/Math.PI;
name = "Y Bend";
break;
case 2:
dof = selectedJoint.length;
origDof = origJoint.length;
dist /= -view.getScale();
name = "Length";
break;
case 3:
dof = selectedJoint.twist;
origDof = origJoint.twist;
dist *= 1.8/Math.PI;
name = "Twist";
break;
}
dof.set(origDof.pos+dist);
selectedJoint.recalcCoords(true);
if (!mv.getSkeletonDetached())
adjustMesh(mesh);
mv.getController().objectChanged();
theWindow.updateImage();
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(3);
theWindow.setHelpText(name+": "+nf.format(dof.pos));
return;
}
if (ik == null)
return;
boolean converged = false;
Vec3 target[] = new Vec3 [s.getNumJoints()];
int jointIndex = s.findJointIndex(selectedJoint.id);
ActionProcessor process = view.getActionProcessor();
do
{
Vec3 jointPos = objCoords.fromLocal().times(selectedJoint.coords.getOrigin());
double distToJoint = cam.getWorldToView().timesZ(jointPos);
Vec3 goal = cam.convertScreenToWorld(e.getPoint(), distToJoint);
objCoords.toLocal().transform(goal);
if (undo == null)
undo = new UndoRecord(SkeletonTool.this.getWindow(), false, UndoRecord.COPY_OBJECT, mesh, mesh.duplicate());
target[jointIndex] = goal;
converged = ik.solve(target, 100);
if (!mv.getSkeletonDetached())
adjustMesh(mesh);
((ObjectViewer) view).getController().objectChanged();
theWindow.updateImage();
} while (!converged && (process == null || (!process.hasEvent() && !process.hasBeenStopped())));
}
@Override
public void mouseReleased(WidgetMouseEvent e, ViewerCanvas view)
{
if (undo == null && e.getClickCount() == 2 && !e.isShiftDown() && !e.isControlDown())
((MeshEditorWindow) theWindow).editJointCommand(); // They double-clicked without dragging.
ik = null;
mesh = oldMesh = null;
clickedHandle = -1;
if (undo != null)
theWindow.setUndoRecord(undo);
undo = null;
theWindow.setHelpText(helpText);
}
@Override
public void iconDoubleClicked()
{
BComboBox dofChoice = new BComboBox(new String [] {
Translate.text("noDOF"),
Translate.text("unlockedDOF"),
Translate.text("allDOF"),
});
dofChoice.setSelectedIndex(whichHandles);
ComponentsDialog dlg = new ComponentsDialog(theFrame, Translate.text("skeletonToolTitle"),
new Widget [] {dofChoice}, new String [] {null});
if (!dlg.clickedOk())
return;
whichHandles = dofChoice.getSelectedIndex();
theWindow.updateImage();
}
/** Adjust the mesh after the skeleton has changed. */
protected void adjustMesh(Mesh newMesh)
{
Skeleton.adjustMesh(oldMesh, newMesh);
}
} | gpl-2.0 |
jeffgdotorg/opennms | features/reporting/availability/src/main/java/org/opennms/reporting/availability/Created.java | 6768 | /*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2017-2017 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2017 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.reporting.availability;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue;
/**
* Class Created.
*
* @version $Revision$ $Date$
*/
@XmlRootElement(name = "created")
@XmlAccessorType(XmlAccessType.FIELD)
public class Created implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* internal content storage
*/
@XmlValue
private java.math.BigDecimal _content;
@XmlAttribute(name = "year", required = true)
private Integer year;
@XmlAttribute(name = "month", required = true)
private String month;
@XmlAttribute(name = "day", required = true)
private Integer day;
@XmlAttribute(name = "hour", required = true)
private Integer hour;
@XmlAttribute(name = "min", required = true)
private Integer min;
@XmlAttribute(name = "sec", required = true)
private Integer sec;
@XmlAttribute(name = "period", required = true)
private String period;
public Created() {
}
/**
*/
public void deleteDay() {
this.day= null;
}
/**
*/
public void deleteHour() {
this.hour= null;
}
/**
*/
public void deleteMin() {
this.min= null;
}
/**
*/
public void deleteSec() {
this.sec= null;
}
/**
*/
public void deleteYear() {
this.year= null;
}
/**
* Returns the value of field 'content'. The field 'content' has the following
* description: internal content storage
*
* @return the value of field 'Content'.
*/
public java.math.BigDecimal getContent() {
return this._content;
}
/**
* Returns the value of field 'day'.
*
* @return the value of field 'Day'.
*/
public Integer getDay() {
return this.day;
}
/**
* Returns the value of field 'hour'.
*
* @return the value of field 'Hour'.
*/
public Integer getHour() {
return this.hour;
}
/**
* Returns the value of field 'min'.
*
* @return the value of field 'Min'.
*/
public Integer getMin() {
return this.min;
}
/**
* Returns the value of field 'month'.
*
* @return the value of field 'Month'.
*/
public String getMonth() {
return this.month;
}
/**
* Returns the value of field 'period'.
*
* @return the value of field 'Period'.
*/
public String getPeriod() {
return this.period;
}
/**
* Returns the value of field 'sec'.
*
* @return the value of field 'Sec'.
*/
public Integer getSec() {
return this.sec;
}
/**
* Returns the value of field 'year'.
*
* @return the value of field 'Year'.
*/
public Integer getYear() {
return this.year;
}
/**
* Method hasDay.
*
* @return true if at least one Day has been added
*/
public boolean hasDay() {
return this.day != null;
}
/**
* Method hasHour.
*
* @return true if at least one Hour has been added
*/
public boolean hasHour() {
return this.hour != null;
}
/**
* Method hasMin.
*
* @return true if at least one Min has been added
*/
public boolean hasMin() {
return this.min != null;
}
/**
* Method hasSec.
*
* @return true if at least one Sec has been added
*/
public boolean hasSec() {
return this.sec != null;
}
/**
* Method hasYear.
*
* @return true if at least one Year has been added
*/
public boolean hasYear() {
return this.year != null;
}
/**
* Sets the value of field 'content'. The field 'content' has the following
* description: internal content storage
*
* @param content the value of field 'content'.
*/
public void setContent(final java.math.BigDecimal content) {
this._content = content;
}
/**
* Sets the value of field 'day'.
*
* @param day the value of field 'day'.
*/
public void setDay(final Integer day) {
this.day = day;
}
/**
* Sets the value of field 'hour'.
*
* @param hour the value of field 'hour'.
*/
public void setHour(final Integer hour) {
this.hour = hour;
}
/**
* Sets the value of field 'min'.
*
* @param min the value of field 'min'.
*/
public void setMin(final Integer min) {
this.min = min;
}
/**
* Sets the value of field 'month'.
*
* @param month the value of field 'month'.
*/
public void setMonth(final String month) {
this.month = month;
}
/**
* Sets the value of field 'period'.
*
* @param period the value of field 'period'.
*/
public void setPeriod(final String period) {
this.period = period;
}
/**
* Sets the value of field 'sec'.
*
* @param sec the value of field 'sec'.
*/
public void setSec(final Integer sec) {
this.sec = sec;
}
/**
* Sets the value of field 'year'.
*
* @param year the value of field 'year'.
*/
public void setYear(final Integer year) {
this.year = year;
}
}
| gpl-2.0 |
UnlimitedFreedom/UF-EchoPet | modules/v1_8_R1/src/main/java/com/dsh105/echopet/compat/nms/v1_8_R1/entity/type/EntityMagmaCubePet.java | 1409 | /*
* This file is part of EchoPet.
*
* EchoPet is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EchoPet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EchoPet. If not, see <http://www.gnu.org/licenses/>.
*/
package com.dsh105.echopet.compat.nms.v1_8_R1.entity.type;
import com.dsh105.echopet.compat.api.entity.EntityPetType;
import com.dsh105.echopet.compat.api.entity.EntitySize;
import com.dsh105.echopet.compat.api.entity.IPet;
import com.dsh105.echopet.compat.api.entity.PetType;
import com.dsh105.echopet.compat.api.entity.type.nms.IEntityMagmaCubePet;
import net.minecraft.server.v1_8_R1.World;
@EntitySize(width = 0.6F, height = 0.6F)
@EntityPetType(petType = PetType.MAGMACUBE)
public class EntityMagmaCubePet extends EntitySlimePet implements IEntityMagmaCubePet {
public EntityMagmaCubePet(World world) {
super(world);
}
public EntityMagmaCubePet(World world, IPet pet) {
super(world, pet);
}
}
| gpl-3.0 |
SKCraft/Applied-Energistics-2 | src/main/java/appeng/client/render/effects/LightningArcFX.java | 2042 | /*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.render.effects;
import java.util.Random;
import net.minecraft.world.World;
public class LightningArcFX extends LightningFX
{
private static final Random RANDOM_GENERATOR = new Random();
final double rx;
final double ry;
final double rz;
public LightningArcFX( World w, double x, double y, double z, double ex, double ey, double ez, double r, double g, double b )
{
super( w, x, y, z, r, g, b, 6 );
this.noClip = true;
this.rx = ex - x;
this.ry = ey - y;
this.rz = ez - z;
this.regen();
}
@Override
protected void regen()
{
double i = 1.0 / ( this.steps - 1 );
double lastDirectionX = this.rx * i;
double lastDirectionY = this.ry * i;
double lastDirectionZ = this.rz * i;
double len = Math.sqrt( lastDirectionX * lastDirectionX + lastDirectionY * lastDirectionY + lastDirectionZ * lastDirectionZ );
for( int s = 0; s < this.steps; s++ )
{
this.Steps[s][0] = ( lastDirectionX + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][1] = ( lastDirectionY + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
this.Steps[s][2] = ( lastDirectionZ + ( RANDOM_GENERATOR.nextDouble() - 0.5 ) * len * 1.2 ) / 2.0;
}
}
}
| gpl-3.0 |
xuwakao/VirtualApp | VirtualApp/lib/src/main/java/com/lody/virtual/helper/ipcbus/ServerInterface.java | 1424 | package com.lody.virtual.helper.ipcbus;
import android.os.Binder;
import com.lody.virtual.helper.collection.SparseArray;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* @author Lody
*/
public class ServerInterface {
private Class<?> interfaceClass;
private final SparseArray<IPCMethod> codeToInterfaceMethod;
private final Map<Method, IPCMethod> methodToIPCMethodMap;
public ServerInterface(Class<?> interfaceClass) {
this.interfaceClass = interfaceClass;
Method[] methods = interfaceClass.getMethods();
codeToInterfaceMethod = new SparseArray<>(methods.length);
methodToIPCMethodMap = new HashMap<>(methods.length);
for (int i = 0; i < methods.length; i++) {
int code = Binder.FIRST_CALL_TRANSACTION + i;
IPCMethod ipcMethod = new IPCMethod(code, methods[i], interfaceClass.getName());
codeToInterfaceMethod.put(code, ipcMethod);
methodToIPCMethodMap.put(methods[i], ipcMethod);
}
}
public Class<?> getInterfaceClass() {
return interfaceClass;
}
public String getInterfaceName() {
return interfaceClass.getName();
}
public IPCMethod getIPCMethod(int code) {
return codeToInterfaceMethod.get(code);
}
public IPCMethod getIPCMethod(Method method) {
return methodToIPCMethodMap.get(method);
}
}
| gpl-3.0 |
wskplho/scdl | scdl/src/main/java/net/rdrei/android/scdl2/DownloadPathValidator.java | 1469 | package net.rdrei.android.scdl2;
import java.io.File;
public class DownloadPathValidator {
public enum ErrorCode {
INSECURE_PATH, PERMISSION_DENIED, RELATIVE_PATH, NOT_A_DIRECTORY,
};
// Injectable
public DownloadPathValidator() {
}
/**
* Using a single class to catch all validation related errors is a
* deliberate choice. It reduces boilerplate a lot as exceptions are all
* caught in one place and handled the same way except for the error message
* provided.
*
* @author pascal
*
*/
public static class DownloadPathValidationException extends Exception {
private final ErrorCode mErrorCode;
private static final long serialVersionUID = 1L;
public DownloadPathValidationException(final ErrorCode code) {
mErrorCode = code;
}
public ErrorCode getErrorCode() {
return mErrorCode;
}
}
public void validateCustomPathOrThrow(final String path)
throws DownloadPathValidationException {
if (path.contains("..")) {
throw new DownloadPathValidationException(ErrorCode.INSECURE_PATH);
}
final File file = new File(path);
if (file.exists()) {
if (!file.isDirectory()) {
throw new DownloadPathValidationException(
ErrorCode.NOT_A_DIRECTORY);
}
} else {
if (!file.mkdirs()) {
throw new DownloadPathValidationException(
ErrorCode.PERMISSION_DENIED);
}
}
if (!file.canWrite()) {
throw new DownloadPathValidationException(
ErrorCode.PERMISSION_DENIED);
}
}
}
| gpl-3.0 |
AnodeCathode/TFCraft | src/Common/com/bioxx/tfc/Commands/GSPVisualCommand.java | 2163 | package com.bioxx.tfc.Commands;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
import com.bioxx.tfc.Chunkdata.ChunkData;
import com.bioxx.tfc.Core.TFC_Core;
import com.bioxx.tfc.api.TFCOptions;
public class GSPVisualCommand extends CommandBase{
@Override
public String getCommandName() {
return "vgsp";
}
@Override
public void processCommand(ICommandSender sender, String[] params)
{
if(!TFCOptions.enableDebugMode)
return;
MinecraftServer server = MinecraftServer.getServer();
EntityPlayerMP player;
player = getCommandSenderAsPlayer(sender);
WorldServer world = server.worldServerForDimension(player.getEntityWorld().provider.dimensionId);
int px = (int)player.posX >> 4;
int pz = (int)player.posZ >> 4;
ChunkData d = TFC_Core.getCDM(world).getData(px, pz);
if(params.length == 0)
{
Chunk chunk = world.getChunkFromBlockCoords((int)player.posX, (int)player.posZ);
for(int x = 0; x < 16; x++)
{
for(int z = 0; z < 16; z++)
world.setBlock(x+(chunk.xPosition*16), (int)player.posY-1, z+(chunk.zPosition*16), Blocks.wool, getColor(d.getSpawnProtectionWithUpdate()), 2);
}
}
else if(params.length == 1)
{
int radius = Integer.parseInt(params[0]);
for(int i = -radius; i <= radius;i++)
{
for(int k = -radius; k <= radius;k++)
{
Chunk chunk = world.getChunkFromBlockCoords((int) player.posX + i * 16, (int) player.posZ + k * 16);
for(int x = 0; x < 16; x++)
{
for(int z = 0; z < 16; z++)
world.setBlock(x + (chunk.xPosition * 16), (int)player.posY - 1, z + (chunk.zPosition * 16), Blocks.wool, getColor(d.getSpawnProtectionWithUpdate()), 2);
}
}
}
}
}
private int getColor(int val)
{
return val/ (4320 / 16);
}
@Override
public String getCommandUsage(ICommandSender icommandsender)
{
return "";
}
}
| gpl-3.0 |
LoickBriot/replication-benchmarker | src/main/java/crdt/tree/graphtree/connection/GraphConnectionPolicyInc.java | 4700 | /**
* Replication Benchmarker
* https://github.com/score-team/replication-benchmarker/
* Copyright (C) 2013 LORIA / Inria / SCORE Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package crdt.tree.graphtree.connection;
import collect.HashMapSet;
import crdt.set.SetOperation;
import crdt.tree.graphtree.Edge;
import crdt.tree.graphtree.GraphConnectionPolicy;
import java.util.HashSet;
import java.util.Observable;
/**
*
* @author Stephane Martin
*/
public abstract class GraphConnectionPolicyInc<T> extends GraphConnectionPolicy<T> {
protected HashMapSet<T, Edge<T>> lookup;
protected HashSet<T> nodes;
protected HashMapSet<T, Edge<T>> badEdges;
protected HashMapSet<T, Edge<T>> goodEdges;
@Override
public void update(Observable o, Object op) {
if (op instanceof SetOperation) {
SetOperation op2 = (SetOperation) op;
if (op2.getContent() instanceof crdt.tree.edgetree.Edge) {
/*
* L'objet est une arête
*/
Edge<T> edge = (Edge<T>) op2.getContent();
if (op2.getType() == SetOperation.OpType.add) {
/*
* Ajout
*/
boolean good = true;
if (!nodes.contains(edge.getFather())) {
badEdges.put(edge.getFather(), edge);
good = false;
}
if (!nodes.contains(edge.getFather())) {
badEdges.put(edge.getSon(), edge);
}
if (good) {
goodEdges.put(edge.getSon(), edge);
goodEdges.put(edge.getFather(), edge);
this.addEdge(edge);
}
} else {
/*
* Suppression
*/
delEdge((Edge<T>) op2.getContent());
}
} else {
/*
* L'objet est un noeud
*/
T node = (T) op2.getContent();
if (op2.getType() == SetOperation.OpType.add) {
/*
* Ajout
*/
nodes.add(node);
for (Edge<T> e : badEdges.removeAll(node)) {
if ((e.getFather() == node && nodes.contains(e.getSon()))
|| (e.getSon() == node && nodes.contains(e.getFather()))) {
addEdge(e);
goodEdges.put(node, e);
}
}
//addNode(node);
} else {
/*
* Suppression
*/
for (Edge<T> e : goodEdges.removeAll(node)) {
badEdges.put(node, e);
delEdge(e);/* Enlève de la vue */
if (e.getFather()==node){
goodEdges.remove(e.getSon(), e);
}else{
goodEdges.remove(e.getFather(), e);
}
}
nodes.remove(node);
//delNode(node);
}
}
}
}
boolean CheckEdge(Edge<T> e) {
return nodes.contains(e.getFather()) && nodes.contains(e.getSon());
}
@Override
public HashMapSet<T, Edge<T>> lookup() {
return lookup;
}
abstract void addEdge(Edge<T> edge);
abstract void delEdge(Edge<T> edge);
/*abstract void addNode(T n);
abstract void delNode(T n);*/
//@Override
//public abstract GraphConnectionPolicyInc<T> create();
abstract GraphConnectionPolicyInc createSpe();
public GraphConnectionPolicyInc create() {
GraphConnectionPolicyInc ret = createSpe();
ret.lookup = new HashMapSet<T, Edge<T>>();
return ret;
}
}
| gpl-3.0 |
khmarbaise/jqassistant | core/analysis/src/test/java/com/buschmais/jqassistant/core/analysis/api/rule/AbstractRuleBucketTest.java | 6330 | package com.buschmais.jqassistant.core.analysis.api.rule;
import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import java.util.Set;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.*;
public class AbstractRuleBucketTest {
private TestBucket bucket;
@Before
public void setUp() {
bucket = new TestBucket();
}
//--- All tests for getRules()
@Test
public void getRulesReturnsAllRules() throws DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
bucket.add(a);
bucket.add(b);
bucket.add(c);
assertThat(bucket.getAll(), containsInAnyOrder(a, b, c));
}
//--- All tests for getIds()
@Test
public void getConceptsIdsReturnsEmptySetIfThereAreNoConceptsInTheBucket() {
assertThat(bucket.getIds(), Matchers.<String>empty());
}
@Test
public void getConceptIdsReturnsAllIdsOfAllConceptsInBucket() throws DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
bucket.add(a);
bucket.add(b);
bucket.add(c);
assertThat(bucket.getIds(), hasSize(3));
assertThat(bucket.getIds(), containsInAnyOrder("a", "b", "c"));
}
@Test(expected = UnsupportedOperationException.class)
public void getConceptIdsReturnsUnmodifiableSet() {
Set<String> conceptIds = bucket.getIds();
conceptIds.add("a");
}
//--- All tests for size()
@Test
public void sizeOfBucketIsZeroIfThereAreNotConcepts() {
assertThat(bucket.size(), equalTo(0));
}
@Test
public void sizeOfBucketIsEqualNumberOfConceptsInBucket() throws DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
bucket.add(a);
bucket.add(b);
bucket.add(c);
assertThat(bucket.size(), equalTo(3));
}
//--- All tests for getConcept()
@Test
public void getConceptReturnsExistingConceptInBucket() throws NoConceptException, DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
bucket.add(a);
Concept b = bucket.getById("a");
assertThat(b, Matchers.sameInstance(a));
}
@Test(expected = NoConceptException.class)
public void getConceptThrowsExceptionIfConceptNotFoundInBucket() throws NoConceptException {
bucket.getById("foobar");
}
//--- All tests for addConcepts
@Test()
public void addConceptsAddsAllConcepts() throws NoConceptException, DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
TestBucket existingBucket = new TestBucket();
existingBucket.add(a);
existingBucket.add(b);
existingBucket.add(c);
ConceptBucket newBucket = new ConceptBucket();
newBucket.add(existingBucket);
assertThat(newBucket.size(), equalTo(3));
assertThat(newBucket.getIds(), containsInAnyOrder("a", "b", "c"));
}
@Test
public void addConceptsCopesWithEmptyBucket() throws NoConceptException, DuplicateConceptException {
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
TestBucket newBucket = new TestBucket();
newBucket.add(a);
newBucket.add(b);
newBucket.add(c);
newBucket.add(new TestBucket());
assertThat(newBucket.size(), equalTo(3));
assertThat(newBucket.getIds(), containsInAnyOrder("a", "b", "c"));
}
@Test(expected = DuplicateConceptException.class)
public void addWithCollectionFailIfAConceptIdIsSameConceptIdIsAlreadyInBucket() throws DuplicateConceptException, NoConceptException {
Concept first = Mockito.mock(Concept.class);
Concept a = Mockito.mock(Concept.class);
Concept b = Mockito.mock(Concept.class);
Concept c = Mockito.mock(Concept.class);
Mockito.when(first.getId()).thenReturn("a");
Mockito.when(a.getId()).thenReturn("a");
Mockito.when(b.getId()).thenReturn("b");
Mockito.when(c.getId()).thenReturn("c");
TestBucket existingBucket = new TestBucket();
existingBucket.add(a);
existingBucket.add(b);
existingBucket.add(c);
TestBucket newBucket = new TestBucket();
newBucket.add(first);
newBucket.add(existingBucket);
}
//--- Helper Classes
private static class TestBucket extends AbstractRuleBucket<Concept, NoConceptException, DuplicateConceptException> {
@Override
protected String getRuleTypeName() {
return "example";
}
@Override
protected DuplicateConceptException newDuplicateRuleException(String message) {
return new DuplicateConceptException(message);
}
@Override
protected NoConceptException newNoRuleException(String message) {
return new NoConceptException(message);
}
}
} | gpl-3.0 |
arraydev/snap-engine | ceres-glayer/src/main/java/com/bc/ceres/glevel/support/DefaultMultiLevelRenderer.java | 1554 | /*
* Copyright (C) 2010 Brockmann Consult GmbH (info@brockmann-consult.de)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option)
* any later version.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see http://www.gnu.org/licenses/
*/
package com.bc.ceres.glevel.support;
import com.bc.ceres.glevel.MultiLevelRenderer;
import com.bc.ceres.glevel.MultiLevelSource;
import com.bc.ceres.grender.Rendering;
import java.awt.geom.AffineTransform;
public class DefaultMultiLevelRenderer implements MultiLevelRenderer {
public DefaultMultiLevelRenderer() {
}
@Override
public void renderImage(Rendering rendering, MultiLevelSource multiLevelSource, int level) {
final AffineTransform i2m = multiLevelSource.getModel().getImageToModelTransform(level);
final AffineTransform m2v = rendering.getViewport().getModelToViewTransform();
i2m.preConcatenate(m2v);
rendering.getGraphics().drawRenderedImage(multiLevelSource.getImage(level), i2m);
}
@Override
public void reset() {
// no state to dispose
}
} | gpl-3.0 |
RyanLee7/redreader | src/main/java/org/quantumbadger/redreader/views/list/ListItemView.java | 2671 | /*******************************************************************************
* This file is part of RedReader.
*
* RedReader is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RedReader is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RedReader. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
package org.quantumbadger.redreader.views.list;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.ContextMenu;
import android.view.View;
import android.widget.ImageView;
import org.holoeverywhere.widget.FrameLayout;
import org.holoeverywhere.widget.LinearLayout;
import org.holoeverywhere.widget.TextView;
import org.quantumbadger.redreader.R;
// TODO just make this a linear layout
public class ListItemView extends FrameLayout {
private final TextView textView;
private final ImageView imageView;
private final View divider;
private ContextMenuBuilder contextMenuBuilder;
public ListItemView(final Context context) {
super(context);
final LinearLayout ll = (LinearLayout)inflate(context, R.layout.list_item, null);
divider = ll.findViewById(R.id.list_item_divider);
textView = (TextView)ll.findViewById(R.id.list_item_text);
imageView = (ImageView)ll.findViewById(R.id.list_item_icon);
setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
addView(ll);
}
public void reset(final Drawable icon, final CharSequence text, final boolean hideDivider) {
if(hideDivider) {
divider.setVisibility(View.GONE);
} else {
divider.setVisibility(View.VISIBLE);
}
textView.setText(text);
if(icon != null) {
imageView.setImageDrawable(icon);
imageView.setVisibility(VISIBLE);
} else {
imageView.setImageBitmap(null);
imageView.setVisibility(GONE);
}
contextMenuBuilder = null;
}
public void setContextMenuBuilder(ContextMenuBuilder contextMenuBuilder) {
this.contextMenuBuilder = contextMenuBuilder;
}
@Override
protected void onCreateContextMenu(ContextMenu menu) {
if(contextMenuBuilder != null) contextMenuBuilder.build(menu);
}
public static interface ContextMenuBuilder {
public void build(ContextMenu menu);
}
}
| gpl-3.0 |
ypsy/Signal-Android | src/org/thoughtcrime/securesms/attachments/Attachment.java | 1569 | package org.thoughtcrime.securesms.attachments;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import org.thoughtcrime.securesms.database.AttachmentDatabase;
public abstract class Attachment {
@NonNull
private final String contentType;
private final int transferState;
private final long size;
@Nullable
private final String location;
@Nullable
private final String key;
@Nullable
private final String relay;
public Attachment(@NonNull String contentType, int transferState, long size,
@Nullable String location, @Nullable String key, @Nullable String relay)
{
this.contentType = contentType;
this.transferState = transferState;
this.size = size;
this.location = location;
this.key = key;
this.relay = relay;
}
@Nullable
public abstract Uri getDataUri();
@Nullable
public abstract Uri getThumbnailUri();
public int getTransferState() {
return transferState;
}
public boolean isInProgress() {
return transferState != AttachmentDatabase.TRANSFER_PROGRESS_DONE &&
transferState != AttachmentDatabase.TRANSFER_PROGRESS_FAILED;
}
public long getSize() {
return size;
}
@NonNull
public String getContentType() {
return contentType;
}
@Nullable
public String getLocation() {
return location;
}
@Nullable
public String getKey() {
return key;
}
@Nullable
public String getRelay() {
return relay;
}
}
| gpl-3.0 |
servinglynk/hmis-lynk-open-source | hmis-service-v2014/src/main/java/com/servinglynk/hmis/warehouse/service/exception/AccountConsentNotFoundException.java | 625 | package com.servinglynk.hmis.warehouse.service.exception;
@SuppressWarnings("serial")
public class AccountConsentNotFoundException extends RuntimeException {
/**
* Default exception message
*/
public static final String DEFAULT_MESSAGE = "consent not found";
public AccountConsentNotFoundException() {
super(DEFAULT_MESSAGE);
}
public AccountConsentNotFoundException(String message) {
super(message);
}
public AccountConsentNotFoundException(Throwable cause) {
super(DEFAULT_MESSAGE, cause);
}
public AccountConsentNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}
| mpl-2.0 |
kuali/kc | coeus-impl/src/main/java/org/kuali/kra/negotiations/web/struts/form/NegotiationForm.java | 14466 | /*
* Kuali Coeus, a comprehensive research administration system for higher education.
*
* Copyright 2005-2016 Kuali, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.kuali.kra.negotiations.web.struts.form;
import org.apache.commons.lang3.StringUtils;
import org.kuali.coeus.common.notification.impl.NotificationHelper;
import org.kuali.coeus.sys.framework.model.KcTransactionalDocumentFormBase;
import org.kuali.coeus.sys.framework.service.KcServiceLocator;
import org.kuali.kra.authorization.KraAuthorizationConstants;
import org.kuali.coeus.common.framework.medusa.MedusaBean;
import org.kuali.kra.negotiations.bo.*;
import org.kuali.kra.negotiations.customdata.CustomDataHelper;
import org.kuali.kra.negotiations.document.NegotiationDocument;
import org.kuali.kra.negotiations.notifications.NegotiationCloseNotificationContext;
import org.kuali.kra.negotiations.notifications.NegotiationNotification;
import org.kuali.kra.negotiations.service.NegotiationService;
import org.kuali.coeus.common.framework.custom.CustomDataDocumentForm;
import org.kuali.rice.kew.api.WorkflowDocument;
import org.kuali.rice.kns.web.ui.HeaderField;
import org.kuali.rice.krad.service.BusinessObjectService;
import org.kuali.rice.krad.util.KRADConstants;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static org.kuali.rice.krad.util.KRADConstants.EMPTY_STRING;
/**
*
* This class holds all the objects required for a negotiation web object.
*/
public class NegotiationForm extends KcTransactionalDocumentFormBase implements CustomDataDocumentForm {
private static final long serialVersionUID = 6245888664423593163L;
private final String filterAllActivities = "All";
private final String filterPendingActivities = "Pending";
private List<NegotiationUnassociatedDetail> negotiationUnassociatedDetailsToDelete;
private NegotiationActivityHelper negotiationActivityHelper;
private NegotiationAssociatedDetailBean negotiationAssociatedDetailBean;
private CustomDataHelper customDataHelper = new CustomDataHelper(this);
private NotificationHelper<NegotiationCloseNotificationContext> notificationHelper;
private String filterActivities;
private MedusaBean medusaBean;
public NegotiationForm() {
super();
negotiationUnassociatedDetailsToDelete = new ArrayList<NegotiationUnassociatedDetail>();
negotiationActivityHelper = new NegotiationActivityHelper(this);
medusaBean = new MedusaBean();
notificationHelper = new NotificationHelper<NegotiationCloseNotificationContext>();
filterActivities = "All";
init();
}
private void init()
{
getCustomDataHelper().prepareCustomData();
}
public CustomDataHelper getCustomDataHelper() {
return customDataHelper;
}
/**
* This method sets the custom data helper
*
* @param customDataHelper
*/
public void setCustomDataHelper(CustomDataHelper customDataHelper) {
this.customDataHelper = customDataHelper;
}
/**
* This method returns a string representation of the document type
*
* @return
*/
public String getDocumentTypeName() {
return "NegotiationDocument";
}
public NegotiationDocument getNegotiationDocument() {
return (NegotiationDocument) this.getDocument();
}
public List<NegotiationUnassociatedDetail> getNegotiationUnassociatedDetailsToDelete() {
return negotiationUnassociatedDetailsToDelete;
}
@Override
protected String getDefaultDocumentTypeName() {
return "NegotiationDocument";
}
@Override
protected String getLockRegion() {
return KraAuthorizationConstants.LOCK_NEGOTIATION;
}
@Override
protected void setSaveDocumentControl(Map editMode) {
getDocumentActions().put(KRADConstants.KUALI_ACTION_CAN_SAVE, KRADConstants.KUALI_DEFAULT_TRUE_VALUE);
}
public BusinessObjectService getBusinessObjectService() {
return KcServiceLocator.getService(BusinessObjectService.class);
}
public NegotiationService getNegotiationService() {
return KcServiceLocator.getService(NegotiationService.class);
}
private boolean isAssocitationType(String typeCode) {
if (this.getNegotiationDocument().getNegotiation().getNegotiationAssociationType() != null) {
return StringUtils.equalsIgnoreCase(typeCode, this.getNegotiationDocument().getNegotiation().getNegotiationAssociationType().getCode());
}
return false;
}
public boolean getDisplayUnAssociatedDetail() {
return isAssocitationType(NegotiationAssociationType.NONE_ASSOCIATION);
}
public boolean getDisplayProposalLog() {
return isAssocitationType(NegotiationAssociationType.PROPOSAL_LOG_ASSOCIATION);
}
public boolean getDisplayInstitutionalProposal() {
return isAssocitationType(NegotiationAssociationType.INSTITUATIONAL_PROPOSAL_ASSOCIATION);
}
public boolean getDisplayAward() {
return isAssocitationType(NegotiationAssociationType.AWARD_ASSOCIATION);
}
public boolean getDisplaySubAward() {
return isAssocitationType(NegotiationAssociationType.SUB_AWARD_ASSOCIATION);
}
public NegotiationActivityHelper getNegotiationActivityHelper() {
return negotiationActivityHelper;
}
public void setNegotiationActivityHelper(NegotiationActivityHelper negotiationActivityHelper) {
this.negotiationActivityHelper = negotiationActivityHelper;
}
public boolean getDispayAssociatedDetailPanel() {
return !getDisplayUnAssociatedDetail() && StringUtils.isNotEmpty(this.getNegotiationDocument().getNegotiation().getAssociatedDocumentId());
}
@Override
public void populateHeaderFields(WorkflowDocument workflowDocument) {
super.populateHeaderFields(workflowDocument);
NegotiationDocument nd = getNegotiationDocument();
final String ATTRIB_NEG_ID = "DataDictionary.Negotiation.attributes.negotiationId";
final String ATTRIB_NEG_USER_NAME = "DataDictionary.Negotiation.attributes.negotiatorUserName";
if (nd == null || nd.getNegotiation() == null)
{
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_ID, EMPTY_STRING));
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_USER_NAME, EMPTY_STRING));
return;
}
if (nd.getNegotiation().getNegotiationId() == null)
{
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_ID, EMPTY_STRING));
}
else
{
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_ID, nd.getNegotiation().getNegotiationId().toString()));
}
if (nd.getNegotiation().getNegotiatorUserName() == null)
{
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_USER_NAME, EMPTY_STRING));
}
else
{
getDocInfo().add(2, new HeaderField(ATTRIB_NEG_USER_NAME, nd.getNegotiation().getNegotiatorUserName()));
}
}
/**
*
* This method returns the NegotiationAssociatedDetailBean. If it hasn't been set, it does so.
* @return
*/
public NegotiationAssociatedDetailBean getNegotiationAssociatedDetailBean() {
Negotiation negotiation = getNegotiationDocument().getNegotiation();
if (negotiationAssociatedDetailBean == null || !StringUtils.equals(negotiationAssociatedDetailBean.getAssociatedDocumentId(), negotiation.getAssociatedDocumentId())) {
this.negotiationAssociatedDetailBean = getNegotiationService().buildNegotiationAssociatedDetailBean(negotiation);
}
return negotiationAssociatedDetailBean;
}
/**
*
* This method builds the javascript the disables and enables the ending date field based on the status field.
* @return
*/
public String getStatusRelatedJavascript() {
StringBuffer sb = new StringBuffer(100);
String newLine = "\n ";
sb.append("function manageStatusEndDate(doUpdateDate){").append(newLine);
sb.append("var statusField = document.getElementById('document.negotiationList[0].negotiationStatusId');").append(newLine);
sb.append("var dateField = document.getElementById('document.negotiationList[0].negotiationEndDate');").append(newLine);
sb.append("var statusFieldSelectedVal = statusField.options[statusField.selectedIndex].value;").append(newLine);
sb.append("var dateFieldPicker = document.getElementById('document.negotiationList[0].negotiationEndDate_datepicker');").append(newLine);
sb.append("if (");
int currentIndex = 0;
List<String> completedCodes = this.getNegotiationService().getCompletedStatusCodes();
for (String currentCode : completedCodes) {
NegotiationStatus currentStatus = getNegotiationStatus(currentCode);
sb.append("statusFieldSelectedVal == '").append(currentStatus.getId().toString()).append("'");
if (currentIndex + 1 < completedCodes.size()) {
sb.append(" || ");
}
currentIndex++;
}
sb.append(") {").append(newLine);
sb.append(" dateField.disabled = false;").append(newLine);
sb.append(" if (dateField.value == '' && doUpdateDate) {").append(newLine);
sb.append(" var currentTime = new Date();").append(newLine);
sb.append(" dateField.value = currentTime.getMonth() + 1 + \"/\" + currentTime.getDate() + \"/\" + currentTime.getFullYear();").append(newLine);
sb.append(" dateFieldPicker.style.display='inline';").append(newLine);
sb.append(" }").append(newLine).append("} else {").append(newLine);
sb.append(" dateField.disabled = true;").append(newLine).append(" dateField.value = '';").append(newLine);
sb.append(" dateFieldPicker.style.display='none';").append(newLine);
sb.append("}").append(newLine).append("}").append(newLine);
sb.append("manageStatusEndDate(false);");
return sb.toString();
}
private NegotiationStatus getNegotiationStatus(String code) {
return getNegotiationService().getNegotiationStatus(code);
}
public MedusaBean getMedusaBean() {
return medusaBean;
}
public void setMedusaBean(MedusaBean medusaBean) {
this.medusaBean = medusaBean;
}
public String getFilterActivities() {
return filterActivities;
}
public void setFilterActivities(String filterActivities) {
this.filterActivities = filterActivities;
}
/**
*
* This method calls the negotiation service and return the results of the getNegotiationActivityHistoryLineBeans function.
* @return
*/
public List<NegotiationActivityHistoryLineBean> getNegotiationActivityHistoryLineBeans() {
return this.getNegotiationService().getNegotiationActivityHistoryLineBeans(this.getNegotiationDocument().getNegotiation().getActivities());
}
/**
*
* This method calls the negotiation service and return the results of the getNegotiationNotifications function.
* @return
*/
public List<NegotiationNotification> getNegotiationNotifications() {
return this.getNegotiationService().getNegotiationNotifications(this.getNegotiationDocument().getNegotiation());
}
public NotificationHelper<NegotiationCloseNotificationContext> getNotificationHelper() {
return notificationHelper;
}
public void setNotificationHelper(NotificationHelper<NegotiationCloseNotificationContext> notificationHelper) {
this.notificationHelper = notificationHelper;
}
public String getFilterAllActivities() {
return filterAllActivities;
}
public String getFilterPendingActivities() {
return filterPendingActivities;
}
/**
*
* This method returns true if the negotiable select icon's need a div tag surrounding it,to generate a javascript warning.
* @return
*/
public boolean getDispayChangeAssociatedDocumentWarning() {
boolean retVal = !StringUtils.isEmpty(this.getNegotiationDocument().getNegotiation().getAssociatedDocumentId());
return retVal;
}
/**
*
* This method creates creates the opening div tag for the warning javascript message.
* @return
*/
public String getDispayChangeAssociatedDocumentWarningMessage() {
if (getDispayChangeAssociatedDocumentWarning() && this.getNegotiationDocument().getNegotiation().getNegotiationAssociationType() != null) {
StringBuffer sb = new StringBuffer("<div id=\"searchIconDiv\" style=\"display: inline;\" onclick=\"return confirm('");
String associatedType = this.getNegotiationDocument().getNegotiation().getNegotiationAssociationType().getDescription();
String docNumber = this.getNegotiationDocument().getNegotiation().getAssociatedNegotiable().getAssociatedDocumentId();
sb.append("This Negotiation is already associated with ").append(associatedType).append(" number ").append(docNumber);
sb.append(". Selecting a different ").append(associatedType).append(" document will disassociate this Negotiation with ");
sb.append(docNumber).append(". Are you sure?").append("')\">");
return sb.toString();
} else {
return "";
}
}
public String getShortUrl() {
return getBaseShortUrl() + "/kc-common/negotiations/" + getNegotiationDocument().getNegotiation().getNegotiationId();
}
}
| agpl-3.0 |
aihua/opennms | opennms-dao/src/test/java/org/opennms/netmgt/dao/PathOutageDaoIT.java | 8238 | /*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2006-2014 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.dao;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.opennms.core.utils.InetAddressUtils.addr;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.opennms.core.spring.BeanUtils;
import org.opennms.core.test.OpenNMSJUnit4ClassRunner;
import org.opennms.core.test.db.annotations.JUnitTemporaryDatabase;
import org.opennms.netmgt.dao.api.MonitoringLocationDao;
import org.opennms.netmgt.dao.api.NodeDao;
import org.opennms.netmgt.dao.api.PathOutageDao;
import org.opennms.netmgt.dao.api.ServiceTypeDao;
import org.opennms.netmgt.model.OnmsIpInterface;
import org.opennms.netmgt.model.OnmsMonitoredService;
import org.opennms.netmgt.model.OnmsNode;
import org.opennms.netmgt.model.OnmsPathOutage;
import org.opennms.netmgt.model.OnmsServiceType;
import org.opennms.test.JUnitConfigurationEnvironment;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
/**
* @author mhuot
*
*/
@RunWith(OpenNMSJUnit4ClassRunner.class)
@ContextConfiguration(locations={
"classpath:/META-INF/opennms/applicationContext-soa.xml",
"classpath:/META-INF/opennms/applicationContext-commonConfigs.xml",
"classpath:/META-INF/opennms/applicationContext-minimal-conf.xml",
"classpath:/META-INF/opennms/applicationContext-dao.xml",
"classpath:/META-INF/opennms/applicationContext-databasePopulator.xml",
"classpath*:/META-INF/opennms/component-dao.xml"
})
@JUnitConfigurationEnvironment
@JUnitTemporaryDatabase
public class PathOutageDaoIT implements InitializingBean {
@Autowired
private MonitoringLocationDao m_locationDao;
@Autowired
private NodeDao m_nodeDao;
@Autowired
private PathOutageDao m_pathOutageDao;
@Autowired
private ServiceTypeDao m_serviceTypeDao;
@Autowired
TransactionTemplate m_transTemplate;
@Override
public void afterPropertiesSet() throws Exception {
BeanUtils.assertAutowiring(this);
}
@Before
public void setUp() throws Exception {
m_transTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
public void doInTransactionWithoutResult(TransactionStatus status) {
OnmsServiceType t = new OnmsServiceType("ICMP");
m_serviceTypeDao.save(t);
}
});
}
@Test
@Transactional
public void testSave() {
final OnmsServiceType serviceType = m_serviceTypeDao.findByName("ICMP");
assertNotNull(serviceType);
// This will be our router with one IP address
OnmsNode router = new OnmsNode(m_locationDao.getDefaultLocation(), "router");
m_nodeDao.save(router);
OnmsIpInterface routerIpInterface = new OnmsIpInterface(addr("172.16.1.1"), router);
routerIpInterface.setIsManaged("M");
OnmsMonitoredService routerService = new OnmsMonitoredService(routerIpInterface, serviceType);
routerService.setStatus("A");
// Add a node that will be routed through the router
OnmsNode node = new OnmsNode(m_locationDao.getDefaultLocation(), "localhost");
m_nodeDao.save(node);
OnmsIpInterface nodeIpInterface = new OnmsIpInterface(addr("172.16.1.2"), node);
nodeIpInterface.setIsManaged("M");
OnmsMonitoredService nodeMonitoredService = new OnmsMonitoredService(nodeIpInterface, serviceType);
nodeMonitoredService.setStatus("A");
// Make another node with an interface that is initially marked as deleted
OnmsNode newNode = new OnmsNode(m_locationDao.getDefaultLocation(), "newnode");
m_nodeDao.save(newNode);
OnmsIpInterface newIpInterface = new OnmsIpInterface(addr("172.16.1.3"), newNode);
newIpInterface.setIsManaged("D");
OnmsMonitoredService newMonitoredService = new OnmsMonitoredService(newIpInterface, serviceType);
newMonitoredService.setStatus("A");
OnmsPathOutage outage = new OnmsPathOutage(node, routerIpInterface.getIpAddress(), routerService.getServiceName());
m_pathOutageDao.save(outage);
//it works we're so smart! hehe
OnmsPathOutage temp = m_pathOutageDao.get(outage.getNode().getId());
assertEquals(1, m_pathOutageDao.countAll());
// Make sure that the path outage points from the node to the router interface/service
assertEquals(node.getLabel(), temp.getNode().getLabel());
assertEquals(routerIpInterface.getIpAddress(), temp.getCriticalPathIp());
assertEquals(routerService.getServiceName(), temp.getCriticalPathServiceName());
List<Integer> nodes = m_pathOutageDao.getNodesForPathOutage(temp);
assertEquals(1, nodes.size());
assertEquals(node.getId(), nodes.get(0));
nodes = m_pathOutageDao.getNodesForPathOutage(routerIpInterface.getIpAddress(), routerService.getServiceName());
assertEquals(1, nodes.size());
assertEquals(node.getId(), nodes.get(0));
// Make sure that nothing is using either node as a path outage
nodes = m_pathOutageDao.getNodesForPathOutage(nodeIpInterface.getIpAddress(), nodeMonitoredService.getServiceName());
assertEquals(0, nodes.size());
nodes = m_pathOutageDao.getNodesForPathOutage(newIpInterface.getIpAddress(), newMonitoredService.getServiceName());
assertEquals(0, nodes.size());
assertEquals(1, m_pathOutageDao.countAll());
OnmsPathOutage newOutage = new OnmsPathOutage(newNode, routerIpInterface.getIpAddress(), routerService.getServiceName());
m_pathOutageDao.save(newOutage);
assertEquals(2, m_pathOutageDao.countAll());
// Should return zero results because the interface is marked as 'D' for deleted
nodes = m_pathOutageDao.getNodesForPathOutage(routerIpInterface.getIpAddress(), routerService.getServiceName());
assertEquals(2, nodes.size());
nodes = m_pathOutageDao.getAllNodesDependentOnAnyServiceOnInterface(routerIpInterface.getIpAddress());
assertEquals(2, nodes.size());
// After we mark it as managed, the node should appear in the path outage list
newIpInterface.setIsManaged("M");
nodes = m_pathOutageDao.getNodesForPathOutage(routerIpInterface.getIpAddress(), routerService.getServiceName());
assertEquals(2, nodes.size());
assertTrue(nodes.contains(node.getId()));
assertTrue(nodes.contains(newNode.getId()));
assertEquals(2, m_pathOutageDao.countAll());
}
}
| agpl-3.0 |
tdefilip/opennms | opennms-services/src/main/java/org/opennms/netmgt/linkd/snmp/IpCidrRouteTableEntry.java | 10182 | /*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2010-2014 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2014 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.linkd.snmp;
import org.opennms.netmgt.snmp.NamedSnmpVar;
/**
*<p>The {@link IpCidrRouteTableEntry} class is designed to hold all the MIB-II
* information for one entry in the ipRouteTable. The table effectively
* contains a list of these entries, each entry having information
* about IP route. The entry contains:</p>
* <ul>
* <li>ipRouteDest</li>
* <li>ipRouteIfIndex</li>
* <li>ipRouteMetric1</li>
* <li>ipRouteMetric2</li>
* <li>ipRouteMetric3</li>
* <li>ipRouteMetric4</li>
* <li>ipRouteNextHop</li>
* <li>ipRouteType</li>
* <li>ipRouteProto</li>
* <li>ipRouteAge</li>
* <li>ipRouteMask</li>
* <li>ipRouteMetric5</li>
* <li>ipRouteInfo</li>
* </ul>
*
* <p>This object is used by the {@link InetCidrRouteTable} to hold information
* single entries in the table. See {@link InetCidrRouteTable}
* for more information.</p>
*
* @author <A HREF="mailto:rssntn67@yahoo.it">Antonio</A>
*
*
* @see InetCidrRouteTable
* @see <A HREF="http://www.ietf.org/rfc/rfc1213.txt">RFC1213</A>
*/
public final class IpCidrRouteTableEntry extends IpRouteCollectorEntry
{
/**
* <P>The TABLE_OID is the object identifier that represents
* the root of the IP ROUTE table in the MIB forest.</P>
*/
public static final String TABLE_OID = ".1.3.6.1.2.1.4.24.4.1"; // start of table (GETNEXT)
/**
* <P>The keys that will be supported by default from the
* TreeMap base class. Each of the elements in the list
* are an instance of the IpCidrRoutetable. Objects
* in this list should be used by multiple instances of
* this class.</P>
*/
public static NamedSnmpVar[] ms_elemList = new NamedSnmpVar[] {
/** The destination IP address of this route. An
* entry with a value of 0.0.0.0 is considered a
* default route. Multiple routes to a single
* destination can appear in the table, but access to
* such multiple entries is dependent on the table-
* access mechanisms defined by the network
* management protocol in use.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPIPADDRESS, IP_ROUTE_DEST, TABLE_OID + ".1", 1),
/**
* The index value which uniquely identifies the
* local interface through which the next hop of this
* route should be reached. The interface identified
* by a particular value of this index is the same
* interface as identified by the same value of
* ifIndex.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_IFINDEX, TABLE_OID + ".5", 2),
/**
* The primary routing metric for this route. The
* semantics of this metric are determined by the
* routing-protocol specified in the route's
* ipRouteProto value. If this metric is not used,
* its value should be set to -1.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_METRIC1, TABLE_OID + ".11", 3),
/**
* An alternate routing metric for this route. The
* semantics of this metric are determined by the
* routing-protocol specified in the route's
* ipRouteProto value. If this metric is not used,
* its value should be set to -1.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_METRIC2, TABLE_OID + ".12", 4),
/**
* An alternate routing metric for this route. The
* semantics of this metric are determined by the
* routing-protocol specified in the route's
* ipRouteProto value. If this metric is not used,
* its value should be set to -1.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_METRIC3, TABLE_OID + ".13", 5),
/**
* An alternate routing metric for this route. The
* semantics of this metric are determined by the
* routing-protocol specified in the route's
* ipRouteProto value. If this metric is not used,
* its value should be set to -1.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_METRIC4, TABLE_OID + ".14", 6),
/**
* The IP address of the next hop of this route.
* (In the case of a route bound to an interface
* which is realized via a broadcast media, the value
* of this field is the agent's IP address on that
* interface.)
*/
new NamedSnmpVar(NamedSnmpVar.SNMPIPADDRESS, IP_ROUTE_NXTHOP, TABLE_OID + ".4", 7),
/**
* The type of route. Note that the values
* direct(3) and indirect(4) refer to the notion of
* direct and indirect routing in the IP
* architecture.
* Setting this object to the value invalid(2) has
* the effect of invalidating the corresponding entry
* in the ipRouteTable object. That is, it
* effectively disassociates the destination
* identified with said entry from the route
* identified with said entry. It is an
* implementation-specific matter as to whether the
* agent removes an invalidated entry from the table.
* Accordingly, management stations must be prepared
* to receive tabular information from agents that
* corresponds to entries not currently in use.
* Proper interpretation of such entries requires
* examination of the relevant ipRouteType object.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_TYPE, TABLE_OID + ".6", 8),
/**
* The routing mechanism via which this route was
* learned. Inclusion of values for gateway routing
* protocols is not intended to imply that hosts
* should support those protocols.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_PROTO, TABLE_OID + ".7", 9),
/**
* The number of seconds since this route was last
* updated or otherwise determined to be correct.
* Note that no semantics of `too old' can be implied
* except through knowledge of the routing protocol
* by which the route was learned.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_AGE, TABLE_OID + ".8", 10),
/**
* Indicate the mask to be logical-ANDed with the
* destination address before being compared to the
* value in the ipRouteDest field. For those systems
* that do not support arbitrary subnet masks, an
* agent constructs the value of the ipRouteMask by
* determining whether the value of the correspondent
* ipRouteDest field belong to a class-A, B, or C
* network, and then using one of:
* mask network
* 255.0.0.0 class-A
* 255.255.0.0 class-B
* 255.255.255.0 class-C
* If the value of the ipRouteDest is 0.0.0.0 (a
* default route), then the mask value is also
* 0.0.0.0. It should be noted that all IP routing
* subsystems implicitly use this mechanism.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPIPADDRESS, IP_ROUTE_MASK, TABLE_OID + ".2", 11),
/**
* An alternate routing metric for this route. The
* semantics of this metric are determined by the
* routing-protocol specified in the route's
* ipRouteProto value. If this metric is not used,
* its value should be set to -1.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPINT32, IP_ROUTE_METRIC5, TABLE_OID + ".15", 12),
/**
* A reference to MIB definitions specific to the
* particular routing protocol which is responsible
* for this route, as determined by the value
* specified in the route's ipRouteProto value. If
* this information is not present, its value should
* be set to the OBJECT IDENTIFIER { 0 0 }, which is
* a syntactically valid object identifier, and any
* conformant implementation of ASN.1 and BER must be
* able to generate and recognize this value.
*/
new NamedSnmpVar(NamedSnmpVar.SNMPOBJECTID, IP_ROUTE_INFO, TABLE_OID + ".9", 13),
new NamedSnmpVar(NamedSnmpVar.SNMPOBJECTID, IP_ROUTE_STATUS, TABLE_OID + ".16", 14),
};
/**
* <P>Creates a default instance of the ipROUTE
* table entry map. The map represents a singular
* instance of the routing table. Each column in
* the table for the loaded instance may be retreived
* either through its name or object identifier.</P>
*
* <P>The initial table is constructied with zero
* elements in the map.</P>
*/
public IpCidrRouteTableEntry( )
{
super(ms_elemList);
}
}
| agpl-3.0 |
jessec/webdav-mongodb-server | src/main/java/com/bradmcevoy/http/values/CData.java | 327 | package com.bradmcevoy.http.values;
/**
* A type of value which will be written into a CDATA section by its
* ValueWriter
*
* @author brad
*/
public class CData {
private final String data;
public CData( String data ) {
this.data = data;
}
public String getData() {
return data;
}
}
| agpl-3.0 |
alvin-reyes/abixen-platform | abixen-platform-core/src/main/java/com/abixen/platform/core/service/impl/PageServiceImpl.java | 4929 | /**
* Copyright (c) 2010-present Abixen Systems. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.abixen.platform.core.service.impl;
import com.abixen.platform.core.form.PageForm;
import com.abixen.platform.core.model.enumtype.PermissionName;
import com.abixen.platform.core.model.impl.Module;
import com.abixen.platform.core.model.impl.Page;
import com.abixen.platform.core.repository.ModuleRepository;
import com.abixen.platform.core.repository.PageRepository;
import com.abixen.platform.core.service.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.prepost.PostAuthorize;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Transactional
@Service
public class PageServiceImpl implements PageService {
private static Logger log = Logger.getLogger(PageServiceImpl.class.getName());
@Resource
private PageRepository pageRepository;
@Resource
private ModuleRepository moduleRepository;
@Autowired
private AclService aclService;
@Autowired
private DomainBuilderService domainBuilderService;
@Autowired
private LayoutService layoutService;
@Autowired
private ModuleService moduleService;
@Override
public Page buildPage(PageForm pageForm) {
log.debug("buildPage() - pageForm: " + pageForm);
return domainBuilderService.newPageBuilderInstance()
.init(pageForm.getTitle(), layoutService.findLayout(pageForm.getLayout().getId()))
.description(pageForm.getDescription())
.build();
}
@PreAuthorize("hasPermission(null, 'com.abixen.platform.core.model.impl.Page', 'PAGE_ADD')")
@Override
public Page createPage(Page page) {
log.debug("createPage() - page: " + page);
Page createdPage = pageRepository.save(page);
aclService.insertDefaultAcl(createdPage, new ArrayList<PermissionName>() {
{
add(PermissionName.PAGE_VIEW);
add(PermissionName.PAGE_EDIT);
add(PermissionName.PAGE_DELETE);
add(PermissionName.PAGE_CONFIGURATION);
add(PermissionName.PAGE_PERMISSION);
}
});
return createdPage;
}
@PreAuthorize("hasPermission(null, 'com.abixen.platform.core.model.impl.Page', 'PAGE_ADD')")
@Override
public PageForm createPage(PageForm pageForm) {
log.debug("updatePage() - pageForm: " + pageForm);
Page page = buildPage(pageForm);
return new PageForm(createPage(page));
}
@Override
public PageForm updatePage(PageForm pageForm) {
log.debug("updatePage() - pageForm: " + pageForm);
Page page = findPage(pageForm.getId());
page.setTitle(pageForm.getTitle());
page.setDescription(pageForm.getDescription());
page.setLayout(layoutService.findLayout(pageForm.getLayout().getId()));
return new PageForm(updatePage(page));
}
@PreAuthorize("hasPermission(#page, 'PAGE_EDIT')")
@Override
public Page updatePage(Page page) {
log.debug("updatePage() - page: " + page);
return pageRepository.saveAndFlush(page);
}
//TODO
//@PreAuthorize("hasPermission(#page, 'PAGE_DELETE')")
@Override
@Transactional
public void deletePage(Long id) {
log.debug("deletePage() - id: " + id);
List<Module> pageModules = moduleService.findAllByPage(pageRepository.findOne(id));
moduleRepository.deleteInBatch(pageModules);
pageRepository.delete(id);
}
@Override
public org.springframework.data.domain.Page<Page> findAllPages(Pageable pageable) {
log.debug("findAllPages() - pageable: " + pageable);
return pageRepository.findAll(pageable);
}
@Override
public List<Page> findAllPages() {
log.debug("findAllPages()");
return pageRepository.findAll();
}
@PostAuthorize("hasPermission(returnObject, 'PAGE_VIEW')")
@Override
public Page findPage(Long id) {
log.debug("findPage() - id: " + id);
return pageRepository.findOne(id);
}
} | lgpl-2.1 |
ACS-Community/ACS | LGPL/CommonSoftware/jcont/test/alma/jconttest/DummyComponentImpl/DummyComponentHelper.java | 2867 | /*
* ALMA - Atacama Large Millimiter Array
* (c) European Southern Observatory, 2002
* Copyright by ESO (in the framework of the ALMA collaboration),
* All rights reserved
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
package alma.jconttest.DummyComponentImpl;
import java.util.logging.Logger;
import alma.acs.component.ComponentLifecycle;
import alma.acs.container.ComponentHelper;
import alma.jconttest.DummyComponentOperations;
import alma.jconttest.DummyComponentPOATie;
import alma.jconttest.DummyComponentImpl.DummyComponentImpl;
/**
* Component helper class.
* Generated for convenience, but can be modified by the component developer.
* Must therefore be treated like any other Java class (CVS, ...).
* <p>
* To create an entry for your component in the Configuration Database,
* copy the line below into a new entry in the file $ACS_CDB/MACI/Components/Components.xml
* and modify the instance name of the component and the container:
* <p>
* Name="DUMMYCOMPONENT1" Code="alma.jconttest.DummyComponentImpl.DummyComponentHelper" Type="IDL:alma/jconttest/DummyComponent:1.0" Container="frodoContainer"
* <p>
* @author alma-component-helper-generator-tool
*/
public class DummyComponentHelper extends ComponentHelper
{
// todo maybe this should be generated by comphelpgen?
public static final String DUMMYCOMPONENT_CORBATYPE = "IDL:alma/jconttest/DummyComponent:1.0";
/**
* Constructor
* @param containerLogger logger used only by the parent class.
*/
public DummyComponentHelper(Logger containerLogger)
{
super(containerLogger);
}
/**
* @see alma.acs.container.ComponentHelper#_createComponentImpl()
*/
protected ComponentLifecycle _createComponentImpl()
{
return new DummyComponentImpl();
}
/**
* @see alma.acs.container.ComponentHelper#_getPOATieClass()
*/
protected Class<DummyComponentPOATie> _getPOATieClass()
{
return DummyComponentPOATie.class;
}
/**
* @see alma.acs.container.ComponentHelper#getOperationsInterface()
*/
protected Class<DummyComponentOperations> _getOperationsInterface()
{
return DummyComponentOperations.class;
}
}
| lgpl-2.1 |
qynnine/JDiffOriginDemo | examples/iTrust_v11/edu/ncsu/csc/itrust/validate/SecurityQAValidator.java | 1615 | package edu.ncsu.csc.itrust.validate;
import edu.ncsu.csc.itrust.action.SetSecurityQuestionAction;
import edu.ncsu.csc.itrust.beans.SecurityQA;
import edu.ncsu.csc.itrust.exception.ErrorList;
import edu.ncsu.csc.itrust.exception.FormValidationException;
/**
* Validates the security question and answer. This doesn't follow the same format as the others because this
* validator is used for the various states of reset password, {@link SetSecurityQuestionAction}
*
* @author Andy
*
*/
public class SecurityQAValidator extends BeanValidator<SecurityQA> {
/**
* Performs the act of validating the bean in question, which varies depending on the
* type of validator. If the validation does not succeed, a {@link FormValidationException} is thrown.
*
* @param p A bean of the type to be validated.
*/
@Override
public void validate(SecurityQA bean) throws FormValidationException {
ErrorList errorList = new ErrorList();
if (null == bean)
throw new FormValidationException("Null form");
if (null == bean.getConfirmAnswer())
throw new FormValidationException("Confirm answer cannot be empty");
if (!bean.getAnswer().equals(bean.getConfirmAnswer()))
throw new FormValidationException("Security answers do not match");
errorList.addIfNotNull(checkFormat("Security Question", bean.getQuestion(),
ValidationFormat.QUESTION, false));
errorList.addIfNotNull(checkFormat("Security Answer", bean.getAnswer(), ValidationFormat.ANSWER,
false));
if (errorList.hasErrors())
throw new FormValidationException(errorList);
}
}
| lgpl-2.1 |
Decentrify/NatTraversal_Old | network/netty/src/main/java/se/sics/gvod/common/msgs/DisconnectMsg.java | 2791 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package se.sics.gvod.common.msgs;
import io.netty.buffer.ByteBuf;
import se.sics.gvod.net.BaseMsgFrameDecoder;
import se.sics.gvod.net.VodAddress;
import se.sics.gvod.net.msgs.RewriteableMsg;
import se.sics.gvod.net.msgs.RewriteableRetryTimeout;
import se.sics.gvod.net.msgs.ScheduleRetryTimeout;
import se.sics.gvod.net.util.UserTypesEncoderFactory;
import se.sics.gvod.timer.TimeoutId;
/**
*
* @author jdowling
*/
public class DisconnectMsg {
public static class Request extends DirectMsgNetty.Request {
public Request(VodAddress source, VodAddress destination) {
super(source, destination);
}
@Override
public byte getOpcode() {
return BaseMsgFrameDecoder.DISCONNECT_REQUEST;
}
@Override
public int getSize() {
return super.getHeaderSize()
;
}
@Override
public ByteBuf toByteArray() throws MessageEncodingException {
ByteBuf buf = createChannelBufferWithHeader();
return buf;
}
@Override
public RewriteableMsg copy() {
Request r = new Request(vodSrc, vodDest);
r.setTimeoutId(timeoutId);
return r;
}
}
public static class Response extends DirectMsgNetty.Response {
private final int ref;
public Response(VodAddress source, VodAddress destination, TimeoutId timeoutId, int ref) {
super(source, destination, timeoutId);
this.ref = ref;
}
public int getRef() {
return ref;
}
@Override
public byte getOpcode() {
return BaseMsgFrameDecoder.DISCONNECT_RESPONSE;
}
@Override
public int getSize() {
return super.getHeaderSize()
+ 2 /* refs */;
}
@Override
public ByteBuf toByteArray() throws MessageEncodingException {
ByteBuf buffer = createChannelBufferWithHeader();
UserTypesEncoderFactory.writeUnsignedintAsTwoBytes(buffer, ref);
return buffer;
}
@Override
public RewriteableMsg copy() {
return new Response(vodSrc, vodDest, timeoutId, ref);
}
}
public static class RequestTimeout extends RewriteableRetryTimeout {
private final VodAddress peer;
public RequestTimeout(ScheduleRetryTimeout request, Request requestMsg) {
super(request, requestMsg, requestMsg.getVodSource().getOverlayId());
this.peer = requestMsg.getVodDestination();
}
public VodAddress getPeer() {
return peer;
}
}
}
| lgpl-3.0 |
xautlx/s2jh | common-service/src/main/java/lab/s2jh/profile/web/action/SimpleParamValController.java | 2414 | package lab.s2jh.profile.web.action;
import java.util.List;
import java.util.Map;
import lab.s2jh.auth.entity.User;
import lab.s2jh.auth.security.AuthUserHolder;
import lab.s2jh.core.annotation.MetaData;
import lab.s2jh.core.service.BaseService;
import lab.s2jh.core.web.annotation.SecurityControlIgnore;
import lab.s2jh.core.web.view.OperationResult;
import lab.s2jh.profile.entity.SimpleParamVal;
import lab.s2jh.profile.service.SimpleParamValService;
import lab.s2jh.web.action.BaseController;
import org.apache.struts2.rest.HttpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import com.google.common.collect.Maps;
@MetaData("个性化配置参数数据管理")
public class SimpleParamValController extends BaseController<SimpleParamVal, String> {
@Autowired
private SimpleParamValService simpleParamValService;
@Override
protected BaseService<SimpleParamVal, String> getEntityService() {
return simpleParamValService;
}
@Override
protected void checkEntityAclPermission(SimpleParamVal entity) {
// TODO Add acl check code logic
}
@Override
@MetaData("保存")
public HttpHeaders doSave() {
String[] codes = getRequiredParameter("codes").split(",");
User user = AuthUserHolder.getLogonUser();
for (String code : codes) {
SimpleParamVal entity = simpleParamValService.findByUserAndCode(user, code);
if (entity == null) {
entity = new SimpleParamVal();
entity.setUser(user);
}
entity.setCode(code);
entity.setValue(getRequiredParameter(code));
getEntityService().save(entity);
}
setModel(OperationResult.buildSuccessResult("参数默认值设定成功"));
return buildDefaultHttpHeaders();
}
@MetaData("参数列表")
@SecurityControlIgnore
public HttpHeaders params() {
User user = AuthUserHolder.getLogonUser();
Map<String, String> datas = Maps.newHashMap();
List<SimpleParamVal> simpleParams = simpleParamValService.findByUser(user);
for (SimpleParamVal simpleParamVal : simpleParams) {
datas.put(simpleParamVal.getCode(), simpleParamVal.getValue());
}
setModel(datas);
return buildDefaultHttpHeaders();
}
} | lgpl-3.0 |
joerivandervelde/molgenis | molgenis-security/src/test/java/org/molgenis/security/login/MolgenisLoginControllerTest.java | 2334 | package org.molgenis.security.login;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import org.molgenis.security.login.MolgenisLoginControllerTest.Config;
import org.molgenis.util.GsonConfig;
import org.molgenis.util.GsonHttpMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@WebAppConfiguration
@ContextConfiguration(classes =
{ Config.class, GsonConfig.class })
public class MolgenisLoginControllerTest extends AbstractTestNGSpringContextTests
{
@Autowired
private MolgenisLoginController molgenisLoginController;
@Autowired
private GsonHttpMessageConverter gsonHttpMessageConverter;
private MockMvc mockMvc;
@BeforeMethod
public void setUp()
{
mockMvc = MockMvcBuilders.standaloneSetup(molgenisLoginController)
.setMessageConverters(gsonHttpMessageConverter).build();
}
@Test
public void getLoginPage() throws Exception
{
this.mockMvc.perform(get("/login")).andExpect(status().isOk()).andExpect(view().name("view-login"));
}
@Test
public void getLoginErrorPage() throws Exception
{
this.mockMvc.perform(get("/login").param("error", "")).andExpect(status().isOk())
.andExpect(view().name("view-login")).andExpect(model().attributeExists("errorMessage"));
}
@Configuration
public static class Config extends WebMvcConfigurerAdapter
{
@Bean
public MolgenisLoginController molgenisLoginController()
{
return new MolgenisLoginController();
}
}
}
| lgpl-3.0 |
xpqiu/fnlp | fnlp-train/src/main/java/org/fnlp/train/parsing/DepRun.java | 1925 | package org.fnlp.train.parsing;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import org.fnlp.ml.eval.SeqEval;
import org.fnlp.nlp.corpus.fnlp.FNLPCorpus;
import org.fnlp.nlp.parser.dep.train.JointParerTester;
import org.fnlp.nlp.parser.dep.train.JointParerTrainer;
import org.fnlp.train.seg.SegTrain;
import org.fnlp.train.tag.ModelOptimization;
import org.fnlp.util.exception.LoadModelException;
public class DepRun {
static String datapath = "../data";
static String outputPath = "../data/FNLPDATA/dep-eval.txt";
static String model = "../models/dep.m";
static String trainfile = "../data/FNLPDATA/train.dep";
static String testfile = "../data/FNLPDATA/test.dep";
static String output = "../data/FNLPDATA/res.dep.3col";
static PrintWriter bw;
public static void main(String[] args) throws Exception {
bw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(outputPath,true), "utf8"));
JointParerTrainer trainer = new JointParerTrainer(model);
int maxite = 25;
float c = 0.01f;
trainer.train(trainfile, maxite, c);
eval();
bw.println("优化");
float thres = 1.0E-3f;
bw.println(thres);
ModelOptimization op = new ModelOptimization(thres);
op.optimizeDep(model);
eval();
/////////////////////////////////////////
bw.println("优化");
thres = 1.0E-2f;
bw.println(thres);
op = new ModelOptimization(thres);
op.optimizeDep(model);
eval();
bw.close();
}
private static void eval() throws Exception{
File modelF = new File(model);
bw.println("模型大小:"+modelF.length()/1000000.0);
JointParerTester tester = new JointParerTester(model);
tester.test(testfile, output, "UTF8");
}
}
| lgpl-3.0 |
lenicliu/spring-boot | spring-boot-samples/spring-boot-sample-test/src/main/java/sample/test/service/ServiceProperties.java | 1199 | /*
* Copyright 2012-2016 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 sample.test.service;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* Properties for the service.
*
* @author Phillip Webb
*/
@Component
@ConfigurationProperties
public class ServiceProperties {
private String vehicleServiceRootUrl = "http://localhost:8080/vs/";
public String getVehicleServiceRootUrl() {
return this.vehicleServiceRootUrl;
}
public void setVehicleServiceRootUrl(String vehicleServiceRootUrl) {
this.vehicleServiceRootUrl = vehicleServiceRootUrl;
}
}
| apache-2.0 |
googleapis/google-api-java-client-services | clients/google-api-services-dlp/v2/1.29.2/com/google/api/services/dlp/v2/model/GooglePrivacyDlpV2CharsToIgnore.java | 2814 | /*
* 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://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.dlp.v2.model;
/**
* Characters to skip when doing deidentification of a value. These will be left alone and skipped.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Data Loss Prevention (DLP) API. For a detailed
* explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class GooglePrivacyDlpV2CharsToIgnore extends com.google.api.client.json.GenericJson {
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String charactersToSkip;
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String commonCharactersToIgnore;
/**
* @return value or {@code null} for none
*/
public java.lang.String getCharactersToSkip() {
return charactersToSkip;
}
/**
* @param charactersToSkip charactersToSkip or {@code null} for none
*/
public GooglePrivacyDlpV2CharsToIgnore setCharactersToSkip(java.lang.String charactersToSkip) {
this.charactersToSkip = charactersToSkip;
return this;
}
/**
* @return value or {@code null} for none
*/
public java.lang.String getCommonCharactersToIgnore() {
return commonCharactersToIgnore;
}
/**
* @param commonCharactersToIgnore commonCharactersToIgnore or {@code null} for none
*/
public GooglePrivacyDlpV2CharsToIgnore setCommonCharactersToIgnore(java.lang.String commonCharactersToIgnore) {
this.commonCharactersToIgnore = commonCharactersToIgnore;
return this;
}
@Override
public GooglePrivacyDlpV2CharsToIgnore set(String fieldName, Object value) {
return (GooglePrivacyDlpV2CharsToIgnore) super.set(fieldName, value);
}
@Override
public GooglePrivacyDlpV2CharsToIgnore clone() {
return (GooglePrivacyDlpV2CharsToIgnore) super.clone();
}
}
| apache-2.0 |
timgifford/tiles | tiles-servlet/src/main/java/org/apache/tiles/web/util/ServletContextAdapter.java | 6046 | /*
* $Id$
*
* 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.tiles.web.util;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Set;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
/**
* Adapts a servlet config and a servlet context to become a unique servlet
* context.
*
* @version $Rev$ $Date$
*/
@SuppressWarnings("deprecation")
public class ServletContextAdapter implements ServletContext {
/**
* The root context to use.
*/
private ServletContext rootContext;
/**
* The union of init parameters of {@link ServletConfig} and
* {@link ServletContext}.
*/
private Hashtable<String, String> initParameters;
/**
* Constructor.
*
* @param config The servlet configuration object.
*/
@SuppressWarnings("unchecked")
public ServletContextAdapter(ServletConfig config) {
this.rootContext = config.getServletContext();
initParameters = new Hashtable<String, String>();
Enumeration<String> enumeration = rootContext
.getInitParameterNames();
while (enumeration.hasMoreElements()) {
String paramName = enumeration.nextElement();
initParameters.put(paramName, rootContext
.getInitParameter(paramName));
}
enumeration = config.getInitParameterNames();
while (enumeration.hasMoreElements()) {
String paramName = enumeration.nextElement();
initParameters.put(paramName, config.getInitParameter(paramName));
}
}
/** {@inheritDoc} */
public ServletContext getContext(String string) {
return rootContext.getContext(string);
}
/** {@inheritDoc} */
public int getMajorVersion() {
return rootContext.getMajorVersion();
}
/** {@inheritDoc} */
public int getMinorVersion() {
return rootContext.getMinorVersion();
}
/** {@inheritDoc} */
public String getMimeType(String string) {
return rootContext.getMimeType(string);
}
/** {@inheritDoc} */
@SuppressWarnings({ "rawtypes" })
public Set getResourcePaths(String string) {
return rootContext.getResourcePaths(string);
}
/** {@inheritDoc} */
public URL getResource(String string) throws MalformedURLException {
return rootContext.getResource(string);
}
/** {@inheritDoc} */
public InputStream getResourceAsStream(String string) {
return rootContext.getResourceAsStream(string);
}
/** {@inheritDoc} */
public RequestDispatcher getRequestDispatcher(String string) {
return rootContext.getRequestDispatcher(string);
}
/** {@inheritDoc} */
public RequestDispatcher getNamedDispatcher(String string) {
return rootContext.getNamedDispatcher(string);
}
/** {@inheritDoc} */
public Servlet getServlet(String string) throws ServletException {
return rootContext.getServlet(string);
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
public Enumeration getServlets() {
return rootContext.getServlets(); //To change body of implemented methods use File | Settings | File Templates.
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
public Enumeration getServletNames() {
return rootContext.getServletNames();
}
/** {@inheritDoc} */
public void log(String string) {
rootContext.log(string);
}
/** {@inheritDoc} */
public void log(Exception exception, String string) {
rootContext.log(exception, string);
}
/** {@inheritDoc} */
public void log(String string, Throwable throwable) {
rootContext.log(string, throwable);
}
/** {@inheritDoc} */
public String getRealPath(String string) {
return rootContext.getRealPath(string);
}
/** {@inheritDoc} */
public String getServerInfo() {
return rootContext.getServerInfo();
}
/** {@inheritDoc} */
public String getInitParameter(String string) {
return initParameters.get(string);
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
public Enumeration getInitParameterNames() {
return initParameters.keys();
}
/** {@inheritDoc} */
public Object getAttribute(String string) {
return rootContext.getAttribute(string);
}
/** {@inheritDoc} */
@SuppressWarnings("rawtypes")
public Enumeration getAttributeNames() {
return rootContext.getAttributeNames();
}
/** {@inheritDoc} */
public void setAttribute(String string, Object object) {
rootContext.setAttribute(string, object);
}
/** {@inheritDoc} */
public void removeAttribute(String string) {
rootContext.removeAttribute(string);
}
/** {@inheritDoc} */
public String getServletContextName() {
return rootContext.getServletContextName();
}
/** {@inheritDoc} */
public String getContextPath() {
return rootContext.getContextPath();
}
}
| apache-2.0 |
foryou2030/incubator-carbondata | core/src/main/java/org/apache/carbondata/scan/filter/resolver/resolverinfo/MeasureColumnResolvedFilterInfo.java | 2704 | /*
* 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.carbondata.scan.filter.resolver.resolverinfo;
import java.io.Serializable;
public class MeasureColumnResolvedFilterInfo implements Serializable {
/**
*
*/
private static final long serialVersionUID = 4222568289115151561L;
private int columnIndex = -1;
private int rowIndex = -1;
private Object uniqueValue;
private String aggregator;
private boolean isMeasureExistsInCurrentSlice = true;
private Object defaultValue;
private org.apache.carbondata.core.carbon.metadata.datatype.DataType type;
public int getColumnIndex() {
return columnIndex;
}
public void setColumnIndex(int columnIndex) {
this.columnIndex = columnIndex;
}
public int getRowIndex() {
return rowIndex;
}
public void setRowIndex(int rowIndex) {
this.rowIndex = rowIndex;
}
public Object getUniqueValue() {
return uniqueValue;
}
public void setUniqueValue(Object uniqueValue) {
this.uniqueValue = uniqueValue;
}
public org.apache.carbondata.core.carbon.metadata.datatype.DataType getType() {
return type;
}
public void setType(org.apache.carbondata.core.carbon.metadata.datatype.DataType dataType) {
this.type = dataType;
}
/**
* @return Returns the aggregator.
*/
public String getAggregator() {
return aggregator;
}
/**
* @param aggregator The aggregator to set.
*/
public void setAggregator(String aggregator) {
this.aggregator = aggregator;
}
public boolean isMeasureExistsInCurrentSlice() {
return isMeasureExistsInCurrentSlice;
}
public void setMeasureExistsInCurrentSlice(boolean isMeasureExistsInCurrentSlice) {
this.isMeasureExistsInCurrentSlice = isMeasureExistsInCurrentSlice;
}
public Object getDefaultValue() {
return defaultValue;
}
public void setDefaultValue(double defaultValue) {
this.defaultValue = defaultValue;
}
}
| apache-2.0 |
apache/wink | wink-itests/wink-itest/wink-itest-targeting/src/main/java/org/apache/wink/itest/transferencoding/TransferEncodingApplication.java | 1197 | /*
* 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.wink.itest.transferencoding;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
public class TransferEncodingApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(ChunkedMirror.class);
return classes;
}
}
| apache-2.0 |
ebr11/ExoPlayer | library/core/src/main/java/com/google/android/exoplayer2/trackselection/RandomTrackSelection.java | 3927 | /*
* Copyright (C) 2016 The Android Open Source 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 com.google.android.exoplayer2.trackselection;
import android.os.SystemClock;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.source.TrackGroup;
import java.util.Random;
/**
* A {@link TrackSelection} whose selected track is updated randomly.
*/
public final class RandomTrackSelection extends BaseTrackSelection {
/**
* Factory for {@link RandomTrackSelection} instances.
*/
public static final class Factory implements TrackSelection.Factory {
private final Random random;
public Factory() {
random = new Random();
}
/**
* @param seed A seed for the {@link Random} instance used by the factory.
*/
public Factory(int seed) {
random = new Random(seed);
}
@Override
public RandomTrackSelection createTrackSelection(TrackGroup group, int... tracks) {
return new RandomTrackSelection(group, tracks, random);
}
}
private final Random random;
private int selectedIndex;
/**
* @param group The {@link TrackGroup}. Must not be null.
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
* null or empty. May be in any order.
*/
public RandomTrackSelection(TrackGroup group, int... tracks) {
super(group, tracks);
random = new Random();
selectedIndex = random.nextInt(length);
}
/**
* @param group The {@link TrackGroup}. Must not be null.
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
* null or empty. May be in any order.
* @param seed A seed for the {@link Random} instance used to update the selected track.
*/
public RandomTrackSelection(TrackGroup group, int[] tracks, long seed) {
this(group, tracks, new Random(seed));
}
/**
* @param group The {@link TrackGroup}. Must not be null.
* @param tracks The indices of the selected tracks within the {@link TrackGroup}. Must not be
* null or empty. May be in any order.
* @param random A source of random numbers.
*/
public RandomTrackSelection(TrackGroup group, int[] tracks, Random random) {
super(group, tracks);
this.random = random;
selectedIndex = random.nextInt(length);
}
@Override
public void updateSelectedTrack(long playbackPositionUs, long bufferedDurationUs,
long availableDurationUs) {
// Count the number of non-blacklisted formats.
long nowMs = SystemClock.elapsedRealtime();
int nonBlacklistedFormatCount = 0;
for (int i = 0; i < length; i++) {
if (!isBlacklisted(i, nowMs)) {
nonBlacklistedFormatCount++;
}
}
selectedIndex = random.nextInt(nonBlacklistedFormatCount);
if (nonBlacklistedFormatCount != length) {
// Adjust the format index to account for blacklisted formats.
nonBlacklistedFormatCount = 0;
for (int i = 0; i < length; i++) {
if (!isBlacklisted(i, nowMs) && selectedIndex == nonBlacklistedFormatCount++) {
selectedIndex = i;
return;
}
}
}
}
@Override
public int getSelectedIndex() {
return selectedIndex;
}
@Override
public int getSelectionReason() {
return C.SELECTION_REASON_ADAPTIVE;
}
@Override
public Object getSelectionData() {
return null;
}
}
| apache-2.0 |
pdxrunner/geode | geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/ComparisonOperatorsJUnitTest.java | 7209 | /*
* 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.
*/
/*
* ComparisonOperatorsJUnitTest.java JUnit based test
*
* Created on March 10, 2005, 3:14 PM
*/
package org.apache.geode.cache.query.functional;
import static org.junit.Assert.fail;
import java.util.Collection;
import java.util.Iterator;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.query.CacheUtils;
import org.apache.geode.cache.query.Query;
import org.apache.geode.cache.query.QueryService;
import org.apache.geode.cache.query.data.Portfolio;
import org.apache.geode.test.junit.categories.OQLQueryTest;
@Category({OQLQueryTest.class})
public class ComparisonOperatorsJUnitTest {
public ComparisonOperatorsJUnitTest() {}
public String getName() {
return this.getClass().getSimpleName();
}
@Before
public void setUp() throws java.lang.Exception {
CacheUtils.startCache();
Region region = CacheUtils.createRegion("Portfolios", Portfolio.class);
region.put("0", new Portfolio(0));
region.put("1", new Portfolio(1));
region.put("2", new Portfolio(2));
region.put("3", new Portfolio(3));
}
@After
public void tearDown() throws java.lang.Exception {
CacheUtils.closeCache();
}
String operators[] = {"=", "<>", "!=", "<", "<=", ">", ">="};
@Test
public void testCompareWithInt() throws Exception {
String var = "ID";
int value = 2;
QueryService qs = CacheUtils.getQueryService();
for (int i = 0; i < operators.length; i++) {
Query query =
qs.newQuery("SELECT DISTINCT * FROM /Portfolios where " + var + operators[i] + value);
Object result = query.execute();
if (result instanceof Collection) {
Iterator iter = ((Collection) result).iterator();
while (iter.hasNext()) {
boolean isPassed = false;
Portfolio p = (Portfolio) iter.next();
switch (i) {
case 0:
isPassed = (p.getID() == value);
break;
case 1:
isPassed = (p.getID() != value);
break;
case 2:
isPassed = (p.getID() != value);
break;
case 3:
isPassed = (p.getID() < value);
break;
case 4:
isPassed = (p.getID() <= value);
break;
case 5:
isPassed = (p.getID() > value);
break;
case 6:
isPassed = (p.getID() >= value);
break;
}
if (!isPassed)
fail(this.getName() + " failed for operator " + operators[i]);
}
} else {
fail(this.getName() + " failed for operator " + operators[i]);
}
}
}
@Test
public void testCompareWithString() throws Exception {
String var = "P1.secId";
String value = "DELL";
QueryService qs = CacheUtils.getQueryService();
for (int i = 0; i < operators.length; i++) {
Query query = qs.newQuery(
"SELECT DISTINCT * FROM /Portfolios where " + var + operators[i] + "'" + value + "'");
Object result = query.execute();
if (result instanceof Collection) {
Iterator iter = ((Collection) result).iterator();
while (iter.hasNext()) {
boolean isPassed = false;
Portfolio p = (Portfolio) iter.next();
switch (i) {
case 0:
isPassed = (p.getP1().getSecId().compareTo(value) == 0);
break;
case 1:
isPassed = (p.getP1().getSecId().compareTo(value) != 0);
break;
case 2:
isPassed = (p.getP1().getSecId().compareTo(value) != 0);
break;
case 3:
isPassed = (p.getP1().getSecId().compareTo(value) < 0);
break;
case 4:
isPassed = (p.getP1().getSecId().compareTo(value) <= 0);
break;
case 5:
isPassed = (p.getP1().getSecId().compareTo(value) > 0);
break;
case 6:
isPassed = (p.getP1().getSecId().compareTo(value) >= 0);
break;
}
if (!isPassed)
fail(this.getName() + " failed for operator " + operators[i]);
}
} else {
fail(this.getName() + " failed for operator " + operators[i]);
}
}
}
@Test
public void testCompareWithNULL() throws Exception {
String var = "P2";
Object value = null;
QueryService qs = CacheUtils.getQueryService();
for (int i = 0; i < operators.length; i++) {
Query query =
qs.newQuery("SELECT DISTINCT * FROM /Portfolios where " + var + operators[i] + value);
Object result = query.execute();
if (result instanceof Collection) {
Iterator iter = ((Collection) result).iterator();
while (iter.hasNext()) {
boolean isPassed = false;
Portfolio p = (Portfolio) iter.next();
switch (i) {
case 0:
isPassed = (p.getP2() == value);
break;
default:
isPassed = (p.getP2() != value);
break;
}
if (!isPassed)
fail(this.getName() + " failed for operator " + operators[i]);
}
} else {
fail(this.getName() + " failed for operator " + operators[i]);
}
}
}
@Test
public void testCompareWithUNDEFINED() throws Exception {
String var = "P2.secId";
QueryService qs = CacheUtils.getQueryService();
for (int i = 0; i < operators.length; i++) {
// According to docs:
// To perform equality or inequality comparisons with UNDEFINED, use the
// IS_DEFINED and IS_UNDEFINED preset query functions instead of these
// comparison operators.
if (!operators[i].equals("=") && !operators[i].equals("!=") && !operators[i].equals("<>")) {
Query query = qs.newQuery(
"SELECT DISTINCT * FROM /Portfolios where " + var + operators[i] + " UNDEFINED");
Object result = query.execute();
if (result instanceof Collection) {
if (((Collection) result).size() != 0)
fail(this.getName() + " failed for operator " + operators[i]);
} else {
fail(this.getName() + " failed for operator " + operators[i]);
}
}
}
}
}
| apache-2.0 |
CU-CommunityApps/cu-db-ojb | src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java | 10635 | package org.apache.ojb.broker.accesslayer;
/* Copyright 2002-2005 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.
*/
import org.apache.commons.pool.BasePoolableObjectFactory;
import org.apache.commons.pool.ObjectPool;
import org.apache.commons.pool.PoolableObjectFactory;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
import org.apache.ojb.broker.util.logging.Logger;
import org.apache.ojb.broker.util.logging.LoggerFactory;
import org.apache.ojb.broker.OJBRuntimeException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
/**
* Connection factory which pools the requested
* connections for different JdbcConnectionDescriptors
* using Commons Pool API.
*
* @version $Id: ConnectionFactoryPooledImpl.java,v 1.1 2007-08-24 22:17:30 ewestfal Exp $
* @see <a href="http://jakarta.apache.org/commons/pool/">Commons Pool Website</a>
*/
public class ConnectionFactoryPooledImpl extends ConnectionFactoryAbstractImpl
{
private Logger log = LoggerFactory.getLogger(ConnectionFactoryPooledImpl.class);
/** Key=PBKey, value=ObjectPool. */
private Map poolMap = new HashMap();
/** Synchronize object for operations not synchronized on Map only. */
private final Object poolSynch = new Object();
public void releaseJdbcConnection(JdbcConnectionDescriptor jcd, Connection con)
throws LookupException
{
final ObjectPool op = (ObjectPool) poolMap.get(jcd.getPBKey());
try
{
/* mkalen: NB - according to the Commons Pool API we should _not_ perform
* any additional checks here since we will then break testOnX semantics
*
* To enable Connection validation on releaseJdbcConnection,
* set a validation query and specify testOnRelease=true
*
* Destruction of pooled objects is performed by the actual Commons Pool
* ObjectPool implementation when the object factory's validateObject method
* returns false. See ConPoolFactory#validateObject.
*/
op.returnObject(con);
}
catch (Exception e)
{
throw new LookupException(e);
}
}
public Connection checkOutJdbcConnection(JdbcConnectionDescriptor jcd) throws LookupException
{
ObjectPool op = (ObjectPool) poolMap.get(jcd.getPBKey());
if (op == null)
{
synchronized (poolSynch)
{
log.info("Create new connection pool:" + jcd);
op = createConnectionPool(jcd);
poolMap.put(jcd.getPBKey(), op);
}
}
final Connection conn;
try
{
conn = (Connection) op.borrowObject();
}
catch (NoSuchElementException e)
{
int active = 0;
int idle = 0;
try
{
active = op.getNumActive();
idle = op.getNumIdle();
}
catch(Exception ignore){}
throw new LookupException("Could not borrow connection from pool, seems ObjectPool is exhausted." +
" Active/Idle instances in pool=" + active + "/" + idle
+ ". "+ JdbcConnectionDescriptor.class.getName() + ": " + jcd, e);
}
catch (Exception e)
{
int active = 0;
int idle = 0;
try
{
active = op.getNumActive();
idle = op.getNumIdle();
}
catch(Exception ignore){}
throw new LookupException("Could not borrow connection from pool." +
" Active/Idle instances in pool=" + active + "/" + idle
+ ". "+ JdbcConnectionDescriptor.class.getName() + ": " + jcd, e);
}
return conn;
}
/**
* Create the pool for pooling the connections of the given connection descriptor.
* Override this method to implement your on {@link org.apache.commons.pool.ObjectPool}.
*/
public ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
{
if (log.isDebugEnabled()) log.debug("createPool was called");
PoolableObjectFactory pof = new ConPoolFactory(this, jcd);
GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();
return (ObjectPool)new GenericObjectPool(pof, conf);
}
/**
* Closes all managed pools.
*/
public void releaseAllResources()
{
synchronized (poolSynch)
{
Collection pools = poolMap.values();
poolMap = new HashMap(poolMap.size());
ObjectPool op = null;
for (Iterator iterator = pools.iterator(); iterator.hasNext();)
{
try
{
op = ((ObjectPool) iterator.next());
op.close();
}
catch (Exception e)
{
log.error("Exception occured while closing pool " + op, e);
}
}
}
super.releaseAllResources();
}
//**************************************************************************************
// Inner classes
//************************************************************************************
/**
* Inner class - {@link org.apache.commons.pool.PoolableObjectFactory}
* used as factory for connection pooling.
*/
class ConPoolFactory extends BasePoolableObjectFactory
{
final private JdbcConnectionDescriptor jcd;
final private ConnectionFactoryPooledImpl cf;
private int failedValidationQuery;
public ConPoolFactory(ConnectionFactoryPooledImpl cf, JdbcConnectionDescriptor jcd)
{
this.cf = cf;
this.jcd = jcd;
}
public boolean validateObject(Object obj)
{
boolean isValid = false;
if (obj != null)
{
final Connection con = (Connection) obj;
try
{
isValid = !con.isClosed();
}
catch (SQLException e)
{
log.warn("Connection validation failed: " + e.getMessage());
if (log.isDebugEnabled()) log.debug(e);
isValid = false;
}
if (isValid)
{
final String validationQuery;
validationQuery = jcd.getConnectionPoolDescriptor().getValidationQuery();
if (validationQuery != null)
{
isValid = validateConnection(con, validationQuery);
}
}
}
return isValid;
}
private boolean validateConnection(Connection conn, String query)
{
PreparedStatement stmt = null;
ResultSet rset = null;
boolean isValid = false;
if (failedValidationQuery > 100)
{
--failedValidationQuery;
throw new OJBRuntimeException("Validation of connection "+conn+" using validation query '"+
query + "' failed more than 100 times.");
}
try
{
stmt = conn.prepareStatement(query);
stmt.setMaxRows(1);
stmt.setFetchSize(1);
rset = stmt.executeQuery();
if (rset.next())
{
failedValidationQuery = 0;
isValid = true;
}
else
{
++failedValidationQuery;
log.warn("Validation query '" + query +
"' result set does not match, discard connection");
isValid = false;
}
}
catch (SQLException e)
{
++failedValidationQuery;
log.warn("Validation query for connection failed, discard connection. Query was '" +
query + "', Message was " + e.getMessage());
if (log.isDebugEnabled()) log.debug(e);
}
finally
{
try
{
if(rset != null) rset.close();
}
catch (SQLException t)
{
if (log.isDebugEnabled()) log.debug("ResultSet already closed.", t);
}
try
{
if(stmt != null) stmt.close();
}
catch (SQLException t)
{
if (log.isDebugEnabled()) log.debug("Statement already closed.", t);
}
}
return isValid;
}
public Object makeObject() throws Exception
{
if (log.isDebugEnabled()) log.debug("makeObject called");
return cf.newConnectionFromDriverManager(jcd);
}
public void destroyObject(Object obj)
throws Exception
{
log.info("Destroy object was called, try to close connection: " + obj);
try
{
((Connection) obj).close();
}
catch (SQLException ignore)
{
//ignore it
}
}
}
}
| apache-2.0 |
panchenko/geometry-api-java | src/main/java/com/esri/core/geometry/WktExportFlags.java | 1787 | /*
Copyright 1995-2015 Esri
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.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts Dept
380 New York Street
Redlands, California, USA 92373
email: contracts@esri.com
*/
package com.esri.core.geometry;
/**
*Flags used by the OperatorExportToWkt
*/
public interface WktExportFlags {
public static final int wktExportDefaults = 0;
public static final int wktExportPoint = 1;
public static final int wktExportMultiPoint = 2;
public static final int wktExportLineString = 4;
public static final int wktExportMultiLineString = 8;
public static final int wktExportPolygon = 16;
public static final int wktExportMultiPolygon = 32;
public static final int wktExportStripZs = 64;
public static final int wktExportStripMs = 128;
public static final int wktExportFailIfNotSimple = 4096;
public static final int wktExportPrecision16 = 0x2000;
public static final int wktExportPrecision15 = 0x4000;
public static final int wktExportPrecision14 = 0x6000;
public static final int wktExportPrecision13 = 0x8000;
public static final int wktExportPrecision12 = 0xa000;
public static final int wktExportPrecision11 = 0xc000;
public static final int wktExportPrecision10 = 0xe000;
}
| apache-2.0 |
cgtz/ambry | ambry-messageformat/src/test/java/com/github/ambry/messageformat/PutMessageFormatBlobV1InputStream.java | 2783 | /**
* Copyright 2018 LinkedIn Corp. 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.
*/
package com.github.ambry.messageformat;
import com.github.ambry.store.StoreKey;
import com.github.ambry.utils.Crc32;
import com.github.ambry.utils.CrcInputStream;
import java.io.InputStream;
import java.nio.ByteBuffer;
/**
* PutMessageFormatInputStream which uses Blob Format V1 instead of the default V2
*/
public class PutMessageFormatBlobV1InputStream extends MessageFormatInputStream {
public PutMessageFormatBlobV1InputStream(StoreKey key, BlobProperties blobProperties, ByteBuffer userMetadata,
InputStream blobStream, long streamSize, BlobType blobType) throws MessageFormatException {
int headerSize = MessageFormatRecord.MessageHeader_Format_V1.getHeaderSize();
int blobPropertiesRecordSize =
MessageFormatRecord.BlobProperties_Format_V1.getBlobPropertiesRecordSize(blobProperties);
int userMetadataSize = MessageFormatRecord.UserMetadata_Format_V1.getUserMetadataSize(userMetadata);
long blobSize = MessageFormatRecord.Blob_Format_V1.getBlobRecordSize(streamSize);
buffer = ByteBuffer.allocate(
headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize + (int) (blobSize - streamSize
- MessageFormatRecord.Crc_Size));
MessageFormatRecord.MessageHeader_Format_V1.serializeHeader(buffer,
blobPropertiesRecordSize + userMetadataSize + blobSize, headerSize + key.sizeInBytes(),
MessageFormatRecord.Message_Header_Invalid_Relative_Offset,
headerSize + key.sizeInBytes() + blobPropertiesRecordSize,
headerSize + key.sizeInBytes() + blobPropertiesRecordSize + userMetadataSize);
buffer.put(key.toBytes());
MessageFormatRecord.BlobProperties_Format_V1.serializeBlobPropertiesRecord(buffer, blobProperties);
MessageFormatRecord.UserMetadata_Format_V1.serializeUserMetadataRecord(buffer, userMetadata);
int bufferBlobStart = buffer.position();
MessageFormatRecord.Blob_Format_V1.serializePartialBlobRecord(buffer, streamSize);
Crc32 crc = new Crc32();
crc.update(buffer.array(), bufferBlobStart, buffer.position() - bufferBlobStart);
stream = new CrcInputStream(crc, blobStream);
streamLength = streamSize;
messageLength = buffer.capacity() + streamLength + MessageFormatRecord.Crc_Size;
buffer.flip();
}
}
| apache-2.0 |
zstackorg/zstack | sdk/src/main/java/org/zstack/sdk/CreateFlowMeterResult.java | 336 | package org.zstack.sdk;
import org.zstack.sdk.FlowMeterInventory;
public class CreateFlowMeterResult {
public FlowMeterInventory inventory;
public void setInventory(FlowMeterInventory inventory) {
this.inventory = inventory;
}
public FlowMeterInventory getInventory() {
return this.inventory;
}
}
| apache-2.0 |
lhaiesp/samza | samza-test/src/test/java/org/apache/samza/test/operator/RepartitionWindowApp.java | 3017 | /*
* 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.samza.test.operator;
import java.time.Duration;
import org.apache.samza.application.StreamApplication;
import org.apache.samza.application.descriptors.StreamApplicationDescriptor;
import org.apache.samza.operators.KV;
import org.apache.samza.operators.windows.Windows;
import org.apache.samza.serializers.IntegerSerde;
import org.apache.samza.serializers.JsonSerdeV2;
import org.apache.samza.serializers.KVSerde;
import org.apache.samza.serializers.StringSerde;
import org.apache.samza.system.kafka.descriptors.KafkaInputDescriptor;
import org.apache.samza.system.kafka.descriptors.KafkaOutputDescriptor;
import org.apache.samza.system.kafka.descriptors.KafkaSystemDescriptor;
import org.apache.samza.test.operator.data.PageView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A {@link StreamApplication} that demonstrates a repartition followed by a windowed count.
*/
public class RepartitionWindowApp implements StreamApplication {
private static final Logger LOG = LoggerFactory.getLogger(RepartitionWindowApp.class);
static final String SYSTEM = "kafka";
static final String INPUT_TOPIC = "page-views";
static final String OUTPUT_TOPIC = "Result";
@Override
public void describe(StreamApplicationDescriptor appDescriptor) {
KVSerde<String, PageView> inputSerde = KVSerde.of(new StringSerde("UTF-8"), new JsonSerdeV2<>(PageView.class));
KVSerde<String, String> outputSerde = KVSerde.of(new StringSerde(), new StringSerde());
KafkaSystemDescriptor ksd = new KafkaSystemDescriptor(SYSTEM);
KafkaInputDescriptor<KV<String, PageView>> id = ksd.getInputDescriptor(INPUT_TOPIC, inputSerde);
KafkaOutputDescriptor<KV<String, String>> od = ksd.getOutputDescriptor(OUTPUT_TOPIC, outputSerde);
appDescriptor.getInputStream(id)
.map(KV::getValue)
.partitionBy(PageView::getUserId, m -> m, inputSerde, "p1")
.window(Windows.keyedSessionWindow(m -> m.getKey(), Duration.ofSeconds(3), () -> 0, (m, c) -> c + 1, new StringSerde("UTF-8"), new IntegerSerde()), "w1")
.map(wp -> KV.of(wp.getKey().getKey().toString(), String.valueOf(wp.getMessage())))
.sendTo(appDescriptor.getOutputStream(od));
}
}
| apache-2.0 |
nvoron23/presto | presto-kafka/src/main/java/com/facebook/presto/kafka/decoder/json/CustomDateTimeJsonKafkaFieldDecoder.java | 3246 | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.kafka.decoder.json;
import com.facebook.presto.kafka.KafkaColumnHandle;
import com.facebook.presto.kafka.KafkaFieldValueProvider;
import com.facebook.presto.spi.PrestoException;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ImmutableSet;
import io.airlift.slice.Slice;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.Set;
import static com.facebook.presto.kafka.KafkaErrorCode.KAFKA_CONVERSION_NOT_SUPPORTED;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Custom date format decoder.
* <p/>
* <tt>formatHint</tt> uses {@link org.joda.time.format.DateTimeFormatter} format.
* <p/>
* Uses hardcoded UTC timezone and english locale.
*/
public class CustomDateTimeJsonKafkaFieldDecoder
extends JsonKafkaFieldDecoder
{
@Override
public Set<Class<?>> getJavaTypes()
{
return ImmutableSet.<Class<?>>of(long.class, Slice.class);
}
@Override
public String getFieldDecoderName()
{
return "custom-date-time";
}
@Override
public KafkaFieldValueProvider decode(JsonNode value, KafkaColumnHandle columnHandle)
{
checkNotNull(columnHandle, "columnHandle is null");
checkNotNull(value, "value is null");
return new CustomDateTimeJsonKafkaValueProvider(value, columnHandle);
}
public static class CustomDateTimeJsonKafkaValueProvider
extends JsonKafkaValueProvider
{
public CustomDateTimeJsonKafkaValueProvider(JsonNode value, KafkaColumnHandle columnHandle)
{
super(value, columnHandle);
}
@Override
public boolean getBoolean()
{
throw new PrestoException(KAFKA_CONVERSION_NOT_SUPPORTED, "conversion to boolean not supported");
}
@Override
public double getDouble()
{
throw new PrestoException(KAFKA_CONVERSION_NOT_SUPPORTED, "conversion to double not supported");
}
@Override
public long getLong()
{
if (isNull()) {
return 0L;
}
if (value.canConvertToLong()) {
return value.asLong();
}
checkNotNull(columnHandle.getFormatHint(), "formatHint is null");
String textValue = value.isValueNode() ? value.asText() : value.toString();
DateTimeFormatter formatter = DateTimeFormat.forPattern(columnHandle.getFormatHint()).withLocale(Locale.ENGLISH).withZoneUTC();
return formatter.parseMillis(textValue);
}
}
}
| apache-2.0 |
shun634501730/java_source_cn | src_en/com/sun/corba/se/impl/activation/ServerMain.java | 11760 | /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.corba.se.impl.activation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.io.*;
import java.util.Date;
import java.util.Properties ;
import org.omg.CORBA.ORB ;
import com.sun.corba.se.spi.activation.Activator ;
import com.sun.corba.se.spi.activation.ActivatorHelper ;
import com.sun.corba.se.impl.orbutil.ORBConstants ;
/**
* @author Ken Cavanaugh
* @since JDK1.2
*/
public class ServerMain
{
/* TODO:
* 1. Rewrite all uses of ORB properties to use constants from someplace.
* The strings are scattered between here, the ORB classes, and
* ServerTableEntry.
* 2. Consider a more general log facility.
* 3. Remove ServerCallback from POAORB.
* 4. Needs to be merged with Harold's changes to support SSL.
* 5. Logs need to be internationalized.
*/
public final static int OK = 0;
public final static int MAIN_CLASS_NOT_FOUND = 1;
public final static int NO_MAIN_METHOD = 2;
public final static int APPLICATION_ERROR = 3;
public final static int UNKNOWN_ERROR = 4;
public final static int NO_SERVER_ID = 5 ;
public final static int REGISTRATION_FAILED = 6;
public static String printResult( int result )
{
switch (result) {
case OK : return "Server terminated normally" ;
case MAIN_CLASS_NOT_FOUND : return "main class not found" ;
case NO_MAIN_METHOD : return "no main method" ;
case APPLICATION_ERROR : return "application error" ;
case NO_SERVER_ID : return "server ID not defined" ;
case REGISTRATION_FAILED: return "server registration failed" ;
default : return "unknown error" ;
}
}
private void redirectIOStreams()
{
// redirect out and err streams
try {
String logDirName =
System.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
System.getProperty("file.separator") +
ORBConstants.SERVER_LOG_DIR +
System.getProperty("file.separator");
File logDir = new File(logDirName);
String server = System.getProperty(
ORBConstants.SERVER_ID_PROPERTY ) ;
FileOutputStream foutStream =
new FileOutputStream(logDirName + server+".out", true);
FileOutputStream ferrStream =
new FileOutputStream(logDirName + server+".err", true);
PrintStream pSout = new PrintStream(foutStream, true);
PrintStream pSerr = new PrintStream(ferrStream, true);
System.setOut(pSout);
System.setErr(pSerr);
logInformation( "Server started" ) ;
} catch (Exception ex) {}
}
/** Write a time-stamped message to the indicated PrintStream.
*/
private static void writeLogMessage( PrintStream pstream, String msg )
{
Date date = new Date();
pstream.print( "[" + date.toString() + "] " + msg + "\n");
}
/** Write information to standard out only.
*/
public static void logInformation( String msg )
{
writeLogMessage( System.out, " " + msg ) ;
}
/** Write error message to standard out and standard err.
*/
public static void logError( String msg )
{
writeLogMessage( System.out, "ERROR: " + msg ) ;
writeLogMessage( System.err, "ERROR: " + msg ) ;
}
/** Write final message to log(s) and then terminate by calling
* System.exit( code ). If code == OK, write a normal termination
* message to standard out, otherwise write an abnormal termination
* message to standard out and standard error.
*/
public static void logTerminal( String msg, int code )
{
if (code == 0) {
writeLogMessage( System.out, " " + msg ) ;
} else {
writeLogMessage( System.out, "FATAL: " +
printResult( code ) + ": " + msg ) ;
writeLogMessage( System.err, "FATAL: " +
printResult( code ) + ": " + msg ) ;
}
System.exit( code ) ;
}
private Method getMainMethod( Class serverClass )
{
Class argTypes[] = new Class[] { String[].class } ;
Method method = null ;
try {
method = serverClass.getDeclaredMethod( "main", argTypes ) ;
} catch (Exception exc) {
logTerminal( exc.getMessage(), NO_MAIN_METHOD ) ;
}
if (!isPublicStaticVoid( method ))
logTerminal( "", NO_MAIN_METHOD ) ;
return method ;
}
private boolean isPublicStaticVoid( Method method )
{
// check modifiers: public static
int modifiers = method.getModifiers ();
if (!Modifier.isPublic (modifiers) || !Modifier.isStatic (modifiers)) {
logError( method.getName() + " is not public static" ) ;
return false ;
}
// check return type and exceptions
if (method.getExceptionTypes ().length != 0) {
logError( method.getName() + " declares exceptions" ) ;
return false ;
}
if (!method.getReturnType().equals (Void.TYPE)) {
logError( method.getName() + " does not have a void return type" ) ;
return false ;
}
return true ;
}
private Method getNamedMethod( Class serverClass, String methodName )
{
Class argTypes[] = new Class[] { org.omg.CORBA.ORB.class } ;
Method method = null ;
try {
method = serverClass.getDeclaredMethod( methodName, argTypes ) ;
} catch (Exception exc) {
return null ;
}
if (!isPublicStaticVoid( method ))
return null ;
return method ;
}
private void run(String[] args)
{
try {
redirectIOStreams() ;
String serverClassName = System.getProperty(
ORBConstants.SERVER_NAME_PROPERTY ) ;
// determine the class loader to be used for loading the class
// since ServerMain is going to be in JDK and we need to have this
// class to load application classes, this is required here.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
// determine the main class
Class serverClass = null;
try {
// determine the main class, try loading with current class loader
serverClass = Class.forName( serverClassName ) ;
} catch (ClassNotFoundException ex) {
// eat the exception and try to load using SystemClassLoader
serverClass = Class.forName( serverClassName, true, cl);
}
if (debug)
System.out.println("class " + serverClassName + " found");
// get the main method
Method mainMethod = getMainMethod( serverClass ) ;
// This piece of code is required, to verify the server definition
// without launching it.
// verify the server
boolean serverVerifyFlag = Boolean.getBoolean(
ORBConstants.SERVER_DEF_VERIFY_PROPERTY) ;
if (serverVerifyFlag) {
if (mainMethod == null)
logTerminal("", NO_MAIN_METHOD);
else {
if (debug)
System.out.println("Valid Server");
logTerminal("", OK);
}
}
registerCallback( serverClass ) ;
// build args to the main and call it
Object params [] = new Object [1];
params[0] = args;
mainMethod.invoke(null, params);
} catch (ClassNotFoundException e) {
logTerminal("ClassNotFound exception: " + e.getMessage(),
MAIN_CLASS_NOT_FOUND);
} catch (Exception e) {
logTerminal("Exception: " + e.getMessage(),
APPLICATION_ERROR);
}
}
public static void main(String[] args) {
ServerMain server = new ServerMain();
server.run(args);
}
private static final boolean debug = false;
private int getServerId()
{
Integer serverId = Integer.getInteger( ORBConstants.SERVER_ID_PROPERTY ) ;
if (serverId == null)
logTerminal( "", NO_SERVER_ID ) ;
return serverId.intValue() ;
}
private void registerCallback( Class serverClass )
{
Method installMethod = getNamedMethod( serverClass, "install" ) ;
Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;
Properties props = new Properties() ;
props.put( "org.omg.CORBA.ORBClass",
"com.sun.corba.se.impl.orb.ORBImpl" ) ;
// NOTE: Very important to pass this property, otherwise the
// Persistent Server registration will be unsucessfull.
props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
String args[] = null ;
ORB orb = ORB.init( args, props ) ;
ServerCallback serverObj = new ServerCallback( orb,
installMethod, uninstallMethod, shutdownMethod ) ;
int serverId = getServerId() ;
try {
Activator activator = ActivatorHelper.narrow(
orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
activator.active(serverId, serverObj);
} catch (Exception ex) {
logTerminal( "exception " + ex.getMessage(),
REGISTRATION_FAILED ) ;
}
}
}
class ServerCallback extends
com.sun.corba.se.spi.activation._ServerImplBase
{
private ORB orb;
private transient Method installMethod ;
private transient Method uninstallMethod ;
private transient Method shutdownMethod ;
private Object methodArgs[] ;
ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
Method shutdownMethod )
{
this.orb = orb;
this.installMethod = installMethod ;
this.uninstallMethod = uninstallMethod ;
this.shutdownMethod = shutdownMethod ;
orb.connect( this ) ;
methodArgs = new Object[] { orb } ;
}
private void invokeMethod( Method method )
{
if (method != null)
try {
method.invoke( null, methodArgs ) ;
} catch (Exception exc) {
ServerMain.logError( "could not invoke " + method.getName() +
" method: " + exc.getMessage() ) ;
}
}
// shutdown the ORB and wait for completion
public void shutdown()
{
ServerMain.logInformation( "Shutdown starting" ) ;
invokeMethod( shutdownMethod ) ;
orb.shutdown(true);
ServerMain.logTerminal( "Shutdown completed", ServerMain.OK ) ;
}
public void install()
{
ServerMain.logInformation( "Install starting" ) ;
invokeMethod( installMethod ) ;
ServerMain.logInformation( "Install completed" ) ;
}
public void uninstall()
{
ServerMain.logInformation( "uninstall starting" ) ;
invokeMethod( uninstallMethod ) ;
ServerMain.logInformation( "uninstall completed" ) ;
}
}
| apache-2.0 |
tufangorel/hazelcast | hazelcast/src/main/java/com/hazelcast/mapreduce/Collator.java | 1671 | /*
* Copyright (c) 2008-2018, Hazelcast, 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.hazelcast.mapreduce;
/**
* This interface can be implemented to define a Collator which is executed after calculation
* of the MapReduce algorithm on remote cluster nodes but before returning the final result.<br>
* Collator can, for example, be used to sum up a final value.
*
* @param <ValueIn> value type of the resulting values
* @param <ValueOut> type for the collated result
* @since 3.2
* @deprecated MapReduce is deprecated and will be removed in 4.0.
* For map aggregations, you can use {@link com.hazelcast.aggregation.Aggregator} on IMap.
* For general data processing, it is superseded by <a href="http://jet.hazelcast.org">Hazelcast Jet</a>.
*/
@Deprecated
public interface Collator<ValueIn, ValueOut> {
/**
* This method is called with the mapped and possibly reduced values from the MapReduce algorithm.
*
* @param values The mapped and possibly reduced values from the MapReduce algorithm
* @return The collated result
*/
ValueOut collate(Iterable<ValueIn> values);
}
| apache-2.0 |
gjesse/RxJava | src/test/java/rx/SingleTest.java | 13611 | /**
* Copyright 2015 Netflix, 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 rx;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Arrays;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import org.junit.Test;
import rx.Single.OnSubscribe;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.functions.Func2;
import rx.observers.TestSubscriber;
import rx.schedulers.Schedulers;
import rx.subscriptions.Subscriptions;
public class SingleTest {
@Test
public void testHelloWorld() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("Hello World!").subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("Hello World!"));
}
@Test
public void testHelloWorld2() {
final AtomicReference<String> v = new AtomicReference<String>();
Single.just("Hello World!").subscribe(new SingleSubscriber<String>() {
@Override
public void onSuccess(String value) {
v.set(value);
}
@Override
public void onError(Throwable error) {
}
});
assertEquals("Hello World!", v.get());
}
@Test
public void testMap() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("A")
.map(new Func1<String, String>() {
@Override
public String call(String s) {
return s + "B";
}
})
.subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("AB"));
}
@Test
public void testZip() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single<String> a = Single.just("A");
Single<String> b = Single.just("B");
Single.zip(a, b, new Func2<String, String, String>() {
@Override
public String call(String a, String b) {
return a + b;
}
})
.subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("AB"));
}
@Test
public void testZipWith() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("A").zipWith(Single.just("B"), new Func2<String, String, String>() {
@Override
public String call(String a, String b) {
return a + b;
}
})
.subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("AB"));
}
@Test
public void testMerge() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single<String> a = Single.just("A");
Single<String> b = Single.just("B");
Single.merge(a, b).subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("A", "B"));
}
@Test
public void testMergeWith() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("A").mergeWith(Single.just("B")).subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("A", "B"));
}
@Test
public void testCreateSuccess() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.create(new OnSubscribe<String>() {
@Override
public void call(SingleSubscriber<? super String> s) {
s.onSuccess("Hello");
}
}).subscribe(ts);
ts.assertReceivedOnNext(Arrays.asList("Hello"));
}
@Test
public void testCreateError() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.create(new OnSubscribe<String>() {
@Override
public void call(SingleSubscriber<? super String> s) {
s.onError(new RuntimeException("fail"));
}
}).subscribe(ts);
assertEquals(1, ts.getOnErrorEvents().size());
}
@Test
public void testAsync() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("Hello")
.subscribeOn(Schedulers.io())
.map(new Func1<String, String>() {
@Override
public String call(String v) {
System.out.println("SubscribeOn Thread: " + Thread.currentThread());
return v;
}
})
.observeOn(Schedulers.computation())
.map(new Func1<String, String>() {
@Override
public String call(String v) {
System.out.println("ObserveOn Thread: " + Thread.currentThread());
return v;
}
})
.subscribe(ts);
ts.awaitTerminalEvent();
ts.assertReceivedOnNext(Arrays.asList("Hello"));
}
@Test
public void testFlatMap() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single.just("Hello").flatMap(new Func1<String, Single<String>>() {
@Override
public Single<String> call(String s) {
return Single.just(s + " World!").subscribeOn(Schedulers.computation());
}
}).subscribe(ts);
ts.awaitTerminalEvent();
ts.assertReceivedOnNext(Arrays.asList("Hello World!"));
}
@Test
public void testTimeout() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(SingleSubscriber<? super String> s) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// ignore as we expect this for the test
}
s.onSuccess("success");
}
}).subscribeOn(Schedulers.io());
s.timeout(100, TimeUnit.MILLISECONDS).subscribe(ts);
ts.awaitTerminalEvent();
ts.assertError(TimeoutException.class);
}
@Test
public void testTimeoutWithFallback() {
TestSubscriber<String> ts = new TestSubscriber<String>();
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(SingleSubscriber<? super String> s) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// ignore as we expect this for the test
}
s.onSuccess("success");
}
}).subscribeOn(Schedulers.io());
s.timeout(100, TimeUnit.MILLISECONDS, Single.just("hello")).subscribe(ts);
ts.awaitTerminalEvent();
ts.assertNoErrors();
ts.assertValue("hello");
}
@Test
public void testUnsubscribe() throws InterruptedException {
TestSubscriber<String> ts = new TestSubscriber<String>();
final AtomicBoolean unsubscribed = new AtomicBoolean();
final AtomicBoolean interrupted = new AtomicBoolean();
final CountDownLatch latch = new CountDownLatch(2);
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(final SingleSubscriber<? super String> s) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
s.onSuccess("success");
} catch (InterruptedException e) {
interrupted.set(true);
latch.countDown();
}
}
});
s.add(Subscriptions.create(new Action0() {
@Override
public void call() {
unsubscribed.set(true);
t.interrupt();
latch.countDown();
}
}));
t.start();
}
});
s.subscribe(ts);
Thread.sleep(100);
ts.unsubscribe();
if (latch.await(1000, TimeUnit.MILLISECONDS)) {
assertTrue(unsubscribed.get());
assertTrue(interrupted.get());
} else {
fail("timed out waiting for latch");
}
}
/**
* Assert that unsubscribe propagates when passing in a SingleSubscriber and not a Subscriber
*/
@Test
public void testUnsubscribe2() throws InterruptedException {
SingleSubscriber<String> ts = new SingleSubscriber<String>() {
@Override
public void onSuccess(String value) {
// not interested in value
}
@Override
public void onError(Throwable error) {
// not interested in value
}
};
final AtomicBoolean unsubscribed = new AtomicBoolean();
final AtomicBoolean interrupted = new AtomicBoolean();
final CountDownLatch latch = new CountDownLatch(2);
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(final SingleSubscriber<? super String> s) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
s.onSuccess("success");
} catch (InterruptedException e) {
interrupted.set(true);
latch.countDown();
}
}
});
s.add(Subscriptions.create(new Action0() {
@Override
public void call() {
unsubscribed.set(true);
t.interrupt();
latch.countDown();
}
}));
t.start();
}
});
s.subscribe(ts);
Thread.sleep(100);
ts.unsubscribe();
if (latch.await(1000, TimeUnit.MILLISECONDS)) {
assertTrue(unsubscribed.get());
assertTrue(interrupted.get());
} else {
fail("timed out waiting for latch");
}
}
/**
* Assert that unsubscribe propagates when passing in a SingleSubscriber and not a Subscriber
*/
@Test
public void testUnsubscribeViaReturnedSubscription() throws InterruptedException {
final AtomicBoolean unsubscribed = new AtomicBoolean();
final AtomicBoolean interrupted = new AtomicBoolean();
final CountDownLatch latch = new CountDownLatch(2);
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(final SingleSubscriber<? super String> s) {
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
s.onSuccess("success");
} catch (InterruptedException e) {
interrupted.set(true);
latch.countDown();
}
}
});
s.add(Subscriptions.create(new Action0() {
@Override
public void call() {
unsubscribed.set(true);
t.interrupt();
latch.countDown();
}
}));
t.start();
}
});
Subscription subscription = s.subscribe();
Thread.sleep(100);
subscription.unsubscribe();
if (latch.await(1000, TimeUnit.MILLISECONDS)) {
assertTrue(unsubscribed.get());
assertTrue(interrupted.get());
} else {
fail("timed out waiting for latch");
}
}
@Test
public void testBackpressureAsObservable() {
Single<String> s = Single.create(new OnSubscribe<String>() {
@Override
public void call(SingleSubscriber<? super String> t) {
t.onSuccess("hello");
}
});
TestSubscriber<String> ts = new TestSubscriber<String>() {
@Override
public void onStart() {
request(0);
}
};
s.subscribe(ts);
ts.assertNoValues();
ts.requestMore(1);
ts.assertValue("hello");
}
}
| apache-2.0 |
ChinmaySKulkarni/hbase | hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMetricsRegion.java | 4788 | /**
* 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.hadoop.hbase.regionserver;
import org.apache.hadoop.hbase.CompatibilityFactory;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@Category({RegionServerTests.class, SmallTests.class})
public class TestMetricsRegion {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestMetricsRegion.class);
public MetricsAssertHelper HELPER = CompatibilityFactory.getInstance(MetricsAssertHelper.class);
@Test
public void testRegionWrapperMetrics() {
MetricsRegion mr = new MetricsRegion(new MetricsRegionWrapperStub());
MetricsRegionAggregateSource agg = mr.getSource().getAggregateSource();
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeCount",
101, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeFileCount",
102, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_maxStoreFileAge",
2, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_minStoreFileAge",
2, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_avgStoreFileAge",
2, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_numReferenceFiles",
2, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_memstoreSize",
103, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_cpRequestCount",
108, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_" +
"filteredReadRequestCount",
107, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_replicaid",
0, agg);
mr.close();
// test region with replica id > 0
mr = new MetricsRegion(new MetricsRegionWrapperStub(1));
agg = mr.getSource().getAggregateSource();
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeCount",
101, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_storeFileCount",
102, agg);
HELPER.assertGauge(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_memstoreSize",
103, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_cpRequestCount",
108, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_" +
"filteredReadRequestCount",
107, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_replicaid",
1, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_compactionsQueuedCount",
4, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_flushesQueuedCount",
6, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_maxCompactionQueueSize",
4, agg);
HELPER.assertCounter(
"namespace_TestNS_table_MetricsRegionWrapperStub_region_DEADBEEF001_metric_maxFlushQueueSize",
6, agg);
mr.close();
}
}
| apache-2.0 |
pkdevbox/stratos | components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java | 12411 | /*
* 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.stratos.common.constants;
public class StratosConstants {
public static final String CLOUD_SERVICE_IS_ACTIVE_PROP_KEY = "active";
public static final String CLOUD_SERVICE_INFO_STORE_PATH =
"/repository/components/org.apache.stratos/cloud-manager/cloud-services";
public static final String TENANT_USER_VALIDATION_STORE_PATH =
"/repository/components/org.wso2.carbon.validations";
public static final String ADMIN_EMAIL_VERIFICATION_FLAG_PATH =
"/repository/components/org.wso2.carbon.email-confirmation-flag";
public static final String TENANT_DOMAIN_VERIFICATION_FLAG_PATH =
"/repository/components/org.wso2.carbon.domain-confirmation-flag";
public static final String DOMAIN_VALIDATOR_INFO_PATH =
"/repository/components/org.wso2.carbon.domain-validator-info";
public static final String TENANT_CREATION_THEME_PAGE_TOKEN =
"/repository/components/org.wso2.carbon.theme-page-token";
public static final String TENANT_PACKAGE_INFO_PATH =
"/repository/components/org.wso2.carbon.package-info";
public static final String ALL_THEMES_PATH =
"/repository/components/org.wso2.carbon.all-themes";
public static final String THROTTLING_RULES_PATH =
"/repository/components/org.wso2.carbon.throttling-rules";
public static final String ORIGINATED_SERVICE_PATH =
"/repository/components/org.wso2.carbon.originated-service";
public static final String PATH_SEPARATOR = "/";
public static final String CLOUD_SERVICE_ICONS_STORE_PATH =
"/repository/components/org.wso2.carbon.cloud-manager/" +
"cloud-services-icons";
public static final String VALIDATION_KEY_RESOURCE_NAME = "validation-key";
public static final String INCOMING_PATH_DIR = "incoming";
public static final String OUTGOING_PATH_DIR = "outgoing";
public static final String MULTITENANCY_SCHEDULED_TASK_ID = "multitenancyScheduledTask";
public static final String MULTITENANCY_VIEWING_TASK_ID = "multitenancyViewingTask";
public static final String INVALID_TENANT = "invalidTenant";
public static final String INACTIVE_TENANT = "inactiveTenant";
public static final String ACTIVE_TENANT = "activeTenant";
public static final String IS_EMAIL_VALIDATED = "isEmailValidated";
public static final String IS_CREDENTIALS_ALREADY_RESET = "isCredentialsReset";
public static final String TENANT_ADMIN = "tenantAdminUsername";
public static final String CLOUD_MANAGER_SERVICE = "Apache Stratos Controller";
public static final String CLOUD_IDENTITY_SERVICE = "WSO2 Stratos Identity";
public static final String CLOUD_GOVERNANCE_SERVICE = "WSO2 Stratos Governance";
public static final String CLOUD_ESB_SERVICE = "WSO2 Stratos Enterprise Service Bus";
// keystore mgt related Constants
public static final String TENANT_KS = "/repository/security/key-stores/";
public static final String TENANT_PUB_KEY = "/repository/security/pub-key";
public static final String PROP_TENANT_KS_TYPE = "key-store-type";
public static final String PROP_TENANT_KS_PASSWD = "key-store-password";
public static final String PROP_TENANT_KS_PRIV_KEY_PASSWD = "priv-key-password";
public static final String PROP_TENANT_KS_ALIAS = "alias";
// constants related to redirection
public static final String UNVERIFIED_ACCOUNT_DOMAIN_SUFFIX = "-unverified";
public static final String TENANT_SPECIFIC_URL_RESOLVED = "tenant-sepcific-url-resolved";
public static final String SUFFIXED_UNVERIFIED_SESSION_FLAG = "temp-suffixed-unverified";
// metering constants
public static final String THROTTLING_ALL_ACTION = "all_actions";
public static final String THROTTLING_IN_DATA_ACTION =
"in_data_action"; //this covers registry capacity + registry bandwidth
public static final String THROTTLING_OUT_DATA_ACTION = "out_data_action"; //this covers registry bandwidth
public static final String THROTTLING_ADD_USER_ACTION = "add_user_action";
public static final String THROTTLING_SERVICE_IN_BANDWIDTH_ACTION = "service_in_bandwith_action";
public static final String THROTTLING_SERVICE_OUT_BANDWIDTH_ACTION = "service_out_bandwith_action";
public static final String THROTTLING_WEBAPP_IN_BANDWIDTH_ACTION = "webapp_in_bandwith_action";
public static final String THROTTLING_WEBAPP_OUT_BANDWIDTH_ACTION = "webapp_out_bandwith_action";
public static final String THROTTLING_SERVICE_REQUEST_ACTION = "service_request_action";
public static final String THROTTLING_SERVICE_RESPONSE_ACTION = "service_response_action";
// the session attribute to keep track whether the registry action validated
// and the usage persisted
public static final String REGISTRY_ACTION_VALIDATED_SESSION_ATTR = "registryActionValidated";
public static final String REGISTRY_USAGE_PERSISTED_SESSION_ATTR = "usagePersited";
// Metering servlet attributes
public static final String SERVICE_NAME_SERVLET_ATTR = "meteringServiceName";
public static final String TENANT_ID_SERVLET_ATTR = "tenantId";
public static final String ADMIN_SERVICE_SERVLET_ATTR = "adminService";
// * as a Service impl related constants
public static final String ORIGINATED_SERVICE = "originatedService";
// Configuration file name
public static final String STRATOS_CONF_FILE = "stratos.xml";
//public static final String STRATOS_CONF_LOC = "repository/conf/";
//public static final String STRATOS_CONF_FILE_WITH_PATH = STRATOS_CONF_LOC + STRATOS_CONF_FILE;
// EULA location
public static final String STRATOS_EULA = "eula.xml";
// EULA default text.
public static final String STRATOS_EULA_DEFAULT_TEXT =
"Please refer to: " + StratosConstants.STRATOS_TERMS_OF_USAGE +
" for terms and usage and " + StratosConstants.STRATOS_PRIVACY_POLICY +
" for privacy policy of WSO2 Stratos.";
// Web location of Terms of Usage and privacy policy
public static final String STRATOS_TERMS_OF_USAGE =
"http://wso2.com/cloud/services/terms-of-use/";
public static final String STRATOS_PRIVACY_POLICY =
"http://wso2.com/cloud/services/privacy-policy/";
public static final String MULTITENANCY_FREE_PLAN = "Demo";
public static final String MULTITENANCY_SMALL_PLAN = "SMB";
public static final String MULTITENANCY_MEDIUM_PLAN = "Professional";
public static final String MULTITENANCY_LARGE_PLAN = "Enterprise";
public static final String EMAIL_CONFIG = "email";
public static final String MULTITENANCY_CONFIG_FOLDER = "multitenancy";
// Cloud controller - payload
public static final String MEMBER_ID = "MEMBER_ID";
public static final String LB_CLUSTER_ID = "LB_CLUSTER_ID";
public static final String NETWORK_PARTITION_ID = "NETWORK_PARTITION_ID";
// Kubernetes related constants
public static final String KUBERNETES_CLUSTER_ID = "KUBERNETES_CLUSTER_ID";
public static final String KUBERNETES_MASTER_PORT = "KUBERNETES_MASTER_PORT";
public static final String KUBERNETES_MASTER_DEFAULT_PORT = "8080";
//drools related constants
public static final String DROOLS_DIR_NAME = "drools";
public static final String SCALE_CHECK_DROOL_FILE = "scaling.drl";
public static final String DEPENDENT_SCALE_CHECK_DROOL_FILE = "dependent-scaling.drl";
public static final String MIN_CHECK_DROOL_FILE = "mincheck.drl";
public static final String MAX_CHECK_DROOL_FILE = "maxcheck.drl";
public static final String OBSOLETE_CHECK_DROOL_FILE = "obsoletecheck.drl";
public static final String MIN_COUNT = "MIN_COUNT";
public static final String SCALING_REASON = "SCALING_REASON";
public static final String SCALING_TIME = "SCALING_TIME";
// Policy and definition related constants
public static final int PUBLIC_DEFINITION = 0;
// member expiry timeout constants
public static final String PENDING_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.pendingMemberExpiryTimeout";
public static final String SPIN_TERMINATE_PARALLEL = "autoscaler.member.spinAfterTerminate";
public static final String OBSOLETED_MEMBER_EXPIRY_TIMEOUT = "autoscaler.member.obsoletedMemberExpiryTimeout";
public static final String PENDING_TERMINATION_MEMBER_EXPIRY_TIMEOUT =
"autoscaler.member.pendingTerminationMemberExpiryTimeout";
public static final String FILTER_VALUE_SEPARATOR = ",";
public static final String TOPOLOGY_APPLICATION_FILTER = "stratos.topology.application.filter";
public static final String TOPOLOGY_SERVICE_FILTER = "stratos.topology.service.filter";
public static final String TOPOLOGY_CLUSTER_FILTER = "stratos.topology.cluster.filter";
public static final String TOPOLOGY_MEMBER_FILTER = "stratos.topology.member.filter";
public static final String TOPOLOGY_NETWORK_PARTITION_FILTER = "stratos.topology.network.partition.filter";
// to identify a lb cluster
public static final String LOAD_BALANCER_REF = "load.balancer.ref";
public static final String SERVICE_AWARE_LOAD_BALANCER = "service.aware.load.balancer";
public static final String DEFAULT_LOAD_BALANCER = "default.load.balancer";
public static final String NO_LOAD_BALANCER = "no.load.balancer";
public static final String EXISTING_LOAD_BALANCERS = "existing.load.balancers";
public static final long HAZELCAST_INSTANCE_INIT_TIMEOUT = 300000; // 5 min
public static final String AUTOSCALER_SERVICE_URL = "autoscaler.service.url";
public static final String CLOUD_CONTROLLER_SERVICE_URL = "cloud.controller.service.url";
public static final String STRATOS_MANAGER_SERVICE_URL = "stratos.manager.service.url";
public static final String CLOUD_CONTROLLER_CLIENT_SOCKET_TIMEOUT = "cc.socket.timeout";
public static final String CLOUD_CONTROLLER_CLIENT_CONNECTION_TIMEOUT = "cc.connection.timeout";
public static final String AUTOSCALER_CLIENT_SOCKET_TIMEOUT = "autoscaler.socket.timeout";
public static final String AUTOSCALER_CLIENT_CONNECTION_TIMEOUT = "autoscaler.connection.timeout";
public static final String STRATOS_MANAGER_CLIENT_SOCKET_TIMEOUT = "stratos.manager.socket.timeout";
public static final String STRATOS_MANAGER_CLIENT_CONNECTION_TIMEOUT = "stratos.manager.connection.timeout";
public static final String DEFAULT_CLIENT_SOCKET_TIMEOUT = "300000";
public static final String DEFAULT_CLIENT_CONNECTION_TIMEOUT = "300000";
// partition algorithm id constants
public static final String PARTITION_ROUND_ROBIN_ALGORITHM_ID = "round-robin";
public static final String PARTITION_WEIGHTED_ROUND_ROBIN_ALGORITHM_ID = "weighted-round-robin";
public static final String PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID = "one-after-another";
// network partition algorithm id constants
public static final String NETWORK_PARTITION_ONE_AFTER_ANOTHER_ALGORITHM_ID = "one-after-another";
public static final String NETWORK_PARTITION_ALL_AT_ONCE_ALGORITHM_ID = "all-at-once";
public static final String APPLICATION_POLICY_NETWORK_PARTITION_GROUPS = "networkPartitionGroups";
public static final String APPLICATION_POLICY_NETWORK_PARTITIONS_SPLITTER = "\\|";
public static final String APPLICATION_POLICY_NETWORK_PARTITION_GROUPS_SPLITTER = ",";
public static final String NOT_DEFINED = "not-defined";
public static final String CLUSTER_INSTANCE_ID = "cluster.instance.id";
}
| apache-2.0 |
mashuai/Open-Source-Research | JUnit/src/org/junit/runner/manipulation/Filter.java | 1893 | package org.junit.runner.manipulation;
import org.junit.runner.Description;
import org.junit.runner.Request;
import org.junit.runner.Runner;
/**
* The canonical case of filtering is when you want to run a single test method in a class. Rather
* than introduce runner API just for that one case, JUnit provides a general filtering mechanism.
* If you want to filter the tests to be run, extend <code>Filter</code> and apply an instance of
* your filter to the {@link org.junit.runner.Request} before running it (see
* {@link org.junit.runner.JUnitCore#run(Request)}. Alternatively, apply a <code>Filter</code> to
* a {@link org.junit.runner.Runner} before running tests (for example, in conjunction with
* {@link org.junit.runner.RunWith}.
*/
public abstract class Filter {
/**
* A null <code>Filter</code> that passes all tests through.
*/
public static Filter ALL= new Filter() {
@Override
public boolean shouldRun(Description description) {
return true;
}
@Override
public String describe() {
return "all tests";
}
};
/**
* @param description the description of the test to be run
* @return <code>true</code> if the test should be run
*/
public abstract boolean shouldRun(Description description);
/**
* Invoke with a {@link org.junit.runner.Runner} to cause all tests it intends to run
* to first be checked with the filter. Only those that pass the filter will be run.
* @param runner the runner to be filtered by the receiver
* @throws NoTestsRemainException if the receiver removes all tests
*/
public void apply(Runner runner) throws NoTestsRemainException {
if (runner instanceof Filterable) {
Filterable filterable= (Filterable)runner;
filterable.filter(this);
}
}
/**
* Returns a textual description of this Filter
* @return a textual description of this Filter
*/
public abstract String describe();
}
| apache-2.0 |
jbertouch/elasticsearch | core/src/test/java/org/elasticsearch/index/store/CorruptedFileIT.java | 39322 | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.elasticsearch.index.store;
import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.apache.lucene.index.CheckIndex;
import org.apache.lucene.index.IndexFileNames;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Requests;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.routing.GroupShardsIterator;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.ShardIterator;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.cluster.routing.allocation.decider.EnableAllocationDecider;
import org.elasticsearch.cluster.routing.allocation.decider.ThrottlingAllocationDecider;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.lucene.Lucene;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.gateway.PrimaryShardAllocator;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.MergePolicyConfig;
import org.elasticsearch.index.shard.IndexEventListener;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.IndexShardState;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.recovery.RecoveryFileChunkRequest;
import org.elasticsearch.indices.recovery.RecoveryTargetService;
import org.elasticsearch.monitor.fs.FsInfo;
import org.elasticsearch.node.Node;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.snapshots.SnapshotState;
import org.elasticsearch.test.CorruptionUtils;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.InternalSettingsPlugin;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.MockIndexEventListener;
import org.elasticsearch.test.store.MockFSIndexStore;
import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.transport.TransportException;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.transport.TransportRequestOptions;
import org.elasticsearch.transport.TransportService;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.elasticsearch.common.settings.Settings.settingsBuilder;
import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.anyOf;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.SUITE)
public class CorruptedFileIT extends ESIntegTestCase {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return Settings.builder()
// we really need local GW here since this also checks for corruption etc.
// and we need to make sure primaries are not just trashed if we don't have replicas
.put(super.nodeSettings(nodeOrdinal))
// speed up recoveries
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_INCOMING_RECOVERIES_SETTING.getKey(), 5)
.put(ThrottlingAllocationDecider.CLUSTER_ROUTING_ALLOCATION_NODE_CONCURRENT_OUTGOING_RECOVERIES_SETTING.getKey(), 5)
.build();
}
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return pluginList(MockTransportService.TestPlugin.class, MockIndexEventListener.TestPlugin.class, MockFSIndexStore.TestPlugin.class,
InternalSettingsPlugin.class); // uses index.version.created
}
/**
* Tests that we can actually recover from a corruption on the primary given that we have replica shards around.
*/
public void testCorruptFileAndRecover() throws ExecutionException, InterruptedException, IOException {
int numDocs = scaledRandomIntBetween(100, 1000);
// have enough space for 3 copies
internalCluster().ensureAtLeastNumDataNodes(3);
if (cluster().numDataNodes() == 3) {
logger.info("--> cluster has [3] data nodes, corrupted primary will be overwritten");
}
assertThat(cluster().numDataNodes(), greaterThanOrEqualTo(3));
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, "1")
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1")
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) // no checkindex - we corrupt shards on purpose
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(1, ByteSizeUnit.PB)) // no translog based flush - it might change the .liv / segments.N files
));
ensureGreen();
disableAllocation("test");
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex("test", "type").setSource("field", "value");
}
indexRandom(true, builders);
ensureGreen();
assertAllSuccessful(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet());
// we have to flush at least once here since we don't corrupt the translog
SearchResponse countResponse = client().prepareSearch().setSize(0).get();
assertHitCount(countResponse, numDocs);
final int numShards = numShards("test");
ShardRouting corruptedShardRouting = corruptRandomPrimaryFile();
logger.info("--> {} corrupted", corruptedShardRouting);
enableAllocation("test");
/*
* we corrupted the primary shard - now lets make sure we never recover from it successfully
*/
Settings build = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "2").build();
client().admin().indices().prepareUpdateSettings("test").setSettings(build).get();
ClusterHealthResponse health = client().admin().cluster()
.health(Requests.clusterHealthRequest("test").waitForGreenStatus()
.timeout("5m") // sometimes due to cluster rebalacing and random settings default timeout is just not enough.
.waitForRelocatingShards(0)).actionGet();
if (health.isTimedOut()) {
logger.info("cluster state:\n{}\n{}", client().admin().cluster().prepareState().get().getState().prettyPrint(), client().admin().cluster().preparePendingClusterTasks().get().prettyPrint());
assertThat("timed out waiting for green state", health.isTimedOut(), equalTo(false));
}
assertThat(health.getStatus(), equalTo(ClusterHealthStatus.GREEN));
final int numIterations = scaledRandomIntBetween(5, 20);
for (int i = 0; i < numIterations; i++) {
SearchResponse response = client().prepareSearch().setSize(numDocs).get();
assertHitCount(response, numDocs);
}
/*
* now hook into the IndicesService and register a close listener to
* run the checkindex. if the corruption is still there we will catch it.
*/
final CountDownLatch latch = new CountDownLatch(numShards * 3); // primary + 2 replicas
final CopyOnWriteArrayList<Throwable> exception = new CopyOnWriteArrayList<>();
final IndexEventListener listener = new IndexEventListener() {
@Override
public void afterIndexShardClosed(ShardId sid, @Nullable IndexShard indexShard, Settings indexSettings) {
if (indexShard != null) {
Store store = indexShard.store();
store.incRef();
try {
if (!Lucene.indexExists(store.directory()) && indexShard.state() == IndexShardState.STARTED) {
return;
}
try (CheckIndex checkIndex = new CheckIndex(store.directory())) {
BytesStreamOutput os = new BytesStreamOutput();
PrintStream out = new PrintStream(os, false, StandardCharsets.UTF_8.name());
checkIndex.setInfoStream(out);
out.flush();
CheckIndex.Status status = checkIndex.checkIndex();
if (!status.clean) {
logger.warn("check index [failure]\n{}", new String(os.bytes().toBytes(), StandardCharsets.UTF_8));
throw new IOException("index check failure");
}
}
} catch (Throwable t) {
exception.add(t);
} finally {
store.decRef();
latch.countDown();
}
}
}
};
for (MockIndexEventListener.TestEventListener eventListener : internalCluster().getDataNodeInstances(MockIndexEventListener.TestEventListener.class)) {
eventListener.setNewDelegate(listener);
}
try {
client().admin().indices().prepareDelete("test").get();
latch.await();
assertThat(exception, empty());
} finally {
for (MockIndexEventListener.TestEventListener eventListener : internalCluster().getDataNodeInstances(MockIndexEventListener.TestEventListener.class)) {
eventListener.setNewDelegate(null);
}
}
}
/**
* Tests corruption that happens on a single shard when no replicas are present. We make sure that the primary stays unassigned
* and all other replicas for the healthy shards happens
*/
public void testCorruptPrimaryNoReplica() throws ExecutionException, InterruptedException, IOException {
int numDocs = scaledRandomIntBetween(100, 1000);
internalCluster().ensureAtLeastNumDataNodes(2);
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0")
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) // no checkindex - we corrupt shards on purpose
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(1, ByteSizeUnit.PB)) // no translog based flush - it might change the .liv / segments.N files
));
ensureGreen();
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex("test", "type").setSource("field", "value");
}
indexRandom(true, builders);
ensureGreen();
assertAllSuccessful(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet());
// we have to flush at least once here since we don't corrupt the translog
SearchResponse countResponse = client().prepareSearch().setSize(0).get();
assertHitCount(countResponse, numDocs);
ShardRouting shardRouting = corruptRandomPrimaryFile();
/*
* we corrupted the primary shard - now lets make sure we never recover from it successfully
*/
Settings build = Settings.builder().put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1").build();
client().admin().indices().prepareUpdateSettings("test").setSettings(build).get();
client().admin().cluster().prepareReroute().get();
boolean didClusterTurnRed = awaitBusy(() -> {
ClusterHealthStatus test = client().admin().cluster()
.health(Requests.clusterHealthRequest("test")).actionGet().getStatus();
return test == ClusterHealthStatus.RED;
}, 5, TimeUnit.MINUTES);// sometimes on slow nodes the replication / recovery is just dead slow
final ClusterHealthResponse response = client().admin().cluster()
.health(Requests.clusterHealthRequest("test")).get();
if (response.getStatus() != ClusterHealthStatus.RED) {
logger.info("Cluster turned red in busy loop: {}", didClusterTurnRed);
logger.info("cluster state:\n{}\n{}", client().admin().cluster().prepareState().get().getState().prettyPrint(), client().admin().cluster().preparePendingClusterTasks().get().prettyPrint());
}
assertThat(response.getStatus(), is(ClusterHealthStatus.RED));
ClusterState state = client().admin().cluster().prepareState().get().getState();
GroupShardsIterator shardIterators = state.getRoutingNodes().getRoutingTable().activePrimaryShardsGrouped(new String[]{"test"}, false);
for (ShardIterator iterator : shardIterators) {
ShardRouting routing;
while ((routing = iterator.nextOrNull()) != null) {
if (routing.getId() == shardRouting.getId()) {
assertThat(routing.state(), equalTo(ShardRoutingState.UNASSIGNED));
} else {
assertThat(routing.state(), anyOf(equalTo(ShardRoutingState.RELOCATING), equalTo(ShardRoutingState.STARTED)));
}
}
}
final List<Path> files = listShardFiles(shardRouting);
Path corruptedFile = null;
for (Path file : files) {
if (file.getFileName().toString().startsWith("corrupted_")) {
corruptedFile = file;
break;
}
}
assertThat(corruptedFile, notNullValue());
}
/**
* This test triggers a corrupt index exception during finalization size if an empty commit point is transferred
* during recovery we don't know the version of the segments_N file because it has no segments we can take it from.
* This simulates recoveries from old indices or even without checksums and makes sure if we fail during finalization
* we also check if the primary is ok. Without the relevant checks this test fails with a RED cluster
*/
public void testCorruptionOnNetworkLayerFinalizingRecovery() throws ExecutionException, InterruptedException, IOException {
internalCluster().ensureAtLeastNumDataNodes(2);
NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().get();
List<NodeStats> dataNodeStats = new ArrayList<>();
for (NodeStats stat : nodeStats.getNodes()) {
if (stat.getNode().isDataNode()) {
dataNodeStats.add(stat);
}
}
assertThat(dataNodeStats.size(), greaterThanOrEqualTo(2));
Collections.shuffle(dataNodeStats, random());
NodeStats primariesNode = dataNodeStats.get(0);
NodeStats unluckyNode = dataNodeStats.get(1);
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0")
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
.put("index.routing.allocation.include._name", primariesNode.getNode().name())
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
));
ensureGreen(); // allocated with empty commit
final AtomicBoolean corrupt = new AtomicBoolean(true);
final CountDownLatch hasCorrupted = new CountDownLatch(1);
for (NodeStats dataNode : dataNodeStats) {
MockTransportService mockTransportService = ((MockTransportService) internalCluster().getInstance(TransportService.class, dataNode.getNode().name()));
mockTransportService.addDelegate(internalCluster().getInstance(TransportService.class, unluckyNode.getNode().name()), new MockTransportService.DelegateTransport(mockTransportService.original()) {
@Override
public void sendRequest(DiscoveryNode node, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException {
if (corrupt.get() && action.equals(RecoveryTargetService.Actions.FILE_CHUNK)) {
RecoveryFileChunkRequest req = (RecoveryFileChunkRequest) request;
byte[] array = req.content().array();
int i = randomIntBetween(0, req.content().length() - 1);
array[i] = (byte) ~array[i]; // flip one byte in the content
hasCorrupted.countDown();
}
super.sendRequest(node, requestId, action, request, options);
}
});
}
Settings build = Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1")
.put("index.routing.allocation.include._name", primariesNode.getNode().name() + "," + unluckyNode.getNode().name()).build();
client().admin().indices().prepareUpdateSettings("test").setSettings(build).get();
client().admin().cluster().prepareReroute().get();
hasCorrupted.await();
corrupt.set(false);
ensureGreen();
}
/**
* Tests corruption that happens on the network layer and that the primary does not get affected by corruption that happens on the way
* to the replica. The file on disk stays uncorrupted
*/
public void testCorruptionOnNetworkLayer() throws ExecutionException, InterruptedException {
int numDocs = scaledRandomIntBetween(100, 1000);
internalCluster().ensureAtLeastNumDataNodes(2);
if (cluster().numDataNodes() < 3) {
internalCluster().startNode(Settings.builder().put(Node.NODE_DATA_SETTING.getKey(), true).put(Node.NODE_MASTER_SETTING.getKey(), false));
}
NodesStatsResponse nodeStats = client().admin().cluster().prepareNodesStats().get();
List<NodeStats> dataNodeStats = new ArrayList<>();
for (NodeStats stat : nodeStats.getNodes()) {
if (stat.getNode().isDataNode()) {
dataNodeStats.add(stat);
}
}
assertThat(dataNodeStats.size(), greaterThanOrEqualTo(2));
Collections.shuffle(dataNodeStats, random());
NodeStats primariesNode = dataNodeStats.get(0);
NodeStats unluckyNode = dataNodeStats.get(1);
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0")
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, between(1, 4)) // don't go crazy here it must recovery fast
// This does corrupt files on the replica, so we can't check:
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false)
.put("index.routing.allocation.include._name", primariesNode.getNode().name())
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), EnableAllocationDecider.Rebalance.NONE)
));
ensureGreen();
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex("test", "type").setSource("field", "value");
}
indexRandom(true, builders);
ensureGreen();
assertAllSuccessful(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet());
// we have to flush at least once here since we don't corrupt the translog
SearchResponse countResponse = client().prepareSearch().setSize(0).get();
assertHitCount(countResponse, numDocs);
final boolean truncate = randomBoolean();
for (NodeStats dataNode : dataNodeStats) {
MockTransportService mockTransportService = ((MockTransportService) internalCluster().getInstance(TransportService.class, dataNode.getNode().name()));
mockTransportService.addDelegate(internalCluster().getInstance(TransportService.class, unluckyNode.getNode().name()), new MockTransportService.DelegateTransport(mockTransportService.original()) {
@Override
public void sendRequest(DiscoveryNode node, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException, TransportException {
if (action.equals(RecoveryTargetService.Actions.FILE_CHUNK)) {
RecoveryFileChunkRequest req = (RecoveryFileChunkRequest) request;
if (truncate && req.length() > 1) {
BytesArray array = new BytesArray(req.content().array(), req.content().arrayOffset(), (int) req.length() - 1);
request = new RecoveryFileChunkRequest(req.recoveryId(), req.shardId(), req.metadata(), req.position(), array, req.lastChunk(), req.totalTranslogOps(), req.sourceThrottleTimeInNanos());
} else {
byte[] array = req.content().array();
int i = randomIntBetween(0, req.content().length() - 1);
array[i] = (byte) ~array[i]; // flip one byte in the content
}
}
super.sendRequest(node, requestId, action, request, options);
}
});
}
Settings build = Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "1")
.put("index.routing.allocation.include._name", "*").build();
client().admin().indices().prepareUpdateSettings("test").setSettings(build).get();
client().admin().cluster().prepareReroute().get();
ClusterHealthResponse actionGet = client().admin().cluster()
.health(Requests.clusterHealthRequest("test").waitForGreenStatus()).actionGet();
if (actionGet.isTimedOut()) {
logger.info("ensureGreen timed out, cluster state:\n{}\n{}", client().admin().cluster().prepareState().get().getState().prettyPrint(), client().admin().cluster().preparePendingClusterTasks().get().prettyPrint());
assertThat("timed out waiting for green state", actionGet.isTimedOut(), equalTo(false));
}
// we are green so primaries got not corrupted.
// ensure that no shard is actually allocated on the unlucky node
ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().get();
for (IndexShardRoutingTable table : clusterStateResponse.getState().getRoutingNodes().getRoutingTable().index("test")) {
for (ShardRouting routing : table) {
if (unluckyNode.getNode().getId().equals(routing.currentNodeId())) {
assertThat(routing.state(), not(equalTo(ShardRoutingState.STARTED)));
assertThat(routing.state(), not(equalTo(ShardRoutingState.RELOCATING)));
}
}
}
final int numIterations = scaledRandomIntBetween(5, 20);
for (int i = 0; i < numIterations; i++) {
SearchResponse response = client().prepareSearch().setSize(numDocs).get();
assertHitCount(response, numDocs);
}
}
/**
* Tests that restoring of a corrupted shard fails and we get a partial snapshot.
* TODO once checksum verification on snapshotting is implemented this test needs to be fixed or split into several
* parts... We should also corrupt files on the actual snapshot and check that we don't restore the corrupted shard.
*/
public void testCorruptFileThenSnapshotAndRestore() throws ExecutionException, InterruptedException, IOException {
int numDocs = scaledRandomIntBetween(100, 1000);
internalCluster().ensureAtLeastNumDataNodes(2);
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, "0") // no replicas for this test
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) // no checkindex - we corrupt shards on purpose
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(1, ByteSizeUnit.PB)) // no translog based flush - it might change the .liv / segments.N files
));
ensureGreen();
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex("test", "type").setSource("field", "value");
}
indexRandom(true, builders);
ensureGreen();
assertAllSuccessful(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet());
// we have to flush at least once here since we don't corrupt the translog
SearchResponse countResponse = client().prepareSearch().setSize(0).get();
assertHitCount(countResponse, numDocs);
ShardRouting shardRouting = corruptRandomPrimaryFile(false);
// we don't corrupt segments.gen since S/R doesn't snapshot this file
// the other problem here why we can't corrupt segments.X files is that the snapshot flushes again before
// it snapshots and that will write a new segments.X+1 file
logger.info("--> creating repository");
assertAcked(client().admin().cluster().preparePutRepository("test-repo")
.setType("fs").setSettings(settingsBuilder()
.put("location", randomRepoPath().toAbsolutePath())
.put("compress", randomBoolean())
.put("chunk_size", randomIntBetween(100, 1000), ByteSizeUnit.BYTES)));
logger.info("--> snapshot");
CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot("test-repo", "test-snap").setWaitForCompletion(true).setIndices("test").get();
assertThat(createSnapshotResponse.getSnapshotInfo().state(), equalTo(SnapshotState.PARTIAL));
logger.info("failed during snapshot -- maybe SI file got corrupted");
final List<Path> files = listShardFiles(shardRouting);
Path corruptedFile = null;
for (Path file : files) {
if (file.getFileName().toString().startsWith("corrupted_")) {
corruptedFile = file;
break;
}
}
assertThat(corruptedFile, notNullValue());
}
/**
* This test verifies that if we corrupt a replica, we can still get to green, even though
* listing its store fails. Note, we need to make sure that replicas are allocated on all data
* nodes, so that replica won't be sneaky and allocated on a node that doesn't have a corrupted
* replica.
*/
public void testReplicaCorruption() throws Exception {
int numDocs = scaledRandomIntBetween(100, 1000);
internalCluster().ensureAtLeastNumDataNodes(2);
assertAcked(prepareCreate("test").setSettings(Settings.builder()
.put(PrimaryShardAllocator.INDEX_RECOVERY_INITIAL_SHARDS_SETTING.getKey(), "one")
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, cluster().numDataNodes() - 1)
.put(MergePolicyConfig.INDEX_MERGE_ENABLED, false)
.put(MockFSIndexStore.INDEX_CHECK_INDEX_ON_CLOSE_SETTING.getKey(), false) // no checkindex - we corrupt shards on purpose
.put(IndexSettings.INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE_SETTING.getKey(), new ByteSizeValue(1, ByteSizeUnit.PB)) // no translog based flush - it might change the .liv / segments.N files
));
ensureGreen();
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
for (int i = 0; i < builders.length; i++) {
builders[i] = client().prepareIndex("test", "type").setSource("field", "value");
}
indexRandom(true, builders);
ensureGreen();
assertAllSuccessful(client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).execute().actionGet());
// we have to flush at least once here since we don't corrupt the translog
SearchResponse countResponse = client().prepareSearch().setSize(0).get();
assertHitCount(countResponse, numDocs);
final Map<String, List<Path>> filesToCorrupt = findFilesToCorruptForReplica();
internalCluster().fullRestart(new InternalTestCluster.RestartCallback() {
@Override
public Settings onNodeStopped(String nodeName) throws Exception {
List<Path> paths = filesToCorrupt.get(nodeName);
if (paths != null) {
for (Path path : paths) {
try (OutputStream os = Files.newOutputStream(path)) {
os.write(0);
}
logger.info("corrupting file {} on node {}", path, nodeName);
}
}
return null;
}
});
ensureGreen();
}
private int numShards(String... index) {
ClusterState state = client().admin().cluster().prepareState().get().getState();
GroupShardsIterator shardIterators = state.getRoutingNodes().getRoutingTable().activePrimaryShardsGrouped(index, false);
return shardIterators.size();
}
private Map<String, List<Path>> findFilesToCorruptForReplica() throws IOException {
Map<String, List<Path>> filesToNodes = new HashMap<>();
ClusterState state = client().admin().cluster().prepareState().get().getState();
for (ShardRouting shardRouting : state.getRoutingTable().allShards("test")) {
if (shardRouting.primary() == true) {
continue;
}
assertTrue(shardRouting.assignedToNode());
NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(shardRouting.currentNodeId()).setFs(true).get();
NodeStats nodeStats = nodeStatses.getNodes()[0];
List<Path> files = new ArrayList<>();
filesToNodes.put(nodeStats.getNode().getName(), files);
for (FsInfo.Path info : nodeStats.getFs()) {
String path = info.getPath();
final String relativeDataLocationPath = "indices/test/" + Integer.toString(shardRouting.getId()) + "/index";
Path file = PathUtils.get(path).resolve(relativeDataLocationPath);
if (Files.exists(file)) { // multi data path might only have one path in use
try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) {
for (Path item : stream) {
if (item.getFileName().toString().startsWith("segments_")) {
files.add(item);
}
}
}
}
}
}
return filesToNodes;
}
private ShardRouting corruptRandomPrimaryFile() throws IOException {
return corruptRandomPrimaryFile(true);
}
private ShardRouting corruptRandomPrimaryFile(final boolean includePerCommitFiles) throws IOException {
ClusterState state = client().admin().cluster().prepareState().get().getState();
GroupShardsIterator shardIterators = state.getRoutingNodes().getRoutingTable().activePrimaryShardsGrouped(new String[]{"test"}, false);
List<ShardIterator> iterators = iterableAsArrayList(shardIterators);
ShardIterator shardIterator = RandomPicks.randomFrom(getRandom(), iterators);
ShardRouting shardRouting = shardIterator.nextOrNull();
assertNotNull(shardRouting);
assertTrue(shardRouting.primary());
assertTrue(shardRouting.assignedToNode());
String nodeId = shardRouting.currentNodeId();
NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(nodeId).setFs(true).get();
Set<Path> files = new TreeSet<>(); // treeset makes sure iteration order is deterministic
for (FsInfo.Path info : nodeStatses.getNodes()[0].getFs()) {
String path = info.getPath();
final String relativeDataLocationPath = "indices/test/" + Integer.toString(shardRouting.getId()) + "/index";
Path file = PathUtils.get(path).resolve(relativeDataLocationPath);
if (Files.exists(file)) { // multi data path might only have one path in use
try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) {
for (Path item : stream) {
if (Files.isRegularFile(item) && "write.lock".equals(item.getFileName().toString()) == false) {
if (includePerCommitFiles || isPerSegmentFile(item.getFileName().toString())) {
files.add(item);
}
}
}
}
}
}
pruneOldDeleteGenerations(files);
CorruptionUtils.corruptFile(getRandom(), files.toArray(new Path[0]));
return shardRouting;
}
private static final boolean isPerCommitFile(String fileName) {
// .liv and segments_N are per commit files and might change after corruption
return fileName.startsWith("segments") || fileName.endsWith(".liv");
}
private static final boolean isPerSegmentFile(String fileName) {
return isPerCommitFile(fileName) == false;
}
/**
* prunes the list of index files such that only the latest del generation files are contained.
*/
private void pruneOldDeleteGenerations(Set<Path> files) {
final TreeSet<Path> delFiles = new TreeSet<>();
for (Path file : files) {
if (file.getFileName().toString().endsWith(".liv")) {
delFiles.add(file);
}
}
Path last = null;
for (Path current : delFiles) {
if (last != null) {
final String newSegmentName = IndexFileNames.parseSegmentName(current.getFileName().toString());
final String oldSegmentName = IndexFileNames.parseSegmentName(last.getFileName().toString());
if (newSegmentName.equals(oldSegmentName)) {
int oldGen = Integer.parseInt(IndexFileNames.stripExtension(IndexFileNames.stripSegmentName(last.getFileName().toString())).replace("_", ""), Character.MAX_RADIX);
int newGen = Integer.parseInt(IndexFileNames.stripExtension(IndexFileNames.stripSegmentName(current.getFileName().toString())).replace("_", ""), Character.MAX_RADIX);
if (newGen > oldGen) {
files.remove(last);
} else {
files.remove(current);
continue;
}
}
}
last = current;
}
}
public List<Path> listShardFiles(ShardRouting routing) throws IOException {
NodesStatsResponse nodeStatses = client().admin().cluster().prepareNodesStats(routing.currentNodeId()).setFs(true).get();
assertThat(routing.toString(), nodeStatses.getNodes().length, equalTo(1));
List<Path> files = new ArrayList<>();
for (FsInfo.Path info : nodeStatses.getNodes()[0].getFs()) {
String path = info.getPath();
Path file = PathUtils.get(path).resolve("indices/test/" + Integer.toString(routing.getId()) + "/index");
if (Files.exists(file)) { // multi data path might only have one path in use
try (DirectoryStream<Path> stream = Files.newDirectoryStream(file)) {
for (Path item : stream) {
files.add(item);
}
}
}
}
return files;
}
}
| apache-2.0 |
emacarron/mybatis-3-no-local-cache | src/test/java/com/ibatis/sqlmap/proc/DerbyProcs.java | 1326 | /*
* Copyright 2009-2012 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 com.ibatis.sqlmap.proc;
import java.sql.*;
public class DerbyProcs {
public static void selectRows(int p1, int p2, int p3, int p4, ResultSet[] rs1, ResultSet[] rs2) throws SQLException {
Connection conn = DriverManager.getConnection("jdbc:default:connection");
PreparedStatement ps1 = conn.prepareStatement("select acc_id as id from account where acc_id in (?,?)");
ps1.setInt(1, p1);
ps1.setInt(2, p2);
rs1[0] = ps1.executeQuery();
PreparedStatement ps2 = conn.prepareStatement("select acc_id as id from account where acc_id in (?,?)");
ps2.setInt(1, p3);
ps2.setInt(2, p4);
rs2[0] = ps2.executeQuery();
conn.close();
}
} | apache-2.0 |
ingorichtsmeier/camunda-bpm-platform | engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/impl/event/CdiEventSupportBpmnParseListener.java | 10110 | /*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.engine.cdi.impl.event;
import java.util.List;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.camunda.bpm.engine.delegate.TaskListener;
import org.camunda.bpm.engine.impl.bpmn.behavior.UserTaskActivityBehavior;
import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.task.TaskDefinition;
import org.camunda.bpm.engine.impl.util.xml.Element;
import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
/**
* {@link BpmnParseListener} registering the {@link CdiEventListener} for
* distributing execution events using the cdi event infrastructure
*
* @author Daniel Meyer
*/
public class CdiEventSupportBpmnParseListener implements BpmnParseListener {
protected void addEndEventListener(ActivityImpl activity) {
activity.addExecutionListener(ExecutionListener.EVENTNAME_END, new CdiEventListener());
}
protected void addStartEventListener(ActivityImpl activity) {
activity.addExecutionListener(ExecutionListener.EVENTNAME_START, new CdiEventListener());
}
protected void addTaskCreateListeners(TaskDefinition taskDefinition) {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_CREATE, new CdiEventListener());
}
protected void addTaskAssignmentListeners(TaskDefinition taskDefinition) {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, new CdiEventListener());
}
protected void addTaskCompleteListeners(TaskDefinition taskDefinition) {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_COMPLETE, new CdiEventListener());
}
protected void addTaskUpdateListeners(TaskDefinition taskDefinition) {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_UPDATE, new CdiEventListener());
}
protected void addTaskDeleteListeners(TaskDefinition taskDefinition) {
taskDefinition.addTaskListener(TaskListener.EVENTNAME_DELETE, new CdiEventListener());
}
@Override
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
}
@Override
public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
addStartEventListener(startEventActivity);
addEndEventListener(startEventActivity);
}
@Override
public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) activity.getActivityBehavior();
TaskDefinition taskDefinition = activityBehavior.getTaskDefinition();
addTaskCreateListeners(taskDefinition);
addTaskAssignmentListeners(taskDefinition);
addTaskCompleteListeners(taskDefinition);
addTaskUpdateListeners(taskDefinition);
addTaskDeleteListeners(taskDefinition);
}
@Override
public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) {
addStartEventListener(timerActivity);
addEndEventListener(timerActivity);
}
@Override
public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) {
}
@Override
public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
transition.addExecutionListener(new CdiEventListener());
}
@Override
public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
}
@Override
public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
addStartEventListener(timerActivity);
addEndEventListener(timerActivity);
}
@Override
public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) {
addStartEventListener(signalActivity);
addEndEventListener(signalActivity);
}
@Override
public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
addStartEventListener(signalActivity);
addEndEventListener(signalActivity);
}
@Override
public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) {
}
@Override
public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
addStartEventListener(activity);
addEndEventListener(activity);
}
@Override
public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
}
@Override
public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) {
}
@Override
public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) {
}
@Override
public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) {
}
@Override
public void parseBoundaryEscalationEventDefinition(Element escalationEventDefinition, boolean interrupting, ActivityImpl boundaryEventActivity) {
}
@Override
public void parseBoundaryConditionalEventDefinition(Element element, boolean interrupting, ActivityImpl conditionalActivity) {
}
@Override
public void parseIntermediateConditionalEventDefinition(Element conditionalEventDefinition, ActivityImpl conditionalActivity) {
}
@Override
public void parseConditionalStartEventForEventSubprocess(Element element, ActivityImpl conditionalActivity, boolean interrupting) {
}
}
| apache-2.0 |
witekcc/spring-loaded | testdata/src/main/java/clinit/Three3.java | 136 | package clinit;
public class Three3 {
static int i;
{
i = 4;
}
public static String run() {
return Integer.toString(i);
}
}
| apache-2.0 |
DavidMihola/moshi | moshi/src/test/java/com/squareup/moshi/ObjectAdapterTest.java | 6071 | /*
* Copyright (C) 2015 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.squareup.moshi;
import java.util.AbstractCollection;
import java.util.AbstractList;
import java.util.AbstractMap;
import java.util.AbstractSet;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.junit.Ignore;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public final class ObjectAdapterTest {
@Test public void toJsonUsesRuntimeType() throws Exception {
Delivery delivery = new Delivery();
delivery.address = "1455 Market St.";
Pizza pizza = new Pizza();
pizza.diameter = 12;
pizza.extraCheese = true;
delivery.items = Arrays.asList(pizza, "Pepsi");
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(delivery)).isEqualTo("{"
+ "\"address\":\"1455 Market St.\","
+ "\"items\":["
+ "{\"diameter\":12,\"extraCheese\":true},"
+ "\"Pepsi\""
+ "]"
+ "}");
}
@Test public void toJsonJavaLangObject() throws Exception {
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(new Object())).isEqualTo("{}");
}
@Test public void fromJsonReturnsMapsAndLists() throws Exception {
Map<Object, Object> delivery = new LinkedHashMap<>();
delivery.put("address", "1455 Market St.");
Map<Object, Object> pizza = new LinkedHashMap<>();
pizza.put("diameter", 12d);
pizza.put("extraCheese", true);
delivery.put("items", Arrays.asList(pizza, "Pepsi"));
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.fromJson("{"
+ "\"address\":\"1455 Market St.\","
+ "\"items\":["
+ "{\"diameter\":12,\"extraCheese\":true},"
+ "\"Pepsi\""
+ "]"
+ "}")).isEqualTo(delivery);
}
@Test public void fromJsonUsesDoublesForNumbers() throws Exception {
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.fromJson("[0, 1]")).isEqualTo(Arrays.asList(0d, 1d));
}
@Test public void fromJsonDoesNotFailOnNullValues() throws Exception {
Map<Object, Object> emptyDelivery = new LinkedHashMap<>();
emptyDelivery.put("address", null);
emptyDelivery.put("items", null);
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.fromJson("{\"address\":null, \"items\":null}"))
.isEqualTo(emptyDelivery);
}
@Test public void toJsonCoercesRuntimeTypeForCollections() throws Exception {
Collection<String> collection = new AbstractCollection<String>() {
@Override public Iterator<String> iterator() {
return Collections.singleton("A").iterator();
}
@Override public int size() {
return 1;
}
};
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(collection)).isEqualTo("[\"A\"]");
}
@Test public void toJsonCoercesRuntimeTypeForLists() throws Exception {
List<String> list = new AbstractList<String>() {
@Override public String get(int i) {
return "A";
}
@Override public int size() {
return 1;
}
};
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(list)).isEqualTo("[\"A\"]");
}
@Test public void toJsonCoercesRuntimeTypeForSets() throws Exception {
Set<String> set = new AbstractSet<String>() {
@Override public Iterator<String> iterator() {
return Collections.singleton("A").iterator();
}
@Override public int size() {
return 1;
}
};
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(set)).isEqualTo("[\"A\"]");
}
@Ignore // We don't support raw maps, like Map<Object, Object>. (Even if the keys are strings!)
@Test public void toJsonCoercesRuntimeTypeForMaps() throws Exception {
Map<String, Boolean> map = new AbstractMap<String, Boolean>() {
@Override public Set<Entry<String, Boolean>> entrySet() {
return Collections.singletonMap("A", true).entrySet();
}
};
Moshi moshi = new Moshi.Builder().build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(map)).isEqualTo("{\"A\":true}");
}
@Test public void toJsonUsesTypeAdapters() throws Exception {
Object dateAdapter = new Object() {
@ToJson Long dateToJson(Date d) {
return d.getTime();
}
@FromJson Date dateFromJson(Long millis) {
return new Date(millis);
}
};
Moshi moshi = new Moshi.Builder()
.add(dateAdapter)
.build();
JsonAdapter<Object> adapter = moshi.adapter(Object.class);
assertThat(adapter.toJson(Arrays.asList(new Date(1), new Date(2)))).isEqualTo("[1,2]");
}
static class Delivery {
String address;
List<Object> items;
}
static class Pizza {
int diameter;
boolean extraCheese;
}
}
| apache-2.0 |
smaring/big-data-plugin | legacy-core/src/main/java/org/pentaho/di/core/namedcluster/NamedClusterManager.java | 13994 | /*******************************************************************************
*
* Pentaho Big Data
*
* Copyright (C) 2002-2020 by Hitachi Vantara : http://www.pentaho.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.pentaho.di.core.namedcluster;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.vfs2.FileName;
import org.apache.commons.vfs2.provider.url.UrlFileName;
import org.apache.commons.vfs2.provider.url.UrlFileNameParser;
import org.pentaho.di.core.namedcluster.model.NamedCluster;
import org.pentaho.di.core.util.StringUtil;
import org.pentaho.di.core.util.Utils;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.metastore.api.IMetaStore;
import org.pentaho.metastore.api.exceptions.MetaStoreException;
import org.pentaho.metastore.persist.MetaStoreFactory;
import org.pentaho.metastore.util.PentahoDefaults;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class NamedClusterManager {
private static final NamedClusterManager instance = new NamedClusterManager( new MetaStoreFactoryFactory() );
private final MetaStoreFactoryFactory metaStoreFactoryFactory;
private final Map<IMetaStore, MetaStoreFactory<NamedCluster>> factoryMap;
private NamedCluster clusterTemplate;
@VisibleForTesting
NamedClusterManager( MetaStoreFactoryFactory metaStoreFactoryFactory ) {
this.metaStoreFactoryFactory = metaStoreFactoryFactory;
factoryMap = new HashMap<>();
}
public static NamedClusterManager getInstance() {
return instance;
}
private MetaStoreFactory<NamedCluster> getMetaStoreFactory( IMetaStore metastore ) {
return factoryMap.computeIfAbsent( metastore, k -> metaStoreFactoryFactory.createFactory( metastore ) );
}
/**
* This method returns the named cluster template used to configure new NamedClusters.
*
* Note that this method returns a clone (deep) of the template.
*
* @return the NamedCluster template
*/
public NamedCluster getClusterTemplate() {
String localHost = "localhost";
if ( clusterTemplate == null ) {
clusterTemplate = new NamedCluster();
clusterTemplate.setName( "" );
clusterTemplate.setHdfsHost( localHost );
clusterTemplate.setHdfsPort( "8020" );
clusterTemplate.setHdfsUsername( "user" );
clusterTemplate.setHdfsPassword( clusterTemplate.encodePassword( "password" ) );
clusterTemplate.setJobTrackerHost( localHost );
clusterTemplate.setJobTrackerPort( "8032" );
clusterTemplate.setZooKeeperHost( localHost );
clusterTemplate.setZooKeeperPort( "2181" );
clusterTemplate.setOozieUrl( "http://localhost:8080/oozie" );
}
return clusterTemplate.clone();
}
/**
* This method will set the cluster template used when creating new NamedClusters
*
* @param clusterTemplate the NamedCluster template to set
*/
public void setClusterTemplate( NamedCluster clusterTemplate ) {
this.clusterTemplate = clusterTemplate;
}
/**
* Saves a named cluster in the provided IMetaStore
*
* @param namedCluster the NamedCluster to save
* @param metastore the IMetaStore to operate with
* @throws MetaStoreException
*/
public void create( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
factory.saveElement( namedCluster );
}
/**
* Reads a NamedCluster from the provided IMetaStore
*
* @param clusterName the name of the NamedCluster to load
* @param metastore the IMetaStore to operate with
* @return the NamedCluster that was loaded
* @throws MetaStoreException
*/
public NamedCluster read( String clusterName, IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
return factory.loadElement( clusterName );
}
/**
* Updates a NamedCluster in the provided IMetaStore
*
* @param namedCluster the NamedCluster to update
* @param metastore the IMetaStore to operate with
* @throws MetaStoreException
*/
public void update( NamedCluster namedCluster, IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
List<NamedCluster> namedClusters = list( metastore );
for ( NamedCluster nc : namedClusters ) {
if ( namedCluster.getName().equals( nc.getName() ) ) {
factory.deleteElement( nc.getName() );
factory.saveElement( namedCluster );
}
}
}
/**
* Deletes a NamedCluster from the provided IMetaStore
*
* @param clusterName the NamedCluster to delete
* @param metastore the IMetaStore to operate with
* @throws MetaStoreException
*/
public void delete( String clusterName, IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
factory.deleteElement( clusterName );
}
/**
* This method lists the NamedCluster in the given IMetaStore. If an exception is thrown when parsing the data for
* a given NamedCluster, the namedCluster will be skipped a processing will continue without logging the exception.
* This methods serves to limit the frequency of any exception logs that would otherwise occur.
*
* @param metastore the IMetaStore to operate with
* @return the list of NamedClusters in the provided IMetaStore
* @throws MetaStoreException
*/
public List<NamedCluster> list( IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
List<MetaStoreException> exceptionList = new ArrayList<>();
return factory.getElements( true, exceptionList );
}
/**
* This method lists the NamedClusters in the given IMetaStore. If an exception is thrown when parsing the data for
* a given NamedCluster. The exception will be added to the exceptionList, but list generation will continue.
*
* @param metastore the IMetaStore to operate with
* @return the list of NamedClusters in the provided IMetaStore
* @throws MetaStoreException
*/
public List<NamedCluster> list( IMetaStore metastore, List<MetaStoreException> exceptionList )
throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
return factory.getElements( true, exceptionList );
}
/**
* This method returns the list of NamedCluster names in the IMetaStore
*
* @param metastore the IMetaStore to operate with
* @return the list of NamedCluster names (Strings)
* @throws MetaStoreException
*/
public List<String> listNames( IMetaStore metastore ) throws MetaStoreException {
MetaStoreFactory<NamedCluster> factory = getMetaStoreFactory( metastore );
return factory.getElementNames();
}
/**
* This method checks if the NamedCluster exists in the metastore
*
* @param clusterName the name of the NamedCluster to check
* @param metastore the IMetaStore to operate with
* @return true if the NamedCluster exists in the given metastore
* @throws MetaStoreException
*/
public boolean contains( String clusterName, IMetaStore metastore ) throws MetaStoreException {
if ( metastore == null ) {
return false;
}
for ( String name : listNames( metastore ) ) {
if ( name.equals( clusterName ) ) {
return true;
}
}
return false;
}
/**
* This method generates the URL from the specific NamedCluster using the specified scheme.
*
* @param scheme
* the name of the scheme to use to create the URL
* @param clusterName
* the name of the NamedCluster to use to create the URL
* @return the generated URL from the specific NamedCluster or null if an error occurs
*/
@VisibleForTesting
String generateURL( String scheme, String clusterName, IMetaStore metastore, VariableSpace variableSpace ) {
String clusterURL = null;
try {
if ( !Utils.isEmpty( scheme ) && !Utils.isEmpty( clusterName ) && metastore != null ) {
NamedCluster namedCluster = read( clusterName, metastore );
if ( namedCluster != null ) {
String ncHostname = Optional.ofNullable( namedCluster.getHdfsHost() ).orElse( "" );
String ncPort = Optional.ofNullable( namedCluster.getHdfsPort() ).orElse( "" );
String ncUsername = Optional.ofNullable( namedCluster.getHdfsUsername() ).orElse( "" );
String ncPassword = Optional.ofNullable( namedCluster.getHdfsPassword() ).orElse( "" );
if ( variableSpace != null ) {
variableSpace.initializeVariablesFrom( namedCluster.getParentVariableSpace() );
scheme = getVariableValue( scheme, variableSpace );
ncHostname = getVariableValue( ncHostname, variableSpace );
ncPort = getVariableValue( ncPort, variableSpace );
ncUsername = getVariableValue( ncUsername, variableSpace );
ncPassword = getVariableValue( ncPassword, variableSpace );
}
ncHostname = Optional.ofNullable( ncHostname ).orElse( "" ).trim();
if ( ncPort == null || Utils.isEmpty( ncPort.trim() ) ) {
ncPort = "-1";
}
ncPort = ncPort.trim();
ncUsername = Optional.ofNullable( ncUsername ).orElse( "" ).trim();
ncPassword = Optional.ofNullable( ncPassword ).orElse( "" ).trim();
UrlFileName file =
new UrlFileName( scheme, ncHostname, Integer.parseInt( ncPort ), -1, ncUsername, ncPassword, null, null,
null );
clusterURL = file.getURI();
if ( clusterURL.endsWith( "/" ) ) {
clusterURL = clusterURL.substring( 0, clusterURL.lastIndexOf( '/' ) );
}
}
}
} catch ( Exception e ) {
clusterURL = null;
}
return clusterURL;
}
/**
* This method checks a value to see if it is a variable and, if it is, gets the value from a variable space.
* @param variableName The String to check if it is a variable
* @param variableSpace The variable space to check for values
* @return The value of the variable within the variable space if found, null if not found or the original value if is not a variable.
*/
private String getVariableValue( String variableName, VariableSpace variableSpace ) {
if ( StringUtil.isVariable( variableName ) ) {
return variableSpace.getVariable( StringUtil.getVariableName( variableName ) ) != null ? variableSpace
.environmentSubstitute( variableName ) : null;
}
return variableName;
}
/**
* This method performs the root URL substitution with the URL of the specified NamedCluster
*
* @param clusterName
* the NamedCluster to use to generate the URL for the substitution
* @param incomingURL
* the URL whose root will be replaced
* @param scheme
* the scheme to be used to generate the URL of the specified NamedCluster
* @return the generated URL or the incoming URL if an error occurs
*/
public String processURLsubstitution( String clusterName, String incomingURL,
String scheme, IMetaStore metastore, VariableSpace variableSpace ) {
String outgoingURL = null;
String clusterURL = null;
if ( !scheme.equals( NamedCluster.MAPRFS_SCHEME ) ) {
clusterURL = generateURL( scheme, clusterName, metastore, variableSpace );
}
try {
if ( clusterURL == null ) {
outgoingURL = incomingURL;
} else if ( incomingURL.equals( "/" ) ) {
outgoingURL = clusterURL;
} else {
String noVariablesURL = incomingURL.replaceAll( "[${}]", "/" );
String fullyQualifiedIncomingURL = incomingURL;
if ( !incomingURL.startsWith( scheme ) ) {
fullyQualifiedIncomingURL = clusterURL + incomingURL;
noVariablesURL = clusterURL + incomingURL.replaceAll( "[${}]", "/" );
}
UrlFileNameParser parser = new UrlFileNameParser();
FileName fileName = parser.parseUri( null, null, noVariablesURL );
String root = fileName.getRootURI();
String path = fullyQualifiedIncomingURL.substring( root.length() - 1 );
StringBuilder buffer = new StringBuilder();
buffer.append( clusterURL );
buffer.append( path );
outgoingURL = buffer.toString();
}
} catch ( Exception e ) {
outgoingURL = null;
}
return outgoingURL;
}
public NamedCluster getNamedClusterByName( String namedCluster, IMetaStore metastore ) {
if ( metastore == null ) {
return null;
}
try {
List<NamedCluster> namedClusters = list( metastore );
for ( NamedCluster nc : namedClusters ) {
if ( nc.getName().equals( namedCluster ) ) {
return nc;
}
}
} catch ( MetaStoreException e ) {
return null;
}
return null;
}
static class MetaStoreFactoryFactory {
MetaStoreFactory<NamedCluster> createFactory( IMetaStore metaStore ) {
return new MetaStoreFactory<>( NamedCluster.class, metaStore, PentahoDefaults.NAMESPACE );
}
}
}
| apache-2.0 |
robertgeiger/incubator-geode | gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/SerialGatewaySenderCreation.java | 3269 | /*
* 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 com.gemstone.gemfire.internal.cache.xmlcache;
import java.util.List;
import com.gemstone.gemfire.CancelCriterion;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.distributed.internal.DM;
import com.gemstone.gemfire.distributed.internal.DistributionAdvisee;
import com.gemstone.gemfire.distributed.internal.DistributionAdvisor;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionAdvisor.Profile;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EnumListenerEvent;
import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
import com.gemstone.gemfire.internal.cache.wan.GatewaySenderAttributes;
public class SerialGatewaySenderCreation extends AbstractGatewaySender implements GatewaySender{
public SerialGatewaySenderCreation(Cache cache,
GatewaySenderAttributes attrs) {
super(cache, attrs);
}
public void distribute(EnumListenerEvent operation, EntryEventImpl event, List<Integer> remoteDSIds) {
}
@Override
public void start(){
}
public void stop() {
}
public void rebalance() {
throw new UnsupportedOperationException();
}
public void fillInProfile(Profile profile) {
// TODO Auto-generated method stub
}
public CancelCriterion getCancelCriterion() {
// TODO Auto-generated method stub
return null;
}
public DistributionAdvisor getDistributionAdvisor() {
// TODO Auto-generated method stub
return null;
}
public DM getDistributionManager() {
// TODO Auto-generated method stub
return null;
}
public String getFullPath() {
// TODO Auto-generated method stub
return null;
}
public String getName() {
// TODO Auto-generated method stub
return null;
}
public DistributionAdvisee getParentAdvisee() {
// TODO Auto-generated method stub
return null;
}
public Profile getProfile() {
// TODO Auto-generated method stub
return null;
}
public int getSerialNumber() {
// TODO Auto-generated method stub
return 0;
}
public InternalDistributedSystem getSystem() {
// TODO Auto-generated method stub
return null;
}
@Override
protected void setModifiedEventId(EntryEventImpl clonedEvent) {
// TODO Auto-generated method stub
}
}
| apache-2.0 |
lukhnos/j2objc | jre_emul/android/platform/libcore/luni/src/test/java/libcore/java/time/OffsetTimeTest.java | 3476 | /*
* Copyright (C) 2017 The Android Open Source 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 libcore.java.time;
import org.junit.Test;
import java.time.OffsetTime;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.util.EnumSet;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
/**
* Additional tests for {@link OffsetTime}.
*
* @see tck.java.time.TCKOffsetTime
* @see test.java.time.TestOffsetTime
*/
public class OffsetTimeTest {
private static final OffsetTime NOON_UTC = OffsetTime
.of(/* hour */ 12, /* minute */ 0, /* second */ 0, /* nano */ 0, ZoneOffset.UTC);
@Test
public void test_plus() {
// Most of the logic is in LocalTime, to which OffsetTime#plus() delegates, verify only some
// simple cases here. In-depth tests for LocalTime#plus() can be found in TCKLocalTime.
assertEquals(OffsetTime.of(13, 0, 0, 0, ZoneOffset.UTC),
NOON_UTC.plus(1, ChronoUnit.HOURS));
assertEquals(OffsetTime.of(11, 0, 0, 0, ZoneOffset.UTC),
NOON_UTC.plus(23, ChronoUnit.HOURS));
assertEquals(OffsetTime.of(12, 1, 0, 0, ZoneOffset.UTC),
NOON_UTC.plus(1, ChronoUnit.MINUTES));
assertEquals(OffsetTime.of(12, 1, 0, 0, ZoneOffset.UTC),
NOON_UTC.plus(60, ChronoUnit.SECONDS));
assertEquals(OffsetTime.of(12, 0, 0, 1_000_000, ZoneOffset.UTC),
NOON_UTC.plus(1, ChronoUnit.MILLIS));
assertEquals(OffsetTime.of(12, 0, 0, 1, ZoneOffset.UTC),
NOON_UTC.plus(1, ChronoUnit.NANOS));
}
@Test
public void test_plus_noop() {
assertPlusIsNoop(0, ChronoUnit.MINUTES);
assertPlusIsNoop(2, ChronoUnit.HALF_DAYS);
assertPlusIsNoop(24, ChronoUnit.HOURS);
assertPlusIsNoop(24 * 60, ChronoUnit.MINUTES);
assertPlusIsNoop(24 * 60 * 60, ChronoUnit.SECONDS);
assertPlusIsNoop(24 * 60 * 60 * 1_000, ChronoUnit.MILLIS);
assertPlusIsNoop(24 * 60 * 60 * 1_000_000_000L, ChronoUnit.NANOS);
}
private static void assertPlusIsNoop(long amount, TemporalUnit unit) {
assertSame(NOON_UTC, NOON_UTC.plus(amount, unit));
}
@Test
public void test_plus_minus_invalidUnits() {
for (ChronoUnit unit : EnumSet.range(ChronoUnit.DAYS, ChronoUnit.FOREVER)) {
try {
NOON_UTC.plus(1, unit);
fail("Adding 1 " + unit + " should have failed.");
} catch (UnsupportedTemporalTypeException expected) {
}
try {
NOON_UTC.minus(1, unit);
fail("Subtracting 1 " + unit + " should have failed.");
} catch (UnsupportedTemporalTypeException expected) {
}
}
}
}
| apache-2.0 |
camunda/camunda-cmmn-model | src/test/java/org/camunda/bpm/model/cmmn/instance/TableItemTest.java | 1446 | /*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.model.cmmn.instance;
import java.util.Arrays;
import java.util.Collection;
/**
* @author Roman Smirnov
*
*/
public class TableItemTest extends CmmnModelElementInstanceTest {
public TypeAssumption getTypeAssumption() {
return new TypeAssumption(CmmnElement.class, true);
}
public Collection<ChildElementAssumption> getChildElementAssumptions() {
return null;
}
public Collection<AttributeAssumption> getAttributesAssumptions() {
return Arrays.asList(
new AttributeAssumption("applicabilityRuleRefs"),
new AttributeAssumption("authorizedRoleRefs")
);
}
}
| apache-2.0 |
fnp/pylucene | lucene-java-3.5.0/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedAllTermDocs.java | 1217 | /**
* 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.lucene.store.instantiated;
import org.apache.lucene.index.AbstractAllTermDocs;
class InstantiatedAllTermDocs extends AbstractAllTermDocs {
private InstantiatedIndexReader reader;
InstantiatedAllTermDocs(InstantiatedIndexReader reader) {
super(reader.maxDoc());
this.reader = reader;
}
@Override
public boolean isDeleted(int doc) {
return reader.isDeleted(doc);
}
}
| apache-2.0 |
sjmittal/pinpoint | bootstrap-core/src/main/java/com/navercorp/pinpoint/bootstrap/plugin/test/ExpectedTrace.java | 2456 | /*
* Copyright 2014 NAVER Corp.
* 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.navercorp.pinpoint.bootstrap.plugin.test;
import java.lang.reflect.Member;
/**
* @author Jongho Moon
*
*/
public class ExpectedTrace {
private final TraceType type;
private final String serviceType;
private final Member method;
private final String methodSignature;
private final String rpc;
private final String endPoint;
private final String remoteAddr;
private final String destinationId;
private final ExpectedAnnotation[] annotations;
private final ExpectedTrace[] asyncTraces;
public ExpectedTrace(TraceType type, String serviceType, Member method, String methodSignature, String rpc, String endPoint, String remoteAddr, String destinationId, ExpectedAnnotation[] annotations, ExpectedTrace[] asyncTraces) {
this.type = type;
this.serviceType = serviceType;
this.method = method;
this.methodSignature = methodSignature;
this.rpc = rpc;
this.endPoint = endPoint;
this.remoteAddr = remoteAddr;
this.destinationId = destinationId;
this.annotations = annotations;
this.asyncTraces = asyncTraces;
}
public TraceType getType() {
return type;
}
public String getServiceType() {
return serviceType;
}
public Member getMethod() {
return method;
}
public String getMethodSignature() {
return methodSignature;
}
public String getRpc() {
return rpc;
}
public String getEndPoint() {
return endPoint;
}
public String getRemoteAddr() {
return remoteAddr;
}
public String getDestinationId() {
return destinationId;
}
public ExpectedAnnotation[] getAnnotations() {
return annotations;
}
public ExpectedTrace[] getAsyncTraces() {
return asyncTraces;
}
}
| apache-2.0 |
umadevik/log4j-android | src/main/java/org/apache/log4j/config/PropertyGetter.java | 3835 | /*
* 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.log4j.config;
import org.apache.log4j.Priority;
import org.apache.log4j.helpers.LogLog;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.InterruptedIOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
Used for inferring configuration information for a log4j's component.
@author Anders Kristensen
*/
public class PropertyGetter {
protected static final Object[] NULL_ARG = new Object[] {};
protected Object obj;
protected PropertyDescriptor[] props;
public interface PropertyCallback {
void foundProperty(Object obj, String prefix, String name, Object value);
}
/**
Create a new PropertyGetter for the specified Object. This is done
in prepartion for invoking {@link
#getProperties(PropertyGetter.PropertyCallback, String)} one or
more times.
@param obj the object for which to set properties */
public
PropertyGetter(Object obj) throws IntrospectionException {
BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
props = bi.getPropertyDescriptors();
this.obj = obj;
}
public
static
void getProperties(Object obj, PropertyCallback callback, String prefix) {
try {
new PropertyGetter(obj).getProperties(callback, prefix);
} catch (IntrospectionException ex) {
LogLog.error("Failed to introspect object " + obj, ex);
}
}
public
void getProperties(PropertyCallback callback, String prefix) {
for (int i = 0; i < props.length; i++) {
Method getter = props[i].getReadMethod();
if (getter == null) continue;
if (!isHandledType(getter.getReturnType())) {
//System.err.println("Ignoring " + props[i].getName() +" " + getter.getReturnType());
continue;
}
String name = props[i].getName();
try {
Object result = getter.invoke(obj, NULL_ARG);
//System.err.println("PROP " + name +": " + result);
if (result != null) {
callback.foundProperty(obj, prefix, name, result);
}
} catch (IllegalAccessException ex) {
LogLog.warn("Failed to get value of property " + name);
} catch (InvocationTargetException ex) {
if (ex.getTargetException() instanceof InterruptedException
|| ex.getTargetException() instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
LogLog.warn("Failed to get value of property " + name);
} catch (RuntimeException ex) {
LogLog.warn("Failed to get value of property " + name);
}
}
}
protected
boolean isHandledType(Class type) {
return String.class.isAssignableFrom(type) ||
Integer.TYPE.isAssignableFrom(type) ||
Long.TYPE.isAssignableFrom(type) ||
Boolean.TYPE.isAssignableFrom(type) ||
Priority.class.isAssignableFrom(type);
}
}
| apache-2.0 |
rodsol/relex-temp | src/java/relex/anaphora/Antecedents.java | 7890 | /*
* Copyright 2008 Novamente LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package relex.anaphora;
import java.util.ArrayList;
import java.util.HashMap;
import relex.tree.PhraseTree;
import relex.feature.FeatureNode;
/**
* Implements storage of anaphora-antecedent pairs,
* used during pronoun resolution.
*
* Copyright (C) 2008 Linas Vepstas <linas@linas.org>
*/
public class Antecedents
{
public static final int DEBUG = 0;
// Map of anaphora to a list of candidate antecedents.
// What's actually stored are the pointers to the
// phrases for each. To get the actual words, use the
// getPhraseLeader() function.
private HashMap<PhraseTree, ArrayList<PhraseTree>> ante_map;
public Antecedents()
{
ante_map = new HashMap<PhraseTree, ArrayList<PhraseTree>>();
}
/**
* add -- Add a pronoun/antecedent pair to the list
* @return: true if the pair was added to the list.
*/
public boolean add(PhraseTree anaph, PhraseTree ante)
{
// A return of true from the filter rejects the antecedent.
if (applyFilters(anaph, ante)) return false;
ArrayList<PhraseTree> ante_list = ante_map.get(anaph);
if (ante_list == null)
{
ante_list = new ArrayList<PhraseTree>();
ante_map.put(anaph, ante_list);
}
ante_list.add(ante);
return true;
}
/**
* clear() -- Remove all pronoun/antecedent pairs from the list
*/
public void clear()
{
ante_map = new HashMap<PhraseTree, ArrayList<PhraseTree>>();
}
/**
* getAntecedents -- return the collection of antecedents
* Returns a map of prononous to antecedent lists.
* The antecedents are ordered from most likely to
* least likely.
*/
private ArrayList<FeatureNode> getAntecedent(PhraseTree anaph)
{
ArrayList<PhraseTree> ante_list = ante_map.get(anaph);
if (ante_list == null) return null;
ArrayList<FeatureNode> rlist = new ArrayList<FeatureNode>();
// Integer i is the "Hobbs distance"
for (int i=0; i<ante_list.size(); i++)
{
PhraseTree ante = ante_list.get(i);
FeatureNode nante = ante.getPhraseLeader();
if (nante != null) rlist.add(nante);
}
return rlist;
}
public HashMap<FeatureNode,ArrayList<FeatureNode>> getAntecedents()
{
HashMap<FeatureNode,ArrayList<FeatureNode>> fmap =
new HashMap<FeatureNode,ArrayList<FeatureNode>>();
for (PhraseTree anaph : ante_map.keySet())
{
ArrayList<FeatureNode> amap = getAntecedent(anaph);
FeatureNode prn = anaph.getPhraseLeader();
if (prn != null) fmap.put(prn, amap);
}
return fmap;
}
/* ----------------------------------------------------------- */
/* Agreement filters */
/**
* Reject anaphora that reference other anaphora as antecedents.
* I.E. "she" can't refer to another "she".
* Retun true to reject.
*/
private Boolean antiAnaFilter(FeatureNode anph, FeatureNode ante)
{
FeatureNode pro = ante.get("pronoun-FLAG");
if (pro == null) return false;
if (DEBUG > 0)
{
System.out.println("Anti-anaphora filter mismatch");
}
return true;
}
/**
* Reject antecedents whose number does not agree with
* the anaphora. noun_number is always valued as
* "singular", "plural" or "uncountable".
* Retun true to reject.
*/
private Boolean numberFilter(FeatureNode anph, FeatureNode ante)
{
FeatureNode ant = ante.get("noun_number");
// Some antecedents may not have a noun number, possibly due
// to a relex bug, or some valid reason?
if (ant == null) return false;
String sant = ant.getValue();
FeatureNode prn = anph.get("noun_number");
// "it" won't have a noun_number, since it needs to be
// singular ("It was a book") or uncountable ("It was hot coffee");
// However, "it" can never match a plural.
if (prn == null)
{
if (sant.equals("plural"))
{
if (DEBUG > 0)
{
System.out.println("Number filter mismatch: it/plural");
}
return true;
}
return false;
}
String sprn = prn.getValue();
if (sant.equals(sprn)) return false;
if (DEBUG > 0)
{
System.out.println("Number filter mismatch");
}
return true;
}
/**
* Reject antecedents whose gender does not agree with
* the anaphora. gender is always valued as
* "masculine", "feminine" or "neuter"
* Retun true to reject.
*/
private Boolean genderFilter(FeatureNode anph, FeatureNode ante)
{
// XXX All anaphors should have a gender at this point,
// we should probably signal an error if not.
FeatureNode prn = anph.get("gender");
if (prn == null) return false;
String sprn = prn.getValue();
// If antecedents don't have gender indicated,
// assume they are neuter. These can only match
// non-sex pronouns.
FeatureNode ant = ante.get("gender");
if (ant == null)
{
if(sprn.equals("neuter")) return false;
if (DEBUG > 0)
{
System.out.println("Gender filter mismatch: neuter/sexed");
}
return true;
}
String sant = ant.getValue();
if (sant.equals(sprn)) return false;
if (sant.equals("person") && sprn.equals("masculine")) return false;
if (sant.equals("person") && sprn.equals("feminine")) return false;
if (DEBUG > 0)
{
System.out.println("Gender filter mismatch");
}
return true;
}
/**
* Phrases like (NP (NP the boxes) and (NP the cup))
* will not have a leader. Reject it, and, instead,
* try to pick up the individual parts.
* XXX but this is wrong/messy:
* "Alice held a lamp and and ashtray. They were ugly"
*/
private Boolean nullLeaderFilter(PhraseTree ante, FeatureNode prn)
{
return true;
}
private Boolean applyFilters(PhraseTree anaph, PhraseTree ante)
{
FeatureNode prn = anaph.getPhraseLeader();
if (prn == null)
{
System.err.println ("Warning: Anaphore is missing a phrase leader!\n" +
anaph.toString());
return false;
}
prn = prn.get("ref");
if (DEBUG > 0)
{
System.out.println("Anaphore: " + anaph.toString());
System.out.println("Candidate antecedent: " + ante.toString());
}
FeatureNode ref = ante.getPhraseLeader();
if ((ref == null) && nullLeaderFilter(ante, prn)) return true;
ref = ref.get("ref");
// Apply filters. Filter returns true to reject.
if (antiAnaFilter(prn, ref)) return true;
if (numberFilter(prn, ref)) return true;
if (genderFilter(prn, ref)) return true;
return false;
}
/* ----------------------------------------------------------- */
// Return string associated to phrase
private String getword(PhraseTree pt)
{
FeatureNode ph = pt.getPhraseLeader();
if (ph == null) return "";
ph = ph.get("str");
if (ph == null) return "";
return ph.getValue();
}
/**
* toString() -- utility print shows antecedent candidates
*
* The integer printed in the square brackets is the
* "Hobbs score" for the candidate: the lower, the more likely.
*/
public String toString(PhraseTree prn)
{
ArrayList<PhraseTree> ante_list = ante_map.get(prn);
if (ante_list == null) return "";
String str = "";
String prw = getword(prn);
// Integer i is the "Hobbs distance"
for (int i=0; i<ante_list.size(); i++)
{
PhraseTree ante = ante_list.get(i);
str += "_ante_candidate(" + prw + ", " + getword(ante) + ") {" + i + "}\n";
}
return str;
}
public String toString()
{
String str = "";
for (PhraseTree prn : ante_map.keySet())
{
str += toString(prn);
}
return str;
}
} // end Antecedents
/* ==================== END OF FILE ================== */
| apache-2.0 |
HonzaKral/elasticsearch | server/src/main/java/org/elasticsearch/common/time/DateUtils.java | 18238 | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch 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.elasticsearch.common.time;
import org.apache.logging.log4j.LogManager;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.joda.time.DateTimeZone;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import static java.util.Map.entry;
import static org.elasticsearch.common.time.DateUtilsRounding.getMonthOfYear;
import static org.elasticsearch.common.time.DateUtilsRounding.getTotalMillisByYearMonth;
import static org.elasticsearch.common.time.DateUtilsRounding.getYear;
import static org.elasticsearch.common.time.DateUtilsRounding.utcMillisAtStartOfYear;
public class DateUtils {
public static DateTimeZone zoneIdToDateTimeZone(ZoneId zoneId) {
if (zoneId == null) {
return null;
}
if (zoneId instanceof ZoneOffset) {
// the id for zoneoffset is not ISO compatible, so cannot be read by ZoneId.of
return DateTimeZone.forOffsetMillis(((ZoneOffset)zoneId).getTotalSeconds() * 1000);
}
return DateTimeZone.forID(zoneId.getId());
}
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(DateFormatters.class));
// pkg private for tests
static final Map<String, String> DEPRECATED_SHORT_TIMEZONES;
public static final Set<String> DEPRECATED_SHORT_TZ_IDS;
static {
Map<String, String> tzs = new HashMap<>();
tzs.put("EST", "-05:00"); // eastern time without daylight savings
tzs.put("HST", "-10:00");
tzs.put("MST", "-07:00");
tzs.put("ROC", "Asia/Taipei");
tzs.put("Eire", "Europe/London");
DEPRECATED_SHORT_TIMEZONES = Collections.unmodifiableMap(tzs);
DEPRECATED_SHORT_TZ_IDS = tzs.keySet();
}
// Map of deprecated timezones and their recommended new counterpart
public static final Map<String, String> DEPRECATED_LONG_TIMEZONES = Map.ofEntries(
entry("Africa/Asmera", "Africa/Nairobi"),
entry("Africa/Timbuktu", "Africa/Abidjan"),
entry("America/Argentina/ComodRivadavia", "America/Argentina/Catamarca"),
entry("America/Atka", "America/Adak"),
entry("America/Buenos_Aires", "America/Argentina/Buenos_Aires"),
entry("America/Catamarca", "America/Argentina/Catamarca"),
entry("America/Coral_Harbour", "America/Atikokan"),
entry("America/Cordoba", "America/Argentina/Cordoba"),
entry("America/Ensenada", "America/Tijuana"),
entry("America/Fort_Wayne", "America/Indiana/Indianapolis"),
entry("America/Indianapolis", "America/Indiana/Indianapolis"),
entry("America/Jujuy", "America/Argentina/Jujuy"),
entry("America/Knox_IN", "America/Indiana/Knox"),
entry("America/Louisville", "America/Kentucky/Louisville"),
entry("America/Mendoza", "America/Argentina/Mendoza"),
entry("America/Montreal", "America/Toronto"),
entry("America/Porto_Acre", "America/Rio_Branco"),
entry("America/Rosario", "America/Argentina/Cordoba"),
entry("America/Santa_Isabel", "America/Tijuana"),
entry("America/Shiprock", "America/Denver"),
entry("America/Virgin", "America/Port_of_Spain"),
entry("Antarctica/South_Pole", "Pacific/Auckland"),
entry("Asia/Ashkhabad", "Asia/Ashgabat"),
entry("Asia/Calcutta", "Asia/Kolkata"),
entry("Asia/Chongqing", "Asia/Shanghai"),
entry("Asia/Chungking", "Asia/Shanghai"),
entry("Asia/Dacca", "Asia/Dhaka"),
entry("Asia/Harbin", "Asia/Shanghai"),
entry("Asia/Kashgar", "Asia/Urumqi"),
entry("Asia/Katmandu", "Asia/Kathmandu"),
entry("Asia/Macao", "Asia/Macau"),
entry("Asia/Rangoon", "Asia/Yangon"),
entry("Asia/Saigon", "Asia/Ho_Chi_Minh"),
entry("Asia/Tel_Aviv", "Asia/Jerusalem"),
entry("Asia/Thimbu", "Asia/Thimphu"),
entry("Asia/Ujung_Pandang", "Asia/Makassar"),
entry("Asia/Ulan_Bator", "Asia/Ulaanbaatar"),
entry("Atlantic/Faeroe", "Atlantic/Faroe"),
entry("Atlantic/Jan_Mayen", "Europe/Oslo"),
entry("Australia/ACT", "Australia/Sydney"),
entry("Australia/Canberra", "Australia/Sydney"),
entry("Australia/LHI", "Australia/Lord_Howe"),
entry("Australia/NSW", "Australia/Sydney"),
entry("Australia/North", "Australia/Darwin"),
entry("Australia/Queensland", "Australia/Brisbane"),
entry("Australia/South", "Australia/Adelaide"),
entry("Australia/Tasmania", "Australia/Hobart"),
entry("Australia/Victoria", "Australia/Melbourne"),
entry("Australia/West", "Australia/Perth"),
entry("Australia/Yancowinna", "Australia/Broken_Hill"),
entry("Brazil/Acre", "America/Rio_Branco"),
entry("Brazil/DeNoronha", "America/Noronha"),
entry("Brazil/East", "America/Sao_Paulo"),
entry("Brazil/West", "America/Manaus"),
entry("Canada/Atlantic", "America/Halifax"),
entry("Canada/Central", "America/Winnipeg"),
entry("Canada/East-Saskatchewan", "America/Regina"),
entry("Canada/Eastern", "America/Toronto"),
entry("Canada/Mountain", "America/Edmonton"),
entry("Canada/Newfoundland", "America/St_Johns"),
entry("Canada/Pacific", "America/Vancouver"),
entry("Canada/Yukon", "America/Whitehorse"),
entry("Chile/Continental", "America/Santiago"),
entry("Chile/EasterIsland", "Pacific/Easter"),
entry("Cuba", "America/Havana"),
entry("Egypt", "Africa/Cairo"),
entry("Eire", "Europe/Dublin"),
entry("Europe/Belfast", "Europe/London"),
entry("Europe/Tiraspol", "Europe/Chisinau"),
entry("GB", "Europe/London"),
entry("GB-Eire", "Europe/London"),
entry("Greenwich", "Etc/GMT"),
entry("Hongkong", "Asia/Hong_Kong"),
entry("Iceland", "Atlantic/Reykjavik"),
entry("Iran", "Asia/Tehran"),
entry("Israel", "Asia/Jerusalem"),
entry("Jamaica", "America/Jamaica"),
entry("Japan", "Asia/Tokyo"),
entry("Kwajalein", "Pacific/Kwajalein"),
entry("Libya", "Africa/Tripoli"),
entry("Mexico/BajaNorte", "America/Tijuana"),
entry("Mexico/BajaSur", "America/Mazatlan"),
entry("Mexico/General", "America/Mexico_City"),
entry("NZ", "Pacific/Auckland"),
entry("NZ-CHAT", "Pacific/Chatham"),
entry("Navajo", "America/Denver"),
entry("PRC", "Asia/Shanghai"),
entry("Pacific/Johnston", "Pacific/Honolulu"),
entry("Pacific/Ponape", "Pacific/Pohnpei"),
entry("Pacific/Samoa", "Pacific/Pago_Pago"),
entry("Pacific/Truk", "Pacific/Chuuk"),
entry("Pacific/Yap", "Pacific/Chuuk"),
entry("Poland", "Europe/Warsaw"),
entry("Portugal", "Europe/Lisbon"),
entry("ROC", "Asia/Taipei"),
entry("ROK", "Asia/Seoul"),
entry("Singapore", "Asia/Singapore"),
entry("Turkey", "Europe/Istanbul"),
entry("UCT", "Etc/UCT"),
entry("US/Alaska", "America/Anchorage"),
entry("US/Aleutian", "America/Adak"),
entry("US/Arizona", "America/Phoenix"),
entry("US/Central", "America/Chicago"),
entry("US/East-Indiana", "America/Indiana/Indianapolis"),
entry("US/Eastern", "America/New_York"),
entry("US/Hawaii", "Pacific/Honolulu"),
entry("US/Indiana-Starke", "America/Indiana/Knox"),
entry("US/Michigan", "America/Detroit"),
entry("US/Mountain", "America/Denver"),
entry("US/Pacific", "America/Los_Angeles"),
entry("US/Samoa", "Pacific/Pago_Pago"),
entry("Universal", "Etc/UTC"),
entry("W-SU", "Europe/Moscow"),
entry("Zulu", "Etc/UTC"));
public static ZoneId dateTimeZoneToZoneId(DateTimeZone timeZone) {
if (timeZone == null) {
return null;
}
if (DateTimeZone.UTC.equals(timeZone)) {
return ZoneOffset.UTC;
}
return of(timeZone.getID());
}
public static ZoneId of(String zoneId) {
String deprecatedId = DEPRECATED_SHORT_TIMEZONES.get(zoneId);
if (deprecatedId != null) {
deprecationLogger.deprecatedAndMaybeLog("timezone",
"Use of short timezone id " + zoneId + " is deprecated. Use " + deprecatedId + " instead");
return ZoneId.of(deprecatedId);
}
return ZoneId.of(zoneId).normalized();
}
static final Instant MAX_NANOSECOND_INSTANT = Instant.parse("2262-04-11T23:47:16.854775807Z");
static final long MAX_NANOSECOND_IN_MILLIS = MAX_NANOSECOND_INSTANT.toEpochMilli();
/**
* convert a java time instant to a long value which is stored in lucene
* the long value resembles the nanoseconds since the epoch
*
* @param instant the instant to convert
* @return the nano seconds and seconds as a single long
*/
public static long toLong(Instant instant) {
if (instant.isBefore(Instant.EPOCH)) {
throw new IllegalArgumentException("date[" + instant + "] is before the epoch in 1970 and cannot be " +
"stored in nanosecond resolution");
}
if (instant.isAfter(MAX_NANOSECOND_INSTANT)) {
throw new IllegalArgumentException("date[" + instant + "] is after 2262-04-11T23:47:16.854775807 and cannot be " +
"stored in nanosecond resolution");
}
return instant.getEpochSecond() * 1_000_000_000 + instant.getNano();
}
/**
* Returns an instant that is with valid nanosecond resolution. If
* the parameter is before the valid nanosecond range then this returns
* the minimum {@linkplain Instant} valid for nanosecond resultion. If
* the parameter is after the valid nanosecond range then this returns
* the maximum {@linkplain Instant} valid for nanosecond resolution.
* <p>
* Useful for checking if all values for the field are within some range,
* even if the range's endpoints are not valid nanosecond resolution.
*/
public static Instant clampToNanosRange(Instant instant) {
if (instant.isBefore(Instant.EPOCH)) {
return Instant.EPOCH;
}
if (instant.isAfter(MAX_NANOSECOND_INSTANT)) {
return MAX_NANOSECOND_INSTANT;
}
return instant;
}
/**
* convert a long value to a java time instant
* the long value resembles the nanoseconds since the epoch
*
* @param nanoSecondsSinceEpoch the nanoseconds since the epoch
* @return the instant resembling the specified date
*/
public static Instant toInstant(long nanoSecondsSinceEpoch) {
if (nanoSecondsSinceEpoch < 0) {
throw new IllegalArgumentException("nanoseconds [" + nanoSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
"be processed in nanosecond resolution");
}
if (nanoSecondsSinceEpoch == 0) {
return Instant.EPOCH;
}
long seconds = nanoSecondsSinceEpoch / 1_000_000_000;
long nanos = nanoSecondsSinceEpoch % 1_000_000_000;
return Instant.ofEpochSecond(seconds, nanos);
}
/**
* Convert a nanosecond timestamp in milliseconds
*
* @param milliSecondsSinceEpoch the millisecond since the epoch
* @return the nanoseconds since the epoch
*/
public static long toNanoSeconds(long milliSecondsSinceEpoch) {
if (milliSecondsSinceEpoch < 0) {
throw new IllegalArgumentException("milliSeconds [" + milliSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
"be converted to nanoseconds");
} else if (milliSecondsSinceEpoch > MAX_NANOSECOND_IN_MILLIS) {
throw new IllegalArgumentException("milliSeconds [" + milliSecondsSinceEpoch + "] are after 2262-04-11T23:47:16.854775807 " +
"and cannot be converted to nanoseconds");
}
return milliSecondsSinceEpoch * 1_000_000;
}
/**
* Convert a nanosecond timestamp in milliseconds
*
* @param nanoSecondsSinceEpoch the nanoseconds since the epoch
* @return the milliseconds since the epoch
*/
public static long toMilliSeconds(long nanoSecondsSinceEpoch) {
if (nanoSecondsSinceEpoch < 0) {
throw new IllegalArgumentException("nanoseconds are [" + nanoSecondsSinceEpoch + "] are before the epoch in 1970 and cannot " +
"be converted to milliseconds");
}
if (nanoSecondsSinceEpoch == 0) {
return 0;
}
return nanoSecondsSinceEpoch / 1_000_000;
}
/**
* Rounds the given utc milliseconds sicne the epoch down to the next unit millis
*
* Note: This does not check for correctness of the result, as this only works with units smaller or equal than a day
* In order to ensure the performane of this methods, there are no guards or checks in it
*
* @param utcMillis the milliseconds since the epoch
* @param unitMillis the unit to round to
* @return the rounded milliseconds since the epoch
*/
public static long roundFloor(long utcMillis, final long unitMillis) {
if (utcMillis >= 0) {
return utcMillis - utcMillis % unitMillis;
} else {
utcMillis += 1;
return utcMillis - utcMillis % unitMillis - unitMillis;
}
}
/**
* Round down to the beginning of the quarter of the year of the specified time
* @param utcMillis the milliseconds since the epoch
* @return The milliseconds since the epoch rounded down to the quarter of the year
*/
public static long roundQuarterOfYear(final long utcMillis) {
int year = getYear(utcMillis);
int month = getMonthOfYear(utcMillis, year);
int firstMonthOfQuarter = (((month-1) / 3) * 3) + 1;
return DateUtils.of(year, firstMonthOfQuarter);
}
/**
* Round down to the beginning of the month of the year of the specified time
* @param utcMillis the milliseconds since the epoch
* @return The milliseconds since the epoch rounded down to the month of the year
*/
public static long roundMonthOfYear(final long utcMillis) {
int year = getYear(utcMillis);
int month = getMonthOfYear(utcMillis, year);
return DateUtils.of(year, month);
}
/**
* Round down to the beginning of the year of the specified time
* @param utcMillis the milliseconds since the epoch
* @return The milliseconds since the epoch rounded down to the beginning of the year
*/
public static long roundYear(final long utcMillis) {
int year = getYear(utcMillis);
return utcMillisAtStartOfYear(year);
}
/**
* Round down to the beginning of the week based on week year of the specified time
* @param utcMillis the milliseconds since the epoch
* @return The milliseconds since the epoch rounded down to the beginning of the week based on week year
*/
public static long roundWeekOfWeekYear(final long utcMillis) {
return roundFloor(utcMillis + 3 * 86400 * 1000L, 604800000) - 3 * 86400 * 1000L;
}
/**
* Return the first day of the month
* @param year the year to return
* @param month the month to return, ranging from 1-12
* @return the milliseconds since the epoch of the first day of the month in the year
*/
private static long of(final int year, final int month) {
long millis = utcMillisAtStartOfYear(year);
millis += getTotalMillisByYearMonth(year, month);
return millis;
}
/**
* Returns the current UTC date-time with milliseconds precision.
* In Java 9+ (as opposed to Java 8) the {@code Clock} implementation uses system's best clock implementation (which could mean
* that the precision of the clock can be milliseconds, microseconds or nanoseconds), whereas in Java 8
* {@code System.currentTimeMillis()} is always used. To account for these differences, this method defines a new {@code Clock}
* which will offer a value for {@code ZonedDateTime.now()} set to always have milliseconds precision.
*
* @return {@link ZonedDateTime} instance for the current date-time with milliseconds precision in UTC
*/
public static ZonedDateTime nowWithMillisResolution() {
return nowWithMillisResolution(Clock.systemUTC());
}
public static ZonedDateTime nowWithMillisResolution(Clock clock) {
Clock millisResolutionClock = Clock.tick(clock, Duration.ofMillis(1));
return ZonedDateTime.now(millisResolutionClock);
}
}
| apache-2.0 |
akchinSTC/systemml | src/main/java/org/apache/sysml/runtime/matrix/MatrixCharacteristics.java | 15412 | /*
* 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.sysml.runtime.matrix;
import java.io.Serializable;
import java.util.HashMap;
import org.apache.sysml.lops.MMTSJ.MMTSJType;
import org.apache.sysml.runtime.DMLRuntimeException;
import org.apache.sysml.runtime.instructions.mr.AggregateBinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.AggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.AggregateUnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.AppendInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryMInstruction;
import org.apache.sysml.runtime.instructions.mr.BinaryMRInstructionBase;
import org.apache.sysml.runtime.instructions.mr.CM_N_COVInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineBinaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineTernaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CombineUnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.CumulativeAggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.DataGenMRInstruction;
import org.apache.sysml.runtime.instructions.mr.GroupedAggregateInstruction;
import org.apache.sysml.runtime.instructions.mr.GroupedAggregateMInstruction;
import org.apache.sysml.runtime.instructions.mr.MMTSJMRInstruction;
import org.apache.sysml.runtime.instructions.mr.MRInstruction;
import org.apache.sysml.runtime.instructions.mr.MapMultChainInstruction;
import org.apache.sysml.runtime.instructions.mr.MatrixReshapeMRInstruction;
import org.apache.sysml.runtime.instructions.mr.PMMJMRInstruction;
import org.apache.sysml.runtime.instructions.mr.ParameterizedBuiltinMRInstruction;
import org.apache.sysml.runtime.instructions.mr.QuaternaryInstruction;
import org.apache.sysml.runtime.instructions.mr.RandInstruction;
import org.apache.sysml.runtime.instructions.mr.RangeBasedReIndexInstruction;
import org.apache.sysml.runtime.instructions.mr.ReblockInstruction;
import org.apache.sysml.runtime.instructions.mr.RemoveEmptyMRInstruction;
import org.apache.sysml.runtime.instructions.mr.ReorgInstruction;
import org.apache.sysml.runtime.instructions.mr.ReplicateInstruction;
import org.apache.sysml.runtime.instructions.mr.ScalarInstruction;
import org.apache.sysml.runtime.instructions.mr.SeqInstruction;
import org.apache.sysml.runtime.instructions.mr.TernaryInstruction;
import org.apache.sysml.runtime.instructions.mr.UaggOuterChainInstruction;
import org.apache.sysml.runtime.instructions.mr.UnaryInstruction;
import org.apache.sysml.runtime.instructions.mr.UnaryMRInstructionBase;
import org.apache.sysml.runtime.instructions.mr.ZeroOutInstruction;
import org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator;
import org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator;
import org.apache.sysml.runtime.matrix.operators.ReorgOperator;
public class MatrixCharacteristics implements Serializable
{
private static final long serialVersionUID = 8300479822915546000L;
private long numRows = -1;
private long numColumns = -1;
private int numRowsPerBlock = 1;
private int numColumnsPerBlock = 1;
private long nonZero = -1;
public MatrixCharacteristics() {
}
public MatrixCharacteristics(long nr, long nc, int bnr, int bnc)
{
set(nr, nc, bnr, bnc);
}
public MatrixCharacteristics(long nr, long nc, int bnr, int bnc, long nnz)
{
set(nr, nc, bnr, bnc, nnz);
}
public MatrixCharacteristics(MatrixCharacteristics that)
{
set(that.numRows, that.numColumns, that.numRowsPerBlock, that.numColumnsPerBlock, that.nonZero);
}
public void set(long nr, long nc, int bnr, int bnc) {
numRows = nr;
numColumns = nc;
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
}
public void set(long nr, long nc, int bnr, int bnc, long nnz) {
numRows = nr;
numColumns = nc;
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
nonZero = nnz;
}
public void set(MatrixCharacteristics that) {
numRows = that.numRows;
numColumns = that.numColumns;
numRowsPerBlock = that.numRowsPerBlock;
numColumnsPerBlock = that.numColumnsPerBlock;
nonZero = that.nonZero;
}
public long getRows(){
return numRows;
}
public long getCols(){
return numColumns;
}
public int getRowsPerBlock() {
return numRowsPerBlock;
}
public void setRowsPerBlock( int brlen){
numRowsPerBlock = brlen;
}
public int getColsPerBlock() {
return numColumnsPerBlock;
}
public void setColsPerBlock( int bclen){
numColumnsPerBlock = bclen;
}
public long getNumBlocks() {
return getNumRowBlocks() * getNumColBlocks();
}
public long getNumRowBlocks() {
return (long) Math.ceil((double)getRows() / getRowsPerBlock());
}
public long getNumColBlocks() {
return (long) Math.ceil((double)getCols() / getColsPerBlock());
}
public String toString()
{
return "["+numRows+" x "+numColumns+", nnz="+nonZero
+", blocks ("+numRowsPerBlock+" x "+numColumnsPerBlock+")]";
}
public void setDimension(long nr, long nc) {
numRows = nr;
numColumns = nc;
}
public void setBlockSize(int blen) {
setBlockSize(blen, blen);
}
public void setBlockSize(int bnr, int bnc) {
numRowsPerBlock = bnr;
numColumnsPerBlock = bnc;
}
public void setNonZeros(long nnz) {
nonZero = nnz;
}
public long getNonZeros() {
return nonZero;
}
public boolean dimsKnown() {
return ( numRows > 0 && numColumns > 0 );
}
public boolean dimsKnown(boolean includeNnz) {
return ( numRows > 0 && numColumns > 0 && (!includeNnz || nonZero>=0));
}
public boolean rowsKnown() {
return ( numRows > 0 );
}
public boolean colsKnown() {
return ( numColumns > 0 );
}
public boolean nnzKnown() {
return ( nonZero >= 0 );
}
public boolean mightHaveEmptyBlocks()
{
long singleBlk = Math.min(numRows, numRowsPerBlock)
* Math.min(numColumns, numColumnsPerBlock);
return !nnzKnown() || (nonZero < numRows*numColumns - singleBlk);
}
public static void reorg(MatrixCharacteristics dim, ReorgOperator op,
MatrixCharacteristics dimOut) throws DMLRuntimeException
{
op.fn.computeDimension(dim, dimOut);
}
public static void aggregateUnary(MatrixCharacteristics dim, AggregateUnaryOperator op,
MatrixCharacteristics dimOut) throws DMLRuntimeException
{
op.indexFn.computeDimension(dim, dimOut);
}
public static void aggregateBinary(MatrixCharacteristics dim1, MatrixCharacteristics dim2,
AggregateBinaryOperator op, MatrixCharacteristics dimOut)
{
//set dimension
dimOut.set(dim1.numRows, dim2.numColumns, dim1.numRowsPerBlock, dim2.numColumnsPerBlock);
}
public static void computeDimension(HashMap<Byte, MatrixCharacteristics> dims, MRInstruction ins)
throws DMLRuntimeException
{
MatrixCharacteristics dimOut=dims.get(ins.output);
if(dimOut==null)
{
dimOut=new MatrixCharacteristics();
dims.put(ins.output, dimOut);
}
if(ins instanceof ReorgInstruction)
{
ReorgInstruction realIns=(ReorgInstruction)ins;
reorg(dims.get(realIns.input), (ReorgOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof AppendInstruction )
{
AppendInstruction realIns = (AppendInstruction)ins;
MatrixCharacteristics in_dim1 = dims.get(realIns.input1);
MatrixCharacteristics in_dim2 = dims.get(realIns.input2);
if( realIns.isCBind() )
dimOut.set(in_dim1.numRows, in_dim1.numColumns+in_dim2.numColumns, in_dim1.numRowsPerBlock, in_dim2.numColumnsPerBlock);
else
dimOut.set(in_dim1.numRows+in_dim2.numRows, in_dim1.numColumns, in_dim1.numRowsPerBlock, in_dim2.numColumnsPerBlock);
}
else if(ins instanceof CumulativeAggregateInstruction)
{
AggregateUnaryInstruction realIns=(AggregateUnaryInstruction)ins;
MatrixCharacteristics in = dims.get(realIns.input);
dimOut.set((long)Math.ceil( (double)in.getRows()/in.getRowsPerBlock()), in.getCols(), in.getRowsPerBlock(), in.getColsPerBlock());
}
else if(ins instanceof AggregateUnaryInstruction)
{
AggregateUnaryInstruction realIns=(AggregateUnaryInstruction)ins;
aggregateUnary(dims.get(realIns.input),
(AggregateUnaryOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof AggregateBinaryInstruction)
{
AggregateBinaryInstruction realIns=(AggregateBinaryInstruction)ins;
aggregateBinary(dims.get(realIns.input1), dims.get(realIns.input2),
(AggregateBinaryOperator)realIns.getOperator(), dimOut);
}
else if(ins instanceof MapMultChainInstruction)
{
//output size independent of chain type
MapMultChainInstruction realIns=(MapMultChainInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.getInput1());
MatrixCharacteristics mc2 = dims.get(realIns.getInput2());
dimOut.set(mc1.numColumns, mc2.numColumns, mc1.numRowsPerBlock, mc1.numColumnsPerBlock);
}
else if(ins instanceof QuaternaryInstruction)
{
QuaternaryInstruction realIns=(QuaternaryInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.getInput1());
MatrixCharacteristics mc2 = dims.get(realIns.getInput2());
MatrixCharacteristics mc3 = dims.get(realIns.getInput3());
realIns.computeMatrixCharacteristics(mc1, mc2, mc3, dimOut);
}
else if(ins instanceof ReblockInstruction)
{
ReblockInstruction realIns=(ReblockInstruction)ins;
MatrixCharacteristics in_dim=dims.get(realIns.input);
dimOut.set(in_dim.numRows, in_dim.numColumns, realIns.brlen, realIns.bclen, in_dim.nonZero);
}
else if( ins instanceof MatrixReshapeMRInstruction )
{
MatrixReshapeMRInstruction mrinst = (MatrixReshapeMRInstruction) ins;
MatrixCharacteristics in_dim=dims.get(mrinst.input);
dimOut.set(mrinst.getNumRows(),mrinst.getNumColunms(),in_dim.getRowsPerBlock(), in_dim.getColsPerBlock(), in_dim.getNonZeros());
}
else if(ins instanceof RandInstruction
|| ins instanceof SeqInstruction)
{
DataGenMRInstruction dataIns=(DataGenMRInstruction)ins;
dimOut.set(dims.get(dataIns.getInput()));
}
else if( ins instanceof ReplicateInstruction )
{
ReplicateInstruction realIns=(ReplicateInstruction)ins;
realIns.computeOutputDimension(dims.get(realIns.input), dimOut);
}
else if( ins instanceof ParameterizedBuiltinMRInstruction ) //before unary
{
ParameterizedBuiltinMRInstruction realIns = (ParameterizedBuiltinMRInstruction)ins;
realIns.computeOutputCharacteristics(dims.get(realIns.input), dimOut);
}
else if(ins instanceof ScalarInstruction
|| ins instanceof AggregateInstruction
||(ins instanceof UnaryInstruction && !(ins instanceof MMTSJMRInstruction))
|| ins instanceof ZeroOutInstruction)
{
UnaryMRInstructionBase realIns=(UnaryMRInstructionBase)ins;
dimOut.set(dims.get(realIns.input));
}
else if (ins instanceof MMTSJMRInstruction)
{
MMTSJMRInstruction mmtsj = (MMTSJMRInstruction)ins;
MMTSJType tstype = mmtsj.getMMTSJType();
MatrixCharacteristics mc = dims.get(mmtsj.input);
dimOut.set( tstype.isLeft() ? mc.numColumns : mc.numRows,
tstype.isLeft() ? mc.numColumns : mc.numRows,
mc.numRowsPerBlock, mc.numColumnsPerBlock );
}
else if( ins instanceof PMMJMRInstruction )
{
PMMJMRInstruction pmmins = (PMMJMRInstruction) ins;
MatrixCharacteristics mc = dims.get(pmmins.input2);
dimOut.set( pmmins.getNumRows(),
mc.numColumns,
mc.numRowsPerBlock, mc.numColumnsPerBlock );
}
else if( ins instanceof RemoveEmptyMRInstruction )
{
RemoveEmptyMRInstruction realIns=(RemoveEmptyMRInstruction)ins;
MatrixCharacteristics mc = dims.get(realIns.input1);
if( realIns.isRemoveRows() )
dimOut.set(realIns.getOutputLen(), mc.getCols(), mc.numRowsPerBlock, mc.numColumnsPerBlock);
else
dimOut.set(mc.getRows(), realIns.getOutputLen(), mc.numRowsPerBlock, mc.numColumnsPerBlock);
}
else if(ins instanceof UaggOuterChainInstruction) //needs to be checked before binary
{
UaggOuterChainInstruction realIns=(UaggOuterChainInstruction)ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
MatrixCharacteristics mc2 = dims.get(realIns.input2);
realIns.computeOutputCharacteristics(mc1, mc2, dimOut);
}
else if( ins instanceof GroupedAggregateMInstruction )
{
GroupedAggregateMInstruction realIns = (GroupedAggregateMInstruction) ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
realIns.computeOutputCharacteristics(mc1, dimOut);
}
else if(ins instanceof BinaryInstruction || ins instanceof BinaryMInstruction || ins instanceof CombineBinaryInstruction )
{
BinaryMRInstructionBase realIns=(BinaryMRInstructionBase)ins;
MatrixCharacteristics mc1 = dims.get(realIns.input1);
MatrixCharacteristics mc2 = dims.get(realIns.input2);
if( mc1.getRows()>1 && mc1.getCols()==1
&& mc2.getRows()==1 && mc2.getCols()>1 ) //outer
{
dimOut.set(mc1.getRows(), mc2.getCols(), mc1.getRowsPerBlock(), mc2.getColsPerBlock());
}
else { //default case
dimOut.set(mc1);
}
}
else if (ins instanceof CombineTernaryInstruction ) {
TernaryInstruction realIns=(TernaryInstruction)ins;
dimOut.set(dims.get(realIns.input1));
}
else if (ins instanceof CombineUnaryInstruction ) {
dimOut.set( dims.get(((CombineUnaryInstruction) ins).input));
}
else if(ins instanceof CM_N_COVInstruction || ins instanceof GroupedAggregateInstruction )
{
dimOut.set(1, 1, 1, 1);
}
else if(ins instanceof RangeBasedReIndexInstruction)
{
RangeBasedReIndexInstruction realIns = (RangeBasedReIndexInstruction)ins;
MatrixCharacteristics dimIn = dims.get(realIns.input);
realIns.computeOutputCharacteristics(dimIn, dimOut);
}
else if (ins instanceof TernaryInstruction) {
TernaryInstruction realIns = (TernaryInstruction)ins;
MatrixCharacteristics in_dim=dims.get(realIns.input1);
dimOut.set(realIns.getOutputDim1(), realIns.getOutputDim2(), in_dim.numRowsPerBlock, in_dim.numColumnsPerBlock);
}
else {
/*
* if ins is none of the above cases then we assume that dim_out dimensions are unknown
*/
dimOut.numRows = -1;
dimOut.numColumns = -1;
dimOut.numRowsPerBlock=1;
dimOut.numColumnsPerBlock=1;
}
}
@Override
public boolean equals (Object anObject)
{
if (anObject instanceof MatrixCharacteristics)
{
MatrixCharacteristics mc = (MatrixCharacteristics) anObject;
return ((numRows == mc.numRows) &&
(numColumns == mc.numColumns) &&
(numRowsPerBlock == mc.numRowsPerBlock) &&
(numColumnsPerBlock == mc.numColumnsPerBlock) &&
(nonZero == mc.nonZero)) ;
}
else
return false;
}
@Override
public int hashCode()
{
return super.hashCode();
}
}
| apache-2.0 |
varshavaradarajan/gocd | server/src/main/java/com/thoughtworks/go/server/sqlmigration/Migration_86.java | 6571 | /*
* Copyright 2017 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.server.sqlmigration;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import org.h2.api.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Migration_86 implements Trigger {
private static final Logger LOGGER = LoggerFactory.getLogger(Migration_86.class);
private PreparedStatement updateStmt;
private PreparedStatement nextModificationIdStmt;
private Long totalCount;
public class PMRRecord {
private final long materialId;
private final String pipelineName;
public PMRRecord(long materialId, String pipelineName) {
this.materialId = materialId;
this.pipelineName = pipelineName;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PMRRecord pmrRecord = (PMRRecord) o;
if (materialId != pmrRecord.materialId) {
return false;
}
if (pipelineName != null ? !pipelineName.equals(pmrRecord.pipelineName) : pmrRecord.pipelineName != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = (int) (materialId ^ (materialId >>> 32));
result = 31 * result + (pipelineName != null ? pipelineName.hashCode() : 0);
return result;
}
}
Map<PMRRecord, Long> map = new HashMap<>();
public void init(Connection connection, String schemaName, String triggerName, String tableName, boolean before, int type) throws SQLException {
totalCount = executeScalar(connection, "SELECT COUNT(*) FROM pipelineMaterialRevisions");
updateStmt = connection.prepareStatement(
" UPDATE pipelineMaterialRevisions pmr"
+ " SET actualFromRevisionId = ? "
+ " WHERE pmr.Id = ?");
nextModificationIdStmt = connection.prepareStatement(
" SELECT TOP 1 id "
+ " FROM modifications "
+ " WHERE id > ? AND materialId = ?"
+ " ORDER BY id");
}
public void fire(Connection connection, Object[] oldRows, Object[] newRows) throws SQLException {
LOGGER.info("migrating {} rows", totalCount);
int count = 0;
ResultSet resultSet = queryPipelineMaterialRevisions(connection);
while (resultSet.next()) {
long pmrId = resultSet.getLong("Id");
long fromRevision = resultSet.getLong("fromRevisionId");
long materialId = resultSet.getLong("materialId");
String materialType = resultSet.getString("materialType");
String pipelineName = resultSet.getString("pipelineName");
PMRRecord pmrRecord = new PMRRecord(materialId, pipelineName);
long lastSeenFromRevision = fromRevision;
if ("DependencyMaterial".equals(materialType) && map.containsKey(pmrRecord)) {
lastSeenFromRevision = nextModificationId(map.get(pmrRecord), materialId);
}
fireUpdateQuery(pmrId, lastSeenFromRevision);
map.put(pmrRecord, fromRevision);
logCount(count++);
}
}
private void logCount(int count) {
if (count % 5000 == 0) {
LOGGER.info(" {} done", count);
}
}
private Long nextModificationId(long prevModificationId, long materialId) throws SQLException {
nextModificationIdStmt.setLong(1, prevModificationId);
nextModificationIdStmt.setLong(2, materialId);
return executeScalar(nextModificationIdStmt, prevModificationId);
}
private void fireUpdateQuery(long pmrId, long lastSeenPmrId) throws SQLException {
updateStmt.setLong(1, lastSeenPmrId);
updateStmt.setLong(2, pmrId);
updateStmt.executeUpdate();
}
private ResultSet queryPipelineMaterialRevisions(Connection connection) throws SQLException {
Statement statement = connection.createStatement();
String sql = "SELECT"
+ " pmr.Id AS Id,"
+ " pmr.fromRevisionId AS fromRevisionId,"
+ " pmr.materialId AS materialId,"
+ " m.type AS materialType,"
+ " p.name AS pipelineName"
+ " FROM"
+ " pipelines p"
+ " INNER JOIN pipelineMaterialRevisions pmr ON pmr.pipelineId = p.id"
+ " INNER JOIN materials m ON m.id = pmr.materialId"
+ " ORDER BY"
+ " p.name, m.id, pmr.id";
return statement.executeQuery(sql);
}
private static Long executeScalar(Connection connection, String sql) throws SQLException {
ResultSet rs = null;
try {
rs = connection.createStatement().executeQuery(sql);
rs.next();
return rs.getLong(1);
} finally {
closeQuietly(rs);
}
}
private static Long executeScalar(PreparedStatement ps, Long defaultValue) throws SQLException {
ResultSet rs = null;
try {
rs = ps.executeQuery();
if (rs.next()) {
return rs.getLong(1);
}
return defaultValue;
} finally {
closeQuietly(rs);
}
}
public static void closeQuietly(ResultSet rs) {
try {
if (rs != null) {
rs.close();
}
} catch (SQLException e) {
// ignore
}
}
public void close() {
}
public void remove() {
}
}
| apache-2.0 |
mmacfadden/orientdb | core/src/test/java/com/orientechnologies/orient/core/record/impl/OJsonReadWriteTest.java | 588 | package com.orientechnologies.orient.core.record.impl;
import com.orientechnologies.orient.core.metadata.schema.OType;
import org.junit.Test;
import static org.testng.Assert.assertEquals;
/**
* Created by tglman on 25/01/16.
*/
public class OJsonReadWriteTest {
@Test
public void testCustomField(){
ODocument doc = new ODocument();
doc.field("test",String.class, OType.CUSTOM);
String json = doc.toJSON();
System.out.println(json);
ODocument doc1 = new ODocument();
doc1.fromJSON(json);
assertEquals(doc.field("test"),doc1.field("test"));
}
}
| apache-2.0 |
haozhun/presto | presto-main/src/main/java/com/facebook/presto/sql/analyzer/ExpressionTreeUtils.java | 3519 | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.sql.analyzer;
import com.facebook.presto.metadata.FunctionRegistry;
import com.facebook.presto.sql.tree.DefaultExpressionTraversalVisitor;
import com.facebook.presto.sql.tree.Expression;
import com.facebook.presto.sql.tree.FunctionCall;
import com.facebook.presto.sql.tree.Node;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.function.Predicate;
import static com.google.common.base.Predicates.alwaysTrue;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.Objects.requireNonNull;
public final class ExpressionTreeUtils
{
private ExpressionTreeUtils() {}
static List<FunctionCall> extractAggregateFunctions(Iterable<? extends Node> nodes, FunctionRegistry functionRegistry)
{
return extractExpressions(nodes, FunctionCall.class, isAggregationPredicate(functionRegistry));
}
static List<FunctionCall> extractWindowFunctions(Iterable<? extends Node> nodes)
{
return extractExpressions(nodes, FunctionCall.class, ExpressionTreeUtils::isWindowFunction);
}
public static <T extends Expression> List<T> extractExpressions(
Iterable<? extends Node> nodes,
Class<T> clazz)
{
return extractExpressions(nodes, clazz, alwaysTrue());
}
private static Predicate<FunctionCall> isAggregationPredicate(FunctionRegistry functionRegistry)
{
return ((functionCall) -> (functionRegistry.isAggregationFunction(functionCall.getName())
|| functionCall.getFilter().isPresent()) && !functionCall.getWindow().isPresent()
|| functionCall.getOrderBy().isPresent());
}
private static boolean isWindowFunction(FunctionCall functionCall)
{
return functionCall.getWindow().isPresent();
}
private static <T extends Expression> List<T> extractExpressions(
Iterable<? extends Node> nodes,
Class<T> clazz,
Predicate<T> predicate)
{
requireNonNull(nodes, "nodes is null");
requireNonNull(clazz, "clazz is null");
requireNonNull(predicate, "predicate is null");
return ImmutableList.copyOf(nodes).stream()
.flatMap(node -> linearizeNodes(node).stream())
.filter(clazz::isInstance)
.map(clazz::cast)
.filter(predicate)
.collect(toImmutableList());
}
private static List<Node> linearizeNodes(Node node)
{
ImmutableList.Builder<Node> nodes = ImmutableList.builder();
new DefaultExpressionTraversalVisitor<Node, Void>()
{
@Override
public Node process(Node node, Void context)
{
Node result = super.process(node, context);
nodes.add(node);
return result;
}
}.process(node, null);
return nodes.build();
}
}
| apache-2.0 |
flofreud/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/DeleteTableResult.java | 3339 | /*
* 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.dynamodbv2.model;
import java.io.Serializable;
/**
* <p>
* Represents the output of a <i>DeleteTable</i> operation.
* </p>
*/
public class DeleteTableResult implements Serializable, Cloneable {
private TableDescription tableDescription;
/**
* @param tableDescription
*/
public void setTableDescription(TableDescription tableDescription) {
this.tableDescription = tableDescription;
}
/**
* @return
*/
public TableDescription getTableDescription() {
return this.tableDescription;
}
/**
* @param tableDescription
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public DeleteTableResult withTableDescription(
TableDescription tableDescription) {
setTableDescription(tableDescription);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTableDescription() != null)
sb.append("TableDescription: " + getTableDescription());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof DeleteTableResult == false)
return false;
DeleteTableResult other = (DeleteTableResult) obj;
if (other.getTableDescription() == null
^ this.getTableDescription() == null)
return false;
if (other.getTableDescription() != null
&& other.getTableDescription().equals(
this.getTableDescription()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getTableDescription() == null) ? 0 : getTableDescription()
.hashCode());
return hashCode;
}
@Override
public DeleteTableResult clone() {
try {
return (DeleteTableResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}
| apache-2.0 |
forGGe/kaa | server/common/nosql/mongo-dao/src/main/java/org/kaaproject/kaa/server/common/nosql/mongo/dao/model/MongoCredentials.java | 4702 | /**
* Copyright 2014-2016 CyberVision, 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.kaaproject.kaa.server.common.nosql.mongo.dao.model;
import org.kaaproject.kaa.common.dto.credentials.CredentialsDto;
import org.kaaproject.kaa.common.dto.credentials.CredentialsStatus;
import org.kaaproject.kaa.server.common.dao.model.Credentials;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import java.io.Serializable;
import java.util.Arrays;
import static org.kaaproject.kaa.server.common.nosql.mongo.dao.model.MongoModelConstants.*;
@Document(collection = CREDENTIALS)
public class MongoCredentials implements Credentials, Serializable {
private static final long serialVersionUID = 817998992561126368L;
@Id
private String id;
@Field(CREDENTIALS_APPLICATION_ID)
private String applicationId;
@Field(CREDENTIALS_BODY)
private byte[] credentialsBody;
@Field(CREDENTIAL_STATUS)
private CredentialsStatus status;
public MongoCredentials() {
}
public MongoCredentials(String applicationId, CredentialsDto dto) {
this.id = dto.getId();
this.applicationId = applicationId;
this.credentialsBody = Arrays.copyOf(dto.getCredentialsBody(), dto.getCredentialsBody().length);
this.status = dto.getStatus();
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getApplicationId() {
return this.applicationId;
}
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
@Override
public byte[] getCredentialsBody() {
return credentialsBody;
}
public void setCredentialsBody(byte[] credentialsBody) {
this.credentialsBody = Arrays.copyOf(credentialsBody, credentialsBody.length);
}
@Override
public CredentialsStatus getStatus() {
return status;
}
public void setStatus(CredentialsStatus status) {
this.status = status;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.applicationId == null) ? 0 : this.applicationId.hashCode());
result = prime * result + Arrays.hashCode(this.credentialsBody);
result = prime * result + ((this.status == null) ? 0 : this.status.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
MongoCredentials other = (MongoCredentials) obj;
if (this.applicationId == null) {
if (other.applicationId != null) {
return false;
}
} else if (!this.applicationId.equals(other.applicationId)) {
return false;
}
if (!Arrays.equals(this.credentialsBody, other.credentialsBody)) {
return false;
}
if (this.status != other.status) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("MongoCredentials [id=");
builder.append(this.id);
builder.append(", applicationId=");
builder.append(this.applicationId);
builder.append(", credentialsBody=");
builder.append(Arrays.toString(this.credentialsBody));
builder.append(", status=");
builder.append(this.status);
builder.append("]");
return builder.toString();
}
@Override
public CredentialsDto toDto() {
CredentialsDto dto = new CredentialsDto();
dto.setId(id);
dto.setCredentialsBody(credentialsBody);
dto.setStatus(status);
return dto;
}
}
| apache-2.0 |
pax95/camel | components/camel-mllp/src/main/java/org/apache/camel/component/mllp/internal/TcpSocketConsumerRunnable.java | 11739 | /*
* 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.camel.component.mllp.internal;
import java.io.IOException;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import org.apache.camel.Route;
import org.apache.camel.component.mllp.MllpInvalidMessageException;
import org.apache.camel.component.mllp.MllpSocketException;
import org.apache.camel.component.mllp.MllpTcpServerConsumer;
import org.apache.camel.spi.UnitOfWork;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
/**
* Runnable to read the Socket
*/
public class TcpSocketConsumerRunnable implements Runnable {
final Socket clientSocket;
final MllpSocketBuffer mllpBuffer;
Logger log = LoggerFactory.getLogger(this.getClass());
MllpTcpServerConsumer consumer;
boolean running;
private final String localAddress;
private final String remoteAddress;
private final String combinedAddress;
private final Hl7Util hl7Util;
private final boolean logPhi;
public TcpSocketConsumerRunnable(MllpTcpServerConsumer consumer, Socket clientSocket, MllpSocketBuffer mllpBuffer,
Hl7Util hl7Util, boolean logPhi) {
this.consumer = consumer;
// this.setName(createThreadName(clientSocket));
this.clientSocket = clientSocket;
this.hl7Util = hl7Util;
this.logPhi = logPhi;
SocketAddress localSocketAddress = clientSocket.getLocalSocketAddress();
if (localSocketAddress != null) {
localAddress = localSocketAddress.toString();
} else {
localAddress = null;
}
SocketAddress remoteSocketAddress = clientSocket.getRemoteSocketAddress();
if (remoteSocketAddress != null) {
remoteAddress = remoteSocketAddress.toString();
} else {
remoteAddress = null;
}
combinedAddress = MllpSocketBuffer.formatAddressString(remoteSocketAddress, localSocketAddress);
try {
if (consumer.getConfiguration().hasKeepAlive()) {
this.clientSocket.setKeepAlive(consumer.getConfiguration().getKeepAlive());
}
if (consumer.getConfiguration().hasTcpNoDelay()) {
this.clientSocket.setTcpNoDelay(consumer.getConfiguration().getTcpNoDelay());
}
if (consumer.getConfiguration().hasReceiveBufferSize()) {
this.clientSocket.setReceiveBufferSize(consumer.getConfiguration().getReceiveBufferSize());
}
if (consumer.getConfiguration().hasSendBufferSize()) {
this.clientSocket.setSendBufferSize(consumer.getConfiguration().getSendBufferSize());
}
this.clientSocket.setSoLinger(false, -1);
// Initial Read Timeout
this.clientSocket.setSoTimeout(consumer.getConfiguration().getReceiveTimeout());
} catch (IOException initializationException) {
throw new IllegalStateException("Failed to initialize " + this.getClass().getSimpleName(), initializationException);
}
if (mllpBuffer == null) {
this.mllpBuffer = new MllpSocketBuffer(consumer.getEndpoint());
} else {
this.mllpBuffer = mllpBuffer;
}
}
/**
* derive a thread name from the class name, the component URI and the connection information
* <p/>
* The String will in the format <class name>[endpoint key] - [local socket address] -> [remote socket address]
*
* @return the thread name
*/
String createThreadName(Socket socket) {
// Get the URI without options
String fullEndpointKey = consumer.getEndpoint().getEndpointKey();
String endpointKey;
if (fullEndpointKey.contains("?")) {
endpointKey = fullEndpointKey.substring(0, fullEndpointKey.indexOf('?'));
} else {
endpointKey = fullEndpointKey;
}
// Now put it all together
return String.format("%s[%s] - %s", this.getClass().getSimpleName(), endpointKey, combinedAddress);
}
@Override
public void run() {
running = true;
String originalThreadName = Thread.currentThread().getName();
Thread.currentThread().setName(createThreadName(clientSocket));
MDC.put(UnitOfWork.MDC_CAMEL_CONTEXT_ID, consumer.getEndpoint().getCamelContext().getName());
Route route = consumer.getRoute();
if (route != null) {
String routeId = route.getId();
if (routeId != null) {
MDC.put(UnitOfWork.MDC_ROUTE_ID, route.getId());
}
}
log.debug("Starting {} for {}", this.getClass().getSimpleName(), combinedAddress);
try {
byte[] hl7MessageBytes = null;
if (mllpBuffer.hasCompleteEnvelope()) {
// If we got a complete message on the validation read, process it
hl7MessageBytes = mllpBuffer.toMllpPayload();
mllpBuffer.reset();
consumer.processMessage(hl7MessageBytes, this);
}
while (running && null != clientSocket && clientSocket.isConnected() && !clientSocket.isClosed()) {
log.debug("Checking for data ....");
try {
mllpBuffer.readFrom(clientSocket);
if (mllpBuffer.hasCompleteEnvelope()) {
hl7MessageBytes = mllpBuffer.toMllpPayload();
if (log.isDebugEnabled()) {
log.debug("Received {} byte message {}", hl7MessageBytes.length,
hl7Util.convertToPrintFriendlyString(hl7MessageBytes));
}
if (mllpBuffer.hasLeadingOutOfBandData()) {
// TODO: Move the conversion utilities to the MllpSocketBuffer to avoid a byte[] copy
log.warn("Ignoring leading out-of-band data: {}",
hl7Util.convertToPrintFriendlyString(mllpBuffer.getLeadingOutOfBandData()));
}
if (mllpBuffer.hasTrailingOutOfBandData()) {
log.warn("Ignoring trailing out-of-band data: {}",
hl7Util.convertToPrintFriendlyString(mllpBuffer.getTrailingOutOfBandData()));
}
mllpBuffer.reset();
consumer.processMessage(hl7MessageBytes, this);
} else if (!mllpBuffer.hasStartOfBlock()) {
byte[] payload = mllpBuffer.toByteArray();
log.warn("Ignoring {} byte un-enveloped payload {}", payload.length,
hl7Util.convertToPrintFriendlyString(payload));
mllpBuffer.reset();
} else if (!mllpBuffer.isEmpty()) {
byte[] payload = mllpBuffer.toByteArray();
log.warn("Partial {} byte payload received {}", payload.length,
hl7Util.convertToPrintFriendlyString(payload));
}
} catch (SocketTimeoutException timeoutEx) {
if (mllpBuffer.isEmpty()) {
if (consumer.getConfiguration().hasIdleTimeout()) {
long currentTicks = System.currentTimeMillis();
long lastReceivedMessageTicks = consumer.getConsumerRunnables().get(this);
long idleTime = currentTicks - lastReceivedMessageTicks;
if (idleTime >= consumer.getConfiguration().getIdleTimeout()) {
String resetMessage = String.format("Connection idle time %d exceeded idleTimeout %d", idleTime,
consumer.getConfiguration().getIdleTimeout());
mllpBuffer.resetSocket(clientSocket, resetMessage);
}
}
log.debug("No data received - ignoring timeout");
} else {
mllpBuffer.resetSocket(clientSocket);
new MllpInvalidMessageException(
"Timeout receiving complete message payload", mllpBuffer.toByteArrayAndReset(), timeoutEx,
logPhi);
consumer.handleMessageTimeout("Timeout receiving complete message payload",
mllpBuffer.toByteArrayAndReset(), timeoutEx);
}
} catch (MllpSocketException mllpSocketEx) {
mllpBuffer.resetSocket(clientSocket);
if (!mllpBuffer.isEmpty()) {
consumer.handleMessageException("Exception encountered reading payload",
mllpBuffer.toByteArrayAndReset(), mllpSocketEx);
} else {
log.debug("Ignoring exception encountered checking for data", mllpSocketEx);
}
}
}
} catch (Exception unexpectedEx) {
log.error("Unexpected exception encountered receiving messages", unexpectedEx);
} finally {
consumer.getConsumerRunnables().remove(this);
log.debug("{} for {} completed", this.getClass().getSimpleName(), combinedAddress);
Thread.currentThread().setName(originalThreadName);
MDC.remove(UnitOfWork.MDC_ROUTE_ID);
MDC.remove(UnitOfWork.MDC_CAMEL_CONTEXT_ID);
mllpBuffer.resetSocket(clientSocket);
}
}
public Socket getSocket() {
return clientSocket;
}
public MllpSocketBuffer getMllpBuffer() {
return mllpBuffer;
}
public void closeSocket() {
mllpBuffer.closeSocket(clientSocket);
}
public void closeSocket(String logMessage) {
mllpBuffer.closeSocket(clientSocket, logMessage);
}
public void resetSocket() {
mllpBuffer.resetSocket(clientSocket);
}
public void resetSocket(String logMessage) {
mllpBuffer.resetSocket(clientSocket, logMessage);
}
public void stop() {
running = false;
}
public boolean hasLocalAddress() {
return localAddress != null && !localAddress.isEmpty();
}
public String getLocalAddress() {
return localAddress;
}
public boolean hasRemoteAddress() {
return remoteAddress != null && !remoteAddress.isEmpty();
}
public String getRemoteAddress() {
return remoteAddress;
}
public boolean hasCombinedAddress() {
return combinedAddress != null && combinedAddress.isEmpty();
}
public String getCombinedAddress() {
return combinedAddress;
}
}
| apache-2.0 |
pperboires/PocDrools | drools-core/src/main/java/org/drools/factmodel/Fact.java | 797 | /*
* Copyright 2010 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.drools.factmodel;
import java.util.ArrayList;
import java.util.List;
/**
* A temporary AST.
*/
public class Fact {
public String name;
public List fields = new ArrayList();
}
| apache-2.0 |
hoangcuongflp/binnavi | src/main/java/com/google/security/zynamics/reil/translators/TranslationHelpers.java | 6018 | /*
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 com.google.security.zynamics.reil.translators;
import com.google.common.base.Preconditions;
import com.google.security.zynamics.reil.ErrorStrings;
import com.google.security.zynamics.reil.OperandSize;
import com.google.security.zynamics.reil.ReilInstruction;
import com.google.security.zynamics.zylib.disassembly.IInstruction;
import com.google.security.zynamics.zylib.disassembly.IOperandTreeNode;
import java.util.List;
/**
* Various system-independent translation helper functions.
*/
public class TranslationHelpers {
/**
* Generic check function for all translators after which a safe translation environment can be
* assumed.
*
* @param environment The translation environment.
* @param instruction The instruction to be translated.
* @param instructions The list of REIL instructions in which the result will be written.
* @param mnemonic The mnemonic which should be translated.
*
* @throws InternalTranslationException
*/
public static void checkTranslationArguments(final ITranslationEnvironment environment,
final IInstruction instruction, final List<ReilInstruction> instructions,
final String mnemonic) throws InternalTranslationException {
Preconditions.checkNotNull(environment, ErrorStrings.ENVIRONMENT_ARGUMENT_ERROR);
Preconditions.checkNotNull(instruction, ErrorStrings.INSTRUCTION_ARGUMENT_ERROR);
Preconditions.checkNotNull(instructions, ErrorStrings.INSTRUCTIONS_ARGUMENT_ERROR);
}
public static long generateOneMask(final int lsb, final int width, final OperandSize size) {
return generateZeroMask(lsb, width, size) ^ getAllBitsMask(size);
}
/**
* Generates a mask which starts at the lsb parameter and is width wide
*
* @param lsb the least significant bit valid 0-size.getBits().
* @param width the width valid 1-(lsb+width)-1 <=size.getBits().
* @param size The size of the mask valid 4-64. In OperandSize.
* @return The mask.
*/
public static long generateZeroMask(final int lsb, final int width, final OperandSize size) {
Preconditions.checkNotNull(size, "Size argument can not be null");
Preconditions.checkPositionIndex(lsb, size.getBitSize() - 1);
Preconditions.checkArgument(width >= 1);
Preconditions.checkPositionIndex((lsb + width) - 1, size.getBitSize());
long mask = getAllBitsMask(size);
final long msb = (lsb + width) - 1;
final long xorBit = 1;
for (long i = lsb; i <= msb; i++) {
mask = (mask ^ (xorBit << i));
}
return mask & getAllBitsMask(size);
}
/**
* Returns a mask that selects all bits for a given operand size.
*
* @param size The given operand size
* @return A mask where all bits are set
*/
public static long getAllBitsMask(final OperandSize size) {
switch (size) {
case BYTE:
return 255L;
case WORD:
return 65535L;
case DWORD:
return 4294967295L;
case QWORD:
return 0xFFFFFFFFFFFFFFFFL;
default:
break;
}
throw new IllegalArgumentException("Error: Invalid argument size");
}
/**
* Returns a mask that masks all bit set for values of a given operand size except for the bits
* that are shared with the smaller operand size.
*
* @param largerSize The larger operand size
* @param smallerSize The smaller operand size
*
* @return A mask of the form F..F0..0
*/
public static long getAllButMask(final OperandSize largerSize, final OperandSize smallerSize) {
return getAllBitsMask(largerSize) ^ getAllBitsMask(smallerSize);
}
/**
* Returns a mask that isolates the most significant bit for values of the given size.
*
* @param size The size of the value
*
* @return The mask that masks the MSB of values of that size
*/
public static long getMsbMask(final OperandSize size) {
switch (size) {
case BYTE:
return 128L;
case WORD:
return 32768L;
case DWORD:
return 2147483648L;
case QWORD:
return 0x8000000000000000L;
default:
break;
}
throw new IllegalArgumentException("Error: Invalid argument size");
}
/**
* Finds the next biggest operand size for a given operand size.
*
* @param size The smaller operand size
*
* @return The next bigger operand size
*/
public static OperandSize getNextSize(final OperandSize size) {
switch (size) {
case BYTE:
return OperandSize.WORD;
case WORD:
return OperandSize.DWORD;
case DWORD:
return OperandSize.QWORD;
case QWORD:
return OperandSize.OWORD;
default:
break;
}
throw new IllegalArgumentException("Error: Invalid argument size");
}
/**
* Returns a shift mask that can be used to shift isolated MSBs into LSBs for values of a given
* operand size.
*
* @param size The operand size of the value
*
* @return The shift mask.
*/
public static long getShiftMsbLsbMask(final OperandSize size) {
return -(size.getBitSize() - 1);
}
/**
* Finds out whether an expression is a size information expression.
*
* @param expression The expression in question
*
* @return True, if the expression is a size information expression. False, otherwise.
*/
public static boolean isSizeExpression(final IOperandTreeNode expression) {
return OperandSize.isSizeString(expression.getValue());
}
}
| apache-2.0 |
nicolaferraro/camel | components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsConsumer.java | 10572 | /*
* 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.camel.component.hdfs;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;
import javax.security.auth.login.Configuration;
import org.apache.camel.Exchange;
import org.apache.camel.ExtendedExchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.RuntimeCamelException;
import org.apache.camel.support.ScheduledPollConsumer;
import org.apache.camel.util.IOHelper;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class HdfsConsumer extends ScheduledPollConsumer {
private static final Logger LOG = LoggerFactory.getLogger(HdfsConsumer.class);
private final HdfsConfiguration endpointConfig;
private final StringBuilder hdfsPath;
private final Processor processor;
private final HdfsInfoFactory hdfsInfoFactory;
private final ReadWriteLock rwLock = new ReentrantReadWriteLock();
public HdfsConsumer(HdfsEndpoint endpoint, Processor processor, HdfsConfiguration endpointConfig) {
this(endpoint, processor, endpointConfig, new HdfsInfoFactory(endpointConfig),
endpointConfig.getFileSystemType().getHdfsPath(endpointConfig));
}
HdfsConsumer(HdfsEndpoint endpoint, Processor processor, HdfsConfiguration endpointConfig, HdfsInfoFactory hdfsInfoFactory,
StringBuilder hdfsPath) {
super(endpoint, processor);
this.processor = processor;
this.endpointConfig = endpointConfig;
this.hdfsPath = hdfsPath;
this.hdfsInfoFactory = hdfsInfoFactory;
setUseFixedDelay(true);
}
@Override
public HdfsEndpoint getEndpoint() {
return (HdfsEndpoint) super.getEndpoint();
}
@Override
protected void doStart() throws Exception {
super.doStart();
if (endpointConfig.isConnectOnStartup()) {
// setup hdfs if configured to do on startup
setupHdfs(true);
}
}
private HdfsInfo setupHdfs(boolean onStartup) throws IOException {
String hdfsFsDescription = endpointConfig.getFileSystemLabel(hdfsPath.toString());
// if we are starting up then log at info level, and if runtime then log at debug level to not flood the log
if (onStartup) {
LOG.info("Connecting to hdfs file-system {} (may take a while if connection is not available)", hdfsFsDescription);
} else {
LOG.debug("Connecting to hdfs file-system {} (may take a while if connection is not available)", hdfsFsDescription);
}
// hadoop will cache the connection by default so its faster to get in the poll method
HdfsInfo answer = hdfsInfoFactory.newHdfsInfo(this.hdfsPath.toString());
if (onStartup) {
LOG.info("Connected to hdfs file-system {}", hdfsFsDescription);
} else {
LOG.debug("Connected to hdfs file-system {}", hdfsFsDescription);
}
return answer;
}
@Override
protected int poll() throws Exception {
// need to remember auth as Hadoop will override that, which otherwise means the Auth is broken afterwards
Configuration auth = HdfsComponent.getJAASConfiguration();
try {
return doPoll();
} finally {
HdfsComponent.setJAASConfiguration(auth);
}
}
protected int doPoll() throws IOException {
class ExcludePathFilter implements PathFilter {
@Override
public boolean accept(Path path) {
return !(path.toString().endsWith(endpointConfig.getOpenedSuffix())
|| path.toString().endsWith(endpointConfig.getReadSuffix()));
}
}
HdfsInfo info = setupHdfs(false);
FileStatus[] fileStatuses;
if (info.getFileSystem().isFile(info.getPath())) {
fileStatuses = info.getFileSystem().globStatus(info.getPath());
} else {
Path pattern = info.getPath().suffix("/" + this.endpointConfig.getPattern());
fileStatuses = info.getFileSystem().globStatus(pattern, new ExcludePathFilter());
}
fileStatuses = Optional.ofNullable(fileStatuses).orElse(new FileStatus[0]);
return processFileStatuses(info, fileStatuses);
}
private int processFileStatuses(HdfsInfo info, FileStatus[] fileStatuses) {
final AtomicInteger totalMessageCount = new AtomicInteger();
List<HdfsInputStream> hdfsFiles = Arrays.stream(fileStatuses)
.filter(status -> normalFileIsDirectoryHasSuccessFile(status, info))
.filter(this::hasMatchingOwner)
.limit(endpointConfig.getMaxMessagesPerPoll())
.map(this::asHdfsFile)
.filter(Objects::nonNull)
.collect(Collectors.toList());
LOG.info("Processing [{}] valid files out of [{}] available.", hdfsFiles.size(), fileStatuses.length);
for (int i = 0; i < hdfsFiles.size(); i++) {
HdfsInputStream hdfsFile = hdfsFiles.get(i);
try {
int messageCount = processHdfsInputStream(hdfsFile, totalMessageCount);
LOG.debug("Processed [{}] files out of [{}].", i, hdfsFiles.size());
LOG.debug("File [{}] was split to [{}] messages.", i, messageCount);
} finally {
IOHelper.close(hdfsFile, "hdfs file", LOG);
}
}
return totalMessageCount.get();
}
private int processHdfsInputStream(HdfsInputStream hdfsFile, AtomicInteger totalMessageCount) {
final AtomicInteger messageCount = new AtomicInteger();
Holder<Object> currentKey = new Holder<>();
Holder<Object> currentValue = new Holder<>();
while (hdfsFile.next(currentKey, currentValue) >= 0) {
processHdfsInputStream(hdfsFile, currentKey, currentValue, messageCount, totalMessageCount);
messageCount.incrementAndGet();
}
return messageCount.get();
}
private void processHdfsInputStream(
HdfsInputStream hdfsFile, Holder<Object> key, Holder<Object> value, AtomicInteger messageCount,
AtomicInteger totalMessageCount) {
Exchange exchange = this.getEndpoint().createExchange();
Message message = exchange.getIn();
String fileName = StringUtils.substringAfterLast(hdfsFile.getActualPath(), "/");
message.setHeader(Exchange.FILE_NAME, fileName);
message.setHeader(Exchange.FILE_NAME_CONSUMED, fileName);
message.setHeader("CamelFileAbsolutePath", hdfsFile.getActualPath());
if (key.getValue() != null) {
message.setHeader(HdfsHeader.KEY.name(), key.getValue());
}
if (hdfsFile.getNumOfReadBytes() >= 0) {
message.setHeader(Exchange.FILE_LENGTH, hdfsFile.getNumOfReadBytes());
}
message.setBody(value.getValue());
updateNewExchange(exchange, messageCount.get(), hdfsFile);
LOG.debug("Processing file [{}]", fileName);
try {
processor.process(exchange);
totalMessageCount.incrementAndGet();
} catch (Exception e) {
exchange.setException(e);
}
// in case of unhandled exceptions then let the exception handler handle them
if (exchange.getException() != null) {
getExceptionHandler().handleException(exchange.getException());
}
}
private boolean normalFileIsDirectoryHasSuccessFile(FileStatus fileStatus, HdfsInfo info) {
if (endpointConfig.getFileType().equals(HdfsFileType.NORMAL_FILE) && fileStatus.isDirectory()) {
try {
Path successPath = new Path(fileStatus.getPath().toString() + "/_SUCCESS");
if (!info.getFileSystem().exists(successPath)) {
return false;
}
} catch (IOException e) {
throw new RuntimeCamelException(e);
}
}
return true;
}
private boolean hasMatchingOwner(FileStatus fileStatus) {
if (endpointConfig.getOwner() != null && !endpointConfig.getOwner().equals(fileStatus.getOwner())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Skipping file: {} as not matching owner: {}", fileStatus.getPath(), endpointConfig.getOwner());
}
return false;
}
return true;
}
private HdfsInputStream asHdfsFile(FileStatus fileStatus) {
try {
this.rwLock.writeLock().lock();
return HdfsInputStream.createInputStream(fileStatus.getPath().toString(), hdfsInfoFactory);
} finally {
this.rwLock.writeLock().unlock();
}
}
protected void updateNewExchange(Exchange exchange, int index, HdfsInputStream hdfsFile) {
// do not share unit of work
exchange.adapt(ExtendedExchange.class).setUnitOfWork(null);
exchange.setProperty(Exchange.SPLIT_INDEX, index);
if (hdfsFile.hasNext()) {
exchange.setProperty(Exchange.SPLIT_COMPLETE, Boolean.FALSE);
} else {
exchange.setProperty(Exchange.SPLIT_COMPLETE, Boolean.TRUE);
// streaming mode, so set total size when we are complete based on the index
exchange.setProperty(Exchange.SPLIT_SIZE, index + 1);
}
}
}
| apache-2.0 |
hugosato/apache-axis | test/wsdl/omit/OmitImpl.java | 864 | /*
* Copyright 2001-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.
*/
/**
* OmitImpl.java
*
*/
package test.wsdl.omit;
public class OmitImpl implements test.wsdl.omit.Omit {
public test.wsdl.omit.Phone echoPhone(test.wsdl.omit.Phone in) throws java.rmi.RemoteException {
return in;
}
}
| apache-2.0 |
XiaominZhang/presto | presto-main/src/main/java/com/facebook/presto/operator/aggregation/MultimapAggregation.java | 8236 | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.operator.aggregation;
import com.facebook.presto.ExceededMemoryLimitException;
import com.facebook.presto.byteCode.DynamicClassLoader;
import com.facebook.presto.metadata.FunctionInfo;
import com.facebook.presto.metadata.FunctionRegistry;
import com.facebook.presto.metadata.ParametricAggregation;
import com.facebook.presto.metadata.Signature;
import com.facebook.presto.operator.aggregation.state.KeyValuePairStateSerializer;
import com.facebook.presto.operator.aggregation.state.KeyValuePairsState;
import com.facebook.presto.operator.aggregation.state.KeyValuePairsStateFactory;
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.block.Block;
import com.facebook.presto.spi.block.BlockBuilder;
import com.facebook.presto.spi.type.Type;
import com.facebook.presto.spi.type.TypeManager;
import com.facebook.presto.type.ArrayType;
import com.facebook.presto.type.MapType;
import com.google.common.collect.ImmutableList;
import java.lang.invoke.MethodHandle;
import java.util.List;
import java.util.Map;
import static com.facebook.presto.metadata.FunctionType.AGGREGATE;
import static com.facebook.presto.metadata.Signature.comparableTypeParameter;
import static com.facebook.presto.metadata.Signature.typeParameter;
import static com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata;
import static com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INDEX;
import static com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.BLOCK_INPUT_CHANNEL;
import static com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.NULLABLE_BLOCK_INPUT_CHANNEL;
import static com.facebook.presto.operator.aggregation.AggregationMetadata.ParameterMetadata.ParameterType.STATE;
import static com.facebook.presto.operator.aggregation.AggregationUtils.generateAggregationName;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
import static com.facebook.presto.util.Reflection.methodHandle;
import static java.lang.String.format;
public class MultimapAggregation
extends ParametricAggregation
{
public static final MultimapAggregation MULTIMAP_AGG = new MultimapAggregation();
public static final String NAME = "multimap_agg";
private static final MethodHandle OUTPUT_FUNCTION = methodHandle(MultimapAggregation.class, "output", KeyValuePairsState.class, BlockBuilder.class);
private static final MethodHandle INPUT_FUNCTION = methodHandle(MultimapAggregation.class, "input", KeyValuePairsState.class, Block.class, Block.class, int.class);
private static final MethodHandle COMBINE_FUNCTION = methodHandle(MultimapAggregation.class, "combine", KeyValuePairsState.class, KeyValuePairsState.class);
private static final Signature SIGNATURE = new Signature(
NAME,
AGGREGATE,
ImmutableList.of(comparableTypeParameter("K"), typeParameter("V")),
"map<K,array<V>>",
ImmutableList.of("K", "V"),
false
);
@Override
public Signature getSignature()
{
return SIGNATURE;
}
@Override
public String getDescription()
{
return "Aggregates all the rows (key/value pairs) into a single multimap";
}
@Override
public FunctionInfo specialize(Map<String, Type> types, int arity, TypeManager typeManager, FunctionRegistry functionRegistry)
{
Type keyType = types.get("K");
Type valueType = types.get("V");
Signature signature = new Signature(NAME, AGGREGATE, new MapType(keyType, new ArrayType(valueType)).getTypeSignature(), keyType.getTypeSignature(), valueType.getTypeSignature());
InternalAggregationFunction aggregation = generateAggregation(keyType, valueType);
return new FunctionInfo(signature, getDescription(), aggregation);
}
private static InternalAggregationFunction generateAggregation(Type keyType, Type valueType)
{
DynamicClassLoader classLoader = new DynamicClassLoader(MultimapAggregation.class.getClassLoader());
List<Type> inputTypes = ImmutableList.of(keyType, valueType);
Type outputType = new MapType(keyType, new ArrayType(valueType));
KeyValuePairStateSerializer stateSerializer = new KeyValuePairStateSerializer(keyType, valueType, true);
Type intermediateType = stateSerializer.getSerializedType();
AggregationMetadata metadata = new AggregationMetadata(
generateAggregationName(NAME, outputType, inputTypes),
createInputParameterMetadata(keyType, valueType),
INPUT_FUNCTION,
null,
null,
COMBINE_FUNCTION,
OUTPUT_FUNCTION,
KeyValuePairsState.class,
stateSerializer,
new KeyValuePairsStateFactory(keyType, valueType),
outputType,
false);
GenericAccumulatorFactoryBinder factory = new AccumulatorCompiler().generateAccumulatorFactoryBinder(metadata, classLoader);
return new InternalAggregationFunction(NAME, inputTypes, intermediateType, outputType, true, false, factory);
}
private static List<ParameterMetadata> createInputParameterMetadata(Type keyType, Type valueType)
{
return ImmutableList.of(new ParameterMetadata(STATE),
new ParameterMetadata(BLOCK_INPUT_CHANNEL, keyType),
new ParameterMetadata(NULLABLE_BLOCK_INPUT_CHANNEL, valueType),
new ParameterMetadata(BLOCK_INDEX));
}
public static void input(KeyValuePairsState state, Block key, Block value, int position)
{
KeyValuePairs pairs = state.get();
if (pairs == null) {
pairs = new KeyValuePairs(state.getKeyType(), state.getValueType(), true);
state.set(pairs);
}
long startSize = pairs.estimatedInMemorySize();
try {
pairs.add(key, value, position, position);
}
catch (ExceededMemoryLimitException e) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("The result of map_agg may not exceed %s", e.getMaxMemory()));
}
state.addMemoryUsage(pairs.estimatedInMemorySize() - startSize);
}
public static void combine(KeyValuePairsState state, KeyValuePairsState otherState)
{
if (state.get() != null && otherState.get() != null) {
Block keys = otherState.get().getKeys();
Block values = otherState.get().getValues();
KeyValuePairs pairs = state.get();
long startSize = pairs.estimatedInMemorySize();
for (int i = 0; i < keys.getPositionCount(); i++) {
try {
pairs.add(keys, values, i, i);
}
catch (ExceededMemoryLimitException e) {
throw new PrestoException(INVALID_FUNCTION_ARGUMENT, format("The result of map_agg may not exceed %s", e.getMaxMemory()));
}
}
state.addMemoryUsage(pairs.estimatedInMemorySize() - startSize);
}
else if (state.get() == null) {
state.set(otherState.get());
}
}
public static void output(KeyValuePairsState state, BlockBuilder out)
{
KeyValuePairs pairs = state.get();
if (pairs == null) {
out.appendNull();
}
else {
Block block = pairs.toMultimapNativeEncoding();
out.writeObject(block);
out.closeEntry();
}
}
}
| apache-2.0 |
wildfly-swarm/wildfly-swarm | docs/howto/autodetect-fractions/src/main/java/org/wildfly/swarm/howto/autodetect/MyRestApplication.java | 833 | /*
* Copyright 2015-2018 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
*
* 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.wildfly.swarm.howto.autodetect;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
public class MyRestApplication extends Application {
}
| apache-2.0 |
datametica/calcite | core/src/main/java/org/apache/calcite/sql/validate/ParameterNamespace.java | 1804 | /*
* 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.calcite.sql.validate;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlNode;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Namespace representing the type of a dynamic parameter.
*
* @see ParameterScope
*/
class ParameterNamespace extends AbstractNamespace {
//~ Instance fields --------------------------------------------------------
@SuppressWarnings("HidingField")
private final RelDataType type;
//~ Constructors -----------------------------------------------------------
ParameterNamespace(SqlValidatorImpl validator, RelDataType type) {
super(validator, null);
this.type = type;
}
//~ Methods ----------------------------------------------------------------
@Override public @Nullable SqlNode getNode() {
return null;
}
@Override public RelDataType validateImpl(RelDataType targetRowType) {
return type;
}
@Override public RelDataType getRowType() {
return type;
}
}
| apache-2.0 |
InspurUSA/nifi | nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/CreateTemplateRequestEntity.java | 1948 | /*
* 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.nifi.web.api.entity;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlRootElement;
/**
* A serialized representation of this class can be placed in the entity body of a request to the API.
*/
@XmlRootElement(name = "createTemplateRequestEntity")
public class CreateTemplateRequestEntity extends Entity {
private String name;
private String description;
private String snippetId;
@ApiModelProperty(
value = "The name of the template."
)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ApiModelProperty(
value = "The description of the template."
)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@ApiModelProperty(
value = "The identifier of the snippet."
)
public String getSnippetId() {
return snippetId;
}
public void setSnippetId(String snippetId) {
this.snippetId = snippetId;
}
}
| apache-2.0 |
fincatto/nfe | src/main/java/com/fincatto/documentofiscal/mdfe3/webservices/statusservico/MDFeStatusServicoStub.java | 93683 | /*
MDFeStatusServicoStub.java
<p>
This file was auto-generated from WSDL by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST)
*/
package com.fincatto.documentofiscal.mdfe3.webservices.statusservico;
import org.apache.axiom.om.OMAttribute;
import org.apache.axis2.client.Stub;
import javax.xml.namespace.QName;
import com.fincatto.documentofiscal.DFConfig;
import com.fincatto.documentofiscal.utils.MessageContextFactory;
/*
* MDFeStatusServicoStub java implementation
*/
public class MDFeStatusServicoStub extends org.apache.axis2.client.Stub {
protected org.apache.axis2.description.AxisOperation[] _operations;
// hashmaps to keep the fault mapping
@SuppressWarnings("rawtypes")
private final java.util.HashMap faultExceptionNameMap = new java.util.HashMap();
@SuppressWarnings("rawtypes")
private final java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
@SuppressWarnings("rawtypes")
private final java.util.HashMap faultMessageMap = new java.util.HashMap();
private static int counter = 0;
private static synchronized java.lang.String getUniqueSuffix() {
// reset the counter if it is greater than 99999
if (MDFeStatusServicoStub.counter > 99999) {
MDFeStatusServicoStub.counter = 0;
}
MDFeStatusServicoStub.counter = MDFeStatusServicoStub.counter + 1;
return System.currentTimeMillis() + "_" + MDFeStatusServicoStub.counter;
}
private void populateAxisService() {
// creating the Service with a unique name
this._service = new org.apache.axis2.description.AxisService("MDFeStatusServico" + MDFeStatusServicoStub.getUniqueSuffix());
this.addAnonymousOperations();
// creating the operations
org.apache.axis2.description.AxisOperation __operation;
this._operations = new org.apache.axis2.description.AxisOperation[1];
__operation = new org.apache.axis2.description.OutInAxisOperation();
__operation.setName(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF"));
this._service.addOperation(__operation);
this._operations[0] = __operation;
}
// populates the faults
private void populateFaults() {
}
/**
* Constructor that takes in a configContext
*/
public MDFeStatusServicoStub(final org.apache.axis2.context.ConfigurationContext configurationContext, final java.lang.String targetEndpoint, DFConfig config) throws org.apache.axis2.AxisFault {
this(configurationContext, targetEndpoint, false, config);
}
/**
* Constructor that takes in a configContext and useseperate listner
*/
public MDFeStatusServicoStub(final org.apache.axis2.context.ConfigurationContext configurationContext, final java.lang.String targetEndpoint, final boolean useSeparateListener, DFConfig config) throws org.apache.axis2.AxisFault {
// To populate AxisService
this.populateAxisService();
this.populateFaults();
this._serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, this._service);
this._serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(targetEndpoint));
this._serviceClient.getOptions().setUseSeparateListener(useSeparateListener);
// Set the soap version
this._serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
this.config = config;
}
/**
* Constructor taking the target endpoint
*/
public MDFeStatusServicoStub(final java.lang.String targetEndpoint, DFConfig config) throws org.apache.axis2.AxisFault {
this(null, targetEndpoint, config);
}
/**
* Auto generated method signature
*
* @param mdfeDadosMsg0
* @param mdfeCabecMsg1
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult mdfeStatusServicoMDF(final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg mdfeDadosMsg0, final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE mdfeCabecMsg1) throws java.rmi.RemoteException {
org.apache.axis2.context.MessageContext _messageContext = null;
try {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico/mdfeStatusServicoMDF");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
// create a message context
_messageContext = MessageContextFactory.INSTANCE.create(config);
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env;
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), mdfeDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF"));
env.build();
// add the children only if the parameter is not null
if (mdfeCabecMsg1 != null) {
final org.apache.axiom.om.OMElement omElementmdfeCabecMsg1 = this.toOM(mdfeCabecMsg1, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF")));
this.addHeader(omElementmdfeCabecMsg1, env);
}
// adding SOAP soap_headers
this._serviceClient.addHeadersToEnvelope(env);
// set the message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message contxt to the operation client
_operationClient.addMessageContext(_messageContext);
// execute the operation client
_operationClient.execute(true);
final org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);
final org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();
final java.lang.Object object = this.fromOM(_returnEnv.getBody().getFirstElement(), com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult.class, this.getEnvelopeNamespaces(_returnEnv));
return (com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult) object;
} catch (final org.apache.axis2.AxisFault f) {
final org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt != null) {
if (this.faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"))) {
// make the fault by reflection
try {
final java.lang.String exceptionClassName = (java.lang.String) this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
// message class
final java.lang.String messageClassName = (java.lang.String) this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = this.fromOM(faultElt, messageClass, null);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
throw new java.rmi.RemoteException(ex.getMessage(), ex);
} catch (final ClassCastException | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
throw f;
}
} else {
throw f;
}
} else {
throw f;
}
} finally {
if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
}
}
}
/**
* Auto generated method signature for Asynchronous Invocations
*
* @param mdfeDadosMsg0
* @param mdfeCabecMsg1
*/
public void startmdfeStatusServicoMDF(final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg mdfeDadosMsg0, final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE mdfeCabecMsg1, final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoCallbackHandler callback) throws java.rmi.RemoteException {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico/mdfeStatusServicoMDF");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env;
final org.apache.axis2.context.MessageContext _messageContext = MessageContextFactory.INSTANCE.create(config);
// Style is Doc.
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), mdfeDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF"));
// add the soap_headers only if they are not null
if (mdfeCabecMsg1 != null) {
final org.apache.axiom.om.OMElement omElementmdfeCabecMsg1 = this.toOM(mdfeCabecMsg1, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDF")));
this.addHeader(omElementmdfeCabecMsg1, env);
}
// adding SOAP soap_headers
this._serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message context to the operation client
_operationClient.addMessageContext(_messageContext);
_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
@Override
public void onMessage(final org.apache.axis2.context.MessageContext resultContext) {
try {
final org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
final java.lang.Object object = MDFeStatusServicoStub.this.fromOM(resultEnv.getBody().getFirstElement(), com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult.class, MDFeStatusServicoStub.this.getEnvelopeNamespaces(resultEnv));
callback.receiveResultmdfeStatusServicoMDF((com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult) object);
} catch (final org.apache.axis2.AxisFault e) {
callback.receiveErrormdfeStatusServicoMDF(e);
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public void onError(final java.lang.Exception error) {
if (error instanceof org.apache.axis2.AxisFault) {
final org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
final org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt != null) {
if (MDFeStatusServicoStub.this.faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"))) {
// make the fault by reflection
try {
final java.lang.String exceptionClassName = (java.lang.String) MDFeStatusServicoStub.this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
// message class
final java.lang.String messageClassName = (java.lang.String) MDFeStatusServicoStub.this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "mdfeStatusServicoMDF"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = MDFeStatusServicoStub.this.fromOM(faultElt, messageClass, null);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
callback.receiveErrormdfeStatusServicoMDF(new java.rmi.RemoteException(ex.getMessage(), ex));
} catch (final ClassCastException | org.apache.axis2.AxisFault | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrormdfeStatusServicoMDF(f);
}
} else {
callback.receiveErrormdfeStatusServicoMDF(f);
}
} else {
callback.receiveErrormdfeStatusServicoMDF(f);
}
} else {
callback.receiveErrormdfeStatusServicoMDF(error);
}
}
@Override
public void onFault(final org.apache.axis2.context.MessageContext faultContext) {
final org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
this.onError(fault);
}
@Override
public void onComplete() {
try {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
} catch (final org.apache.axis2.AxisFault axisFault) {
callback.receiveErrormdfeStatusServicoMDF(axisFault);
}
}
});
org.apache.axis2.util.CallbackReceiver _callbackReceiver;
if (this._operations[0].getMessageReceiver() == null && _operationClient.getOptions().isUseSeparateListener()) {
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
this._operations[0].setMessageReceiver(_callbackReceiver);
}
// execute the operation client
_operationClient.execute(false);
}
/**
* A utility method that copies the namepaces from the SOAPEnvelope
*/
@SuppressWarnings({"rawtypes", "unchecked"})
private java.util.Map getEnvelopeNamespaces(final org.apache.axiom.soap.SOAPEnvelope env) {
final java.util.Map returnMap = new java.util.HashMap();
final java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
while (namespaceIterator.hasNext()) {
final org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
returnMap.put(ns.getPrefix(), ns.getNamespaceURI());
}
return returnMap;
}
private final javax.xml.namespace.QName[] opNameArray = null;
private final DFConfig config;
private boolean optimizeContent(final javax.xml.namespace.QName opName) {
if (this.opNameArray == null) {
return false;
}
for (final QName element : this.opNameArray) {
if (opName.equals(element)) {
return true;
}
}
return false;
}
// https://mdfe.sefaz.rs.gov.br/ws/MDFeStatusServico/MDFeStatusServico.asmx
@SuppressWarnings("serial")
public static class MdfeCabecMsgE implements org.apache.axis2.databinding.ADBBean {
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeCabecMsg", "ns5");
/**
* field for MdfeCabecMsg
*/
protected MdfeCabecMsg localMdfeCabecMsg;
/**
* Auto generated getter method
*
* @return MdfeCabecMsg
*/
public MdfeCabecMsg getMdfeCabecMsg() {
return this.localMdfeCabecMsg;
}
/**
* Auto generated setter method
*
* @param param MdfeCabecMsg
*/
public void setMdfeCabecMsg(final MdfeCabecMsg param) {
this.localMdfeCabecMsg = param;
}
/**
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
@Override
public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) {
final org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, MdfeCabecMsgE.MY_QNAME);
return factory.createOMElement(dataSource, MdfeCabecMsgE.MY_QNAME);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
this.serialize(parentQName, xmlWriter, false);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter, final boolean serializeType) throws javax.xml.stream.XMLStreamException {
// We can safely assume an element has only one type associated with it
if (this.localMdfeCabecMsg == null) {
throw new org.apache.axis2.databinding.ADBException("mdfeCabecMsg cannot be null!");
}
this.localMdfeCabecMsg.serialize(MdfeCabecMsgE.MY_QNAME, xmlWriter);
}
private static java.lang.String generatePrefix(final java.lang.String namespace) {
if (namespace.equals("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico")) {
return "ns5";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
@SuppressWarnings("unused")
private void writeStartElement(java.lang.String prefix, final java.lang.String namespace, final java.lang.String localPart, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = MdfeCabecMsgE.generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
@SuppressWarnings("unused")
private void writeAttribute(final java.lang.String prefix, final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace, attName, attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeAttribute(final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeQNameAttribute(final java.lang.String namespace, final java.lang.String attName, final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = this.registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
@SuppressWarnings("unused")
private void writeQName(final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = MdfeCabecMsgE.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
@SuppressWarnings("unused")
private void writeQNames(final javax.xml.namespace.QName[] qnames, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
final StringBuilder stringToWrite = new StringBuilder();
java.lang.String namespaceURI;
java.lang.String prefix;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = MdfeCabecMsgE.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(final javax.xml.stream.XMLStreamWriter xmlWriter, final java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = MdfeCabecMsgE.generatePrefix(namespace);
final javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
final java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*/
@Override
public javax.xml.stream.XMLStreamReader getPullParser(final javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
// We can safely assume an element has only one type associated with it
return this.localMdfeCabecMsg.getPullParser(MdfeCabecMsgE.MY_QNAME);
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
*/
@SuppressWarnings({"unused", "rawtypes"})
public static MdfeCabecMsgE parse(final javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
final MdfeCabecMsgE object = new MdfeCabecMsgE();
final int event;
final java.lang.String nillableValue = null;
final java.lang.String prefix = "";
final java.lang.String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
final java.util.Vector handledAttributes = new java.util.Vector();
while (!reader.isEndElement()) {
if (reader.isStartElement()) {
if (reader.isStartElement() && new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeCabecMsg").equals(reader.getName())) {
object.setMdfeCabecMsg(MdfeCabecMsg.Factory.parse(reader));
} // End of if for expected property start element
else {
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
} else {
reader.next();
}
} // end of while loop
} catch (final javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}// end of factory class
}
public static class ExtensionMapper {
public static java.lang.Object getTypeObject(final java.lang.String namespaceURI, final java.lang.String typeName, final javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
if ("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico".equals(namespaceURI) && "mdfeCabecMsg".equals(typeName)) {
return MdfeCabecMsg.Factory.parse(reader);
}
throw new org.apache.axis2.databinding.ADBException("Unsupported type " + namespaceURI + " " + typeName);
}
}
@SuppressWarnings("serial")
public static class MdfeDadosMsg implements org.apache.axis2.databinding.ADBBean {
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeDadosMsg", "ns5");
/**
* field for ExtraElement
*/
protected org.apache.axiom.om.OMElement localExtraElement;
/**
* Auto generated getter method
*
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getExtraElement() {
return this.localExtraElement;
}
/**
* Auto generated setter method
*
* @param param ExtraElement
*/
public void setExtraElement(final org.apache.axiom.om.OMElement param) {
this.localExtraElement = param;
}
/**
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
@Override
public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) {
final org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, MdfeDadosMsg.MY_QNAME);
return factory.createOMElement(dataSource, MdfeDadosMsg.MY_QNAME);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
this.serialize(parentQName, xmlWriter, false);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter, final boolean serializeType) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix;
java.lang.String namespace;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
this.writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
if (serializeType) {
final java.lang.String namespacePrefix = this.registerPrefix(xmlWriter, "http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":mdfeDadosMsg", xmlWriter);
} else {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "mdfeDadosMsg", xmlWriter);
}
}
if (this.localExtraElement != null) {
this.localExtraElement.serialize(xmlWriter);
} else {
throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!");
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(final java.lang.String namespace) {
if (namespace.equals("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico")) {
return "ns5";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, final java.lang.String namespace, final java.lang.String localPart, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = MdfeDadosMsg.generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(final java.lang.String prefix, final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace, attName, attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeAttribute(final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeQNameAttribute(final java.lang.String namespace, final java.lang.String attName, final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = this.registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
@SuppressWarnings("unused")
private void writeQName(final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = MdfeDadosMsg.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
@SuppressWarnings("unused")
private void writeQNames(final javax.xml.namespace.QName[] qnames, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
final StringBuilder stringToWrite = new StringBuilder();
java.lang.String namespaceURI;
java.lang.String prefix;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = MdfeDadosMsg.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(final javax.xml.stream.XMLStreamWriter xmlWriter, final java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = MdfeDadosMsg.generatePrefix(namespace);
final javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
final java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*/
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public javax.xml.stream.XMLStreamReader getPullParser(final javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
final java.util.ArrayList elementList = new java.util.ArrayList();
final java.util.ArrayList attribList = new java.util.ArrayList();
if (this.localExtraElement != null) {
elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
elementList.add(this.localExtraElement);
} else {
throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!");
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
*/
@SuppressWarnings({"unused", "rawtypes"})
public static MdfeDadosMsg parse(final javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
final MdfeDadosMsg object = new MdfeDadosMsg();
final int event;
final java.lang.String nillableValue = null;
final java.lang.String prefix = "";
final java.lang.String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
final java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
if (fullTypeName != null) {
java.lang.String nsPrefix = null;
if (fullTypeName.contains(":")) {
nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix == null ? "" : nsPrefix;
final java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
if (!"mdfeDadosMsg".equals(type)) {
// find namespace for the prefix
final java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (MdfeDadosMsg) ExtensionMapper.getTypeObject(nsUri, type, reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
final java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement()) {
// use the QName from the parser as the name for the builder
final javax.xml.namespace.QName startQname1 = reader.getName();
// We need to wrap the reader so that it produces a fake START_DOCUMENT event
// this is needed by the builder classes
final org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(reader), startQname1);
object.setExtraElement(builder1.getOMElement());
reader.next();
} // End of if for expected property start element
else {
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement()) {
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
} catch (final javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}// end of factory class
}
@SuppressWarnings("serial")
public static class MdfeStatusServicoMDFResult implements org.apache.axis2.databinding.ADBBean {
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "mdfeStatusServicoMDFResult", "ns5");
/**
* field for ExtraElement
*/
protected org.apache.axiom.om.OMElement localExtraElement;
/**
* Auto generated getter method
*
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getExtraElement() {
return this.localExtraElement;
}
/**
* Auto generated setter method
*
* @param param ExtraElement
*/
public void setExtraElement(final org.apache.axiom.om.OMElement param) {
this.localExtraElement = param;
}
/**
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
@Override
public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) {
final org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, MdfeStatusServicoMDFResult.MY_QNAME);
return factory.createOMElement(dataSource, MdfeStatusServicoMDFResult.MY_QNAME);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
this.serialize(parentQName, xmlWriter, false);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter, final boolean serializeType) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix;
java.lang.String namespace;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
this.writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
if (serializeType) {
final java.lang.String namespacePrefix = this.registerPrefix(xmlWriter, "http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":mdfeStatusServicoMDFResult", xmlWriter);
} else {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "mdfeStatusServicoMDFResult", xmlWriter);
}
}
if (this.localExtraElement != null) {
this.localExtraElement.serialize(xmlWriter);
} else {
throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!");
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(final java.lang.String namespace) {
if (namespace.equals("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico")) {
return "ns5";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, final java.lang.String namespace, final java.lang.String localPart, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = MdfeStatusServicoMDFResult.generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(final java.lang.String prefix, final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace, attName, attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeAttribute(final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeQNameAttribute(final java.lang.String namespace, final java.lang.String attName, final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = this.registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
@SuppressWarnings("unused")
private void writeQName(final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = MdfeStatusServicoMDFResult.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
@SuppressWarnings("unused")
private void writeQNames(final javax.xml.namespace.QName[] qnames, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
final StringBuilder stringToWrite = new StringBuilder();
java.lang.String namespaceURI;
java.lang.String prefix;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = MdfeStatusServicoMDFResult.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(final javax.xml.stream.XMLStreamWriter xmlWriter, final java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = MdfeStatusServicoMDFResult.generatePrefix(namespace);
final javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
final java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*/
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public javax.xml.stream.XMLStreamReader getPullParser(final javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
final java.util.ArrayList elementList = new java.util.ArrayList();
final java.util.ArrayList attribList = new java.util.ArrayList();
if (this.localExtraElement != null) {
elementList.add(org.apache.axis2.databinding.utils.Constants.OM_ELEMENT_KEY);
elementList.add(this.localExtraElement);
} else {
throw new org.apache.axis2.databinding.ADBException("extraElement cannot be null!!");
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
*/
@SuppressWarnings({"unused", "rawtypes"})
public static MdfeStatusServicoMDFResult parse(final javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
final MdfeStatusServicoMDFResult object = new MdfeStatusServicoMDFResult();
final int event;
final java.lang.String nillableValue = null;
final java.lang.String prefix = "";
final java.lang.String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
final java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
if (fullTypeName != null) {
java.lang.String nsPrefix = null;
if (fullTypeName.contains(":")) {
nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix == null ? "" : nsPrefix;
final java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
if (!"mdfeStatusServicoMDFResult".equals(type)) {
// find namespace for the prefix
final java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (MdfeStatusServicoMDFResult) ExtensionMapper.getTypeObject(nsUri, type, reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
final java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement()) {
// use the QName from the parser as the name for the builder
final javax.xml.namespace.QName startQname1 = reader.getName();
// We need to wrap the reader so that it produces a fake START_DOCUMENT event
// this is needed by the builder classes
final org.apache.axis2.databinding.utils.NamedStaxOMBuilder builder1 = new org.apache.axis2.databinding.utils.NamedStaxOMBuilder(new org.apache.axis2.util.StreamWrapper(reader), startQname1);
object.setExtraElement(builder1.getOMElement());
reader.next();
} // End of if for expected property start element
else {
// A start element we are not expecting indicates an invalid parameter was passed
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement()) {
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
} catch (final javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}// end of factory class
}
@SuppressWarnings("serial")
public static class MdfeCabecMsg implements org.apache.axis2.databinding.ADBBean {
/*
* This type was generated from the piece of schema that had name = mdfeCabecMsg Namespace URI = http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico Namespace Prefix = ns5
*/
/**
* field for CUF
*/
protected java.lang.String localCUF;
/*
* This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be used to determine whether to include this field in the serialized XML
*/
protected boolean localCUFTracker = false;
public boolean isCUFSpecified() {
return this.localCUFTracker;
}
/**
* Auto generated getter method
*
* @return java.lang.String
*/
public java.lang.String getCUF() {
return this.localCUF;
}
/**
* Auto generated setter method
*
* @param param CUF
*/
public void setCUF(final java.lang.String param) {
this.localCUFTracker = param != null;
this.localCUF = param;
}
/**
* field for VersaoDados
*/
protected java.lang.String localVersaoDados;
/*
* This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be used to determine whether to include this field in the serialized XML
*/
protected boolean localVersaoDadosTracker = false;
public boolean isVersaoDadosSpecified() {
return this.localVersaoDadosTracker;
}
/**
* Auto generated getter method
*
* @return java.lang.String
*/
public java.lang.String getVersaoDados() {
return this.localVersaoDados;
}
/**
* Auto generated setter method
*
* @param param VersaoDados
*/
public void setVersaoDados(final java.lang.String param) {
this.localVersaoDadosTracker = param != null;
this.localVersaoDados = param;
}
/**
* field for ExtraAttributes This was an Attribute! This was an Array!
*/
protected org.apache.axiom.om.OMAttribute[] localExtraAttributes;
/**
* Auto generated getter method
*
* @return org.apache.axiom.om.OMAttribute[]
*/
public org.apache.axiom.om.OMAttribute[] getExtraAttributes() {
return this.localExtraAttributes;
}
/**
* validate the array for ExtraAttributes
*/
protected void validateExtraAttributes(final org.apache.axiom.om.OMAttribute[] param) {
if ((param != null) && (param.length > 1)) {
throw new java.lang.RuntimeException();
}
if ((param != null) && (param.length < 1)) {
throw new java.lang.RuntimeException();
}
}
/**
* Auto generated setter method
*
* @param param ExtraAttributes
*/
public void setExtraAttributes(final org.apache.axiom.om.OMAttribute[] param) {
this.validateExtraAttributes(param);
this.localExtraAttributes = param;
}
/**
* Auto generated add method for the array for convenience
*
* @param param org.apache.axiom.om.OMAttribute
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public void addExtraAttributes(final org.apache.axiom.om.OMAttribute param) {
if (this.localExtraAttributes == null) {
this.localExtraAttributes = new org.apache.axiom.om.OMAttribute[]{};
}
final java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil.toList(this.localExtraAttributes);
list.add(param);
this.localExtraAttributes = (org.apache.axiom.om.OMAttribute[]) list.toArray(new OMAttribute[0]);
}
/**
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
@Override
public org.apache.axiom.om.OMElement getOMElement(final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory) {
final org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(this, parentQName);
return factory.createOMElement(dataSource, parentQName);
}
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
this.serialize(parentQName, xmlWriter, false);
}
@SuppressWarnings("deprecation")
@Override
public void serialize(final javax.xml.namespace.QName parentQName, final javax.xml.stream.XMLStreamWriter xmlWriter, final boolean serializeType) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix;
java.lang.String namespace;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
this.writeStartElement(prefix, namespace, parentQName.getLocalPart(), xmlWriter);
if (serializeType) {
final java.lang.String namespacePrefix = this.registerPrefix(xmlWriter, "http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico");
if ((namespacePrefix != null) && (namespacePrefix.trim().length() > 0)) {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":mdfeCabecMsg", xmlWriter);
} else {
this.writeAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "mdfeCabecMsg", xmlWriter);
}
}
if (this.localExtraAttributes != null) {
for (final OMAttribute localExtraAttribute : this.localExtraAttributes) {
this.writeAttribute(localExtraAttribute.getNamespace().getName(), localExtraAttribute.getLocalName(), localExtraAttribute.getAttributeValue(), xmlWriter);
}
}
if (this.localCUFTracker) {
namespace = "http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico";
this.writeStartElement(null, namespace, "cUF", xmlWriter);
if (this.localCUF == null) {
// write the nil attribute
throw new org.apache.axis2.databinding.ADBException("cUF cannot be null!!");
} else {
xmlWriter.writeCharacters(this.localCUF);
}
xmlWriter.writeEndElement();
}
if (this.localVersaoDadosTracker) {
namespace = "http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico";
this.writeStartElement(null, namespace, "versaoDados", xmlWriter);
if (this.localVersaoDados == null) {
// write the nil attribute
throw new org.apache.axis2.databinding.ADBException("versaoDados cannot be null!!");
} else {
xmlWriter.writeCharacters(this.localVersaoDados);
}
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(final java.lang.String namespace) {
if (namespace.equals("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico")) {
return "ns5";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix, final java.lang.String namespace, final java.lang.String localPart, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = MdfeCabecMsg.generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(final java.lang.String prefix, final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace, attName, attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(final java.lang.String namespace, final java.lang.String attName, final java.lang.String attValue, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
@SuppressWarnings("unused")
private void writeQNameAttribute(final java.lang.String namespace, final java.lang.String attName, final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = this.registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
this.registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
@SuppressWarnings("unused")
private void writeQName(final javax.xml.namespace.QName qname, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
final java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = MdfeCabecMsg.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix + ":" + org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
} else {
xmlWriter.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qname));
}
}
@SuppressWarnings("unused")
private void writeQNames(final javax.xml.namespace.QName[] qnames, final javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not possible to write any
// namespace data after writing the charactor data
final StringBuilder stringToWrite = new StringBuilder();
java.lang.String namespaceURI;
java.lang.String prefix;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = MdfeCabecMsg.generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite.append(prefix).append(":").append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
} else {
stringToWrite.append(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(final javax.xml.stream.XMLStreamWriter xmlWriter, final java.lang.String namespace) throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = MdfeCabecMsg.generatePrefix(namespace);
final javax.xml.namespace.NamespaceContext nsContext = xmlWriter.getNamespaceContext();
while (true) {
final java.lang.String uri = nsContext.getNamespaceURI(prefix);
if (uri == null || uri.length() == 0) {
break;
}
prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*/
@SuppressWarnings({"rawtypes", "unchecked"})
@Override
public javax.xml.stream.XMLStreamReader getPullParser(final javax.xml.namespace.QName qName) throws org.apache.axis2.databinding.ADBException {
final java.util.ArrayList elementList = new java.util.ArrayList();
final java.util.ArrayList attribList = new java.util.ArrayList();
if (this.localCUFTracker) {
elementList.add(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "cUF"));
if (this.localCUF != null) {
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(this.localCUF));
} else {
throw new org.apache.axis2.databinding.ADBException("cUF cannot be null!!");
}
}
if (this.localVersaoDadosTracker) {
elementList.add(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "versaoDados"));
if (this.localVersaoDados != null) {
elementList.add(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(this.localVersaoDados));
} else {
throw new org.apache.axis2.databinding.ADBException("versaoDados cannot be null!!");
}
}
for (final OMAttribute localExtraAttribute : this.localExtraAttributes) {
attribList.add(org.apache.axis2.databinding.utils.Constants.OM_ATTRIBUTE_KEY);
attribList.add(localExtraAttribute);
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an element, the current or next start element starts this object and any intervening reader events are ignorable If this object is not an element, it is a complex type and the reader is at the event just after the outer start element Postcondition: If this object is an element, the reader is positioned at its end element If this object is a complex type, the reader is positioned at the end element of its outer element
*/
@SuppressWarnings({"unused", "rawtypes"})
public static MdfeCabecMsg parse(final javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
final MdfeCabecMsg object = new MdfeCabecMsg();
final int event;
java.lang.String nillableValue;
final java.lang.String prefix = "";
final java.lang.String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
final java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
if (fullTypeName != null) {
java.lang.String nsPrefix = null;
if (fullTypeName.contains(":")) {
nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix == null ? "" : nsPrefix;
final java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
if (!"mdfeCabecMsg".equals(type)) {
// find namespace for the prefix
final java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
return (MdfeCabecMsg) ExtensionMapper.getTypeObject(nsUri, type, reader);
}
}
}
// Note all attributes that were handled. Used to differ normal attributes
// from anyAttributes.
final java.util.Vector handledAttributes = new java.util.Vector();
// now run through all any or extra attributes
// which were not reflected until now
for (int i = 0; i < reader.getAttributeCount(); i++) {
if (!handledAttributes.contains(reader.getAttributeLocalName(i))) {
// this is an anyAttribute and we create
// an OMAttribute for this
final org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();
final org.apache.axiom.om.OMAttribute attr = factory.createOMAttribute(reader.getAttributeLocalName(i), factory.createOMNamespace(reader.getAttributeNamespace(i), reader.getAttributePrefix(i)), reader.getAttributeValue(i));
// and add it to the extra attributes
object.addExtraAttributes(attr);
}
}
reader.next();
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement() && new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "cUF").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
throw new org.apache.axis2.databinding.ADBException("The element: " + "cUF" + " cannot be null");
}
final java.lang.String content = reader.getElementText();
object.setCUF(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement() && new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/mdfe/wsdl/MDFeStatusServico", "versaoDados").equals(reader.getName())) {
nillableValue = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
throw new org.apache.axis2.databinding.ADBException("The element: " + "versaoDados" + " cannot be null");
}
final java.lang.String content = reader.getElementText();
object.setVersaoDados(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));
reader.next();
} // End of if for expected property start element
while (!reader.isStartElement() && !reader.isEndElement()) {
reader.next();
}
if (reader.isStartElement()) {
// A start element we are not expecting indicates a trailing invalid property
throw new org.apache.axis2.databinding.ADBException("Unexpected subelement " + reader.getName());
}
} catch (final javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}// end of factory class
}
// @SuppressWarnings("unused")
// private org.apache.axiom.om.OMElement toOM(final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg param, final boolean optimizeContent) throws org.apache.axis2.AxisFault {
//
// try {
// return param.getOMElement(com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory());
// } catch (final org.apache.axis2.databinding.ADBException e) {
// throw org.apache.axis2.AxisFault.makeFault(e);
// }
//
// }
//
// @SuppressWarnings("unused")
// private org.apache.axiom.om.OMElement toOM(final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult param, final boolean optimizeContent) throws org.apache.axis2.AxisFault {
//
// try {
// return param.getOMElement(com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory());
// } catch (final org.apache.axis2.databinding.ADBException e) {
// throw org.apache.axis2.AxisFault.makeFault(e);
// }
//
// }
private org.apache.axiom.om.OMElement toOM(final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE param, final boolean optimizeContent) {
//try {
return param.getOMElement(com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE.MY_QNAME, org.apache.axiom.om.OMAbstractFactory.getOMFactory());
//} catch (final org.apache.axis2.databinding.ADBException e) {
// throw org.apache.axis2.AxisFault.makeFault(e);
//}
}
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(final org.apache.axiom.soap.SOAPFactory factory, final com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg param, final boolean optimizeContent, final javax.xml.namespace.QName methodQName) {
// try {
final org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
emptyEnvelope.getBody().addChild(param.getOMElement(com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg.MY_QNAME, factory));
return emptyEnvelope;
// } catch (final org.apache.axis2.databinding.ADBException e) {
// throw org.apache.axis2.AxisFault.makeFault(e);
// }
}
/* methods to provide back word compatibility */
/**
* get the default envelope
*/
@SuppressWarnings("unused")
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(final org.apache.axiom.soap.SOAPFactory factory) {
return factory.getDefaultEnvelope();
}
@SuppressWarnings("rawtypes")
private java.lang.Object fromOM(final org.apache.axiom.om.OMElement param, final java.lang.Class type, final java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault {
try {
if (com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg.class.equals(type)) {
return com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeDadosMsg.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult.class.equals(type)) {
return com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeStatusServicoMDFResult.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
if (com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE.class.equals(type)) {
return com.fincatto.documentofiscal.mdfe3.webservices.statusservico.MDFeStatusServicoStub.MdfeCabecMsgE.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
} catch (final java.lang.Exception e) {
throw org.apache.axis2.AxisFault.makeFault(e);
}
return null;
}
}
| apache-2.0 |
HonzaKral/elasticsearch | x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/transport/netty4/SecurityNetty4HttpServerTransportTests.java | 10512 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.security.transport.netty4;
import io.netty.channel.ChannelHandler;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.ssl.SslHandler;
import org.elasticsearch.common.network.NetworkService;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.MockSecureSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.TestEnvironment;
import org.elasticsearch.http.NullDispatcher;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.ssl.SSLClientAuth;
import org.elasticsearch.xpack.core.ssl.SSLService;
import org.elasticsearch.xpack.security.transport.filter.IPFilter;
import org.junit.Before;
import javax.net.ssl.SSLEngine;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Locale;
import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.mockito.Mockito.mock;
public class SecurityNetty4HttpServerTransportTests extends ESTestCase {
private SSLService sslService;
private Environment env;
private Path testnodeCert;
private Path testnodeKey;
@Before
public void createSSLService() {
testnodeCert = getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.crt");
testnodeKey = getDataPath("/org/elasticsearch/xpack/security/transport/ssl/certs/simple/testnode.pem");
MockSecureSettings secureSettings = new MockSecureSettings();
secureSettings.setString("xpack.security.http.ssl.secure_key_passphrase", "testnode");
Settings settings = Settings.builder()
.put("xpack.security.http.ssl.enabled", true)
.put("xpack.security.http.ssl.key", testnodeKey)
.put("xpack.security.http.ssl.certificate", testnodeCert)
.put("path.home", createTempDir())
.setSecureSettings(secureSettings)
.build();
env = TestEnvironment.newEnvironment(settings);
sslService = new SSLService(env);
}
public void testDefaultClientAuth() throws Exception {
Settings settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true).build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
ChannelHandler handler = transport.configureServerChannelHandler();
final EmbeddedChannel ch = new EmbeddedChannel(handler);
assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false));
assertThat(ch.pipeline().get(SslHandler.class).engine().getWantClientAuth(), is(false));
}
public void testOptionalClientAuth() throws Exception {
String value = randomFrom(SSLClientAuth.OPTIONAL.name(), SSLClientAuth.OPTIONAL.name().toLowerCase(Locale.ROOT));
Settings settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true)
.put("xpack.security.http.ssl.client_authentication", value).build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
ChannelHandler handler = transport.configureServerChannelHandler();
final EmbeddedChannel ch = new EmbeddedChannel(handler);
assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false));
assertThat(ch.pipeline().get(SslHandler.class).engine().getWantClientAuth(), is(true));
}
public void testRequiredClientAuth() throws Exception {
String value = randomFrom(SSLClientAuth.REQUIRED.name(), SSLClientAuth.REQUIRED.name().toLowerCase(Locale.ROOT));
Settings settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true)
.put("xpack.security.http.ssl.client_authentication", value).build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
ChannelHandler handler = transport.configureServerChannelHandler();
final EmbeddedChannel ch = new EmbeddedChannel(handler);
assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(true));
assertThat(ch.pipeline().get(SslHandler.class).engine().getWantClientAuth(), is(false));
}
public void testNoClientAuth() throws Exception {
String value = randomFrom(SSLClientAuth.NONE.name(), SSLClientAuth.NONE.name().toLowerCase(Locale.ROOT));
Settings settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true)
.put("xpack.security.http.ssl.client_authentication", value).build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
ChannelHandler handler = transport.configureServerChannelHandler();
final EmbeddedChannel ch = new EmbeddedChannel(handler);
assertThat(ch.pipeline().get(SslHandler.class).engine().getNeedClientAuth(), is(false));
assertThat(ch.pipeline().get(SslHandler.class).engine().getWantClientAuth(), is(false));
}
public void testCustomSSLConfiguration() throws Exception {
Settings settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true).build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
ChannelHandler handler = transport.configureServerChannelHandler();
EmbeddedChannel ch = new EmbeddedChannel(handler);
SSLEngine defaultEngine = ch.pipeline().get(SslHandler.class).engine();
settings = Settings.builder()
.put(env.settings())
.put(XPackSettings.HTTP_SSL_ENABLED.getKey(), true)
.put("xpack.security.http.ssl.supported_protocols", "TLSv1.2")
.build();
sslService = new SSLService(TestEnvironment.newEnvironment(settings));
transport = new SecurityNetty4HttpServerTransport(settings, new NetworkService(Collections.emptyList()),
mock(BigArrays.class), mock(IPFilter.class), sslService, mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
handler = transport.configureServerChannelHandler();
ch = new EmbeddedChannel(handler);
SSLEngine customEngine = ch.pipeline().get(SslHandler.class).engine();
assertThat(customEngine.getEnabledProtocols(), arrayContaining("TLSv1.2"));
assertThat(customEngine.getEnabledProtocols(), not(equalTo(defaultEngine.getEnabledProtocols())));
}
public void testNoExceptionWhenConfiguredWithoutSslKeySSLDisabled() throws Exception {
MockSecureSettings secureSettings = new MockSecureSettings();
secureSettings.setString("xpack.security.http.ssl.secure_key_passphrase", "testnode");
Settings settings = Settings.builder()
.put("xpack.security.http.ssl.enabled", false)
.put("xpack.security.http.ssl.key", testnodeKey)
.put("xpack.security.http.ssl.certificate", testnodeCert)
.setSecureSettings(secureSettings)
.put("path.home", createTempDir())
.build();
env = TestEnvironment.newEnvironment(settings);
sslService = new SSLService(env);
SecurityNetty4HttpServerTransport transport = new SecurityNetty4HttpServerTransport(settings,
new NetworkService(Collections.emptyList()), mock(BigArrays.class), mock(IPFilter.class), sslService,
mock(ThreadPool.class), xContentRegistry(), new NullDispatcher(),
new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS));
assertNotNull(transport.configureServerChannelHandler());
}
}
| apache-2.0 |
goldmansachs/reladomo | reladomo/src/test/java/com/gs/fw/common/mithra/test/domain/WishListItemList.java | 1044 |
/*
Copyright 2016 Goldman Sachs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package com.gs.fw.common.mithra.test.domain;
import com.gs.fw.common.mithra.finder.Operation;
import java.util.*;
public class WishListItemList extends WishListItemListAbstract
{
public WishListItemList()
{
super();
}
public WishListItemList(int initialSize)
{
super(initialSize);
}
public WishListItemList(Collection c)
{
super(c);
}
public WishListItemList(Operation operation)
{
super(operation);
}
}
| apache-2.0 |
ollie314/docker-java | src/main/java/com/github/dockerjava/netty/exec/StartContainerCmdExec.java | 1103 | package com.github.dockerjava.netty.exec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.dockerjava.api.command.StartContainerCmd;
import com.github.dockerjava.core.DockerClientConfig;
import com.github.dockerjava.netty.MediaType;
import com.github.dockerjava.netty.WebTarget;
public class StartContainerCmdExec extends AbstrSyncDockerCmdExec<StartContainerCmd, Void> implements
StartContainerCmd.Exec {
private static final Logger LOGGER = LoggerFactory.getLogger(StartContainerCmdExec.class);
public StartContainerCmdExec(WebTarget baseResource, DockerClientConfig dockerClientConfig) {
super(baseResource, dockerClientConfig);
}
@Override
protected Void execute(StartContainerCmd command) {
WebTarget webResource = getBaseResource().path("/containers/{id}/start").resolveTemplate("id",
command.getContainerId());
LOGGER.trace("POST: {}", webResource);
webResource.request()
.accept(MediaType.APPLICATION_JSON)
.post(command);
return null;
}
}
| apache-2.0 |
serenapan/cwac-camera-master | camera-v9/build/generated/source/r/release/com/commonsware/cwac/camera/acl/R.java | 173280 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.commonsware.cwac.camera.acl;
public final class R {
public static final class attr {
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarDivider=0x7f010027;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarItemBackground=0x7f010028;
/** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
<p>May be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>wrap_content</code></td><td>0</td><td></td></tr>
</table>
*/
public static int actionBarSize=0x7f010026;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarSplitStyle=0x7f010024;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarStyle=0x7f010023;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarTabBarStyle=0x7f010020;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarTabStyle=0x7f01001f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarTabTextStyle=0x7f010021;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionBarWidgetTheme=0x7f010025;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionButtonStyle=0x7f010053;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionDropDownStyle=0x7f010052;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionMenuTextAppearance=0x7f010029;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int actionMenuTextColor=0x7f01002a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeBackground=0x7f01002d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeCloseButtonStyle=0x7f01002c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeCloseDrawable=0x7f01002f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModePopupWindowStyle=0x7f010031;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeShareDrawable=0x7f010030;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeSplitBackground=0x7f01002e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionModeStyle=0x7f01002b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionOverflowButtonStyle=0x7f010022;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int actionSpinnerItemStyle=0x7f010058;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int activatedBackgroundIndicator=0x7f010060;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int activityChooserViewStyle=0x7f01005f;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int background=0x7f010000;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int backgroundSplit=0x7f010001;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int backgroundStacked=0x7f01000c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int buttonStyleSmall=0x7f010032;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int customNavigationLayout=0x7f01000d;
/** <p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>
<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>
<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>
<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>
<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>
<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>
</table>
*/
public static int displayOptions=0x7f010007;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int divider=0x7f010002;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int dividerVertical=0x7f010051;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int dropDownHintAppearance=0x7f010061;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int dropDownListViewStyle=0x7f010055;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int dropdownListPreferredItemHeight=0x7f010057;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int expandActivityOverflowButtonDrawable=0x7f010014;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int headerBackground=0x7f010018;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int height=0x7f010003;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int homeAsUpIndicator=0x7f010054;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int homeLayout=0x7f01000e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int horizontalDivider=0x7f010016;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int icon=0x7f01000a;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int iconifiedByDefault=0x7f01001d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int indeterminateProgressStyle=0x7f010010;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int initialActivityCount=0x7f010013;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int itemBackground=0x7f010019;
/** <p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int itemIconDisabledAlpha=0x7f01001b;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int itemPadding=0x7f010012;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int itemTextAppearance=0x7f010015;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int listPopupWindowStyle=0x7f01005e;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int listPreferredItemHeightSmall=0x7f01004b;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int listPreferredItemPaddingLeft=0x7f01004c;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int listPreferredItemPaddingRight=0x7f01004d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int logo=0x7f01000b;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>normal</code></td><td>0</td><td></td></tr>
<tr><td><code>listMode</code></td><td>1</td><td></td></tr>
<tr><td><code>tabMode</code></td><td>2</td><td></td></tr>
</table>
*/
public static int navigationMode=0x7f010006;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int popupMenuStyle=0x7f010056;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int preserveIconSpacing=0x7f01001c;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int progressBarPadding=0x7f010011;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int progressBarStyle=0x7f01000f;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int queryHint=0x7f01001e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchAutoCompleteTextView=0x7f01003d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchDropdownBackground=0x7f01003e;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int searchResultListItemHeight=0x7f010048;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewCloseIcon=0x7f01003f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewEditQuery=0x7f010043;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewEditQueryBackground=0x7f010044;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewGoIcon=0x7f010040;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewSearchIcon=0x7f010041;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewTextField=0x7f010045;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewTextFieldRight=0x7f010046;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int searchViewVoiceIcon=0x7f010042;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int selectableItemBackground=0x7f010033;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int spinnerDropDownItemStyle=0x7f01003c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int spinnerItemStyle=0x7f01003b;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int subtitle=0x7f010009;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int subtitleTextStyle=0x7f010004;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceLargePopupMenu=0x7f010035;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceListItemSmall=0x7f01004e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceSearchResultSubtitle=0x7f01004a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceSearchResultTitle=0x7f010049;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceSmall=0x7f010037;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int textAppearanceSmallPopupMenu=0x7f010036;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int textColorPrimary=0x7f010038;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int textColorPrimaryDisableOnly=0x7f010039;
/** <p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int textColorPrimaryInverse=0x7f01003a;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static int textColorSearchUrl=0x7f010047;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int title=0x7f010008;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int titleTextStyle=0x7f010005;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int verticalDivider=0x7f010017;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowActionBar=0x7f01005a;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowActionBarOverlay=0x7f01005b;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowActionModeOverlay=0x7f01005c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int windowAnimationStyle=0x7f01001a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static int windowContentOverlay=0x7f010034;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowMinWidthMajor=0x7f01004f;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowMinWidthMinor=0x7f010050;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowNoTitle=0x7f010059;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static int windowSplitActionBar=0x7f01005d;
}
public static final class bool {
public static int abs__action_bar_embed_tabs=0x7f050000;
public static int abs__action_bar_expanded_action_views_exclusive=0x7f050001;
public static int abs__config_actionMenuItemAllCaps=0x7f050002;
public static int abs__config_allowActionMenuItemTextWithIcon=0x7f050003;
public static int abs__config_showMenuShortcutsWhenKeyboardPresent=0x7f050004;
public static int abs__split_action_bar_is_narrow=0x7f050005;
}
public static final class color {
public static int abs__background_holo_dark=0x7f060000;
public static int abs__background_holo_light=0x7f060001;
public static int abs__bright_foreground_disabled_holo_dark=0x7f060002;
public static int abs__bright_foreground_disabled_holo_light=0x7f060003;
public static int abs__bright_foreground_holo_dark=0x7f060004;
public static int abs__bright_foreground_holo_light=0x7f060005;
public static int abs__primary_text_disable_only_holo_dark=0x7f060006;
public static int abs__primary_text_disable_only_holo_light=0x7f060007;
public static int abs__primary_text_holo_dark=0x7f060008;
public static int abs__primary_text_holo_light=0x7f060009;
}
public static final class dimen {
public static int abs__action_bar_default_height=0x7f080000;
public static int abs__action_bar_icon_vertical_padding=0x7f080001;
public static int abs__action_bar_subtitle_bottom_margin=0x7f080002;
public static int abs__action_bar_subtitle_text_size=0x7f080003;
public static int abs__action_bar_subtitle_top_margin=0x7f080004;
public static int abs__action_bar_title_text_size=0x7f080005;
public static int abs__action_button_min_width=0x7f080006;
public static int abs__config_prefDialogWidth=0x7f080007;
public static int abs__dialog_min_width_major=0x7f08000d;
public static int abs__dialog_min_width_minor=0x7f08000e;
public static int abs__dropdownitem_icon_width=0x7f080008;
public static int abs__dropdownitem_text_padding_left=0x7f080009;
public static int abs__dropdownitem_text_padding_right=0x7f08000a;
public static int abs__search_view_preferred_width=0x7f08000b;
public static int abs__search_view_text_min_width=0x7f08000c;
}
public static final class drawable {
public static int abs__ab_bottom_solid_dark_holo=0x7f020000;
public static int abs__ab_bottom_solid_inverse_holo=0x7f020001;
public static int abs__ab_bottom_solid_light_holo=0x7f020002;
public static int abs__ab_bottom_transparent_dark_holo=0x7f020003;
public static int abs__ab_bottom_transparent_light_holo=0x7f020004;
public static int abs__ab_share_pack_holo_dark=0x7f020005;
public static int abs__ab_share_pack_holo_light=0x7f020006;
public static int abs__ab_solid_dark_holo=0x7f020007;
public static int abs__ab_solid_light_holo=0x7f020008;
public static int abs__ab_solid_shadow_holo=0x7f020009;
public static int abs__ab_stacked_solid_dark_holo=0x7f02000a;
public static int abs__ab_stacked_solid_light_holo=0x7f02000b;
public static int abs__ab_stacked_transparent_dark_holo=0x7f02000c;
public static int abs__ab_stacked_transparent_light_holo=0x7f02000d;
public static int abs__ab_transparent_dark_holo=0x7f02000e;
public static int abs__ab_transparent_light_holo=0x7f02000f;
public static int abs__activated_background_holo_dark=0x7f020010;
public static int abs__activated_background_holo_light=0x7f020011;
public static int abs__btn_cab_done_default_holo_dark=0x7f020012;
public static int abs__btn_cab_done_default_holo_light=0x7f020013;
public static int abs__btn_cab_done_focused_holo_dark=0x7f020014;
public static int abs__btn_cab_done_focused_holo_light=0x7f020015;
public static int abs__btn_cab_done_holo_dark=0x7f020016;
public static int abs__btn_cab_done_holo_light=0x7f020017;
public static int abs__btn_cab_done_pressed_holo_dark=0x7f020018;
public static int abs__btn_cab_done_pressed_holo_light=0x7f020019;
public static int abs__cab_background_bottom_holo_dark=0x7f02001a;
public static int abs__cab_background_bottom_holo_light=0x7f02001b;
public static int abs__cab_background_top_holo_dark=0x7f02001c;
public static int abs__cab_background_top_holo_light=0x7f02001d;
public static int abs__ic_ab_back_holo_dark=0x7f02001e;
public static int abs__ic_ab_back_holo_light=0x7f02001f;
public static int abs__ic_cab_done_holo_dark=0x7f020020;
public static int abs__ic_cab_done_holo_light=0x7f020021;
public static int abs__ic_clear=0x7f020022;
public static int abs__ic_clear_disabled=0x7f020023;
public static int abs__ic_clear_holo_light=0x7f020024;
public static int abs__ic_clear_normal=0x7f020025;
public static int abs__ic_clear_search_api_disabled_holo_light=0x7f020026;
public static int abs__ic_clear_search_api_holo_light=0x7f020027;
public static int abs__ic_commit_search_api_holo_dark=0x7f020028;
public static int abs__ic_commit_search_api_holo_light=0x7f020029;
public static int abs__ic_go=0x7f02002a;
public static int abs__ic_go_search_api_holo_light=0x7f02002b;
public static int abs__ic_menu_moreoverflow_holo_dark=0x7f02002c;
public static int abs__ic_menu_moreoverflow_holo_light=0x7f02002d;
public static int abs__ic_menu_moreoverflow_normal_holo_dark=0x7f02002e;
public static int abs__ic_menu_moreoverflow_normal_holo_light=0x7f02002f;
public static int abs__ic_menu_share_holo_dark=0x7f020030;
public static int abs__ic_menu_share_holo_light=0x7f020031;
public static int abs__ic_search=0x7f020032;
public static int abs__ic_search_api_holo_light=0x7f020033;
public static int abs__ic_voice_search=0x7f020034;
public static int abs__ic_voice_search_api_holo_light=0x7f020035;
public static int abs__item_background_holo_dark=0x7f020036;
public static int abs__item_background_holo_light=0x7f020037;
public static int abs__list_activated_holo=0x7f020038;
public static int abs__list_divider_holo_dark=0x7f020039;
public static int abs__list_divider_holo_light=0x7f02003a;
public static int abs__list_focused_holo=0x7f02003b;
public static int abs__list_longpressed_holo=0x7f02003c;
public static int abs__list_pressed_holo_dark=0x7f02003d;
public static int abs__list_pressed_holo_light=0x7f02003e;
public static int abs__list_selector_background_transition_holo_dark=0x7f02003f;
public static int abs__list_selector_background_transition_holo_light=0x7f020040;
public static int abs__list_selector_disabled_holo_dark=0x7f020041;
public static int abs__list_selector_disabled_holo_light=0x7f020042;
public static int abs__list_selector_holo_dark=0x7f020043;
public static int abs__list_selector_holo_light=0x7f020044;
public static int abs__menu_dropdown_panel_holo_dark=0x7f020045;
public static int abs__menu_dropdown_panel_holo_light=0x7f020046;
public static int abs__progress_bg_holo_dark=0x7f020047;
public static int abs__progress_bg_holo_light=0x7f020048;
public static int abs__progress_horizontal_holo_dark=0x7f020049;
public static int abs__progress_horizontal_holo_light=0x7f02004a;
public static int abs__progress_medium_holo=0x7f02004b;
public static int abs__progress_primary_holo_dark=0x7f02004c;
public static int abs__progress_primary_holo_light=0x7f02004d;
public static int abs__progress_secondary_holo_dark=0x7f02004e;
public static int abs__progress_secondary_holo_light=0x7f02004f;
public static int abs__search_dropdown_dark=0x7f020050;
public static int abs__search_dropdown_light=0x7f020051;
public static int abs__spinner_48_inner_holo=0x7f020052;
public static int abs__spinner_48_outer_holo=0x7f020053;
public static int abs__spinner_ab_default_holo_dark=0x7f020054;
public static int abs__spinner_ab_default_holo_light=0x7f020055;
public static int abs__spinner_ab_disabled_holo_dark=0x7f020056;
public static int abs__spinner_ab_disabled_holo_light=0x7f020057;
public static int abs__spinner_ab_focused_holo_dark=0x7f020058;
public static int abs__spinner_ab_focused_holo_light=0x7f020059;
public static int abs__spinner_ab_holo_dark=0x7f02005a;
public static int abs__spinner_ab_holo_light=0x7f02005b;
public static int abs__spinner_ab_pressed_holo_dark=0x7f02005c;
public static int abs__spinner_ab_pressed_holo_light=0x7f02005d;
public static int abs__tab_indicator_ab_holo=0x7f02005e;
public static int abs__tab_selected_focused_holo=0x7f02005f;
public static int abs__tab_selected_holo=0x7f020060;
public static int abs__tab_selected_pressed_holo=0x7f020061;
public static int abs__tab_unselected_pressed_holo=0x7f020062;
public static int abs__textfield_search_default_holo_dark=0x7f020063;
public static int abs__textfield_search_default_holo_light=0x7f020064;
public static int abs__textfield_search_right_default_holo_dark=0x7f020065;
public static int abs__textfield_search_right_default_holo_light=0x7f020066;
public static int abs__textfield_search_right_selected_holo_dark=0x7f020067;
public static int abs__textfield_search_right_selected_holo_light=0x7f020068;
public static int abs__textfield_search_selected_holo_dark=0x7f020069;
public static int abs__textfield_search_selected_holo_light=0x7f02006a;
public static int abs__textfield_searchview_holo_dark=0x7f02006b;
public static int abs__textfield_searchview_holo_light=0x7f02006c;
public static int abs__textfield_searchview_right_holo_dark=0x7f02006d;
public static int abs__textfield_searchview_right_holo_light=0x7f02006e;
public static int abs__toast_frame=0x7f02006f;
}
public static final class id {
public static int abs__action_bar=0x7f070020;
public static int abs__action_bar_container=0x7f07001f;
public static int abs__action_bar_subtitle=0x7f070011;
public static int abs__action_bar_title=0x7f070010;
public static int abs__action_context_bar=0x7f070021;
public static int abs__action_menu_divider=0x7f07000a;
public static int abs__action_menu_presenter=0x7f07000b;
public static int abs__action_mode_bar=0x7f070025;
public static int abs__action_mode_bar_stub=0x7f070024;
public static int abs__action_mode_close_button=0x7f070014;
public static int abs__activity_chooser_view_content=0x7f070015;
public static int abs__checkbox=0x7f07001c;
public static int abs__content=0x7f070022;
public static int abs__default_activity_button=0x7f070018;
public static int abs__expand_activities_button=0x7f070016;
public static int abs__home=0x7f07000c;
public static int abs__icon=0x7f07001a;
public static int abs__image=0x7f070017;
public static int abs__imageButton=0x7f070012;
public static int abs__list_item=0x7f070019;
public static int abs__progress_circular=0x7f07000d;
public static int abs__progress_horizontal=0x7f07000e;
public static int abs__radio=0x7f07001d;
public static int abs__search_badge=0x7f070028;
public static int abs__search_bar=0x7f070027;
public static int abs__search_button=0x7f070029;
public static int abs__search_close_btn=0x7f07002e;
public static int abs__search_edit_frame=0x7f07002a;
public static int abs__search_go_btn=0x7f070030;
public static int abs__search_mag_icon=0x7f07002b;
public static int abs__search_plate=0x7f07002c;
public static int abs__search_src_text=0x7f07002d;
public static int abs__search_voice_btn=0x7f070031;
public static int abs__shortcut=0x7f07001e;
public static int abs__split_action_bar=0x7f070023;
public static int abs__submit_area=0x7f07002f;
public static int abs__textButton=0x7f070013;
public static int abs__title=0x7f07001b;
public static int abs__up=0x7f07000f;
public static int disableHome=0x7f070008;
public static int edit_query=0x7f070026;
public static int homeAsUp=0x7f070005;
public static int listMode=0x7f070001;
public static int normal=0x7f070000;
public static int showCustom=0x7f070007;
public static int showHome=0x7f070004;
public static int showTitle=0x7f070006;
public static int tabMode=0x7f070002;
public static int useLogo=0x7f070003;
public static int wrap_content=0x7f070009;
}
public static final class integer {
public static int abs__max_action_buttons=0x7f090000;
}
public static final class layout {
public static int abs__action_bar_home=0x7f030000;
public static int abs__action_bar_tab=0x7f030001;
public static int abs__action_bar_tab_bar_view=0x7f030002;
public static int abs__action_bar_title_item=0x7f030003;
public static int abs__action_menu_item_layout=0x7f030004;
public static int abs__action_menu_layout=0x7f030005;
public static int abs__action_mode_bar=0x7f030006;
public static int abs__action_mode_close_item=0x7f030007;
public static int abs__activity_chooser_view=0x7f030008;
public static int abs__activity_chooser_view_list_item=0x7f030009;
public static int abs__list_menu_item_checkbox=0x7f03000a;
public static int abs__list_menu_item_icon=0x7f03000b;
public static int abs__list_menu_item_radio=0x7f03000c;
public static int abs__popup_menu_item_layout=0x7f03000d;
public static int abs__screen_action_bar=0x7f03000e;
public static int abs__screen_action_bar_overlay=0x7f03000f;
public static int abs__screen_simple=0x7f030010;
public static int abs__screen_simple_overlay_action_mode=0x7f030011;
public static int abs__search_dropdown_item_icons_2line=0x7f030012;
public static int abs__search_view=0x7f030013;
public static int abs__simple_dropdown_hint=0x7f030014;
public static int sherlock_spinner_dropdown_item=0x7f030015;
public static int sherlock_spinner_item=0x7f030016;
}
public static final class string {
public static int abs__action_bar_home_description=0x7f0a0000;
public static int abs__action_bar_up_description=0x7f0a0001;
public static int abs__action_menu_overflow_description=0x7f0a0002;
public static int abs__action_mode_done=0x7f0a0003;
public static int abs__activity_chooser_view_see_all=0x7f0a0004;
public static int abs__activitychooserview_choose_application=0x7f0a0005;
public static int abs__searchview_description_clear=0x7f0a0006;
public static int abs__searchview_description_query=0x7f0a0007;
public static int abs__searchview_description_search=0x7f0a0008;
public static int abs__searchview_description_submit=0x7f0a0009;
public static int abs__searchview_description_voice=0x7f0a000a;
public static int abs__shareactionprovider_share_with=0x7f0a000b;
public static int abs__shareactionprovider_share_with_application=0x7f0a000c;
}
public static final class style {
public static int Sherlock___TextAppearance_Small=0x7f0b0000;
public static int Sherlock___Theme=0x7f0b0001;
public static int Sherlock___Theme_DarkActionBar=0x7f0b0002;
public static int Sherlock___Theme_Light=0x7f0b0003;
public static int Sherlock___Widget_ActionBar=0x7f0b0004;
public static int Sherlock___Widget_ActionMode=0x7f0b0005;
public static int Sherlock___Widget_ActivityChooserView=0x7f0b0006;
public static int Sherlock___Widget_Holo_DropDownItem=0x7f0b0007;
public static int Sherlock___Widget_Holo_ListView=0x7f0b0008;
public static int Sherlock___Widget_Holo_Spinner=0x7f0b0009;
public static int Sherlock___Widget_SearchAutoCompleteTextView=0x7f0b000a;
public static int TextAppearance_Sherlock=0x7f0b000b;
public static int TextAppearance_Sherlock_Light_SearchResult=0x7f0b000c;
public static int TextAppearance_Sherlock_Light_SearchResult_Subtitle=0x7f0b000d;
public static int TextAppearance_Sherlock_Light_SearchResult_Title=0x7f0b000e;
public static int TextAppearance_Sherlock_Light_Small=0x7f0b000f;
public static int TextAppearance_Sherlock_Light_Widget_PopupMenu_Large=0x7f0b0010;
public static int TextAppearance_Sherlock_Light_Widget_PopupMenu_Small=0x7f0b0011;
public static int TextAppearance_Sherlock_SearchResult=0x7f0b0012;
public static int TextAppearance_Sherlock_SearchResult_Subtitle=0x7f0b0013;
public static int TextAppearance_Sherlock_SearchResult_Title=0x7f0b0014;
public static int TextAppearance_Sherlock_Small=0x7f0b0015;
public static int TextAppearance_Sherlock_Widget_ActionBar_Menu=0x7f0b0016;
public static int TextAppearance_Sherlock_Widget_ActionBar_Subtitle=0x7f0b0017;
public static int TextAppearance_Sherlock_Widget_ActionBar_Subtitle_Inverse=0x7f0b0018;
public static int TextAppearance_Sherlock_Widget_ActionBar_Title=0x7f0b0019;
public static int TextAppearance_Sherlock_Widget_ActionBar_Title_Inverse=0x7f0b001a;
public static int TextAppearance_Sherlock_Widget_ActionMode_Subtitle=0x7f0b001b;
public static int TextAppearance_Sherlock_Widget_ActionMode_Subtitle_Inverse=0x7f0b001c;
public static int TextAppearance_Sherlock_Widget_ActionMode_Title=0x7f0b001d;
public static int TextAppearance_Sherlock_Widget_ActionMode_Title_Inverse=0x7f0b001e;
public static int TextAppearance_Sherlock_Widget_DropDownHint=0x7f0b001f;
public static int TextAppearance_Sherlock_Widget_DropDownItem=0x7f0b0020;
public static int TextAppearance_Sherlock_Widget_PopupMenu=0x7f0b0021;
public static int TextAppearance_Sherlock_Widget_PopupMenu_Large=0x7f0b0022;
public static int TextAppearance_Sherlock_Widget_PopupMenu_Small=0x7f0b0023;
public static int TextAppearance_Sherlock_Widget_TextView_SpinnerItem=0x7f0b0024;
public static int Theme_Sherlock=0x7f0b0025;
public static int Theme_Sherlock_Light=0x7f0b0026;
public static int Theme_Sherlock_Light_DarkActionBar=0x7f0b0027;
public static int Theme_Sherlock_Light_NoActionBar=0x7f0b0028;
public static int Theme_Sherlock_NoActionBar=0x7f0b0029;
public static int Widget=0x7f0b002a;
public static int Widget_Sherlock_ActionBar=0x7f0b002b;
public static int Widget_Sherlock_ActionBar_Solid=0x7f0b002c;
public static int Widget_Sherlock_ActionBar_TabBar=0x7f0b002d;
public static int Widget_Sherlock_ActionBar_TabText=0x7f0b002e;
public static int Widget_Sherlock_ActionBar_TabView=0x7f0b002f;
public static int Widget_Sherlock_ActionButton=0x7f0b0030;
public static int Widget_Sherlock_ActionButton_CloseMode=0x7f0b0031;
public static int Widget_Sherlock_ActionButton_Overflow=0x7f0b0032;
public static int Widget_Sherlock_ActionMode=0x7f0b0033;
public static int Widget_Sherlock_ActivityChooserView=0x7f0b0034;
public static int Widget_Sherlock_Button_Small=0x7f0b0035;
public static int Widget_Sherlock_DropDownItem_Spinner=0x7f0b0036;
public static int Widget_Sherlock_Light_ActionBar=0x7f0b0037;
public static int Widget_Sherlock_Light_ActionBar_Solid=0x7f0b0038;
public static int Widget_Sherlock_Light_ActionBar_Solid_Inverse=0x7f0b0039;
public static int Widget_Sherlock_Light_ActionBar_TabBar=0x7f0b003a;
public static int Widget_Sherlock_Light_ActionBar_TabBar_Inverse=0x7f0b003b;
public static int Widget_Sherlock_Light_ActionBar_TabText=0x7f0b003c;
public static int Widget_Sherlock_Light_ActionBar_TabText_Inverse=0x7f0b003d;
public static int Widget_Sherlock_Light_ActionBar_TabView=0x7f0b003e;
public static int Widget_Sherlock_Light_ActionBar_TabView_Inverse=0x7f0b003f;
public static int Widget_Sherlock_Light_ActionButton=0x7f0b0040;
public static int Widget_Sherlock_Light_ActionButton_CloseMode=0x7f0b0041;
public static int Widget_Sherlock_Light_ActionButton_Overflow=0x7f0b0042;
public static int Widget_Sherlock_Light_ActionMode=0x7f0b0043;
public static int Widget_Sherlock_Light_ActionMode_Inverse=0x7f0b0044;
public static int Widget_Sherlock_Light_ActivityChooserView=0x7f0b0045;
public static int Widget_Sherlock_Light_Button_Small=0x7f0b0046;
public static int Widget_Sherlock_Light_DropDownItem_Spinner=0x7f0b0047;
public static int Widget_Sherlock_Light_ListPopupWindow=0x7f0b0048;
public static int Widget_Sherlock_Light_ListView_DropDown=0x7f0b0049;
public static int Widget_Sherlock_Light_PopupMenu=0x7f0b004a;
public static int Widget_Sherlock_Light_PopupWindow_ActionMode=0x7f0b004b;
public static int Widget_Sherlock_Light_ProgressBar=0x7f0b004c;
public static int Widget_Sherlock_Light_ProgressBar_Horizontal=0x7f0b004d;
public static int Widget_Sherlock_Light_SearchAutoCompleteTextView=0x7f0b004e;
public static int Widget_Sherlock_Light_Spinner_DropDown_ActionBar=0x7f0b004f;
public static int Widget_Sherlock_ListPopupWindow=0x7f0b0050;
public static int Widget_Sherlock_ListView_DropDown=0x7f0b0051;
public static int Widget_Sherlock_PopupMenu=0x7f0b0052;
public static int Widget_Sherlock_PopupWindow_ActionMode=0x7f0b0053;
public static int Widget_Sherlock_ProgressBar=0x7f0b0054;
public static int Widget_Sherlock_ProgressBar_Horizontal=0x7f0b0055;
public static int Widget_Sherlock_SearchAutoCompleteTextView=0x7f0b0056;
public static int Widget_Sherlock_Spinner_DropDown_ActionBar=0x7f0b0057;
public static int Widget_Sherlock_TextView_SpinnerItem=0x7f0b0058;
}
public static final class xml {
public static int cwac_camera_profile_htc_htc_mecha=0x7f040000;
public static int cwac_camera_profile_htc_m7=0x7f040001;
public static int cwac_camera_profile_motorola_xt910_rtanz=0x7f040002;
public static int cwac_camera_profile_samsung_corsicadd=0x7f040003;
public static int cwac_camera_profile_samsung_d2att=0x7f040004;
public static int cwac_camera_profile_samsung_d2spr=0x7f040005;
public static int cwac_camera_profile_samsung_d2tmo=0x7f040006;
public static int cwac_camera_profile_samsung_d2uc=0x7f040007;
public static int cwac_camera_profile_samsung_d2vzw=0x7f040008;
public static int cwac_camera_profile_samsung_gd1wifiue=0x7f040009;
public static int cwac_camera_profile_samsung_ja3gxx=0x7f04000a;
public static int cwac_camera_profile_samsung_jflteuc=0x7f04000b;
public static int cwac_camera_profile_samsung_kyleproxx=0x7f04000c;
public static int cwac_camera_profile_samsung_nevispxx=0x7f04000d;
public static int cwac_camera_profile_samsung_yakju=0x7f04000e;
}
public static final class styleable {
/** Attributes that can be used with a SherlockActionBar.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockActionBar_background com.commonsware.cwac.camera.acl:background}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_backgroundSplit com.commonsware.cwac.camera.acl:backgroundSplit}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_backgroundStacked com.commonsware.cwac.camera.acl:backgroundStacked}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_customNavigationLayout com.commonsware.cwac.camera.acl:customNavigationLayout}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_displayOptions com.commonsware.cwac.camera.acl:displayOptions}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_divider com.commonsware.cwac.camera.acl:divider}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_height com.commonsware.cwac.camera.acl:height}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_homeLayout com.commonsware.cwac.camera.acl:homeLayout}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_icon com.commonsware.cwac.camera.acl:icon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_indeterminateProgressStyle com.commonsware.cwac.camera.acl:indeterminateProgressStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_itemPadding com.commonsware.cwac.camera.acl:itemPadding}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_logo com.commonsware.cwac.camera.acl:logo}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_navigationMode com.commonsware.cwac.camera.acl:navigationMode}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_progressBarPadding com.commonsware.cwac.camera.acl:progressBarPadding}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_progressBarStyle com.commonsware.cwac.camera.acl:progressBarStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_subtitle com.commonsware.cwac.camera.acl:subtitle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_subtitleTextStyle com.commonsware.cwac.camera.acl:subtitleTextStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_title com.commonsware.cwac.camera.acl:title}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionBar_titleTextStyle com.commonsware.cwac.camera.acl:titleTextStyle}</code></td><td></td></tr>
</table>
@see #SherlockActionBar_background
@see #SherlockActionBar_backgroundSplit
@see #SherlockActionBar_backgroundStacked
@see #SherlockActionBar_customNavigationLayout
@see #SherlockActionBar_displayOptions
@see #SherlockActionBar_divider
@see #SherlockActionBar_height
@see #SherlockActionBar_homeLayout
@see #SherlockActionBar_icon
@see #SherlockActionBar_indeterminateProgressStyle
@see #SherlockActionBar_itemPadding
@see #SherlockActionBar_logo
@see #SherlockActionBar_navigationMode
@see #SherlockActionBar_progressBarPadding
@see #SherlockActionBar_progressBarStyle
@see #SherlockActionBar_subtitle
@see #SherlockActionBar_subtitleTextStyle
@see #SherlockActionBar_title
@see #SherlockActionBar_titleTextStyle
*/
public static final int[] SherlockActionBar = {
0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003,
0x7f010004, 0x7f010005, 0x7f010006, 0x7f010007,
0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b,
0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f,
0x7f010010, 0x7f010011, 0x7f010012
};
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#background}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:background
*/
public static final int SherlockActionBar_background = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#backgroundSplit}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:backgroundSplit
*/
public static final int SherlockActionBar_backgroundSplit = 1;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#backgroundStacked}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:backgroundStacked
*/
public static final int SherlockActionBar_backgroundStacked = 12;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#customNavigationLayout}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:customNavigationLayout
*/
public static final int SherlockActionBar_customNavigationLayout = 13;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#displayOptions}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>
<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>
<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>
<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>
<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>
<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>
</table>
@attr name com.commonsware.cwac.camera.acl:displayOptions
*/
public static final int SherlockActionBar_displayOptions = 7;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#divider}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:divider
*/
public static final int SherlockActionBar_divider = 2;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#height}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:height
*/
public static final int SherlockActionBar_height = 3;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#homeLayout}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:homeLayout
*/
public static final int SherlockActionBar_homeLayout = 14;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#icon}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:icon
*/
public static final int SherlockActionBar_icon = 10;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#indeterminateProgressStyle}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:indeterminateProgressStyle
*/
public static final int SherlockActionBar_indeterminateProgressStyle = 16;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#itemPadding}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:itemPadding
*/
public static final int SherlockActionBar_itemPadding = 18;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#logo}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:logo
*/
public static final int SherlockActionBar_logo = 11;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#navigationMode}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>normal</code></td><td>0</td><td></td></tr>
<tr><td><code>listMode</code></td><td>1</td><td></td></tr>
<tr><td><code>tabMode</code></td><td>2</td><td></td></tr>
</table>
@attr name com.commonsware.cwac.camera.acl:navigationMode
*/
public static final int SherlockActionBar_navigationMode = 6;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#progressBarPadding}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:progressBarPadding
*/
public static final int SherlockActionBar_progressBarPadding = 17;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#progressBarStyle}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:progressBarStyle
*/
public static final int SherlockActionBar_progressBarStyle = 15;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#subtitle}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:subtitle
*/
public static final int SherlockActionBar_subtitle = 9;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#subtitleTextStyle}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:subtitleTextStyle
*/
public static final int SherlockActionBar_subtitleTextStyle = 4;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#title}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:title
*/
public static final int SherlockActionBar_title = 8;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#titleTextStyle}
attribute's value can be found in the {@link #SherlockActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:titleTextStyle
*/
public static final int SherlockActionBar_titleTextStyle = 5;
/** Attributes that can be used with a SherlockActionMenuItemView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockActionMenuItemView_android_minWidth android:minWidth}</code></td><td></td></tr>
</table>
@see #SherlockActionMenuItemView_android_minWidth
*/
public static final int[] SherlockActionMenuItemView = {
0x0101013f
};
/**
<p>This symbol is the offset where the {@link android.R.attr#minWidth}
attribute's value can be found in the {@link #SherlockActionMenuItemView} array.
@attr name android:minWidth
*/
public static final int SherlockActionMenuItemView_android_minWidth = 0;
/** Attributes that can be used with a SherlockActionMode.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockActionMode_background com.commonsware.cwac.camera.acl:background}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionMode_backgroundSplit com.commonsware.cwac.camera.acl:backgroundSplit}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionMode_height com.commonsware.cwac.camera.acl:height}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionMode_subtitleTextStyle com.commonsware.cwac.camera.acl:subtitleTextStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActionMode_titleTextStyle com.commonsware.cwac.camera.acl:titleTextStyle}</code></td><td></td></tr>
</table>
@see #SherlockActionMode_background
@see #SherlockActionMode_backgroundSplit
@see #SherlockActionMode_height
@see #SherlockActionMode_subtitleTextStyle
@see #SherlockActionMode_titleTextStyle
*/
public static final int[] SherlockActionMode = {
0x7f010000, 0x7f010001, 0x7f010003, 0x7f010004,
0x7f010005
};
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#background}
attribute's value can be found in the {@link #SherlockActionMode} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:background
*/
public static final int SherlockActionMode_background = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#backgroundSplit}
attribute's value can be found in the {@link #SherlockActionMode} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:backgroundSplit
*/
public static final int SherlockActionMode_backgroundSplit = 1;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#height}
attribute's value can be found in the {@link #SherlockActionMode} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:height
*/
public static final int SherlockActionMode_height = 2;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#subtitleTextStyle}
attribute's value can be found in the {@link #SherlockActionMode} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:subtitleTextStyle
*/
public static final int SherlockActionMode_subtitleTextStyle = 3;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#titleTextStyle}
attribute's value can be found in the {@link #SherlockActionMode} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:titleTextStyle
*/
public static final int SherlockActionMode_titleTextStyle = 4;
/** Attributes that can be used with a SherlockActivityChooserView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockActivityChooserView_android_background android:background}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActivityChooserView_expandActivityOverflowButtonDrawable com.commonsware.cwac.camera.acl:expandActivityOverflowButtonDrawable}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockActivityChooserView_initialActivityCount com.commonsware.cwac.camera.acl:initialActivityCount}</code></td><td></td></tr>
</table>
@see #SherlockActivityChooserView_android_background
@see #SherlockActivityChooserView_expandActivityOverflowButtonDrawable
@see #SherlockActivityChooserView_initialActivityCount
*/
public static final int[] SherlockActivityChooserView = {
0x010100d4, 0x7f010013, 0x7f010014
};
/**
<p>This symbol is the offset where the {@link android.R.attr#background}
attribute's value can be found in the {@link #SherlockActivityChooserView} array.
@attr name android:background
*/
public static final int SherlockActivityChooserView_android_background = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#expandActivityOverflowButtonDrawable}
attribute's value can be found in the {@link #SherlockActivityChooserView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:expandActivityOverflowButtonDrawable
*/
public static final int SherlockActivityChooserView_expandActivityOverflowButtonDrawable = 2;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#initialActivityCount}
attribute's value can be found in the {@link #SherlockActivityChooserView} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:initialActivityCount
*/
public static final int SherlockActivityChooserView_initialActivityCount = 1;
/** Attributes that can be used with a SherlockMenuGroup.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_checkableBehavior android:checkableBehavior}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_enabled android:enabled}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_id android:id}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_menuCategory android:menuCategory}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_orderInCategory android:orderInCategory}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuGroup_android_visible android:visible}</code></td><td></td></tr>
</table>
@see #SherlockMenuGroup_android_checkableBehavior
@see #SherlockMenuGroup_android_enabled
@see #SherlockMenuGroup_android_id
@see #SherlockMenuGroup_android_menuCategory
@see #SherlockMenuGroup_android_orderInCategory
@see #SherlockMenuGroup_android_visible
*/
public static final int[] SherlockMenuGroup = {
0x0101000e, 0x010100d0, 0x01010194, 0x010101de,
0x010101df, 0x010101e0
};
/**
<p>This symbol is the offset where the {@link android.R.attr#checkableBehavior}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:checkableBehavior
*/
public static final int SherlockMenuGroup_android_checkableBehavior = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#enabled}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:enabled
*/
public static final int SherlockMenuGroup_android_enabled = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#id}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:id
*/
public static final int SherlockMenuGroup_android_id = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#menuCategory}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:menuCategory
*/
public static final int SherlockMenuGroup_android_menuCategory = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#orderInCategory}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:orderInCategory
*/
public static final int SherlockMenuGroup_android_orderInCategory = 4;
/**
<p>This symbol is the offset where the {@link android.R.attr#visible}
attribute's value can be found in the {@link #SherlockMenuGroup} array.
@attr name android:visible
*/
public static final int SherlockMenuGroup_android_visible = 2;
/** Attributes that can be used with a SherlockMenuItem.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockMenuItem_android_actionLayout android:actionLayout}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_actionProviderClass android:actionProviderClass}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_actionViewClass android:actionViewClass}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_alphabeticShortcut android:alphabeticShortcut}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_checkable android:checkable}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_checked android:checked}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_enabled android:enabled}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_icon android:icon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_id android:id}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_menuCategory android:menuCategory}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_numericShortcut android:numericShortcut}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_onClick android:onClick}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_orderInCategory android:orderInCategory}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_showAsAction android:showAsAction}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_title android:title}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_titleCondensed android:titleCondensed}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuItem_android_visible android:visible}</code></td><td></td></tr>
</table>
@see #SherlockMenuItem_android_actionLayout
@see #SherlockMenuItem_android_actionProviderClass
@see #SherlockMenuItem_android_actionViewClass
@see #SherlockMenuItem_android_alphabeticShortcut
@see #SherlockMenuItem_android_checkable
@see #SherlockMenuItem_android_checked
@see #SherlockMenuItem_android_enabled
@see #SherlockMenuItem_android_icon
@see #SherlockMenuItem_android_id
@see #SherlockMenuItem_android_menuCategory
@see #SherlockMenuItem_android_numericShortcut
@see #SherlockMenuItem_android_onClick
@see #SherlockMenuItem_android_orderInCategory
@see #SherlockMenuItem_android_showAsAction
@see #SherlockMenuItem_android_title
@see #SherlockMenuItem_android_titleCondensed
@see #SherlockMenuItem_android_visible
*/
public static final int[] SherlockMenuItem = {
0x01010002, 0x0101000e, 0x010100d0, 0x01010106,
0x01010194, 0x010101de, 0x010101df, 0x010101e1,
0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5,
0x0101026f, 0x010102d9, 0x010102fb, 0x010102fc,
0x01010389
};
/**
<p>This symbol is the offset where the {@link android.R.attr#actionLayout}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:actionLayout
*/
public static final int SherlockMenuItem_android_actionLayout = 14;
/**
<p>This symbol is the offset where the {@link android.R.attr#actionProviderClass}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:actionProviderClass
*/
public static final int SherlockMenuItem_android_actionProviderClass = 16;
/**
<p>This symbol is the offset where the {@link android.R.attr#actionViewClass}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:actionViewClass
*/
public static final int SherlockMenuItem_android_actionViewClass = 15;
/**
<p>This symbol is the offset where the {@link android.R.attr#alphabeticShortcut}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:alphabeticShortcut
*/
public static final int SherlockMenuItem_android_alphabeticShortcut = 9;
/**
<p>This symbol is the offset where the {@link android.R.attr#checkable}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:checkable
*/
public static final int SherlockMenuItem_android_checkable = 11;
/**
<p>This symbol is the offset where the {@link android.R.attr#checked}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:checked
*/
public static final int SherlockMenuItem_android_checked = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#enabled}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:enabled
*/
public static final int SherlockMenuItem_android_enabled = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#icon}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:icon
*/
public static final int SherlockMenuItem_android_icon = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#id}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:id
*/
public static final int SherlockMenuItem_android_id = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#menuCategory}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:menuCategory
*/
public static final int SherlockMenuItem_android_menuCategory = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#numericShortcut}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:numericShortcut
*/
public static final int SherlockMenuItem_android_numericShortcut = 10;
/**
<p>This symbol is the offset where the {@link android.R.attr#onClick}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:onClick
*/
public static final int SherlockMenuItem_android_onClick = 12;
/**
<p>This symbol is the offset where the {@link android.R.attr#orderInCategory}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:orderInCategory
*/
public static final int SherlockMenuItem_android_orderInCategory = 6;
/**
<p>This symbol is the offset where the {@link android.R.attr#showAsAction}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:showAsAction
*/
public static final int SherlockMenuItem_android_showAsAction = 13;
/**
<p>This symbol is the offset where the {@link android.R.attr#title}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:title
*/
public static final int SherlockMenuItem_android_title = 7;
/**
<p>This symbol is the offset where the {@link android.R.attr#titleCondensed}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:titleCondensed
*/
public static final int SherlockMenuItem_android_titleCondensed = 8;
/**
<p>This symbol is the offset where the {@link android.R.attr#visible}
attribute's value can be found in the {@link #SherlockMenuItem} array.
@attr name android:visible
*/
public static final int SherlockMenuItem_android_visible = 4;
/** Attributes that can be used with a SherlockMenuView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockMenuView_headerBackground com.commonsware.cwac.camera.acl:headerBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_horizontalDivider com.commonsware.cwac.camera.acl:horizontalDivider}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_itemBackground com.commonsware.cwac.camera.acl:itemBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_itemIconDisabledAlpha com.commonsware.cwac.camera.acl:itemIconDisabledAlpha}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_itemTextAppearance com.commonsware.cwac.camera.acl:itemTextAppearance}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_preserveIconSpacing com.commonsware.cwac.camera.acl:preserveIconSpacing}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_verticalDivider com.commonsware.cwac.camera.acl:verticalDivider}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockMenuView_windowAnimationStyle com.commonsware.cwac.camera.acl:windowAnimationStyle}</code></td><td></td></tr>
</table>
@see #SherlockMenuView_headerBackground
@see #SherlockMenuView_horizontalDivider
@see #SherlockMenuView_itemBackground
@see #SherlockMenuView_itemIconDisabledAlpha
@see #SherlockMenuView_itemTextAppearance
@see #SherlockMenuView_preserveIconSpacing
@see #SherlockMenuView_verticalDivider
@see #SherlockMenuView_windowAnimationStyle
*/
public static final int[] SherlockMenuView = {
0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018,
0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c
};
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#headerBackground}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:headerBackground
*/
public static final int SherlockMenuView_headerBackground = 3;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#horizontalDivider}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:horizontalDivider
*/
public static final int SherlockMenuView_horizontalDivider = 1;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#itemBackground}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:itemBackground
*/
public static final int SherlockMenuView_itemBackground = 4;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#itemIconDisabledAlpha}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a floating point value, such as "<code>1.2</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:itemIconDisabledAlpha
*/
public static final int SherlockMenuView_itemIconDisabledAlpha = 6;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#itemTextAppearance}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:itemTextAppearance
*/
public static final int SherlockMenuView_itemTextAppearance = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#preserveIconSpacing}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:preserveIconSpacing
*/
public static final int SherlockMenuView_preserveIconSpacing = 7;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#verticalDivider}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:verticalDivider
*/
public static final int SherlockMenuView_verticalDivider = 2;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowAnimationStyle}
attribute's value can be found in the {@link #SherlockMenuView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:windowAnimationStyle
*/
public static final int SherlockMenuView_windowAnimationStyle = 5;
/** Attributes that can be used with a SherlockSearchView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockSearchView_android_imeOptions android:imeOptions}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSearchView_android_inputType android:inputType}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSearchView_android_maxWidth android:maxWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSearchView_iconifiedByDefault com.commonsware.cwac.camera.acl:iconifiedByDefault}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSearchView_queryHint com.commonsware.cwac.camera.acl:queryHint}</code></td><td></td></tr>
</table>
@see #SherlockSearchView_android_imeOptions
@see #SherlockSearchView_android_inputType
@see #SherlockSearchView_android_maxWidth
@see #SherlockSearchView_iconifiedByDefault
@see #SherlockSearchView_queryHint
*/
public static final int[] SherlockSearchView = {
0x0101011f, 0x01010220, 0x01010264, 0x7f01001d,
0x7f01001e
};
/**
<p>This symbol is the offset where the {@link android.R.attr#imeOptions}
attribute's value can be found in the {@link #SherlockSearchView} array.
@attr name android:imeOptions
*/
public static final int SherlockSearchView_android_imeOptions = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#inputType}
attribute's value can be found in the {@link #SherlockSearchView} array.
@attr name android:inputType
*/
public static final int SherlockSearchView_android_inputType = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#maxWidth}
attribute's value can be found in the {@link #SherlockSearchView} array.
@attr name android:maxWidth
*/
public static final int SherlockSearchView_android_maxWidth = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#iconifiedByDefault}
attribute's value can be found in the {@link #SherlockSearchView} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:iconifiedByDefault
*/
public static final int SherlockSearchView_iconifiedByDefault = 3;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#queryHint}
attribute's value can be found in the {@link #SherlockSearchView} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:queryHint
*/
public static final int SherlockSearchView_queryHint = 4;
/** Attributes that can be used with a SherlockSpinner.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockSpinner_android_dropDownHorizontalOffset android:dropDownHorizontalOffset}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_dropDownSelector android:dropDownSelector}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_dropDownVerticalOffset android:dropDownVerticalOffset}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_dropDownWidth android:dropDownWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_gravity android:gravity}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_popupBackground android:popupBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_popupPromptView android:popupPromptView}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockSpinner_android_prompt android:prompt}</code></td><td></td></tr>
</table>
@see #SherlockSpinner_android_dropDownHorizontalOffset
@see #SherlockSpinner_android_dropDownSelector
@see #SherlockSpinner_android_dropDownVerticalOffset
@see #SherlockSpinner_android_dropDownWidth
@see #SherlockSpinner_android_gravity
@see #SherlockSpinner_android_popupBackground
@see #SherlockSpinner_android_popupPromptView
@see #SherlockSpinner_android_prompt
*/
public static final int[] SherlockSpinner = {
0x010100af, 0x01010175, 0x01010176, 0x0101017b,
0x01010262, 0x010102ac, 0x010102ad, 0x01010411
};
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownHorizontalOffset}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:dropDownHorizontalOffset
*/
public static final int SherlockSpinner_android_dropDownHorizontalOffset = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownSelector}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:dropDownSelector
*/
public static final int SherlockSpinner_android_dropDownSelector = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownVerticalOffset}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:dropDownVerticalOffset
*/
public static final int SherlockSpinner_android_dropDownVerticalOffset = 6;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownWidth}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:dropDownWidth
*/
public static final int SherlockSpinner_android_dropDownWidth = 4;
/**
<p>This symbol is the offset where the {@link android.R.attr#gravity}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:gravity
*/
public static final int SherlockSpinner_android_gravity = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#popupBackground}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:popupBackground
*/
public static final int SherlockSpinner_android_popupBackground = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#popupPromptView}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:popupPromptView
*/
public static final int SherlockSpinner_android_popupPromptView = 7;
/**
<p>This symbol is the offset where the {@link android.R.attr#prompt}
attribute's value can be found in the {@link #SherlockSpinner} array.
@attr name android:prompt
*/
public static final int SherlockSpinner_android_prompt = 3;
/** Attributes that can be used with a SherlockTheme.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockTheme_actionBarDivider com.commonsware.cwac.camera.acl:actionBarDivider}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarItemBackground com.commonsware.cwac.camera.acl:actionBarItemBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarSize com.commonsware.cwac.camera.acl:actionBarSize}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarSplitStyle com.commonsware.cwac.camera.acl:actionBarSplitStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarStyle com.commonsware.cwac.camera.acl:actionBarStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarTabBarStyle com.commonsware.cwac.camera.acl:actionBarTabBarStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarTabStyle com.commonsware.cwac.camera.acl:actionBarTabStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarTabTextStyle com.commonsware.cwac.camera.acl:actionBarTabTextStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionBarWidgetTheme com.commonsware.cwac.camera.acl:actionBarWidgetTheme}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionButtonStyle com.commonsware.cwac.camera.acl:actionButtonStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionDropDownStyle com.commonsware.cwac.camera.acl:actionDropDownStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionMenuTextAppearance com.commonsware.cwac.camera.acl:actionMenuTextAppearance}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionMenuTextColor com.commonsware.cwac.camera.acl:actionMenuTextColor}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeBackground com.commonsware.cwac.camera.acl:actionModeBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeCloseButtonStyle com.commonsware.cwac.camera.acl:actionModeCloseButtonStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeCloseDrawable com.commonsware.cwac.camera.acl:actionModeCloseDrawable}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModePopupWindowStyle com.commonsware.cwac.camera.acl:actionModePopupWindowStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeShareDrawable com.commonsware.cwac.camera.acl:actionModeShareDrawable}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeSplitBackground com.commonsware.cwac.camera.acl:actionModeSplitBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionModeStyle com.commonsware.cwac.camera.acl:actionModeStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionOverflowButtonStyle com.commonsware.cwac.camera.acl:actionOverflowButtonStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_actionSpinnerItemStyle com.commonsware.cwac.camera.acl:actionSpinnerItemStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_activatedBackgroundIndicator com.commonsware.cwac.camera.acl:activatedBackgroundIndicator}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_activityChooserViewStyle com.commonsware.cwac.camera.acl:activityChooserViewStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_buttonStyleSmall com.commonsware.cwac.camera.acl:buttonStyleSmall}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_dividerVertical com.commonsware.cwac.camera.acl:dividerVertical}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_dropDownHintAppearance com.commonsware.cwac.camera.acl:dropDownHintAppearance}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_dropDownListViewStyle com.commonsware.cwac.camera.acl:dropDownListViewStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_dropdownListPreferredItemHeight com.commonsware.cwac.camera.acl:dropdownListPreferredItemHeight}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_homeAsUpIndicator com.commonsware.cwac.camera.acl:homeAsUpIndicator}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_listPopupWindowStyle com.commonsware.cwac.camera.acl:listPopupWindowStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_listPreferredItemHeightSmall com.commonsware.cwac.camera.acl:listPreferredItemHeightSmall}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_listPreferredItemPaddingLeft com.commonsware.cwac.camera.acl:listPreferredItemPaddingLeft}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_listPreferredItemPaddingRight com.commonsware.cwac.camera.acl:listPreferredItemPaddingRight}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_popupMenuStyle com.commonsware.cwac.camera.acl:popupMenuStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchAutoCompleteTextView com.commonsware.cwac.camera.acl:searchAutoCompleteTextView}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchDropdownBackground com.commonsware.cwac.camera.acl:searchDropdownBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchResultListItemHeight com.commonsware.cwac.camera.acl:searchResultListItemHeight}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewCloseIcon com.commonsware.cwac.camera.acl:searchViewCloseIcon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewEditQuery com.commonsware.cwac.camera.acl:searchViewEditQuery}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewEditQueryBackground com.commonsware.cwac.camera.acl:searchViewEditQueryBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewGoIcon com.commonsware.cwac.camera.acl:searchViewGoIcon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewSearchIcon com.commonsware.cwac.camera.acl:searchViewSearchIcon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewTextField com.commonsware.cwac.camera.acl:searchViewTextField}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewTextFieldRight com.commonsware.cwac.camera.acl:searchViewTextFieldRight}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_searchViewVoiceIcon com.commonsware.cwac.camera.acl:searchViewVoiceIcon}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_selectableItemBackground com.commonsware.cwac.camera.acl:selectableItemBackground}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_spinnerDropDownItemStyle com.commonsware.cwac.camera.acl:spinnerDropDownItemStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_spinnerItemStyle com.commonsware.cwac.camera.acl:spinnerItemStyle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceLargePopupMenu com.commonsware.cwac.camera.acl:textAppearanceLargePopupMenu}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceListItemSmall com.commonsware.cwac.camera.acl:textAppearanceListItemSmall}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceSearchResultSubtitle com.commonsware.cwac.camera.acl:textAppearanceSearchResultSubtitle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceSearchResultTitle com.commonsware.cwac.camera.acl:textAppearanceSearchResultTitle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceSmall com.commonsware.cwac.camera.acl:textAppearanceSmall}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textAppearanceSmallPopupMenu com.commonsware.cwac.camera.acl:textAppearanceSmallPopupMenu}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textColorPrimary com.commonsware.cwac.camera.acl:textColorPrimary}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textColorPrimaryDisableOnly com.commonsware.cwac.camera.acl:textColorPrimaryDisableOnly}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textColorPrimaryInverse com.commonsware.cwac.camera.acl:textColorPrimaryInverse}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_textColorSearchUrl com.commonsware.cwac.camera.acl:textColorSearchUrl}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowActionBar com.commonsware.cwac.camera.acl:windowActionBar}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowActionBarOverlay com.commonsware.cwac.camera.acl:windowActionBarOverlay}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowActionModeOverlay com.commonsware.cwac.camera.acl:windowActionModeOverlay}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowContentOverlay com.commonsware.cwac.camera.acl:windowContentOverlay}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowMinWidthMajor com.commonsware.cwac.camera.acl:windowMinWidthMajor}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowMinWidthMinor com.commonsware.cwac.camera.acl:windowMinWidthMinor}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowNoTitle com.commonsware.cwac.camera.acl:windowNoTitle}</code></td><td></td></tr>
<tr><td><code>{@link #SherlockTheme_windowSplitActionBar com.commonsware.cwac.camera.acl:windowSplitActionBar}</code></td><td></td></tr>
</table>
@see #SherlockTheme_actionBarDivider
@see #SherlockTheme_actionBarItemBackground
@see #SherlockTheme_actionBarSize
@see #SherlockTheme_actionBarSplitStyle
@see #SherlockTheme_actionBarStyle
@see #SherlockTheme_actionBarTabBarStyle
@see #SherlockTheme_actionBarTabStyle
@see #SherlockTheme_actionBarTabTextStyle
@see #SherlockTheme_actionBarWidgetTheme
@see #SherlockTheme_actionButtonStyle
@see #SherlockTheme_actionDropDownStyle
@see #SherlockTheme_actionMenuTextAppearance
@see #SherlockTheme_actionMenuTextColor
@see #SherlockTheme_actionModeBackground
@see #SherlockTheme_actionModeCloseButtonStyle
@see #SherlockTheme_actionModeCloseDrawable
@see #SherlockTheme_actionModePopupWindowStyle
@see #SherlockTheme_actionModeShareDrawable
@see #SherlockTheme_actionModeSplitBackground
@see #SherlockTheme_actionModeStyle
@see #SherlockTheme_actionOverflowButtonStyle
@see #SherlockTheme_actionSpinnerItemStyle
@see #SherlockTheme_activatedBackgroundIndicator
@see #SherlockTheme_activityChooserViewStyle
@see #SherlockTheme_buttonStyleSmall
@see #SherlockTheme_dividerVertical
@see #SherlockTheme_dropDownHintAppearance
@see #SherlockTheme_dropDownListViewStyle
@see #SherlockTheme_dropdownListPreferredItemHeight
@see #SherlockTheme_homeAsUpIndicator
@see #SherlockTheme_listPopupWindowStyle
@see #SherlockTheme_listPreferredItemHeightSmall
@see #SherlockTheme_listPreferredItemPaddingLeft
@see #SherlockTheme_listPreferredItemPaddingRight
@see #SherlockTheme_popupMenuStyle
@see #SherlockTheme_searchAutoCompleteTextView
@see #SherlockTheme_searchDropdownBackground
@see #SherlockTheme_searchResultListItemHeight
@see #SherlockTheme_searchViewCloseIcon
@see #SherlockTheme_searchViewEditQuery
@see #SherlockTheme_searchViewEditQueryBackground
@see #SherlockTheme_searchViewGoIcon
@see #SherlockTheme_searchViewSearchIcon
@see #SherlockTheme_searchViewTextField
@see #SherlockTheme_searchViewTextFieldRight
@see #SherlockTheme_searchViewVoiceIcon
@see #SherlockTheme_selectableItemBackground
@see #SherlockTheme_spinnerDropDownItemStyle
@see #SherlockTheme_spinnerItemStyle
@see #SherlockTheme_textAppearanceLargePopupMenu
@see #SherlockTheme_textAppearanceListItemSmall
@see #SherlockTheme_textAppearanceSearchResultSubtitle
@see #SherlockTheme_textAppearanceSearchResultTitle
@see #SherlockTheme_textAppearanceSmall
@see #SherlockTheme_textAppearanceSmallPopupMenu
@see #SherlockTheme_textColorPrimary
@see #SherlockTheme_textColorPrimaryDisableOnly
@see #SherlockTheme_textColorPrimaryInverse
@see #SherlockTheme_textColorSearchUrl
@see #SherlockTheme_windowActionBar
@see #SherlockTheme_windowActionBarOverlay
@see #SherlockTheme_windowActionModeOverlay
@see #SherlockTheme_windowContentOverlay
@see #SherlockTheme_windowMinWidthMajor
@see #SherlockTheme_windowMinWidthMinor
@see #SherlockTheme_windowNoTitle
@see #SherlockTheme_windowSplitActionBar
*/
public static final int[] SherlockTheme = {
0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022,
0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026,
0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a,
0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e,
0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032,
0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036,
0x7f010037, 0x7f010038, 0x7f010039, 0x7f01003a,
0x7f01003b, 0x7f01003c, 0x7f01003d, 0x7f01003e,
0x7f01003f, 0x7f010040, 0x7f010041, 0x7f010042,
0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046,
0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a,
0x7f01004b, 0x7f01004c, 0x7f01004d, 0x7f01004e,
0x7f01004f, 0x7f010050, 0x7f010051, 0x7f010052,
0x7f010053, 0x7f010054, 0x7f010055, 0x7f010056,
0x7f010057, 0x7f010058, 0x7f010059, 0x7f01005a,
0x7f01005b, 0x7f01005c, 0x7f01005d, 0x7f01005e,
0x7f01005f, 0x7f010060, 0x7f010061
};
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarDivider}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarDivider
*/
public static final int SherlockTheme_actionBarDivider = 8;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarItemBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarItemBackground
*/
public static final int SherlockTheme_actionBarItemBackground = 9;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarSize}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
<p>May be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>wrap_content</code></td><td>0</td><td></td></tr>
</table>
@attr name com.commonsware.cwac.camera.acl:actionBarSize
*/
public static final int SherlockTheme_actionBarSize = 7;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarSplitStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarSplitStyle
*/
public static final int SherlockTheme_actionBarSplitStyle = 5;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarStyle
*/
public static final int SherlockTheme_actionBarStyle = 4;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarTabBarStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarTabBarStyle
*/
public static final int SherlockTheme_actionBarTabBarStyle = 1;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarTabStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarTabStyle
*/
public static final int SherlockTheme_actionBarTabStyle = 0;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarTabTextStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarTabTextStyle
*/
public static final int SherlockTheme_actionBarTabTextStyle = 2;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionBarWidgetTheme}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionBarWidgetTheme
*/
public static final int SherlockTheme_actionBarWidgetTheme = 6;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionButtonStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionButtonStyle
*/
public static final int SherlockTheme_actionButtonStyle = 52;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionDropDownStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionDropDownStyle
*/
public static final int SherlockTheme_actionDropDownStyle = 51;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionMenuTextAppearance}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionMenuTextAppearance
*/
public static final int SherlockTheme_actionMenuTextAppearance = 10;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionMenuTextColor}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionMenuTextColor
*/
public static final int SherlockTheme_actionMenuTextColor = 11;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeBackground
*/
public static final int SherlockTheme_actionModeBackground = 14;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeCloseButtonStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeCloseButtonStyle
*/
public static final int SherlockTheme_actionModeCloseButtonStyle = 13;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeCloseDrawable}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeCloseDrawable
*/
public static final int SherlockTheme_actionModeCloseDrawable = 16;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModePopupWindowStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModePopupWindowStyle
*/
public static final int SherlockTheme_actionModePopupWindowStyle = 18;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeShareDrawable}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeShareDrawable
*/
public static final int SherlockTheme_actionModeShareDrawable = 17;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeSplitBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeSplitBackground
*/
public static final int SherlockTheme_actionModeSplitBackground = 15;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionModeStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionModeStyle
*/
public static final int SherlockTheme_actionModeStyle = 12;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionOverflowButtonStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionOverflowButtonStyle
*/
public static final int SherlockTheme_actionOverflowButtonStyle = 3;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#actionSpinnerItemStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:actionSpinnerItemStyle
*/
public static final int SherlockTheme_actionSpinnerItemStyle = 57;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#activatedBackgroundIndicator}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:activatedBackgroundIndicator
*/
public static final int SherlockTheme_activatedBackgroundIndicator = 65;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#activityChooserViewStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:activityChooserViewStyle
*/
public static final int SherlockTheme_activityChooserViewStyle = 64;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#buttonStyleSmall}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:buttonStyleSmall
*/
public static final int SherlockTheme_buttonStyleSmall = 19;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#dividerVertical}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:dividerVertical
*/
public static final int SherlockTheme_dividerVertical = 50;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#dropDownHintAppearance}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:dropDownHintAppearance
*/
public static final int SherlockTheme_dropDownHintAppearance = 66;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#dropDownListViewStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:dropDownListViewStyle
*/
public static final int SherlockTheme_dropDownListViewStyle = 54;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#dropdownListPreferredItemHeight}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:dropdownListPreferredItemHeight
*/
public static final int SherlockTheme_dropdownListPreferredItemHeight = 56;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#homeAsUpIndicator}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:homeAsUpIndicator
*/
public static final int SherlockTheme_homeAsUpIndicator = 53;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#listPopupWindowStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:listPopupWindowStyle
*/
public static final int SherlockTheme_listPopupWindowStyle = 63;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#listPreferredItemHeightSmall}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:listPreferredItemHeightSmall
*/
public static final int SherlockTheme_listPreferredItemHeightSmall = 44;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#listPreferredItemPaddingLeft}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:listPreferredItemPaddingLeft
*/
public static final int SherlockTheme_listPreferredItemPaddingLeft = 45;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#listPreferredItemPaddingRight}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:listPreferredItemPaddingRight
*/
public static final int SherlockTheme_listPreferredItemPaddingRight = 46;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#popupMenuStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:popupMenuStyle
*/
public static final int SherlockTheme_popupMenuStyle = 55;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchAutoCompleteTextView}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchAutoCompleteTextView
*/
public static final int SherlockTheme_searchAutoCompleteTextView = 30;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchDropdownBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchDropdownBackground
*/
public static final int SherlockTheme_searchDropdownBackground = 31;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchResultListItemHeight}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:searchResultListItemHeight
*/
public static final int SherlockTheme_searchResultListItemHeight = 41;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewCloseIcon}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewCloseIcon
*/
public static final int SherlockTheme_searchViewCloseIcon = 32;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewEditQuery}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewEditQuery
*/
public static final int SherlockTheme_searchViewEditQuery = 36;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewEditQueryBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewEditQueryBackground
*/
public static final int SherlockTheme_searchViewEditQueryBackground = 37;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewGoIcon}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewGoIcon
*/
public static final int SherlockTheme_searchViewGoIcon = 33;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewSearchIcon}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewSearchIcon
*/
public static final int SherlockTheme_searchViewSearchIcon = 34;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewTextField}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewTextField
*/
public static final int SherlockTheme_searchViewTextField = 38;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewTextFieldRight}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewTextFieldRight
*/
public static final int SherlockTheme_searchViewTextFieldRight = 39;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#searchViewVoiceIcon}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:searchViewVoiceIcon
*/
public static final int SherlockTheme_searchViewVoiceIcon = 35;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#selectableItemBackground}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:selectableItemBackground
*/
public static final int SherlockTheme_selectableItemBackground = 20;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#spinnerDropDownItemStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:spinnerDropDownItemStyle
*/
public static final int SherlockTheme_spinnerDropDownItemStyle = 29;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#spinnerItemStyle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:spinnerItemStyle
*/
public static final int SherlockTheme_spinnerItemStyle = 28;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceLargePopupMenu}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceLargePopupMenu
*/
public static final int SherlockTheme_textAppearanceLargePopupMenu = 22;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceListItemSmall}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceListItemSmall
*/
public static final int SherlockTheme_textAppearanceListItemSmall = 47;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceSearchResultSubtitle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceSearchResultSubtitle
*/
public static final int SherlockTheme_textAppearanceSearchResultSubtitle = 43;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceSearchResultTitle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceSearchResultTitle
*/
public static final int SherlockTheme_textAppearanceSearchResultTitle = 42;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceSmall}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceSmall
*/
public static final int SherlockTheme_textAppearanceSmall = 24;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textAppearanceSmallPopupMenu}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:textAppearanceSmallPopupMenu
*/
public static final int SherlockTheme_textAppearanceSmallPopupMenu = 23;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textColorPrimary}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:textColorPrimary
*/
public static final int SherlockTheme_textColorPrimary = 25;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textColorPrimaryDisableOnly}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:textColorPrimaryDisableOnly
*/
public static final int SherlockTheme_textColorPrimaryDisableOnly = 26;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textColorPrimaryInverse}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:textColorPrimaryInverse
*/
public static final int SherlockTheme_textColorPrimaryInverse = 27;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#textColorSearchUrl}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.commonsware.cwac.camera.acl:textColorSearchUrl
*/
public static final int SherlockTheme_textColorSearchUrl = 40;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowActionBar}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowActionBar
*/
public static final int SherlockTheme_windowActionBar = 59;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowActionBarOverlay}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowActionBarOverlay
*/
public static final int SherlockTheme_windowActionBarOverlay = 60;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowActionModeOverlay}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowActionModeOverlay
*/
public static final int SherlockTheme_windowActionModeOverlay = 61;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowContentOverlay}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.commonsware.cwac.camera.acl:windowContentOverlay
*/
public static final int SherlockTheme_windowContentOverlay = 21;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowMinWidthMajor}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowMinWidthMajor
*/
public static final int SherlockTheme_windowMinWidthMajor = 48;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowMinWidthMinor}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowMinWidthMinor
*/
public static final int SherlockTheme_windowMinWidthMinor = 49;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowNoTitle}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowNoTitle
*/
public static final int SherlockTheme_windowNoTitle = 58;
/**
<p>This symbol is the offset where the {@link com.commonsware.cwac.camera.acl.R.attr#windowSplitActionBar}
attribute's value can be found in the {@link #SherlockTheme} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.commonsware.cwac.camera.acl:windowSplitActionBar
*/
public static final int SherlockTheme_windowSplitActionBar = 62;
/** Attributes that can be used with a SherlockView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SherlockView_android_focusable android:focusable}</code></td><td></td></tr>
</table>
@see #SherlockView_android_focusable
*/
public static final int[] SherlockView = {
0x010100da
};
/**
<p>This symbol is the offset where the {@link android.R.attr#focusable}
attribute's value can be found in the {@link #SherlockView} array.
@attr name android:focusable
*/
public static final int SherlockView_android_focusable = 0;
};
}
| apache-2.0 |
scnakandala/derby | java/testing/org/apache/derbyTesting/junit/LocaleTestSetup.java | 1917 | /*
*
* Derby - Class org.apache.derbyTesting.junit.LocaleTestSetup
*
* 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.derbyTesting.junit;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
import junit.extensions.TestSetup;
import junit.framework.Test;
/**
* This decorator allows the usage of different locales on the tests
*/
public class LocaleTestSetup extends TestSetup {
private Locale oldLocale;
private Locale newLocale;
public LocaleTestSetup(Test test, Locale newLocale) {
super(test);
oldLocale = Locale.getDefault();
this.newLocale = newLocale;
}
/**
* Set up the new locale for the test
*/
protected void setUp() {
setDefaultLocale(newLocale);
}
/**
* Revert the locale back to the old one
*/
protected void tearDown() {
setDefaultLocale(oldLocale);
}
public static void setDefaultLocale(final Locale locale) {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
Locale.setDefault(locale);
return null;
}
});
}
}
| apache-2.0 |
rockmkd/datacollector | container/src/main/java/com/streamsets/datacollector/blobstore/BlobStoreTaskImpl.java | 13095 | /*
* Copyright 2018 StreamSets Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.streamsets.datacollector.blobstore;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.streamsets.datacollector.blobstore.meta.BlobStoreMetadata;
import com.streamsets.datacollector.blobstore.meta.NamespaceMetadata;
import com.streamsets.datacollector.blobstore.meta.ObjectMetadata;
import com.streamsets.datacollector.main.RuntimeInfo;
import com.streamsets.datacollector.task.AbstractTask;
import com.streamsets.pipeline.api.BlobStore;
import com.streamsets.pipeline.api.StageException;
import com.streamsets.pipeline.api.impl.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class BlobStoreTaskImpl extends AbstractTask implements BlobStoreTask {
private static final Logger LOG = LoggerFactory.getLogger(BlobStoreTaskImpl.class);
// Subdirectory that will be created under data directory for storing the objects
private static final String BASE_DIR = "blobstore";
// File name of stored version of our metadata database
private static final String METADATA_FILE = "metadata.json";
// Temporary name for a three-phase commit
private static final String NEW_METADATA_FILE = "updated.metadata.json";
// JSON ObjectMapper for storing and reading metadata database to/from disk
private static final ObjectMapper jsonMapper = new ObjectMapper();
static {
jsonMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
}
/**
* Implementation of VersionedContent when we need to return both version and it's content at the same time.
*/
private static class VersionedContentImpl implements VersionedContent {
long version;
String content;
VersionedContentImpl(long version, String content) {
this.version = version;
this.content = content;
}
@Override
public long version() {
return version;
}
@Override
public String content() {
return content;
}
}
private final RuntimeInfo runtimeInfo;
private Path baseDir;
@VisibleForTesting
Path metadataFile;
@VisibleForTesting
Path newMetadataFile;
private BlobStoreMetadata metadata;
@Inject
public BlobStoreTaskImpl(
RuntimeInfo runtimeInfo
) {
super("Blob Store Task");
this.runtimeInfo = runtimeInfo;
}
@Override
public void initTask() {
this.baseDir = Paths.get(runtimeInfo.getDataDir(), BASE_DIR);
this.metadataFile = this.baseDir.resolve(METADATA_FILE);
this.newMetadataFile = this.baseDir.resolve(NEW_METADATA_FILE);
if (!Files.exists(baseDir)) {
initializeFreshInstall();
} else {
initializeFromDisk();
}
}
private void initializeFreshInstall() {
try {
Files.createDirectories(baseDir);
} catch (IOException e) {
throw new RuntimeException(Utils.format("Could not create directory '{}'", baseDir), e);
}
// Create new fresh metadata and persist them on disk
this.metadata = new BlobStoreMetadata();
try {
saveMetadata();
} catch (StageException e) {
throw new RuntimeException(Utils.format("Can't initialize blob store: {}", e.toString()), e);
}
}
private void initializeFromDisk() {
try {
if (Files.exists(metadataFile)) {
// Most happy path - the metadata file exists
this.metadata = loadMetadata();
if (Files.exists(newMetadataFile)) {
LOG.error("Old temporary file already exists, using older state and dropping new state");
Files.delete(newMetadataFile);
}
} else if (Files.exists(newMetadataFile)) {
LOG.error("Missing primary metadata file, recovering new state");
Files.move(newMetadataFile, metadataFile);
this.metadata = loadMetadata();
} else {
throw new StageException(BlobStoreError.BLOB_STORE_0013);
}
LOG.debug(
"Loaded blob store metadata of version {} with {} namespaces",
metadata.getVersion(),
metadata.getNamespaces().size()
);
} catch (StageException | IOException e) {
throw new RuntimeException(Utils.format("Can't initialize blob store: {}", e.toString()), e);
}
}
@Override
public synchronized void store(String namespace, String id, long version, String content) throws StageException {
LOG.debug("Store on namespace={}, id={}, version={}", namespace, id, version);
Preconditions.checkArgument(BlobStore.VALID_NAMESPACE_PATTERN.matcher(namespace).matches());
Preconditions.checkArgument(BlobStore.VALID_ID_PATTERN.matcher(id).matches());
ObjectMetadata objectMetadata = metadata.getOrCreateNamespace(namespace).getOrCreateObject(id);
if (objectMetadata.containsVersion(version)) {
throw new StageException(BlobStoreError.BLOB_STORE_0003, namespace, id, version);
}
// Store the content inside independent file with randomized location
String contentFile = namespace + UUID.randomUUID().toString() + ".content";
try {
Files.write(baseDir.resolve(contentFile), content.getBytes());
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0004, e.toString(), e);
}
// Update and save internal structure
objectMetadata.createContent(version, contentFile);
saveMetadata();
}
@Override
public synchronized long latestVersion(String namespace, String id) throws StageException {
return getObjectDieIfNotExists(namespace, id).latestVersion();
}
@Override
public synchronized boolean exists(String namespace, String id) {
ObjectMetadata objectMetadata = getObject(namespace, id);
return objectMetadata != null;
}
@Override
public synchronized boolean exists(String namespace, String id, long version) {
ObjectMetadata objectMetadata = getObject(namespace, id);
if (objectMetadata == null) {
return false;
}
return objectMetadata.containsVersion(version);
}
@Override
public synchronized Set<Long> allVersions(String namespace, String id) {
ObjectMetadata objectMetadata = getObject(namespace, id);
return objectMetadata == null ? Collections.emptySet() : objectMetadata.allVersions();
}
@Override
public synchronized String retrieve(String namespace, String id, long version) throws StageException {
LOG.debug("Retrieve on namespace={}, id={}, version={}", namespace, id, version);
ObjectMetadata objectMetadata = getObjectDieIfNotExists(namespace, id);
if (!objectMetadata.containsVersion(version)) {
throw new StageException(BlobStoreError.BLOB_STORE_0007, namespace, id, version);
}
return loadContentFromDrive(objectMetadata.uuidForVersion(version));
}
@Override
public synchronized VersionedContent retrieveLatest(String namespace, String id) throws StageException {
ObjectMetadata objectMetadata = getObject(namespace, id);
if (objectMetadata == null) {
return null;
}
long version = objectMetadata.latestVersion();
return new VersionedContentImpl(
version,
loadContentFromDrive(objectMetadata.uuidForVersion(version))
);
}
private String loadContentFromDrive(String objectUuid) throws StageException {
try {
return new String(Files.readAllBytes(baseDir.resolve(objectUuid)));
} catch(IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0008, e.toString(), e);
}
}
@Override
public synchronized void delete(String namespace, String id, long version) throws StageException {
LOG.debug("Delete on namespace={}, id={}, version={}", namespace, id, version);
ObjectMetadata objectMetadata = getObjectDieIfNotExists(namespace, id);
if(!objectMetadata.containsVersion(version)) {
throw new StageException(BlobStoreError.BLOB_STORE_0007, namespace, id, version);
}
String uuid = objectMetadata.uuidForVersion(version);
objectMetadata.removeVersion(version);
try {
Files.delete(baseDir.resolve(uuid));
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0008, e.toString(), e);
}
NamespaceMetadata namespaceMetadata = metadata.getNamespace(namespace);
// If this is the last version of given object, let's also remove the whole object
if(objectMetadata.isEmpty()) {
namespaceMetadata.removeObject(id);
}
// And propagate the same delete up
if(namespaceMetadata.isEmpty()) {
metadata.removeNamespace(namespace);
}
saveMetadata();
}
@Override
public void deleteAllVersions(String namespace, String id) throws StageException {
for(long version: allVersions(namespace, id)) {
delete(namespace, id, version);
}
}
/**
* Commit metadata content to a file to disk.
*
* This method does three-phased commit:
* 1) New content is written into a new temporary file.
* 2) Old metadata is dropped
* 3) Rename from new to old is done
*/
synchronized private void saveMetadata() throws StageException {
// 0) Validate pre-conditions
if(Files.exists(newMetadataFile)) {
throw new StageException(BlobStoreError.BLOB_STORE_0010);
}
// 1) New content is written into a new temporary file.
try (
OutputStream os = Files.newOutputStream(newMetadataFile, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)
) {
jsonMapper.writeValue(os, metadata);
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0001, e.toString(), e);
}
// 2) Old metadata is dropped
try {
if(Files.exists(metadataFile)) {
Files.delete(metadataFile);
}
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0011, e.toString(), e);
}
// 3) Rename from new to old is done
try {
Files.move(newMetadataFile, metadataFile);
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0012, e.toString(), e);
}
}
private BlobStoreMetadata loadMetadata() throws StageException {
try(
InputStream is = Files.newInputStream(metadataFile);
) {
return jsonMapper.readValue(is, BlobStoreMetadata.class);
} catch (IOException e) {
throw new StageException(BlobStoreError.BLOB_STORE_0001, e.toString(), e);
}
}
private ObjectMetadata getObject(String namespace, String id) {
NamespaceMetadata namespaceMetadata = metadata.getNamespace(namespace);
if(namespaceMetadata == null) {
return null;
}
return namespaceMetadata.getObject(id);
}
private ObjectMetadata getObjectDieIfNotExists(String namespace, String id) throws StageException {
NamespaceMetadata namespaceMetadata = metadata.getNamespace(namespace);
if(namespaceMetadata == null) {
throw new StageException(BlobStoreError.BLOB_STORE_0005, namespace);
}
ObjectMetadata objectMetadata = namespaceMetadata.getObject(id);
if(objectMetadata == null) {
throw new StageException(BlobStoreError.BLOB_STORE_0006, namespace, id);
}
return objectMetadata;
}
@Override
public Set<String> listNamespaces() {
return Collections.unmodifiableSet(metadata.getNamespaces().keySet());
}
@Override
public Set<String> listObjects(String namespace) {
NamespaceMetadata namespaceMetadata = metadata.getNamespace(namespace);
if(namespaceMetadata == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(namespaceMetadata.getObjects().keySet());
}
@Override
public String retrieveContentFileName(String namespace, String id, long version) throws StageException {
LOG.debug("Retrieve content file name on namespace={}, id={}, version={}", namespace, id, version);
ObjectMetadata objectMetadata = getObjectDieIfNotExists(namespace, id);
if (!objectMetadata.containsVersion(version)) {
throw new StageException(BlobStoreError.BLOB_STORE_0007, namespace, id, version);
}
return objectMetadata.uuidForVersion(version);
}
}
| apache-2.0 |
nmldiegues/stibt | infinispan/core/src/main/java/org/infinispan/configuration/cache/LoadersConfigurationChildBuilder.java | 993 | /*
* Copyright 2011 Red Hat, Inc. and/or its affiliates.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
package org.infinispan.configuration.cache;
public interface LoadersConfigurationChildBuilder extends ConfigurationChildBuilder {
@Override
LoadersConfigurationBuilder loaders();
}
| apache-2.0 |
SaiNadh001/aws-sdk-for-java | src/main/java/com/amazonaws/services/simpleemail/model/transform/SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller.java | 2488 | /*
* Copyright 2010-2012 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.simpleemail.model.transform;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.stream.events.XMLEvent;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.transform.MapEntry;
import com.amazonaws.transform.StaxUnmarshallerContext;
import com.amazonaws.transform.SimpleTypeStaxUnmarshallers.*;
/**
* Set Identity Feedback Forwarding Enabled Result StAX Unmarshaller
*/
public class SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller implements Unmarshaller<SetIdentityFeedbackForwardingEnabledResult, StaxUnmarshallerContext> {
public SetIdentityFeedbackForwardingEnabledResult unmarshall(StaxUnmarshallerContext context) throws Exception {
SetIdentityFeedbackForwardingEnabledResult setIdentityFeedbackForwardingEnabledResult = new SetIdentityFeedbackForwardingEnabledResult();
int originalDepth = context.getCurrentDepth();
int targetDepth = originalDepth + 1;
if (context.isStartOfDocument()) targetDepth += 2;
while (true) {
XMLEvent xmlEvent = context.nextEvent();
if (xmlEvent.isEndDocument()) return setIdentityFeedbackForwardingEnabledResult;
if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
} else if (xmlEvent.isEndElement()) {
if (context.getCurrentDepth() < originalDepth) {
return setIdentityFeedbackForwardingEnabledResult;
}
}
}
}
private static SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller instance;
public static SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller getInstance() {
if (instance == null) instance = new SetIdentityFeedbackForwardingEnabledResultStaxUnmarshaller();
return instance;
}
}
| apache-2.0 |