code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
/*
* Licensed to the University Corporation for Advanced Internet Development,
* Inc. (UCAID) under one or more contributor license agreements. See the
* NOTICE file distributed with this work for additional information regarding
* copyright ownership. The UCAID 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 edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.basic;
import edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.FilterProcessingException;
import edu.internet2.middleware.shibboleth.common.attribute.filtering.provider.match.BaseTestCase;
/** {@link AttributeValueRegexMatchFunctor} unit test. */
public class AttributeValueRegexMatchFunctorTest extends BaseTestCase {
/** {@inheritDoc} */
public void setUp() throws Exception {
super.setUp();
AttributeValueRegexMatchFunctor functor = new AttributeValueRegexMatchFunctor();
matchFunctor = functor;
functor.setAttributeId(sAttribute.getId());
functor.setRegularExpression("o.e");
}
/**
* Test that values to permit value test.
*/
public void testPermitValue() {
try {
assertTrue("evaluatePermitValue", matchFunctor.evaluatePermitValue(filterContext, null, "one"));
assertFalse("evaluatePermitValue", matchFunctor.evaluatePermitValue(filterContext, null, "two"));
} catch (FilterProcessingException e) {
fail(e.getLocalizedMessage());
}
}
/**
* Test the policy.
*/
public void testPolicyRequirement() {
try {
AttributeValueRegexMatchFunctor functor = (AttributeValueRegexMatchFunctor) matchFunctor;
assertTrue("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
functor.setRegularExpression("[tT].*e");
assertFalse("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
sAttribute.getValues().add("two");
assertFalse("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
sAttribute.getValues().add("three");
assertTrue("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
functor.setAttributeId("ScopedValue");
assertFalse("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
functor.setAttributeId("Scope");
assertFalse("evaluatePolicyRequirement", matchFunctor.evaluatePolicyRequirement(filterContext));
} catch (FilterProcessingException e) {
fail(e.getLocalizedMessage());
}
}
}
|
brainysmith/shibboleth-common
|
src/test/java/edu/internet2/middleware/shibboleth/common/attribute/filtering/provider/match/basic/AttributeValueRegexMatchFunctorTest.java
|
Java
|
apache-2.0
| 3,265
|
/*
* Copyright 2021, Yahoo Inc.
* Licensed under the terms of the Apache License, Version 2.0.
* See the LICENSE file associated with the project for terms.
*/
package com.yahoo.bullet.storm.testing;
import com.yahoo.bullet.common.BulletConfig;
import com.yahoo.bullet.storm.SpoutConnector;
import org.apache.storm.spout.SpoutOutputCollector;
import org.apache.storm.task.TopologyContext;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class CallCountingSpoutConnector extends SpoutConnector<CallCountingSpout> {
private static final long serialVersionUID = 5538368781947223090L;
public CallCountingSpoutConnector(BulletConfig bulletConfig) {
super(bulletConfig);
}
@Override
public List<Object> read() {
return Collections.emptyList();
}
public CallCountingSpout getProxy() {
return this.spout;
}
public Map<String, Object> getOpenMap() {
return this.stormConfiguration;
}
public TopologyContext getOpenContext() {
return this.context;
}
public SpoutOutputCollector getOpenCollector() {
return this.outputCollector;
}
}
|
yahoo/bullet-storm
|
src/test/java/com/yahoo/bullet/storm/testing/CallCountingSpoutConnector.java
|
Java
|
apache-2.0
| 1,176
|
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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.
from abc import ABCMeta
from abc import abstractmethod
import six
@six.add_metaclass(ABCMeta)
class CryptographicEngine(object):
"""
The abstract base class of the cryptographic engine hierarchy.
A cryptographic engine is responsible for generating all cryptographic
objects and conducting all cryptographic operations for a KMIP server
instance.
"""
@abstractmethod
def create_symmetric_key(self, algorithm, length):
"""
Create a symmetric key.
Args:
algorithm(CryptographicAlgorithm): An enumeration specifying the
algorithm for which the created key will be compliant.
length(int): The length of the key to be created. This value must
be compliant with the constraints of the provided algorithm.
Returns:
dict: A dictionary containing the key data, with the following
key/value fields:
* value - the bytes of the key
* format - a KeyFormatType enumeration for the bytes format
"""
@abstractmethod
def create_asymmetric_key_pair(self, algorithm, length):
"""
Create an asymmetric key pair.
Args:
algorithm(CryptographicAlgorithm): An enumeration specifying the
algorithm for which the created keys will be compliant.
length(int): The length of the keys to be created. This value must
be compliant with the constraints of the provided algorithm.
Returns:
dict: A dictionary containing the public key data, with the
following key/value fields:
* value - the bytes of the key
* format - a KeyFormatType enumeration for the bytes format
dict: A dictionary containing the private key data, identical in
structure to the public key dictionary.
"""
|
viktorTarasov/PyKMIP
|
kmip/services/server/crypto/api.py
|
Python
|
apache-2.0
| 2,580
|
# AUTOGENERATED FILE
FROM balenalib/up-squared-debian:stretch-run
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# install python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/*
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 2.7.18
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& buildDeps=' \
curl \
' \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" \
&& echo "aafb68a7aeaf62223d12bbe13cbf0bafc993f5296d620e8fdfcfcbefe26a18fc Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-amd64-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python get-pip.py \
&& rm get-pip.py \
; fi \
&& pip install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# https://github.com/docker-library/python/issues/147
ENV PYTHONIOENCODING UTF-8
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python2.7/dist-packages:/usr/lib/python2.7/site-packages:$PYTHONPATH
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/python-deprecation-warning
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Debian Stretch \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v2.7.18, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh
|
nghiant2710/base-images
|
balena-base-images/python/up-squared/debian/stretch/2.7.18/run/Dockerfile
|
Dockerfile
|
apache-2.0
| 4,477
|
# AUTOGENERATED FILE
FROM balenalib/jetson-xavier-nx-devkit-ubuntu:disco-run
ENV GO_VERSION 1.16.3
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
git \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& fetchDeps=' \
curl \
' \
&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/go \
&& curl -SLO "https://storage.googleapis.com/golang/go$GO_VERSION.linux-arm64.tar.gz" \
&& echo "f4e96bbcd5d2d1942f5b55d9e4ab19564da4fad192012f6d7b0b9b055ba4208f go$GO_VERSION.linux-arm64.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-arm64.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-arm64.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Ubuntu disco \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.16.3 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh
|
nghiant2710/base-images
|
balena-base-images/golang/jetson-xavier-nx-devkit/ubuntu/disco/1.16.3/run/Dockerfile
|
Dockerfile
|
apache-2.0
| 2,336
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_31) on Mon Oct 01 00:28:19 PDT 2012 -->
<TITLE>
Uses of Class org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase (Hadoop 1.0.3.16 API)
</TITLE>
<META NAME="date" CONTENT="2012-10-01">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase (Hadoop 1.0.3.16 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.html" title="class in org.apache.hadoop.metrics.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/metrics/util//class-useMetricsDynamicMBeanBase.html" target="_top"><B>FRAMES</B></A>
<A HREF="MetricsDynamicMBeanBase.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase</B></H2>
</CENTER>
No usage of org.apache.hadoop.metrics.util.MetricsDynamicMBeanBase
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.html" title="class in org.apache.hadoop.metrics.util"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/hadoop/metrics/util//class-useMetricsDynamicMBeanBase.html" target="_top"><B>FRAMES</B></A>
<A HREF="MetricsDynamicMBeanBase.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
|
davidl1/hortonworks-extension
|
docs/api/org/apache/hadoop/metrics/util/class-use/MetricsDynamicMBeanBase.html
|
HTML
|
apache-2.0
| 6,211
|
module ApplicationHelper
def sanitize_date(date)
new_date = []
split_date = date.split('/')
new_date << split_date[1]
new_date << split_date[0]
new_date << split_date[2]
return new_date.join("-")
end
def unsanitize_date(date)
new_date = []
split_dates = date.split('-')
new_date << split_dates[1]
new_date << split_dates[2]
new_date << split_dates[0]
return new_date.join("/")
end
end
|
ctpelnar1988/CodingChallenge
|
app/helpers/application_helper.rb
|
Ruby
|
apache-2.0
| 442
|
/*
* Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.java.swing.plaf.windows;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Shape;
import javax.swing.plaf.basic.*;
import javax.swing.*;
import javax.swing.plaf.TextUI;
import javax.swing.plaf.UIResource;
import javax.swing.text.*;
/**
* Windows text rendering.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is appropriate
* for short term storage or RMI between applications running the same
* version of Swing. A future release of Swing will provide support for
* long term persistence.
*/
public abstract class WindowsTextUI extends BasicTextUI {
/**
* Creates the object to use for a caret. By default an
* instance of WindowsCaret is created. This method
* can be redefined to provide something else that implements
* the InputPosition interface or a subclass of DefaultCaret.
*
* @return the caret object
*/
protected Caret createCaret() {
return new WindowsCaret();
}
/* public */
static LayeredHighlighter.LayerPainter WindowsPainter = new WindowsHighlightPainter(null);
/* public */
static class WindowsCaret extends DefaultCaret
implements UIResource {
/**
* Gets the painter for the Highlighter.
*
* @return the painter
*/
protected Highlighter.HighlightPainter getSelectionPainter() {
return WindowsTextUI.WindowsPainter;
}
}
/* public */
static class WindowsHighlightPainter extends
DefaultHighlighter.DefaultHighlightPainter {
WindowsHighlightPainter(Color c) {
super(c);
}
// --- HighlightPainter methods ---------------------------------------
/**
* Paints a highlight.
*
* @param g the graphics context
* @param offs0 the starting model offset >= 0
* @param offs1 the ending model offset >= offs1
* @param bounds the bounding box for the highlight
* @param c the editor
*/
public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
Rectangle alloc = bounds.getBounds();
try {
// --- determine locations ---
TextUI mapper = c.getUI();
Rectangle p0 = mapper.modelToView(c, offs0);
Rectangle p1 = mapper.modelToView(c, offs1);
// --- render ---
Color color = getColor();
if (color == null) {
g.setColor(c.getSelectionColor());
}
else {
g.setColor(color);
}
boolean firstIsDot = false;
boolean secondIsDot = false;
if (c.isEditable()) {
int dot = c.getCaretPosition();
firstIsDot = (offs0 == dot);
secondIsDot = (offs1 == dot);
}
if (p0.y == p1.y) {
// same line, render a rectangle
Rectangle r = p0.union(p1);
if (r.width > 0) {
if (firstIsDot) {
r.x++;
r.width--;
}
else if (secondIsDot) {
r.width--;
}
}
g.fillRect(r.x, r.y, r.width, r.height);
} else {
// different lines
int p0ToMarginWidth = alloc.x + alloc.width - p0.x;
if (firstIsDot && p0ToMarginWidth > 0) {
p0.x++;
p0ToMarginWidth--;
}
g.fillRect(p0.x, p0.y, p0ToMarginWidth, p0.height);
if ((p0.y + p0.height) != p1.y) {
g.fillRect(alloc.x, p0.y + p0.height, alloc.width,
p1.y - (p0.y + p0.height));
}
if (secondIsDot && p1.x > alloc.x) {
p1.x--;
}
g.fillRect(alloc.x, p1.y, (p1.x - alloc.x), p1.height);
}
} catch (BadLocationException e) {
// can't render
}
}
// --- LayerPainter methods ----------------------------
/**
* Paints a portion of a highlight.
*
* @param g the graphics context
* @param offs0 the starting model offset >= 0
* @param offs1 the ending model offset >= offs1
* @param bounds the bounding box of the view, which is not
* necessarily the region to paint.
* @param c the editor
* @param view View painting for
* @return region drawing occured in
*/
public Shape paintLayer(Graphics g, int offs0, int offs1,
Shape bounds, JTextComponent c, View view) {
Color color = getColor();
if (color == null) {
g.setColor(c.getSelectionColor());
}
else {
g.setColor(color);
}
boolean firstIsDot = false;
boolean secondIsDot = false;
if (c.isEditable()) {
int dot = c.getCaretPosition();
firstIsDot = (offs0 == dot);
secondIsDot = (offs1 == dot);
}
if (offs0 == view.getStartOffset() &&
offs1 == view.getEndOffset()) {
// Contained in view, can just use bounds.
Rectangle alloc;
if (bounds instanceof Rectangle) {
alloc = (Rectangle)bounds;
}
else {
alloc = bounds.getBounds();
}
if (firstIsDot && alloc.width > 0) {
g.fillRect(alloc.x + 1, alloc.y, alloc.width - 1,
alloc.height);
}
else if (secondIsDot && alloc.width > 0) {
g.fillRect(alloc.x, alloc.y, alloc.width - 1,
alloc.height);
}
else {
g.fillRect(alloc.x, alloc.y, alloc.width, alloc.height);
}
return alloc;
}
else {
// Should only render part of View.
try {
// --- determine locations ---
Shape shape = view.modelToView(offs0, Position.Bias.Forward,
offs1,Position.Bias.Backward,
bounds);
Rectangle r = (shape instanceof Rectangle) ?
(Rectangle)shape : shape.getBounds();
if (firstIsDot && r.width > 0) {
g.fillRect(r.x + 1, r.y, r.width - 1, r.height);
}
else if (secondIsDot && r.width > 0) {
g.fillRect(r.x, r.y, r.width - 1, r.height);
}
else {
g.fillRect(r.x, r.y, r.width, r.height);
}
return r;
} catch (BadLocationException e) {
// can't render
}
}
// Only if exception
return null;
}
}
}
|
haikuowuya/android_system_code
|
src/com/sun/java/swing/plaf/windows/WindowsTextUI.java
|
Java
|
apache-2.0
| 7,973
|
package com.geofence.drivergeofence;
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.geofence.drivergeofence.R;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.UiSettings;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import com.google.android.gms.vision.barcode.Barcode;
import com.parse.GetCallback;
import com.parse.Parse;
import com.parse.ParseGeoPoint;
import com.parse.ParseInstallation;
import com.parse.ParseObject;
import com.parse.ParsePush;
import com.parse.ParseQuery;
import java.util.ArrayList;
import java.util.Collections;
import static com.google.android.gms.maps.UiSettings.*;
/**
* Created by pc on 12/3/2015.
*/
public class DriverMapsActivity extends FragmentActivity implements OnMapReadyCallback,LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private GoogleMap mMap;
MapView mMapView;
Marker startPerc;
GoogleApiClient mGoogleApiClient;
private LocationManager locationManager;
PolylineOptions lineOpt;
PolygonOptions polyOpt;
String src, dest;
LocationRequest mLocationRequest;
LatLng prev;
ArrayList<LatLng> pathList = new ArrayList<LatLng>();
ArrayList<LatLng> leftFenceList = new ArrayList<LatLng>();
ArrayList<LatLng> rightFenceList = new ArrayList<LatLng>();
ArrayList<Barcode.GeoPoint> path=new ArrayList<>();
ArrayList<Barcode.GeoPoint> left=new ArrayList<>();
ArrayList<Barcode.GeoPoint> right=new ArrayList<>();
private Location mLastLocation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
Intent i = getIntent();
Bundle b =i.getBundleExtra("pathBundle");
Bundle bPt = getIntent().getExtras();
// if(b!=null) {
// String jsondata=b.getString("com.parse.Data");
//
// Log.d("json:", jsondata);
// }
if (b != null) {
// list1 = (ArrayList<String>) b.getStringArrayList("list");
pathList = b.getParcelableArrayList("pathLatLng");
leftFenceList = b.getParcelableArrayList("leftFenceLatLng");
rightFenceList = b.getParcelableArrayList("rightFenceLatLng");
src = bPt.getString("Source");
dest = bPt.getString("Destination");
Log.d("pathlist", pathList.toString());
}
initializemap();
buildGoogleApiClient();
createLocationRequest();
}
private ArrayList<LatLng> getvertexlist(){
ArrayList<LatLng> vertices=new ArrayList<>();
// for(LatLng ll:pathList){
// double lat = (ll.latitude * 1E6);
// double lng = (ll.longitude * 1E6);
// Barcode.GeoPoint point = new Barcode.GeoPoint(1,lat,lng);
// path.add(point);
//
// }
// for(LatLng ll:leftFenceList){
// double lat = (ll.latitude * 1E6);
// double lng = (ll.longitude * 1E6);
// Barcode.GeoPoint point = new Barcode.GeoPoint(1,lat,lng);
// left.add(point);
//
// }
vertices.addAll(leftFenceList);
// for(LatLng ll:rightFenceList){
// double lat = (ll.latitude * 1E6);
// double lng = (ll.longitude * 1E6);
// Barcode.GeoPoint point = new Barcode.GeoPoint(1,lat,lng);
// right.add(point);
//
// }
//Collections.reverse(right);
vertices.addAll(rightFenceList);
return vertices;
}
private void initializemap() {
setUpMapIfNeeded();
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
}
// locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
//
// // Create a criteria object to retrieve provider
// Criteria criteria = new Criteria();
//
// // Get the name of the best provider
// String provider = locationManager.getBestProvider(criteria, true);
//
// // Get Current Location
// Location myLocation = locationManager.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
//
// //set map type
// mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
//
// // Get latitude of the current location
// double latitude = myLocation.getLatitude();
//
// // Get longitude of the current location
// double longitude = myLocation.getLongitude();
//
// // Create a LatLng object for the current location
// LatLng latLng = new LatLng(latitude, longitude);
//
// // Show the current location in Google Map
// mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
//
// // Zoom in the Google Map
// mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
// mMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("You are here!"));
mMap.clear();
mMap.addMarker(new MarkerOptions().position(pathList.get(0)).title("Start"));
mMap.addMarker(new MarkerOptions().position(pathList.get(pathList.size() - 1)).title("End"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(pathList.get(0)));
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
lineOpt = new PolylineOptions();
polyOpt = new PolygonOptions();
lineOpt.addAll(pathList);
lineOpt.width(10);
lineOpt.color(Color.RED);
mMap.addPolyline(lineOpt);
Collections.reverse(rightFenceList);
polyOpt.addAll(leftFenceList).strokeColor(Color.BLUE).strokeWidth(3);
polyOpt.addAll(rightFenceList).strokeColor(Color.BLUE).strokeWidth(3);
mMap.addPolygon(polyOpt);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
// if (requestCode == MY_LOCATION_REQUEST_CODE) {
if (permissions.length == 1 &&
permissions[0] == Manifest.permission.ACCESS_FINE_LOCATION &&
grantResults[0] == PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
Location mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
mGoogleApiClient);
onLocationChanged(mLastLocation);
} else {
// Permission was denied. Display an error message.
}
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
}
public void onLocationChanged(Location location) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng latLng = new LatLng(latitude, longitude);
// mMap.addMarker(new MarkerOptions().position(latLng));
// mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
// mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
// startPerc.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher));
// LatLng origin = new LatLng(3.214732, 101.747047);
// LatLng dest = new LatLng(3.214507, 101.749697);
//LatLng tmp= new LatLng(location.getLatitude(),location.getLongitude());
if(prev!=null){
//mMap.
}
prev=latLng;
final ParseGeoPoint driverLoc=new ParseGeoPoint(location.getLatitude(),location.getLongitude());
final LatLng driverloclatlng=new LatLng(location.getLatitude(),location.getLongitude());
final ArrayList<LatLng> vertices=getvertexlist();
ParseQuery<ParseObject> query2 = ParseQuery.getQuery("PathFence");
query2.whereEqualTo("Source", src).whereEqualTo("Destination", dest);
query2.getFirstInBackground(new GetCallback<ParseObject>() {
@Override
public void done(ParseObject objects, com.parse.ParseException e) {
if(objects != null){
objects.put("DriverLocation", driverLoc);
objects.saveInBackground();
//Toast.makeText(getApplication(),"sucessfully updated",Toast.LENGTH_LONG).show();
boolean check=isPointInPolygon(driverloclatlng,vertices);
if(!check){
Toast.makeText(getApplicationContext(),"Outside",Toast.LENGTH_SHORT).show();
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush push = new ParsePush();
//push.setQuery(pushQuery); // Set our Installation query
push.setChannel("sendtoowner");
push.setMessage("Driver is outside the fence");
push.sendInBackground();
}
else
{
Toast.makeText(getApplicationContext(),"Inside",Toast.LENGTH_SHORT).show();
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
//locationManager.removeUpdates((android.location.LocationListener) this);
}
private void setUpMapIfNeeded() {
// Do a null check to confirm that we have not already instantiated the map.
if (mMap == null) {
// Try to obtain the map from the SupportMapFragment.
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
// Check if we were successful in obtaining the map.
// if (mMap != null) {
// setUpMap();
// }
}
}
@Override
public void onConnected(Bundle bundle) {
mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
mGoogleApiClient);
if (mLastLocation != null) {
Log.d("DriverLoc", String.valueOf(mLastLocation.getLatitude()));
Log.d("DriverLoc", String.valueOf(mLastLocation.getLongitude()));
// Toast.makeText(this, "Latitude:" + mLastLocation.getLatitude() + ", Longitude:" + mLastLocation.getLongitude(), Toast.LENGTH_LONG).show();
}
startLocationUpdates();
}
protected void createLocationRequest() {
mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(10000);
mLocationRequest.setFastestInterval(5000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
}
protected void startLocationUpdates() {
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
}
@Override
public void onConnectionSuspended(int i) {
}
@Override
protected void onStart(){
super.onStart();
if(mGoogleApiClient!=null)
{
mGoogleApiClient.connect();
}
}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
}
private boolean isPointInPolygon(LatLng tap, ArrayList<LatLng> vertices) {
int intersectCount = 0;
for(int j=0; j<vertices.size()-1; j++) {
if( rayCastIntersect(tap, vertices.get(j), vertices.get(j+1)) ) {
intersectCount++;
}
}
return ((intersectCount%2) == 1); // true = inside, false = outside;
}
private boolean rayCastIntersect(LatLng tap,LatLng vertA,LatLng vertB) {
double aY = vertA.latitude;
double bY = vertB.latitude;
double aX = vertA.longitude;
double bX = vertB.longitude;
double pY = tap.latitude;
double pX = tap.longitude;
if ( (aY>pY && bY>pY) || (aY<pY && bY<pY) || (aX<pX && bX<pX) ) {
return false; // a and b can't both be above or below pt.y, and a or b must be east of pt.x
}
double m = (aY-bY) / (aX-bX); // Rise over run
double bee = (-aX) * m + aY; // y = mx + b
double x = (pY - bee) / m; // algebra is neat!
return x > pX;
}
// private void setUpMap() {
// mMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
// }
}
|
apoorv22/DriverGeoFence-master
|
app/src/main/java/com/geofence/drivergeofence/DriverMapsActivity.java
|
Java
|
apache-2.0
| 14,298
|
package com.novoda.simplechromecustomtabs.demo.linkify;
class MatchedUrl {
final String url;
final int start;
final int end;
MatchedUrl(String url, int start, int end) {
this.url = url;
this.start = start;
this.end = end;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
MatchedUrl that = (MatchedUrl) o;
if (start != that.start) {
return false;
}
if (end != that.end) {
return false;
}
return url != null ? url.equals(that.url) : that.url == null;
}
@Override
public int hashCode() {
int result = url != null ? url.hashCode() : 0;
result = 31 * result + start;
result = 31 * result + end;
return result;
}
@Override
public String toString() {
return "MatchedUrl{" +
"url='" + url + '\'' +
", start=" + start +
", end=" + end +
'}';
}
}
|
novoda/simplechromecustomtabs
|
demo-extended/src/main/java/com/novoda/simplechromecustomtabs/demo/linkify/MatchedUrl.java
|
Java
|
apache-2.0
| 1,151
|
---
layout: model
title: Translate Japanese to Spanish Pipeline
author: John Snow Labs
name: translate_ja_es
date: 2021-06-04
tags: [open_source, pipeline, seq2seq, translation, ja, es, xx, multilingual]
task: Translation
language: xx
edition: Spark NLP 3.1.0
spark_version: 3.0
supported: true
article_header:
type: cover
use_language_switcher: "Python-Scala-Java"
---
## Description
Marian is an efficient, free Neural Machine Translation framework written in pure C++ with minimal dependencies. It is mainly being developed by the Microsoft Translator team. Many academic (most notably the University of Edinburgh and in the past the Adam Mickiewicz University in Poznań) and commercial contributors help with its development.
It is currently the engine behind the Microsoft Translator Neural Machine Translation services and being deployed by many companies, organizations and research projects (see below for an incomplete list).
source languages: ja
target languages: es
{:.btn-box}
[Live Demo](https://demo.johnsnowlabs.com/public/TRANSLATION_MARIAN/){:.button.button-orange}
[Open in Colab](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/TRANSLATION_MARIAN.ipynb){:.button.button-orange.button-orange-trans.co.button-icon}
[Download](https://s3.amazonaws.com/auxdata.johnsnowlabs.com/public/models/translate_ja_es_xx_3.1.0_2.4_1622845928818.zip){:.button.button-orange.button-orange-trans.arr.button-icon}
## How to use
<div class="tabs-box" markdown="1">
{% include programmingLanguageSelectScalaPythonNLU.html %}
```python
from sparknlp.pretrained import PretrainedPipeline
pipeline = PretrainedPipeline("translate_ja_es", lang = "xx")
pipeline.annotate("Your sentence to translate!")
```
```scala
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
val pipeline = new PretrainedPipeline("translate_ja_es", lang = "xx")
pipeline.annotate("Your sentence to translate!")
```
{:.nlu-block}
```python
import nlu
text = ["text to translate"]
translate_df = nlu.load('xx.Japanese.translate_to.Spanish').predict(text, output_level='sentence')
translate_df
```
</div>
{:.model-param}
## Model Information
{:.table-model}
|---|---|
|Model Name:|translate_ja_es|
|Type:|pipeline|
|Compatibility:|Spark NLP 3.1.0+|
|License:|Open Source|
|Edition:|Official|
|Language:|xx|
## Data Source
[https://huggingface.co/Helsinki-NLP/opus-mt-ja-es](https://huggingface.co/Helsinki-NLP/opus-mt-ja-es)
## Included Models
- DocumentAssembler
- SentenceDetectorDLModel
- MarianTransformer
|
JohnSnowLabs/spark-nlp
|
docs/_posts/maziyarpanahi/2021-06-04-translate_ja_es_xx.md
|
Markdown
|
apache-2.0
| 2,607
|
/*
* Copyright 2012 zhongl
* 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.github.zhongl.util;
import org.junit.Before;
import org.junit.Test;
import java.util.concurrent.Callable;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
/** @author <a href="mailto:zhong.lunfu@gmail.com">zhongl<a> */
public class CallByCountOrElapseTest {
private int count = 3;
private long elapseMilliseconds = 100L;
private CallByCountOrElapse callByCountOrElapse;
@Before
public void setUp() throws Exception {
callByCountOrElapse = new CallByCountOrElapse(count, elapseMilliseconds, new Callable<Object>() {
@Override
public Object call() throws Exception {
return null;
}
});
}
@Test
public void runByElapseFirst() throws Exception {
assertThat(callByCountOrElapse.tryCallByCount(), is(false));
assertThat(callByCountOrElapse.tryCallByCount(), is(false));
assertThat(callByCountOrElapse.tryCallByElapse(), is(false));
Thread.sleep(elapseMilliseconds);
assertThat(callByCountOrElapse.tryCallByElapse(), is(true)); // run and reset
assertThat(callByCountOrElapse.tryCallByCount(), is(false));
}
@Test
public void runByCountFirst() throws Exception {
assertThat(callByCountOrElapse.tryCallByCount(), is(false));
assertThat(callByCountOrElapse.tryCallByCount(), is(false));
assertThat(callByCountOrElapse.tryCallByElapse(), is(false));
Thread.sleep(elapseMilliseconds / 2);
assertThat(callByCountOrElapse.tryCallByElapse(), is(false));
assertThat(callByCountOrElapse.tryCallByCount(), is(true)); // run and reset
Thread.sleep(elapseMilliseconds / 2);
assertThat(callByCountOrElapse.tryCallByElapse(), is(false));
}
}
|
zhongl/iPage
|
src/test/java/com/github/zhongl/util/CallByCountOrElapseTest.java
|
Java
|
apache-2.0
| 2,430
|
# Stemmacantha aulieatensis (Iljin) Dittrich SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
Rhaponticum aulieatense Iljin
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Stemmacantha aulieatensis/README.md
|
Markdown
|
apache-2.0
| 217
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jrt.slobrok.api;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;
import java.util.logging.Logger;
public class SlobrokList {
private static final Logger log = Logger.getLogger(SlobrokList.class.getName());
private final Internal internal;
private String[] slobroks;
private int idx = 0;
public SlobrokList() {
this.internal = new Internal();
}
public SlobrokList(SlobrokList sibling) {
this.internal = sibling.internal;
}
private void checkUpdate() {
synchronized (internal) {
if (slobroks == internal.slobroks) {
return;
}
slobroks = internal.slobroks;
log.fine(() -> "checkUpdate() updated tmp list="+Arrays.toString(slobroks)+" from shared list="+Arrays.toString(internal.slobroks));
idx = 0;
}
}
public String nextSlobrokSpec() {
checkUpdate();
if (idx < slobroks.length) {
log.fine(() -> "nextSlobrokSpec() returns: "+slobroks[idx]);
return slobroks[idx++];
}
log.fine(() -> "nextSlobrokSpec() reached end of internal list, idx="+idx+"/"+slobroks.length+", tmp list="+Arrays.toString(slobroks)+", shared list="+Arrays.toString(internal.slobroks));
idx = 0;
return null;
}
public void setup(String[] slobroks) {
internal.setup(slobroks);
}
public int length() {
return internal.length();
}
public boolean contains(String slobrok) {
checkUpdate();
for (String s : slobroks) {
if (s.equals(slobrok)) return true;
}
return false;
}
@Override
public String toString() {
return internal.toString();
}
private static class Internal {
String[] slobroks = new String[0];
void setup(String[] slobroks) {
String[] next = new String[slobroks.length];
for (int i = 0; i < slobroks.length; i++) {
next[i] = slobroks[i];
}
for (int i = 0; i + 1 < next.length; i++) {
int lim = next.length - i;
int x = ThreadLocalRandom.current().nextInt(lim);
if (x != 0) {
String tmp = next[i];
next[i] = next[i+x];
next[i+x] = tmp;
}
}
synchronized (this) {
this.slobroks = next;
}
}
synchronized int length() {
return slobroks.length;
}
@Override
public synchronized String toString() {
return Arrays.toString(slobroks);
}
}
}
|
vespa-engine/vespa
|
jrt/src/com/yahoo/jrt/slobrok/api/SlobrokList.java
|
Java
|
apache-2.0
| 2,837
|
# Gentiana axillariflora f. alba Y.N.Lee FORM
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Gentianaceae/Gentiana/Gentiana axillariflora/Gentiana axillariflora alba/README.md
|
Markdown
|
apache-2.0
| 185
|
# Alopecurus geniculatus var. armurensis VARIETY
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Alopecurus/Alopecurus aequalis/ Syn. Alopecurus geniculatus armurensis/README.md
|
Markdown
|
apache-2.0
| 195
|
# Neodiscolaimus dubius Das et al., 1969 SPECIES
#### Status
ACCEPTED
#### According to
Fauna Europaea
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/incertae sedis/Discolaimidae/Neodiscolaimus/Neodiscolaimus dubius/README.md
|
Markdown
|
apache-2.0
| 171
|
# Bryodesma densum (Rydb.) Soják SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Lycopodiophyta/Lycopodiopsida/Selaginellales/Selaginellaceae/Bryodesma/Bryodesma densum/README.md
|
Markdown
|
apache-2.0
| 181
|
/**
* Copyright 2013, WebGate Consulting AG
*
* 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.openntf.xpt.core.dss.changeLog;
import java.util.List;
import lotus.domino.Database;
import lotus.domino.Session;
public interface IChangeLogProcessor {
/**
* Invokes the changeLogging in the ChangeLogProvider
* @param cle - the current changelog entrie
* @return
*/
public int doChangeLog(ChangeLogEntry cle, Session sesCurrent, Database ndbSource);
public List<ChangeLogEntry> getAllChangeLogEntries(String strObjectClassName, String strPK);
public List<ChangeLogEntry> getAllChangeLogEntries4Attribute(String strObjectClassName, String strPK, String strObjectMember);
}
|
OpenNTF/XPagesToolkit
|
org.openntf.xpt.core/src/org/openntf/xpt/core/dss/changeLog/IChangeLogProcessor.java
|
Java
|
apache-2.0
| 1,251
|
# Aeluropus laevis Trin. SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Aeluropus/Aeluropus lagopoides/ Syn. Aeluropus laevis/README.md
|
Markdown
|
apache-2.0
| 179
|
# Lexipyretum luteum Dulac SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Gentianaceae/Lexipyretum/Lexipyretum luteum/README.md
|
Markdown
|
apache-2.0
| 174
|
# Cortinarius cereifolius (M.M. Moser) M.M. Moser SPECIES
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
in Gams, Kleine Kryptogamenflora (Stuttgart), Edn 3 2b/2: 308 (1967)
#### Original name
Phlegmacium cereifolium M.M. Moser
### Remarks
null
|
mdoering/backbone
|
life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Cortinariaceae/Cortinarius/Cortinarius cereifolius/README.md
|
Markdown
|
apache-2.0
| 274
|
# Meliola callicarpicola W. Yamam. SPECIES
#### Status
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Meliola callicarpicola W. Yamam.
### Remarks
null
|
mdoering/backbone
|
life/Fungi/Ascomycota/Dothideomycetes/Meliolales/Meliolaceae/Meliola/Meliola callicarpicola/README.md
|
Markdown
|
apache-2.0
| 193
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Wed Jan 16 11:48:26 MST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Package org.wildfly.swarm.msc (BOM: * : All 2.3.0.Final API)</title>
<meta name="date" content="2019-01-16">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package org.wildfly.swarm.msc (BOM: * : All 2.3.0.Final API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li class="navBarCell1Rev">Use</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.3.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/wildfly/swarm/msc/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Uses of Package org.wildfly.swarm.msc" class="title">Uses of Package<br>org.wildfly.swarm.msc</h1>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../org/wildfly/swarm/msc/package-summary.html">org.wildfly.swarm.msc</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.wildfly.swarm.msc">org.wildfly.swarm.msc</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList"><a name="org.wildfly.swarm.msc">
<!-- -->
</a>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
<caption><span>Classes in <a href="../../../../org/wildfly/swarm/msc/package-summary.html">org.wildfly.swarm.msc</a> used by <a href="../../../../org/wildfly/swarm/msc/package-summary.html">org.wildfly.swarm.msc</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colOne"><a href="../../../../org/wildfly/swarm/msc/class-use/MSCMessages.html#org.wildfly.swarm.msc">MSCMessages</a> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><a href="../../../../org/wildfly/swarm/msc/class-use/ServiceActivatorArchive.html#org.wildfly.swarm.msc">ServiceActivatorArchive</a> </td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li class="navBarCell1Rev">Use</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.3.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/wildfly/swarm/msc/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
|
wildfly-swarm/wildfly-swarm-javadocs
|
2.3.0.Final/apidocs/org/wildfly/swarm/msc/package-use.html
|
HTML
|
apache-2.0
| 5,901
|
/**
* Copyright (C) 2012 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.dashbuilder.scheduler;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.dashbuilder.config.Config;
import org.slf4j.Logger;
/**
* Task scheduler component.
* <p>It uses internally an instance of java.util.concurrent.ScheduledThreadPoolExecutor
* which provides a thread pool and the delayed task execution capability.</p>
*/
@ApplicationScoped
public class Scheduler {
@Inject
private Logger log;
protected PausableThreadPoolExecutor executor;
protected ThreadFactory threadFactory;
protected Map<Object, SchedulerTask> scheduledTasks;
@Inject @Config("10")
protected int maxThreadPoolSize;
@PostConstruct
public void init() {
scheduledTasks = Collections.synchronizedMap(new HashMap<Object,SchedulerTask>());
threadFactory = new SchedulerThreadFactory();
executor = new PausableThreadPoolExecutor(maxThreadPoolSize, threadFactory);
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
log.debug("Scheduler started [pool size=" + maxThreadPoolSize + "].");
}
@PreDestroy
public void shutdown() {
log.debug("Scheduler shutdown started.");
executor.shutdown();
log.debug("Scheduler shutdown completed.");
}
public int getMaxThreadPoolSize() {
return maxThreadPoolSize;
}
public void setMaxThreadPoolSize(int maxThreadPoolSize) {
this.maxThreadPoolSize = maxThreadPoolSize;
if (executor != null) executor.setCorePoolSize(maxThreadPoolSize);
}
public int getThreadPoolSize() {
return executor.getPoolSize();
}
public ThreadFactory getThreadFactory() {
return threadFactory;
}
public void setThreadFactory(ThreadFactory threadFactory) {
this.threadFactory = threadFactory;
}
public int getNumberOfScheduledTasks() {
return scheduledTasks.size();
}
public int getNumberOfScheduledTasksInQueue() {
return executor.getQueue().size();
}
public List<SchedulerTask> getScheduledTasks() {
return new ArrayList<SchedulerTask>(scheduledTasks.values());
}
public List<SchedulerTask> getRunningTasks() {
List<SchedulerTask> result = new ArrayList<SchedulerTask>();
for (SchedulerTask task : scheduledTasks.values()) {
if (task.isRunning()) result.add(task);
}
return result;
}
public List<SchedulerTask> getMisfiredTasks() {
List<SchedulerTask> result = new ArrayList<SchedulerTask>();
for (SchedulerTask task : scheduledTasks.values()) {
if (task.isMisfired()) result.add(task);
}
return result;
}
public List<SchedulerTask> getWaitingTasks() {
List<SchedulerTask> result = new ArrayList<SchedulerTask>();
for (SchedulerTask task : scheduledTasks.values()) {
if (!task.isDone() && !task.isRunning() && !task.isMisfired()) result.add(task);
}
return result;
}
// Transactional operations
public void pause() {
executor.pause();
}
public void resume() {
executor.resume();
}
public boolean isPaused() {
return executor.isPaused();
}
public synchronized void execute(SchedulerTask task) {
try {
_schedule(task, null);
} catch (Exception e) {
log.error("Execute call failed for task: " + task.getKey(), e);
}
}
public synchronized void schedule(SchedulerTask task, Date date) {
try {
_schedule(task, date);
} catch (Exception e) {
log.error("Schedule call failed for task: " + task.getKey(), e);
}
}
public synchronized void schedule(SchedulerTask task, long seconds) {
try {
_schedule(task, seconds);
} catch (Exception e) {
log.error("Schedule call failed for task: " + task.getKey(), e);
}
}
public synchronized void unschedule(final String key) {
try {
_unschedule(key);
} catch (Exception e) {
log.error("Unschedule call failed for task: " + key, e);
}
}
public synchronized void unscheduleAll() {
try {
_unscheduleAll();
} catch (Exception e) {
log.error("Unschedule all call failed.", e);
}
}
public synchronized void fireTask(String key) {
SchedulerTask task = scheduledTasks.get(key);
if (task != null && !task.isDone() && !task.isRunning()) {
try {
task.run();
log.debug("Task " + task + " executed.");
} finally {
scheduledTasks.remove(key);
task.cancel();
_purge();
// Re-schedule fixed delay (repetitive) tasks after issue a fire.
if (task.isFixedDelay()) {
schedule(task, task.getFixedDelaySeconds());
}
}
}
}
// Scheduler business logic
protected void _schedule(SchedulerTask task, Date date) {
// Calculate the delay.
// Never use a delay=0 in order to force the task to be launched in a separated thread.
long delay = 10000;
if (date != null) {
Date now = new Date();
delay = date.getTime() - now.getTime();
if (delay <= 0) throw new IllegalArgumentException("Delay is negative. The task can not be scheduled [" + task.toString() + "] Date=" + date);
}
// Remove any old task (if any)
_unschedule(task.getKey());
// Register the new task.
task.future = executor.schedule(task, delay, TimeUnit.MILLISECONDS);
scheduledTasks.put(task.getKey(), task);
if (date == null) log.debug("Task " + task + " execution requested.");
else log.debug("Task " + task + " scheduled to: " + date);
}
protected void _schedule(SchedulerTask task, long seconds) {
// Remove any old task (if any)
_unschedule(task.getKey());
// Register the new task.
task.fixedDelay = true;
task.fixedDelaySeconds = seconds;
task.future = executor.scheduleWithFixedDelay(task, seconds, seconds, TimeUnit.SECONDS);
scheduledTasks.put(task.getKey(), task);
log.debug("Task " + task + " scheduled every " + seconds + " seconds.");
}
protected void _unschedule(String key) {
SchedulerTask task = scheduledTasks.remove(key);
if (task != null && !task.isDone() && !task.isRunning()) {
task.cancel();
_purge();
log.debug("Task " + task + " unscheduled.");
}
}
public void _unscheduleAll() {
Collection<SchedulerTask> tasks = scheduledTasks.values();
for (SchedulerTask task : tasks) {
if (task != null && !task.isDone() && !task.isRunning()) {
task.cancel();
}
}
executor.purge();
scheduledTasks.clear();
log.debug("All tasks unscheduled.");
}
protected void _purge() {
executor.purge();
Iterator<SchedulerTask> it = scheduledTasks.values().iterator();
while (it.hasNext()) {
SchedulerTask task = it.next();
if (task.isDone()) {
it.remove();
log.debug("Task " + task + " purged.");
}
}
}
public String printScheduledTasksReport() {
Map<Object, SchedulerTask> temp = new HashMap<Object, SchedulerTask>(scheduledTasks);
StringBuilder buf = new StringBuilder();
buf.append("\n\n------------------ SCHEDULED TASKS=").append(temp.size())
.append(" (Queue size=").append(executor.getQueue().size()).append(") -----------------------------\n");
for (Map.Entry<Object, SchedulerTask> entry : temp.entrySet()) {
SchedulerTask task = entry.getValue();
buf.append("\n");
if (task.isRunning()) buf.append("RUNNING - ");
else if (task.isCancelled()) buf.append("CANCELL - ");
else if (task.isDone()) buf.append("COMPLTD - ");
else buf.append("WAITING - [Firing in ").append(task.printTimeToFire()).append("] - ");
buf.append("[").append(task).append("]");
}
return buf.toString();
}
}
|
psiroky/dashbuilder
|
dashbuilder-backend/dashbuilder-scheduler/src/main/java/org/dashbuilder/scheduler/Scheduler.java
|
Java
|
apache-2.0
| 9,476
|
package ru.job4j.springmvc.repo;
import org.springframework.data.repository.CrudRepository;
import ru.job4j.springmvc.models.Car;
public interface CarRepository extends CrudRepository<Car, Integer> {
}
|
alexeremeev/aeremeev
|
chapter_011springcars/src/main/java/ru/job4j/springmvc/repo/CarRepository.java
|
Java
|
apache-2.0
| 204
|
/*D************************************************************
* Modul: GRAPHIC gbook.c
*
* Booking operations: book many DLTs, book one DLT
*
*
*
* Copyright: yafra.org, Basel, Switzerland
**************************************************************
*/
#include <uinclude.h>
#include <ginclude.h>
static char rcsid[]="$Header: /yafra/cvsroot/mapo/source/gui/gbook.c,v 1.2 2008-11-02 19:55:44 mwn Exp $";
void xGRbook(XEvent *event, int tog)
{
extern Display *display;
extern GRAWIDGETS grawidgets;
extern GRAWINDOWS grawindows;
extern long anzregObj;
extern REGOBJ *regObj;
extern GRAGLOB graglob;
REGOBJ *region, *reg;
XmString eintrag;
long aktnummer, i, oldnum;
int x, y;
unsigned int width, height;
unsigned int dummy;
Window root;
Arg args[2];
/*--- Check if booking is possible ---------*/
aktnummer = xGRfind_region_koord(event->xbutton.x, event->xbutton.y);
if (aktnummer == NOVATER)
{
xUIbeep(grawidgets.shell, 0, 0, 0);
return;
}
/*--- Find aktuelle Pointerregion -----*/
region = ®Obj[aktnummer];
if (graglob.bookingMode == XGRBOOK_MANY)
{
/*--- many in list booking ---------------------------------------*/
eintrag = xGRregion_name( region, 0);
if (!XmListItemExists(grawidgets.booking, eintrag)) {
XGetGeometry(display, XtWindow(grawidgets.scrolledgraphik), &root,
&x, &y, &width, &height, &dummy, &dummy);
XtSetArg(args[0], XmNwidth, width);
XtSetArg(args[1], XmNheight, height);
XtSetValues(grawidgets.scrolledgraphik, args, 2);
/*--- list ---*/
XmListAddItem(grawidgets.booking, eintrag, 0);
}
XmStringFree(eintrag);
region->temp = True;
}
else /*------ single booking -------------------------------------*/
{
/*--- Reset all booked regions ---*/
xGRbook_temp_reset();
/*--- book new -------------------*/
region->temp = True;
}
XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True);
}
void xGRshowbook(XEvent *event, int tog)
{
extern Display *display;
extern GRAWIDGETS grawidgets;
extern GRAWINDOWS grawindows;
extern long anzregObj;
extern REGOBJ *regObj;
extern GRAGLOB graglob;
extern char *outcomm;
extern int aktmenuz;
extern int aktmenuobj[];
extern int aktfield[];
BOOKMENU *b;
REGOBJ *region, *reg;
XmString eintrag;
XmString xmstring;
String string;
char *ptr;
long aktnummer, i, oldnum;
int x, y;
int len;
unsigned int width, height;
unsigned int dummy;
Window root;
Arg args[2];
/*--- Check if booking is possible ---------*/
aktnummer = xGRfind_region_koord(event->xbutton.x, event->xbutton.y);
if (aktnummer == NOVATER)
{
xUIbeep(grawidgets.shell, 0, 0, 0);
return;
}
/*--- inits ----*/
ptr = outcomm;
*ptr = '\0';
/*--- Find aktuelle Pointerregion -----*/
region = ®Obj[aktnummer];
/*--- Reset all booked regions ---*/
xGRbook_temp_reset();
/*--- book new -------------------*/
region->temp = True;
XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True);
xmstring = xGRregion_name( region, 0);
XmStringGetLtoR( xmstring, XmSTRING_DEFAULT_CHARSET, &string);
strcpy(ptr, string);
XtFree((void *)string);
/*--- get BM menu ----*/
b = xBMmenuActive();
if (b)
MENUNR = (unsigned char) _RESERVATION; /* bm_ix is _BMCATIX */
else
MENUNR = (unsigned char)aktmenuobj[aktmenuz];
/*--- Send to DB --------------*/
len = strlen(outcomm);
COMMTYP = GRACHOOSE;
ACTIONTYP = GRASHOWINFO;
FELDNR = (unsigned char)aktfield[aktmenuz];
(void)xUItalkto(SEND, outcomm, len);
}
/*F--------------------------------------------------------------------------
* Function: xGRbook_one ()
* -call specialized function for booking
* -
*
*---------------------------------------------------------------------------
*/
XtActionProc xGRbook_one( Widget w, XEvent* event, String* s, Cardinal* m)
{
extern GRAGLOB graglob;
extern Boolean zoomingflag;
/*--- Inhibit during zooming operations ---*/
if (zoomingflag)
return;
if (graglob.mode == XGRSELGRAFIC)
xGRbook(event, 0);
else if (graglob.mode == XGRSHOWGRAFIC)
xGRshowbook(event, 0);
}
/*F--------------------------------------------------------------------------
* Function: xGRbook_andquit ()
* -single booking is done in one shot: select and quit
* -(First click has already selected the region)
*
*---------------------------------------------------------------------------
*/
XtActionProc xGRbook_andquit( Widget w, XEvent* event, String* s, Cardinal* m)
{
extern GRAWIDGETS grawidgets;
extern GRAGLOB graglob;
extern Boolean zoomingflag;
/*--- Inhibit during zooming operations ---*/
if (zoomingflag)
return;
if (graglob.mode == XGRSELGRAFIC)
xGRquit( grawidgets.shell, 0, 0);
}
/*F--------------------------------------------------------------------------
* Function: xGRbook_clear ()
* -reset and forget the booked regions
* -
*
*---------------------------------------------------------------------------
*/
XtActionProc xGRbook_clear( Widget w, XEvent* event, String* s, Cardinal* m)
{
extern Display *display;
extern GRAWINDOWS grawindows;
extern GRAGLOB graglob;
extern Boolean zoomingflag;
/*--- Inhibit during zooming operations ---*/
if (zoomingflag)
return;
if ((graglob.bookingMode == XGRBOOK_ONE) && (graglob.mode == XGRSELGRAFIC))
{
xGRbook_temp_reset();
XClearArea(display, grawindows.graphik, 0, 0, 0, 0, True);
}
}
/*F--------------------------------------------------------------------------
* Function: xGRbook_temp_reset ()
* -clear temporary-booked flag of all regions
* -
*
*---------------------------------------------------------------------------
*/
void xGRbook_temp_reset()
{
extern long anzregObj;
extern REGOBJ *regObj;
REGOBJ *reg;
long i;
/*--- Reset all booked regions and keep index ---*/
for (i=0; i<anzregObj; i++)
{
reg = ®Obj[i];
reg->temp = False;
}
}
|
yafraorg/yafra-tdb-c
|
org.yafra.tdb.classic/gui/gbook.c
|
C
|
apache-2.0
| 5,952
|
#!/bin/sh
#
# Unix/Linux Environment build script
# Author: Sasuke
#
if [ -e ~/.vim ] ; then
else
mkdir ~/.vim
fi
if [ -e ~/.vimrc ]; then
read ANS
# Ordinary Pochi files
ln -s $HOME/Pochi/.tmux.conf $HOME/.tmux.conf
ln -s $HOME/Pochi/.vimrc $HOME/.vimrc
ln -s $HOME/Pochi/.editorconfig $HOME/.editorconfig
# I think it's useful for zsh to contain zsh configuration to Pochi
# but if I want to use prezto, It's difficult to deploy on Pochi.
# And then I decided not to deploy zsh files on Pochi.
# I can deploy zsh and prezto maually instead of this script.
#
# 1.
# git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
# 2. setopt
# setopt EXTENDED_GLOB
# for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
# ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
# done
|
sasukeh/Pochi
|
pinit.sh
|
Shell
|
apache-2.0
| 851
|
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2014/07/28 10:40
//
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
#if COMPATIBLE
using DG.Tweening.Core.Surrogates;
using DOVector3 = DG.Tweening.Core.Surrogates.Vector3Wrapper;
using DOQuaternion = DG.Tweening.Core.Surrogates.QuaternionWrapper;
#else
using DOVector3 = UnityEngine.Vector3;
using DOQuaternion = UnityEngine.Quaternion;
#endif
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
using DG.Tweening.CustomPlugins;
using DG.Tweening.Plugins;
using DG.Tweening.Plugins.Core.PathCore;
using DG.Tweening.Plugins.Options;
using UnityEngine;
#pragma warning disable 1573
namespace DG.Tweening
{
/// <summary>
/// Methods that extend known Unity objects and allow to directly create and control tweens from their instances
/// </summary>
public static class ShortcutExtensions
{
// ===================================================================================
// CREATION SHORTCUTS ----------------------------------------------------------------
#region Audio Shortcuts
/// <summary>Tweens an AudioSource's volume to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
public static Tweener DOFade(this AudioSource target, float endValue, float duration)
{
if (endValue < 0) endValue = 0;
else if (endValue > 1) endValue = 1;
return DOTween.To(() => target.volume, x => target.volume = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens an AudioSource's pitch to the given value.
/// Also stores the AudioSource as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOPitch(this AudioSource target, float endValue, float duration)
{
return DOTween.To(() => target.pitch, x => target.pitch = x, endValue, duration).SetTarget(target);
}
#endregion
#region Camera Shortcuts
/// <summary>Tweens a Camera's <code>aspect</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOAspect(this Camera target, float endValue, float duration)
{
return DOTween.To(() => target.aspect, x => target.aspect = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's backgroundColor to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOColor(this Camera target, Color endValue, float duration)
{
return DOTween.To(() => target.backgroundColor, x => target.backgroundColor = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>farClipPlane</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOFarClipPlane(this Camera target, float endValue, float duration)
{
return DOTween.To(() => target.farClipPlane, x => target.farClipPlane = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>fieldOfView</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOFieldOfView(this Camera target, float endValue, float duration)
{
return DOTween.To(() => target.fieldOfView, x => target.fieldOfView = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>nearClipPlane</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DONearClipPlane(this Camera target, float endValue, float duration)
{
return DOTween.To(() => target.nearClipPlane, x => target.nearClipPlane = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>orthographicSize</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOOrthoSize(this Camera target, float endValue, float duration)
{
return DOTween.To(() => target.orthographicSize, x => target.orthographicSize = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>pixelRect</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOPixelRect(this Camera target, Rect endValue, float duration)
{
return DOTween.To(() => target.pixelRect, x => target.pixelRect = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Camera's <code>rect</code> to the given value.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DORect(this Camera target, Rect endValue, float duration)
{
return DOTween.To(() => target.rect, x => target.rect = x, endValue, duration).SetTarget(target);
}
/// <summary>Shakes a Camera's localPosition along its relative X Y axes with the given values.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakePosition(this Camera target, float duration, float strength = 3, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.transform.localPosition, x => target.transform.localPosition = x, duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetCameraShakePosition);
}
/// <summary>Shakes a Camera's localPosition along its relative X Y axes with the given values.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakePosition(this Camera target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.transform.localPosition, x => target.transform.localPosition = x, duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetCameraShakePosition);
}
/// <summary>Shakes a Camera's localRotation.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeRotation(this Camera target, float duration, float strength = 90, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.transform.localEulerAngles, x => target.transform.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness, false)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
/// <summary>Shakes a Camera's localRotation.
/// Also stores the camera as the tween's target so it can be used for filtered operations</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeRotation(this Camera target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.transform.localEulerAngles, x => target.transform.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
#endregion
#region Light Shortcuts
/// <summary>Tweens a Light's color to the given value.
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOColor(this Light target, Color endValue, float duration)
{
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Light's intensity to the given value.
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOIntensity(this Light target, float endValue, float duration)
{
return DOTween.To(() => target.intensity, x => target.intensity = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Light's shadowStrength to the given value.
/// Also stores the light as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOShadowStrength(this Light target, float endValue, float duration)
{
return DOTween.To(() => target.shadowStrength, x => target.shadowStrength = x, endValue, duration).SetTarget(target);
}
#endregion
#region LineRenderer
/// <summary>Tweens a LineRenderer's color to the given value.
/// Also stores the LineRenderer as the tween's target so it can be used for filtered operations.
/// <para>Note that this method requires to also insert the start colors for the tween,
/// since LineRenderers have no way to get them.</para></summary>
/// <param name="startValue">The start value to tween from</param>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOColor(this LineRenderer target, Color2 startValue, Color2 endValue, float duration)
{
return DOTween.To(() => startValue, x => target.SetColors(x.ca, x.cb), endValue, duration).SetTarget(target);
}
#endregion
#region Material Shortcuts
/// <summary>Tweens a Material's color to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOColor(this Material target, Color endValue, float duration)
{
return DOTween.To(() => target.color, x => target.color = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's named color property to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOColor(this Material target, Color endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.To(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's alpha color to the given value
/// (will have no effect unless your material supports transparency).
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOFade(this Material target, float endValue, float duration)
{
return DOTween.ToAlpha(() => target.color, x => target.color = x, endValue, duration)
.SetTarget(target);
}
/// <summary>Tweens a Material's alpha color to the given value
/// (will have no effect unless your material supports transparency).
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOFade(this Material target, float endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.ToAlpha(() => target.GetColor(property), x => target.SetColor(property, x), endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's named float property to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOFloat(this Material target, float endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.To(() => target.GetFloat(property), x => target.SetFloat(property, x), endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's texture offset to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOOffset(this Material target, Vector2 endValue, float duration)
{
return DOTween.To(() => target.mainTextureOffset, x => target.mainTextureOffset = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's named texture offset property to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOOffset(this Material target, Vector2 endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.To(() => target.GetTextureOffset(property), x => target.SetTextureOffset(property, x), endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's texture scale to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOTiling(this Material target, Vector2 endValue, float duration)
{
return DOTween.To(() => target.mainTextureScale, x => target.mainTextureScale = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's named texture scale property to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOTiling(this Material target, Vector2 endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.To(() => target.GetTextureScale(property), x => target.SetTextureScale(property, x), endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Material's named Vector property to the given value.
/// Also stores the material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="property">The name of the material property to tween</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOVector(this Material target, Vector4 endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
return DOTween.To(() => target.GetVector(property), x => target.SetVector(property, x), endValue, duration).SetTarget(target);
}
#endregion
#region Rigidbody Shortcuts
/// <summary>Tweens a Rigidbody's position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMove(this Rigidbody target, Vector3 endValue, float duration, bool snapping = false)
{
#if COMPATIBLE
return DOTween.To(() => target.position, x=> target.MovePosition(x.value), endValue, duration)
#else
return DOTween.To(() => target.position, target.MovePosition, endValue, duration)
#endif
.SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a Rigidbody's X position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveX(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
#if COMPATIBLE
return DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue, 0, 0), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue, 0, 0), duration)
#endif
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
}
/// <summary>Tweens a Rigidbody's Y position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveY(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
#if COMPATIBLE
return DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, endValue, 0), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, endValue, 0), duration)
#endif
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
}
/// <summary>Tweens a Rigidbody's Z position to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveZ(this Rigidbody target, float endValue, float duration, bool snapping = false)
{
#if COMPATIBLE
return DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, 0, endValue), duration)
#else
return DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue), duration)
#endif
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
}
/// <summary>Tweens a Rigidbody's rotation to the given value.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static Tweener DORotate(this Rigidbody target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
#if COMPATIBLE
TweenerCore<QuaternionWrapper, Vector3Wrapper, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), endValue, duration);
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, endValue, duration);
#endif
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Rigidbody's rotation so that it will look towards the given position.
/// Also stores the rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
public static Tweener DOLookAt(this Rigidbody target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
{
#if COMPATIBLE
TweenerCore<QuaternionWrapper, Vector3Wrapper, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.MoveRotation(x), towards, duration)
#else
TweenerCore<Quaternion, Vector3, QuaternionOptions> t = DOTween.To(() => target.rotation, target.MoveRotation, towards, duration)
#endif
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
return t;
}
#region Special
/// <summary>Tweens a Rigidbody's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the Rigidbody as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Rigidbody target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = target.position.y;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
#if COMPATIBLE
s.Append(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(endValue.x, 0, 0), duration)
#else
s.Append(DOTween.To(() => target.position, target.MovePosition, new Vector3(endValue.x, 0, 0), duration)
#endif
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.MovePosition(pos);
})
#if COMPATIBLE
).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, 0, endValue.z), duration)
#else
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, 0, endValue.z), duration)
#endif
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
#if COMPATIBLE
).Join(DOTween.To(() => target.position, x => target.MovePosition(x.value), new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
#else
).Join(DOTween.To(() => target.position, target.MovePosition, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
#endif
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad)
.SetLoops(numJumps * 2, LoopType.Yoyo).SetRelative()
).SetTarget(target).SetEase(DOTween.defaultEaseType);
return s;
}
#endregion
#endregion
#region TrailRenderer Shortcuts
/// <summary>Tweens a TrailRenderer's startWidth/endWidth to the given value.
/// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="toStartWidth">The end startWidth to reach</param><param name="toEndWidth">The end endWidth to reach</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOResize(this TrailRenderer target, float toStartWidth, float toEndWidth, float duration)
{
return DOTween.To(() => new Vector2(target.startWidth, target.endWidth), x => {
#if COMPATIBLE
target.startWidth = x.value.x;
target.endWidth = x.value.y;
#else
target.startWidth = x.x;
target.endWidth = x.y;
#endif
}, new Vector2(toStartWidth, toEndWidth), duration)
.SetTarget(target);
}
/// <summary>Tweens a TrailRenderer's time to the given value.
/// Also stores the TrailRenderer as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOTime(this TrailRenderer target, float endValue, float duration)
{
return DOTween.To(() => target.time, x => target.time = x, endValue, duration)
.SetTarget(target);
}
#endregion
#region Transform Shortcuts
/// <summary>Tweens a Transform's position to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.position, x => target.position = x, endValue, duration)
.SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's X position to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveX(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's Y position to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveY(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, endValue, 0), duration)
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's Z position to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue), duration)
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's localPosition to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOLocalMove(this Transform target, Vector3 endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.localPosition, x => target.localPosition = x, endValue, duration)
.SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's X localPosition to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOLocalMoveX(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's Y localPosition to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOLocalMoveY(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, endValue, 0), duration)
.SetOptions(AxisConstraint.Y, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's Z localPosition to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOLocalMoveZ(this Transform target, float endValue, float duration, bool snapping = false)
{
return DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue), duration)
.SetOptions(AxisConstraint.Z, snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's rotation to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static Tweener DORotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, endValue, duration);
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Transform's rotation to the given value using pure quaternion values.
/// Also stores the transform as the tween's target so it can be used for filtered operations.
/// <para>PLEASE NOTE: DORotate, which takes Vector3 values, is the preferred rotation method.
/// This method was implemented for very special cases, and doesn't support LoopType.Incremental loops
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
/// </summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DORotateQuaternion(this Transform target, Quaternion endValue, float duration)
{
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.rotation, x => target.rotation = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Transform's localRotation to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static Tweener DOLocalRotate(this Transform target, Vector3 endValue, float duration, RotateMode mode = RotateMode.Fast)
{
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.localRotation, x => target.localRotation = x, endValue, duration);
t.SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Transform's rotation to the given value using pure quaternion values.
/// Also stores the transform as the tween's target so it can be used for filtered operations.
/// <para>PLEASE NOTE: DOLocalRotate, which takes Vector3 values, is the preferred rotation method.
/// This method was implemented for very special cases, and doesn't support LoopType.Incremental loops
/// (neither for itself nor if placed inside a LoopType.Incremental Sequence)</para>
/// </summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOLocalRotateQuaternion(this Transform target, Quaternion endValue, float duration)
{
TweenerCore<Quaternion, Quaternion, NoOptions> t = DOTween.To(PureQuaternionPlugin.Plug(), () => target.localRotation, x => target.localRotation = x, endValue, duration);
t.SetTarget(target);
return t;
}
/// <summary>Tweens a Transform's localScale to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOScale(this Transform target, Vector3 endValue, float duration)
{
return DOTween.To(() => target.localScale, x => target.localScale = x, endValue, duration).SetTarget(target);
}
/// <summary>Tweens a Transform's localScale uniformly to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOScale(this Transform target, float endValue, float duration)
{
Vector3 endValueV3 = new Vector3(endValue, endValue, endValue);
return DOTween.To(() => target.localScale, x => target.localScale = x, endValueV3, duration).SetTarget(target);
}
/// <summary>Tweens a Transform's X localScale to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOScaleX(this Transform target, float endValue, float duration)
{
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(endValue, 0, 0), duration)
.SetOptions(AxisConstraint.X)
.SetTarget(target);
}
/// <summary>Tweens a Transform's Y localScale to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOScaleY(this Transform target, float endValue, float duration)
{
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, endValue, 0), duration)
.SetOptions(AxisConstraint.Y)
.SetTarget(target);
}
/// <summary>Tweens a Transform's Z localScale to the given value.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
public static Tweener DOScaleZ(this Transform target, float endValue, float duration)
{
return DOTween.To(() => target.localScale, x => target.localScale = x, new Vector3(0, 0, endValue), duration)
.SetOptions(AxisConstraint.Z)
.SetTarget(target);
}
/// <summary>Tweens a Transform's rotation so that it will look towards the given position.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="towards">The position to look at</param><param name="duration">The duration of the tween</param>
/// <param name="axisConstraint">Eventual axis constraint for the rotation</param>
/// <param name="up">The vector that defines in which direction up is (default: Vector3.up)</param>
public static Tweener DOLookAt(this Transform target, Vector3 towards, float duration, AxisConstraint axisConstraint = AxisConstraint.None, Vector3? up = null)
{
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => target.rotation, x => target.rotation = x, towards, duration)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetLookAt);
t.plugOptions.axisConstraint = axisConstraint;
t.plugOptions.up = (up == null) ? Vector3.up : (Vector3)up;
return t;
}
/// <summary>Punches a Transform's localPosition towards the given direction and then back to the starting one
/// as if it was connected to the starting position via an elastic.</summary>
/// <param name="punch">The direction and strength of the punch (added to the Transform's current position)</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="vibrato">Indicates how much will the punch vibrate</param>
/// <param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting position when bouncing backwards.
/// 1 creates a full oscillation between the punch direction and the opposite direction,
/// while 0 oscillates only between the punch and the start position</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOPunchPosition(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1, bool snapping = false)
{
return DOTween.Punch(() => target.localPosition, x => target.localPosition = x, punch, duration, vibrato, elasticity)
.SetTarget(target).SetOptions(snapping);
}
/// <summary>Punches a Transform's localScale towards the given size and then back to the starting one
/// as if it was connected to the starting scale via an elastic.</summary>
/// <param name="punch">The punch strength (added to the Transform's current scale)</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="vibrato">Indicates how much will the punch vibrate</param>
/// <param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting size when bouncing backwards.
/// 1 creates a full oscillation between the punch scale and the opposite scale,
/// while 0 oscillates only between the punch scale and the start scale</param>
public static Tweener DOPunchScale(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1)
{
return DOTween.Punch(() => target.localScale, x => target.localScale = x, punch, duration, vibrato, elasticity)
.SetTarget(target);
}
/// <summary>Punches a Transform's localRotation towards the given size and then back to the starting one
/// as if it was connected to the starting rotation via an elastic.</summary>
/// <param name="punch">The punch strength (added to the Transform's current rotation)</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="vibrato">Indicates how much will the punch vibrate</param>
/// <param name="elasticity">Represents how much (0 to 1) the vector will go beyond the starting rotation when bouncing backwards.
/// 1 creates a full oscillation between the punch rotation and the opposite rotation,
/// while 0 oscillates only between the punch and the start rotation</param>
public static Tweener DOPunchRotation(this Transform target, Vector3 punch, float duration, int vibrato = 10, float elasticity = 1)
{
return DOTween.Punch(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), punch, duration, vibrato, elasticity)
.SetTarget(target);
}
/// <summary>Shakes a Transform's localPosition with the given values.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOShakePosition(this Transform target, float duration, float strength = 1, int vibrato = 10, float randomness = 90, bool snapping = false)
{
return DOTween.Shake(() => target.localPosition, x => target.localPosition = x, duration, strength, vibrato, randomness, false)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping);
}
/// <summary>Shakes a Transform's localPosition with the given values.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOShakePosition(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90, bool snapping = false)
{
return DOTween.Shake(() => target.localPosition, x => target.localPosition = x, duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake).SetOptions(snapping);
}
/// <summary>Shakes a Transform's localRotation.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeRotation(this Transform target, float duration, float strength = 90, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness, false)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
/// <summary>Shakes a Transform's localRotation.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeRotation(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.localEulerAngles, x => target.localRotation = Quaternion.Euler(x), duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
/// <summary>Shakes a Transform's localScale.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeScale(this Transform target, float duration, float strength = 1, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.localScale, x => target.localScale = x, duration, strength, vibrato, randomness, false)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
/// <summary>Shakes a Transform's localScale.</summary>
/// <param name="duration">The duration of the tween</param>
/// <param name="strength">The shake strength on each axis</param>
/// <param name="vibrato">Indicates how much will the shake vibrate</param>
/// <param name="randomness">Indicates how much the shake will be random (0 to 180 - values higher than 90 kind of suck, so beware).
/// Setting it to 0 will shake along a single direction.</param>
public static Tweener DOShakeScale(this Transform target, float duration, Vector3 strength, int vibrato = 10, float randomness = 90)
{
return DOTween.Shake(() => target.localScale, x => target.localScale = x, duration, strength, vibrato, randomness)
.SetTarget(target).SetSpecialStartupMode(SpecialStartupMode.SetShake);
}
#region Special
/// <summary>Tweens a Transform's position to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = target.position.y;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
s.Append(DOTween.To(() => target.position, x => target.position = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = true;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.position;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.position = pos;
})
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.position, x => target.position = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType);
return s;
}
/// <summary>Tweens a Transform's localPosition to the given value, while also applying a jump effect along the Y axis.
/// Returns a Sequence instead of a Tweener.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The end value to reach</param>
/// <param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
/// <param name="numJumps">Total number of jumps</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Sequence DOLocalJump(this Transform target, Vector3 endValue, float jumpPower, int numJumps, float duration, bool snapping = false)
{
if (numJumps < 1) numJumps = 1;
float startPosY = target.localPosition.y;
float offsetY = -1;
bool offsetYSet = false;
Sequence s = DOTween.Sequence();
s.Append(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(endValue.x, 0, 0), duration)
.SetOptions(AxisConstraint.X, snapping).SetEase(Ease.Linear)
.OnUpdate(() => {
if (!offsetYSet) {
offsetYSet = false;
offsetY = s.isRelative ? endValue.y : endValue.y - startPosY;
}
Vector3 pos = target.localPosition;
pos.y += DOVirtual.EasedValue(0, offsetY, s.ElapsedDirectionalPercentage(), Ease.OutQuad);
target.localPosition = pos;
})
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, 0, endValue.z), duration)
.SetOptions(AxisConstraint.Z, snapping).SetEase(Ease.Linear)
).Join(DOTween.To(() => target.localPosition, x => target.localPosition = x, new Vector3(0, jumpPower, 0), duration / (numJumps * 2))
.SetOptions(AxisConstraint.Y, snapping).SetEase(Ease.OutQuad).SetRelative()
.SetLoops(numJumps * 2, LoopType.Yoyo)
).SetTarget(target).SetEase(DOTween.defaultEaseType);
return s;
}
/// <summary>Tweens a Transform's position through the given path waypoints, using the chosen path algorithm.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="path">The waypoints to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path (useless in case of Linear paths): higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Transform target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.position = x, new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target);
t.plugOptions.mode = pathMode;
return t;
}
/// <summary>Tweens a Transform's localPosition through the given path waypoints, using the chosen path algorithm.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="path">The waypoint to go through</param>
/// <param name="duration">The duration of the tween</param>
/// <param name="pathType">The type of path: Linear (straight path) or CatmullRom (curved CatmullRom path)</param>
/// <param name="pathMode">The path mode: 3D, side-scroller 2D, top-down 2D</param>
/// <param name="resolution">The resolution of the path: higher resolutions make for more detailed curved paths but are more expensive.
/// Defaults to 10, but a value of 5 is usually enough if you don't have dramatic long curves between waypoints</param>
/// <param name="gizmoColor">The color of the path (shown when gizmos are active in the Play panel and the tween is running)</param>
public static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Transform target, Vector3[] path, float duration, PathType pathType = PathType.Linear,
PathMode pathMode = PathMode.Full3D, int resolution = 10, Color? gizmoColor = null
)
{
if (resolution < 1) resolution = 1;
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.localPosition, x => target.localPosition = x, new Path(pathType, path, resolution, gizmoColor), duration)
.SetTarget(target);
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
// Used by path editor when creating the actual tween, so it can pass a pre-compiled path
internal static TweenerCore<Vector3, Path, PathOptions> DOPath(
this Transform target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.position, x => target.position = x, path, duration)
.SetTarget(target);
t.plugOptions.mode = pathMode;
return t;
}
internal static TweenerCore<Vector3, Path, PathOptions> DOLocalPath(
this Transform target, Path path, float duration, PathMode pathMode = PathMode.Full3D
)
{
TweenerCore<Vector3, Path, PathOptions> t = DOTween.To(PathPlugin.Get(), () => target.localPosition, x => target.localPosition = x, path, duration)
.SetTarget(target);
t.plugOptions.mode = pathMode;
t.plugOptions.useLocalPosition = true;
return t;
}
#endregion
#endregion
#region Blendables
#region Light
/// <summary>Tweens a Light's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Light as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Light target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
#if COMPATIBLE
Color diff = x.value - to;
#else
Color diff = x - to;
#endif
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#region Material
/// <summary>Tweens a Material's color to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Material target, Color endValue, float duration)
{
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
#if COMPATIBLE
Color diff = x.value - to;
#else
Color diff = x - to;
#endif
to = x;
target.color += diff;
}, endValue, duration)
.Blendable().SetTarget(target);
}
/// <summary>Tweens a Material's named color property to the given value,
/// in a way that allows other DOBlendableColor tweens to work together on the same target,
/// instead than fight each other as multiple DOColor would do.
/// Also stores the Material as the tween's target so it can be used for filtered operations</summary>
/// <param name="endValue">The value to tween to</param>
/// <param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
/// <param name="duration">The duration of the tween</param>
public static Tweener DOBlendableColor(this Material target, Color endValue, string property, float duration)
{
if (!target.HasProperty(property)) {
if (Debugger.logPriority > 0) Debugger.LogMissingMaterialProperty(property);
return null;
}
endValue = endValue - target.color;
Color to = new Color(0, 0, 0, 0);
return DOTween.To(() => to, x => {
#if COMPATIBLE
Color diff = x.value - to;
#else
Color diff = x - to;
#endif
to = x;
target.SetColor(property, target.GetColor(property) + diff);
}, endValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#region Transform
/// <summary>Tweens a Transform's position BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableMove tweens to work together on the same target,
/// instead than fight each other as multiple DOMove would do.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOBlendableMoveBy(this Transform target, Vector3 byValue, float duration, bool snapping = false)
{
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
#if COMPATIBLE
Vector3 diff = x.value - to;
#else
Vector3 diff = x - to;
#endif
to = x;
target.position += diff;
}, byValue, duration)
.Blendable().SetOptions(snapping).SetTarget(target);
}
/// <summary>Tweens a Transform's localPosition BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableMove tweens to work together on the same target,
/// instead than fight each other as multiple DOMove would do.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
/// <param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
public static Tweener DOBlendableLocalMoveBy(this Transform target, Vector3 byValue, float duration, bool snapping = false)
{
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
#if COMPATIBLE
Vector3 diff = x.value - to;
#else
Vector3 diff = x - to;
#endif
to = x;
target.localPosition += diff;
}, byValue, duration)
.Blendable().SetOptions(snapping).SetTarget(target);
}
/// <summary>EXPERIMENTAL METHOD - Tweens a Transform's rotation BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableRotate tweens to work together on the same target,
/// instead than fight each other as multiple DORotate would do.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static Tweener DOBlendableRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{
Quaternion to = target.rotation;
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => {
#if COMPATIBLE
Quaternion diff = x.value * Quaternion.Inverse(to);
#else
Quaternion diff = x * Quaternion.Inverse(to);
#endif
to = x;
target.rotation = target.rotation * Quaternion.Inverse(target.rotation) * diff * target.rotation;
}, byValue, duration)
.Blendable().SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>EXPERIMENTAL METHOD - Tweens a Transform's lcoalRotation BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableRotate tweens to work together on the same target,
/// instead than fight each other as multiple DORotate would do.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
/// <param name="mode">Rotation mode</param>
public static Tweener DOBlendableLocalRotateBy(this Transform target, Vector3 byValue, float duration, RotateMode mode = RotateMode.Fast)
{
Quaternion to = target.localRotation;
TweenerCore<DOQuaternion, DOVector3, QuaternionOptions> t = DOTween.To(() => to, x => {
#if COMPATIBLE
Quaternion diff = x.value * Quaternion.Inverse(to);
#else
Quaternion diff = x * Quaternion.Inverse(to);
#endif
to = x;
target.localRotation = target.localRotation * Quaternion.Inverse(target.localRotation) * diff * target.localRotation;
}, byValue, duration)
.Blendable().SetTarget(target);
t.plugOptions.rotateMode = mode;
return t;
}
/// <summary>Tweens a Transform's localScale BY the given value (as if you chained a <code>SetRelative</code>),
/// in a way that allows other DOBlendableScale tweens to work together on the same target,
/// instead than fight each other as multiple DOScale would do.
/// Also stores the transform as the tween's target so it can be used for filtered operations</summary>
/// <param name="byValue">The value to tween by</param><param name="duration">The duration of the tween</param>
public static Tweener DOBlendableScaleBy(this Transform target, Vector3 byValue, float duration)
{
Vector3 to = Vector3.zero;
return DOTween.To(() => to, x => {
#if COMPATIBLE
Vector3 diff = x.value - to;
#else
Vector3 diff = x - to;
#endif
to = x;
target.localScale += diff;
}, byValue, duration)
.Blendable().SetTarget(target);
}
#endregion
#endregion
// ===================================================================================
// OPERATION SHORTCUTS ---------------------------------------------------------------
#region Operation Shortcuts
/// <summary>
/// Completes all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens completed
/// (meaning the tweens that don't have infinite loops and were not already complete)
/// </summary>
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
/// otherwise they will be ignored</param>
public static int DOComplete(this Component target, bool withCallbacks = false)
{
return DOTween.Complete(target, withCallbacks);
}
/// <summary>
/// Completes all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens completed
/// (meaning the tweens that don't have infinite loops and were not already complete)
/// </summary>
/// <param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,
/// otherwise they will be ignored</param>
public static int DOComplete(this Material target, bool withCallbacks = false)
{
return DOTween.Complete(target, withCallbacks);
}
/// <summary>
/// Kills all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens killed.
/// </summary>
/// <param name="complete">If TRUE completes the tween before killing it</param>
public static int DOKill(this Component target, bool complete = false)
{
// int tot = complete ? DOTween.CompleteAndReturnKilledTot(target) : 0;
// return tot + DOTween.Kill(target);
return DOTween.Kill(target, complete);
}
/// <summary>
/// Kills all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens killed.
/// </summary>
/// <param name="complete">If TRUE completes the tween before killing it</param>
public static int DOKill(this Material target, bool complete = false)
{
return DOTween.Kill(target, complete);
}
/// <summary>
/// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens flipped.
/// </summary>
public static int DOFlip(this Component target)
{
return DOTween.Flip(target);
}
/// <summary>
/// Flips the direction (backwards if it was going forward or viceversa) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens flipped.
/// </summary>
public static int DOFlip(this Material target)
{
return DOTween.Flip(target);
}
/// <summary>
/// Sends to the given position all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
/// <param name="to">Time position to reach
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
public static int DOGoto(this Component target, float to, bool andPlay = false)
{
return DOTween.Goto(target, to, andPlay);
}
/// <summary>
/// Sends to the given position all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
/// <param name="to">Time position to reach
/// (if higher than the whole tween duration the tween will simply reach its end)</param>
/// <param name="andPlay">If TRUE will play the tween after reaching the given position, otherwise it will pause it</param>
public static int DOGoto(this Material target, float to, bool andPlay = false)
{
return DOTween.Goto(target, to, andPlay);
}
/// <summary>
/// Pauses all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens paused.
/// </summary>
public static int DOPause(this Component target)
{
return DOTween.Pause(target);
}
/// <summary>
/// Pauses all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens paused.
/// </summary>
public static int DOPause(this Material target)
{
return DOTween.Pause(target);
}
/// <summary>
/// Plays all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlay(this Component target)
{
return DOTween.Play(target);
}
/// <summary>
/// Plays all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlay(this Material target)
{
return DOTween.Play(target);
}
/// <summary>
/// Plays backwards all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayBackwards(this Component target)
{
return DOTween.PlayBackwards(target);
}
/// <summary>
/// Plays backwards all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayBackwards(this Material target)
{
return DOTween.PlayBackwards(target);
}
/// <summary>
/// Plays forward all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayForward(this Component target)
{
return DOTween.PlayForward(target);
}
/// <summary>
/// Plays forward all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens played.
/// </summary>
public static int DOPlayForward(this Material target)
{
return DOTween.PlayForward(target);
}
/// <summary>
/// Restarts all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens restarted.
/// </summary>
public static int DORestart(this Component target, bool includeDelay = true)
{
return DOTween.RestartTOI(target, includeDelay);
}
/// <summary>
/// Restarts all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens restarted.
/// </summary>
public static int DORestart(this Material target, bool includeDelay = true)
{
return DOTween.RestartTOI(target, includeDelay);
}
/// <summary>
/// Rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DORewind(this Component target, bool includeDelay = true)
{
return DOTween.Rewind(target, includeDelay);
}
/// <summary>
/// Rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DORewind(this Material target, bool includeDelay = true)
{
return DOTween.Rewind(target, includeDelay);
}
/// <summary>
/// Smoothly rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DOSmoothRewind(this Component target)
{
return DOTween.SmoothRewind(target);
}
/// <summary>
/// Smoothly rewinds all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens rewinded.
/// </summary>
public static int DOSmoothRewind(this Material target)
{
return DOTween.SmoothRewind(target);
}
/// <summary>
/// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
public static int DOTogglePause(this Component target)
{
return DOTween.TogglePause(target);
}
/// <summary>
/// Toggles the paused state (plays if it was paused, pauses if it was playing) of all tweens that have this target as a reference
/// (meaning tweens that were started from this target, or that had this target added as an Id)
/// and returns the total number of tweens involved.
/// </summary>
public static int DOTogglePause(this Material target)
{
return DOTween.TogglePause(target);
}
#endregion
}
}
|
cathy33/Infinity
|
examples/GameClient/Assets/Plugins/3rdParty/Demigiant/DOTween/ShortcutExtensions.cs
|
C#
|
apache-2.0
| 85,379
|
package com.chickenkiller.upods2.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
/**
* Created by Alon Zilberman on 7/5/15.
*/
public class AutofitRecyclerView extends RecyclerView {
private GridLayoutManager manager;
private int columnWidth = -1;
private int spanCount;
public AutofitRecyclerView(Context context) {
super(context);
init(context, null);
}
public AutofitRecyclerView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public AutofitRecyclerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
if (attrs != null) {
int[] attrsArray = {
android.R.attr.columnWidth
};
TypedArray array = context.obtainStyledAttributes(attrs, attrsArray);
columnWidth = array.getDimensionPixelSize(0, -1);
array.recycle();
}
manager = new GridLayoutManager(getContext(), 1);
setLayoutManager(manager);
}
public void setSpanSizeLookup(GridLayoutManager.SpanSizeLookup spanSizeLookup) {
manager.setSpanSizeLookup(spanSizeLookup);
}
public int getSpanCount() {
return spanCount;
}
@Override
protected void onMeasure(int widthSpec, int heightSpec) {
super.onMeasure(widthSpec, heightSpec);
if (columnWidth > 0) {
spanCount = Math.max(1, getMeasuredWidth() / columnWidth);
manager.setSpanCount(spanCount);
}
}
protected int getTotalSpan(View view, RecyclerView parent) {
return manager.getSpanCount();
}
}
|
KKorvin/uPods-android
|
app/src/main/java/com/chickenkiller/upods2/views/AutofitRecyclerView.java
|
Java
|
apache-2.0
| 1,987
|
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Units of Measurement
</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="keilw">
<meta name="description" content="Static blog generated with JBake">
<!-- Style -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<link rel="stylesheet" href="/css/base.css">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="/js/html5shiv.js"></script>
<![endif]-->
<!-- Fav icon -->
<link rel="shortcut icon" href="/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/img/favicon.ico" type="image/x-icon">
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top " role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Units of Measurement</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/pages/about.html">About</a></li>
<!--li><a href="/pages/contact.html">Contact</a></li-->
<li><a href="/pages/calendar.html">Calendar</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="nav-header">JSR 385</li>
<li><a href="https://docs.google.com/document/d/12KhosAFriGCczBs6gwtJJDfg_QlANT92_lhxUWO2gCY">Specification</a></li>
<li><a href="https://unitsofmeasurement.github.io/unit-api">API</a></li>
<li><a href="https://unitsofmeasurement.github.io/unit-api/site/apidocs/index.html">JavaDoc (API)</a></li>
<li><a href="https://unitsofmeasurement.github.io/indriya">Reference Implementation</a></li>
<li><a href="https://unitsofmeasurement.github.io/unit-tck">TCK (Technical Compatibility Kit)</a></li>
<li><a href="https://jcp.org/en/jsr/detail?id=385">Detail Page</a></li>
<li class="divider"></li>
<li><a href="https://unitsofmeasurement.github.io/uom-demos">Units Demos</a></li>
<li><a href="https://unitsofmeasurement.gitbook.io/uom-guide/">Guide Book</a></li>
<li><a href="/pages/references.html">References</a></li>
<li class="divider"></li>
<li class="nav-header">Extensions</li>
<li><a href="https://unitsofmeasurement.github.io/uom-lib">Units Libraries</a></li>
<li><a href="http://uom.si">SI Units</a></li>
<li><a href="http://www.uom.systems">Unit Systems</a></li>
<!-- FOR LATER USE if necessary
<li class="divider"></li>
<li class="nav-header">Additional Information</li>
-->
</ul>
</li>
</ul>
<!-- Right navigation -->
<ul class="nav navbar-nav navbar-right">
<li><a href="/archive.html"><i class="fa fa-list"></i> Archive</a></li>
<li><a href="/feed.xml" title="Rss"><i class="fa fa-rss"></i> Feed</a></li>
</ul>
<!-- Right navigation end -->
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav><!-- /.navbar -->
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h1>Tag: us</h1>
</div>
<!--<ul>-->
<h4>July 2020</h4>
<ul>
<li>25 - <a href="../2020/hanna.html">Hanna</a></li>
</ul>
<h4>September 2019</h4>
<ul>
<li>25 - <a href="../2019/code1jcon19-jcpaward.html">CodeOne, JCON 2019, JCP Award</a></li>
</ul>
<h4>March 2017</h4>
<ul>
<li>23 - <a href="../2017/devoxxus17.html">DevoXX US 2017</a></li>
</ul>
<h4>September 2016</h4>
<ul>
<li>20 - <a href="../2016/javaone16-f2f.html">JavaOne 2016</a></li>
</ul>
<h4>August 2016</h4>
<ul>
<li>28 - <a href="../2016/javaone16-announce.html">JavaOne 2016 Announcement</a></li>
</ul>
<h4>October 2015</h4>
<ul>
<li>28 - <a href="../2015/javaone15-jcpaward.html">JavaOne 2015, JCP Award</a></li>
</ul>
<h4>October 2014</h4>
<ul>
<li>02 - <a href="../2014/javaone14-f2f.html">JavaOne 2014</a></li>
</ul>
</div><!-- /.container -->
<footer>
<div class="container">
<hr>
<div class="row">
<div class="col-xs-10">
<p class="text-muted credit">© Units of Measurement project 2022 | Mixed with <a href="http://getbootstrap.com/">Bootstrap v3.1.1</a> | Baked with <a href="http://jbake.org">JBake v2.6.5</a> | <i title="Linux" class="fa fa-linux"></i></p>
</div>
<div class="col-xs-2 gotop">
<a href="#"><i class="fa fa-arrow-circle-up"> top</i></a>
</div>
</div>
</div>
</footer>
<!-- Placed at the end of the document so the pages load faster -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gist-embed/1.6/gist-embed.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js"></script>
<script type="text/javascript">
<!-- load prettify only when needed -->
$(document).ready(function(){
var prettify = false;
var classToAdd = 'prettyprint snippet';
$("pre > code").each(function() {
$("pre > code").parent().addClass(classToAdd);
prettify = true;
});
if(prettify) {
prettyPrint();
}
});
</script>
</body>
</html>
|
unitsofmeasurement/unitsofmeasurement.github.io
|
tags/us.html
|
HTML
|
apache-2.0
| 6,945
|
# -*- encoding: utf-8 -*-
from django.db import models
import reversion
from base.model_utils import TimeStampedModel
from base.singleton import SingletonModel
from block.models import (
Page,
PageSection,
Section,
)
|
pkimber/cms
|
cms/models.py
|
Python
|
apache-2.0
| 233
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Threading.Tasks;
namespace Falcor.Server.Routing
{
public class RoutingEngine : IFalcorRouter
{
private readonly List<PathValue> _results = new List<PathValue>();
private Lazy<Route> LazyRootRoute => new Lazy<Route>(() => Routes.FirstToComplete());
private Route RootRoute => LazyRootRoute.Value;
public RouteCollection Routes { get; } = new RouteCollection();
public async Task<FalcorResponse> RouteAsync(FalcorRequest request)
{
await Route(request).ToList().ToTask();
var response = FalcorResponse.From(_results);
return response;
}
private IObservable<PathValue> Resolve(Route route, RequestContext context)
{
if (!context.Unmatched.Any() || _results.Any(pv => pv.Path.Equals(context.Unmatched)))
return Observable.Empty<PathValue>();
var results = route(context).SelectMany(result =>
{
if (result.IsComplete)
{
var pathValues = result.Values;
if (pathValues.Any())
{
_results.AddRange(pathValues);
if (result.UnmatchedPath.Any())
{
return pathValues.ToObservable()
.Where(pathValue => pathValue.Value is Ref)
.SelectMany(pathValue =>
{
var unmatched = ((Ref) pathValue.Value).AsRef().AppendAll(result.UnmatchedPath);
return Resolve(route, context.WithUnmatched(unmatched));
})
//.StartWith(pathValues) // Is this nescessary?
;
}
}
}
else
{
var error = new Error(result.Error);
_results.Add(new PathValue(context.Unmatched, error));
return Observable.Return(new PathValue(context.Unmatched, error));
}
return Observable.Empty<PathValue>();
});
return results;
}
private IObservable<PathValue> Route(FalcorRequest request) =>
request.Paths.ToObservable()
.SelectMany(unmatched => Resolve(RootRoute, new RequestContext(request, unmatched)));
}
}
|
falcordotnet/falcor.net
|
src/Falcor.Server/Routing/RoutingEngine.cs
|
C#
|
apache-2.0
| 2,680
|
# Simple REST client for version V1 of the Domains RDAP API
This is a simple client library for version V1 of the Domains RDAP API. It provides:
* A client object that connects to the HTTP/JSON REST endpoint for the service.
* Ruby objects for data structures related to the service.
* Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.
* Control of retry, pagination, and timeouts.
Note that although this client library is supported and will continue to be updated to track changes to the service, it is otherwise considered complete and not under active development. Many Google services, especially Google Cloud Platform services, may provide a more modern client that is under more active development and improvement. See the section below titled *Which client should I use?* for more information.
## Getting started
### Before you begin
There are a few setup steps you need to complete before you can use this library:
1. If you don't already have a Google account, [sign up](https://www.google.com/accounts).
2. If you have never created a Google APIs Console project, read about [Managing Projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects) and create a project in the [Google API Console](https://console.cloud.google.com/).
3. Most APIs need to be enabled for your project. [Enable it](https://console.cloud.google.com/apis/library/domainsrdap.googleapis.com) in the console.
### Installation
Add this line to your application's Gemfile:
```ruby
gem 'google-apis-domainsrdap_v1', '~> 0.1'
```
And then execute:
```
$ bundle
```
Or install it yourself as:
```
$ gem install google-apis-domainsrdap_v1
```
### Creating a client object
Once the gem is installed, you can load the client code and instantiate a client.
```ruby
# Load the client
require "google/apis/domainsrdap_v1"
# Create a client object
client = Google::Apis::DomainsrdapV1::DomainsRDAPService.new
# Authenticate calls
client.authorization = # ... use the googleauth gem to create credentials
```
See the class reference docs for information on the methods you can call from a client.
## Documentation
More detailed descriptions of the Google simple REST clients are available in two documents.
* The [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/main/docs/usage-guide.md) discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
* The [Auth Guide](https://github.com/googleapis/google-api-ruby-client/blob/main/docs/auth-guide.md) discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
(Note: the above documents are written for the simple REST clients in general, and their examples may not reflect the Domainsrdap service in particular.)
For reference information on specific calls in the Domains RDAP API, see the {Google::Apis::DomainsrdapV1::DomainsRDAPService class reference docs}.
## Which client should I use?
Google provides two types of Ruby API client libraries: **simple REST clients** and **modern clients**.
This library, `google-apis-domainsrdap_v1`, is a simple REST client. You can identify these clients by their gem names, which are always in the form `google-apis-<servicename>_<serviceversion>`. The simple REST clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.
Modern clients are produced by a modern code generator, sometimes combined with hand-crafted functionality. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Google Cloud Platform services, but do not yet support all the services covered by the simple clients.
Gem names for modern clients are often of the form `google-cloud-<service_name>`. (For example, [google-cloud-pubsub](https://rubygems.org/gems/google-cloud-pubsub).) Note that most modern clients also have corresponding "versioned" gems with names like `google-cloud-<service_name>-<version>`. (For example, [google-cloud-pubsub-v1](https://rubygems.org/gems/google-cloud-pubsub-v1).) The "versioned" gems can be used directly, but often provide lower-level interfaces. In most cases, the main gem is recommended.
**For most users, we recommend the modern client, if one is available.** Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.
The [product documentation](https://developers.google.com/domains/rdap/) may provide guidance regarding the preferred client library to use.
## Supported Ruby versions
This library is supported on Ruby 2.5+.
Google provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.5 and later. Older versions of Ruby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.
## License
This library is licensed under Apache 2.0. Full license text is available in the {file:LICENSE.md LICENSE}.
## Support
Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).
|
googleapis/google-api-ruby-client
|
generated/google-apis-domainsrdap_v1/OVERVIEW.md
|
Markdown
|
apache-2.0
| 6,109
|
/*
* Copyright (C) 2014 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.testing.compile;
import static javax.tools.Diagnostic.NOPOS;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.sun.source.tree.Tree;
import com.sun.source.util.TreePath;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* A data structure describing the set of syntactic differences between two {@link Tree}s.
*
* @author Stephen Pratt
*/
final class TreeDifference {
private static final String NO_LINE = "[unavailable]";
private final ImmutableList<OneWayDiff> extraExpectedNodes;
private final ImmutableList<OneWayDiff> extraActualNodes;
private final ImmutableList<TwoWayDiff> differingNodes;
/** Constructs an empty {@code TreeDifference}. */
TreeDifference() {
this.extraExpectedNodes = ImmutableList.<OneWayDiff>of();
this.extraActualNodes = ImmutableList.<OneWayDiff>of();
this.differingNodes = ImmutableList.<TwoWayDiff>of();
}
/** Constructs a {@code TreeDifference} that includes the given diffs. */
TreeDifference(ImmutableList<OneWayDiff> extraExpectedNodes,
ImmutableList<OneWayDiff> extraActualNodes, ImmutableList<TwoWayDiff> differingNodes) {
this.extraExpectedNodes = extraExpectedNodes;
this.extraActualNodes = extraActualNodes;
this.differingNodes = differingNodes;
}
/** Returns {@code true} iff there are no diffs. */
boolean isEmpty() {
return extraExpectedNodes.isEmpty() && extraActualNodes.isEmpty() && differingNodes.isEmpty();
}
/**
* Returns {@code OneWayDiff}s describing nodes on the expected tree that are unmatched on the
* actual tree.
*/
ImmutableList<OneWayDiff> getExtraExpectedNodes() {
return extraExpectedNodes;
}
/**
* Returns {@code OneWayDiff}s describing nodes on the actual tree that are unmatched on the
* expected tree.
*/
ImmutableList<OneWayDiff> getExtraActualNodes() {
return extraActualNodes;
}
/** Returns {@code TwoWayDiff}s describing nodes that differ on the expected and actual trees. */
ImmutableList<TwoWayDiff> getDifferingNodes() {
return differingNodes;
}
/**
* Returns a {@code String} reporting all diffs known to this {@code TreeDifference}. No context
* will be provided in the report.
*/
String getDiffReport() {
return getDiffReport(null, null);
}
/**
* Returns a {@code String} reporting all diffs known to this {@code TreeDifference}. If an
* expected or actual {@code TreeContext} is provided, then it will be used to contextualize
* corresponding entries in the report.
*/
String getDiffReport(@Nullable TreeContext expectedContext, @Nullable TreeContext actualContext) {
ImmutableList.Builder<String> reportLines = new ImmutableList.Builder<String>();
if (!extraExpectedNodes.isEmpty()) {
reportLines.add(String.format("Found %s unmatched nodes in the expected tree. %n",
extraExpectedNodes.size()));
for (OneWayDiff diff : extraExpectedNodes) {
reportLines.add(
createMessage(diff.getDetails(), diff.getNodePath(), expectedContext, true));
}
}
if (!extraActualNodes.isEmpty()) {
reportLines.add(String.format("Found %s unmatched nodes in the actual tree. %n",
extraActualNodes.size()));
for (OneWayDiff diff : extraActualNodes) {
reportLines.add(
createMessage(diff.getDetails(), diff.getNodePath(), actualContext, false));
}
}
if (!differingNodes.isEmpty()) {
reportLines.add(String.format("Found %s nodes that differed in expected and actual trees. %n",
differingNodes.size()));
for (TwoWayDiff diff : differingNodes) {
reportLines.add(createMessage(diff.getDetails(), diff.getExpectedNodePath(),
expectedContext, diff.getActualNodePath(), actualContext));
}
}
return Joiner.on('\n').join(reportLines.build());
}
/** Creates a log entry about an extra node on the expected or actual tree. */
private String createMessage(String details, TreePath nodePath, @Nullable TreeContext treeContext,
boolean onExpected) {
long startLine = (treeContext == null)
? NOPOS : treeContext.getNodeStartLine(nodePath.getLeaf());
String contextStr = String.format("Line %s %s",
(startLine == NOPOS) ? NO_LINE : startLine,
Breadcrumbs.describeTreePath(nodePath));
return Joiner.on('\n').join(
String.format("> Extra node in %s tree.", onExpected ? "expected" : "actual"),
String.format(" %s", contextStr),
String.format(" Node contents: <%s>.", nodeContents(nodePath.getLeaf())),
String.format(" %s", details),
"");
}
/** Creates a log entry about two differing nodes. */
private String createMessage(String details, TreePath expectedNodePath,
@Nullable TreeContext expectedTreeContext, TreePath actualNodePath,
@Nullable TreeContext actualTreeContext) {
long expectedTreeStartLine = (expectedTreeContext == null)
? NOPOS : expectedTreeContext.getNodeStartLine(expectedNodePath.getLeaf());
String expectedContextStr = String.format("Line %s %s",
(expectedTreeStartLine == NOPOS) ? NO_LINE : expectedTreeStartLine,
Breadcrumbs.describeTreePath(expectedNodePath));
long actualTreeStartLine = (actualTreeContext == null)
? NOPOS : actualTreeContext.getNodeStartLine(actualNodePath.getLeaf());
String actualContextStr = String.format("Line %s %s",
(actualTreeStartLine == NOPOS) ? NO_LINE : actualTreeStartLine,
Breadcrumbs.describeTreePath(actualNodePath));
return Joiner.on('\n').join(
"> Difference in expected tree and actual tree.",
String.format(" Expected node: %s", expectedContextStr),
String.format(" Actual node: %s", actualContextStr),
String.format(" %s", details),
"");
}
/** Returns a specially formatted String containing the contents of the given node. */
private String nodeContents(Tree node) {
return node.toString().replaceFirst("\n", ""); // nodes begin with an ugly newline.
}
/**
* A {@code Builder} class for {@code TreeDifference} objects.
*/
static final class Builder {
private final ImmutableList.Builder<OneWayDiff> extraExpectedNodesBuilder;
private final ImmutableList.Builder<OneWayDiff> extraActualNodesBuilder;
private final ImmutableList.Builder<TwoWayDiff> differingNodesBuilder;
Builder() {
this.extraExpectedNodesBuilder = new ImmutableList.Builder<OneWayDiff>();
this.extraActualNodesBuilder = new ImmutableList.Builder<OneWayDiff>();
this.differingNodesBuilder = new ImmutableList.Builder<TwoWayDiff>();
}
/** Logs an extra node on the expected tree in the {@code TreeDifference} being built. */
@CanIgnoreReturnValue
Builder addExtraExpectedNode(TreePath extraNode) {
return addExtraExpectedNode(extraNode, "");
}
/** Logs an extra node on the expected tree in the {@code TreeDifference} being built. */
@CanIgnoreReturnValue
Builder addExtraExpectedNode(TreePath extraNode, String message) {
extraExpectedNodesBuilder.add(new OneWayDiff(extraNode, message));
return this;
}
/** Logs an extra node on the actual tree in the {@code TreeDifference} being built. */
@CanIgnoreReturnValue
Builder addExtraActualNode(TreePath extraNode, String message) {
extraActualNodesBuilder.add(new OneWayDiff(extraNode, message));
return this;
}
/** Logs an extra node on the actual tree in the {@code TreeDifference} being built. */
@CanIgnoreReturnValue
Builder addExtraActualNode(TreePath extraNode) {
return addExtraActualNode(extraNode, "");
}
/**
* Logs a discrepancy between an expected and actual node in the {@code TreeDifference} being
* built.
*/
@CanIgnoreReturnValue
Builder addDifferingNodes(TreePath expectedNode, TreePath actualNode) {
return addDifferingNodes(expectedNode, actualNode, "");
}
/**
* Logs a discrepancy between an expected and actual node in the {@code TreeDifference} being
* built.
*/
@CanIgnoreReturnValue
Builder addDifferingNodes(TreePath expectedNode, TreePath actualNode, String message) {
differingNodesBuilder.add(new TwoWayDiff(expectedNode, actualNode, message));
return this;
}
/** Builds and returns the {@code TreeDifference}. */
TreeDifference build() {
return new TreeDifference(extraExpectedNodesBuilder.build(),
extraActualNodesBuilder.build(), differingNodesBuilder.build());
}
}
/**
* A class describing an extra node on either the expected or actual tree.
*/
static final class OneWayDiff {
private final TreePath nodePath;
private String details;
OneWayDiff(TreePath nodePath, String details) {
this.nodePath = nodePath;
this.details = details;
}
TreePath getNodePath() {
return nodePath;
}
/** Returns a string that provides contextual details about the diff. */
String getDetails() {
return details;
}
}
/**
* A class describing a difference between a node on the expected tree and a corresponding node on
* the actual tree.
*/
static final class TwoWayDiff {
private final TreePath expectedNodePath;
private final TreePath actualNodePath;
private String details;
TwoWayDiff(TreePath expectedNodePath, TreePath actualNodePath, String details) {
this.expectedNodePath = expectedNodePath;
this.actualNodePath = actualNodePath;
this.details = details;
}
TreePath getExpectedNodePath() {
return expectedNodePath;
}
TreePath getActualNodePath() {
return actualNodePath;
}
/** Returns a string that provides contextual details about the diff. */
String getDetails() {
return details;
}
}
}
|
google/compile-testing
|
src/main/java/com/google/testing/compile/TreeDifference.java
|
Java
|
apache-2.0
| 10,594
|
/*
* 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.jclouds.azureblob.blobstore.functions;
import java.util.Map;
import java.util.SortedSet;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.jclouds.azureblob.domain.ListBlobsResponse;
import org.jclouds.blobstore.domain.PageSet;
import org.jclouds.blobstore.domain.StorageMetadata;
import org.jclouds.blobstore.domain.StorageType;
import org.jclouds.blobstore.domain.internal.PageSetImpl;
import org.jclouds.blobstore.functions.PrefixToResourceMetadata;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@Singleton
public class ListBlobsResponseToResourceList implements
Function<ListBlobsResponse, PageSet<? extends StorageMetadata>> {
private final BlobPropertiesToBlobMetadata object2blobMd;
private final PrefixToResourceMetadata prefix2ResourceMd;
protected final Function<StorageMetadata, String> indexer = new Function<StorageMetadata, String>() {
@Override
public String apply(StorageMetadata from) {
return from.getName();
}
};
@Inject
public ListBlobsResponseToResourceList(BlobPropertiesToBlobMetadata object2blobMd,
PrefixToResourceMetadata prefix2ResourceMd) {
this.object2blobMd = object2blobMd;
this.prefix2ResourceMd = prefix2ResourceMd;
}
public PageSet<? extends StorageMetadata> apply(ListBlobsResponse from) {
// use sorted set to order relative paths correctly
SortedSet<StorageMetadata> contents = Sets.<StorageMetadata> newTreeSet(Iterables.transform(from,
object2blobMd));
Map<String, StorageMetadata> nameToMd = Maps.uniqueIndex(contents, indexer);
for (String prefix : from.getBlobPrefixes()) {
prefix = prefix.endsWith("/") ? prefix.substring(0, prefix.lastIndexOf('/')) : prefix;
if (!nameToMd.containsKey(prefix)
|| nameToMd.get(prefix).getType() != StorageType.RELATIVE_PATH)
contents.add(prefix2ResourceMd.apply(prefix));
}
return new PageSetImpl<StorageMetadata>(contents, from.getNextMarker());
}
}
|
yanzhijun/jclouds-aliyun
|
providers/azureblob/src/main/java/org/jclouds/azureblob/blobstore/functions/ListBlobsResponseToResourceList.java
|
Java
|
apache-2.0
| 2,972
|
package org.sagebionetworks.client;
import static org.sagebionetworks.client.Method.GET;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.utils.URIBuilder;
import org.json.JSONException;
import org.json.JSONObject;
import org.sagebionetworks.client.exceptions.SynapseClientException;
import org.sagebionetworks.client.exceptions.SynapseException;
import org.sagebionetworks.client.exceptions.SynapseResultNotReadyException;
import org.sagebionetworks.evaluation.model.BatchUploadResponse;
import org.sagebionetworks.evaluation.model.Evaluation;
import org.sagebionetworks.evaluation.model.EvaluationRound;
import org.sagebionetworks.evaluation.model.EvaluationRoundListRequest;
import org.sagebionetworks.evaluation.model.EvaluationRoundListResponse;
import org.sagebionetworks.evaluation.model.Submission;
import org.sagebionetworks.evaluation.model.SubmissionBundle;
import org.sagebionetworks.evaluation.model.SubmissionStatus;
import org.sagebionetworks.evaluation.model.SubmissionStatusBatch;
import org.sagebionetworks.evaluation.model.SubmissionStatusEnum;
import org.sagebionetworks.evaluation.model.TeamSubmissionEligibility;
import org.sagebionetworks.evaluation.model.UserEvaluationPermissions;
import org.sagebionetworks.reflection.model.PaginatedResults;
import org.sagebionetworks.repo.model.ACCESS_TYPE;
import org.sagebionetworks.repo.model.AccessApproval;
import org.sagebionetworks.repo.model.AccessControlList;
import org.sagebionetworks.repo.model.AccessRequirement;
import org.sagebionetworks.repo.model.AuthorizationConstants;
import org.sagebionetworks.repo.model.BatchAccessApprovalInfoRequest;
import org.sagebionetworks.repo.model.BatchAccessApprovalInfoResponse;
import org.sagebionetworks.repo.model.Challenge;
import org.sagebionetworks.repo.model.ChallengePagedResults;
import org.sagebionetworks.repo.model.ChallengeTeam;
import org.sagebionetworks.repo.model.ChallengeTeamPagedResults;
import org.sagebionetworks.repo.model.Count;
import org.sagebionetworks.repo.model.DataType;
import org.sagebionetworks.repo.model.DataTypeResponse;
import org.sagebionetworks.repo.model.Entity;
import org.sagebionetworks.repo.model.EntityChildrenRequest;
import org.sagebionetworks.repo.model.EntityChildrenResponse;
import org.sagebionetworks.repo.model.EntityHeader;
import org.sagebionetworks.repo.model.EntityId;
import org.sagebionetworks.repo.model.EntityIdList;
import org.sagebionetworks.repo.model.EntityPath;
import org.sagebionetworks.repo.model.IdList;
import org.sagebionetworks.repo.model.InviteeVerificationSignedToken;
import org.sagebionetworks.repo.model.JoinTeamSignedToken;
import org.sagebionetworks.repo.model.ListWrapper;
import org.sagebionetworks.repo.model.LockAccessRequirement;
import org.sagebionetworks.repo.model.LogEntry;
import org.sagebionetworks.repo.model.MembershipInvitation;
import org.sagebionetworks.repo.model.MembershipInvtnSignedToken;
import org.sagebionetworks.repo.model.MembershipRequest;
import org.sagebionetworks.repo.model.ObjectType;
import org.sagebionetworks.repo.model.PaginatedIds;
import org.sagebionetworks.repo.model.ProjectHeader;
import org.sagebionetworks.repo.model.ProjectHeaderList;
import org.sagebionetworks.repo.model.ProjectListSortColumn;
import org.sagebionetworks.repo.model.ProjectListType;
import org.sagebionetworks.repo.model.ProjectListTypeDeprecated;
import org.sagebionetworks.repo.model.Reference;
import org.sagebionetworks.repo.model.ResponseMessage;
import org.sagebionetworks.repo.model.RestrictableObjectDescriptor;
import org.sagebionetworks.repo.model.RestrictableObjectDescriptorResponse;
import org.sagebionetworks.repo.model.RestrictionInformationRequest;
import org.sagebionetworks.repo.model.RestrictionInformationResponse;
import org.sagebionetworks.repo.model.ServiceConstants;
import org.sagebionetworks.repo.model.Team;
import org.sagebionetworks.repo.model.TeamMember;
import org.sagebionetworks.repo.model.TeamMemberTypeFilterOptions;
import org.sagebionetworks.repo.model.TeamMembershipStatus;
import org.sagebionetworks.repo.model.TrashedEntity;
import org.sagebionetworks.repo.model.UserBundle;
import org.sagebionetworks.repo.model.UserGroup;
import org.sagebionetworks.repo.model.UserGroupHeader;
import org.sagebionetworks.repo.model.UserGroupHeaderResponsePage;
import org.sagebionetworks.repo.model.UserProfile;
import org.sagebionetworks.repo.model.VersionInfo;
import org.sagebionetworks.repo.model.annotation.AnnotationsUtils;
import org.sagebionetworks.repo.model.annotation.v2.Annotations;
import org.sagebionetworks.repo.model.asynch.AsyncJobId;
import org.sagebionetworks.repo.model.asynch.AsynchronousJobStatus;
import org.sagebionetworks.repo.model.asynch.AsynchronousRequestBody;
import org.sagebionetworks.repo.model.asynch.AsynchronousResponseBody;
import org.sagebionetworks.repo.model.auth.AccessToken;
import org.sagebionetworks.repo.model.auth.AccessTokenGenerationRequest;
import org.sagebionetworks.repo.model.auth.AccessTokenGenerationResponse;
import org.sagebionetworks.repo.model.auth.AccessTokenRecord;
import org.sagebionetworks.repo.model.auth.AccessTokenRecordList;
import org.sagebionetworks.repo.model.auth.ChangePasswordInterface;
import org.sagebionetworks.repo.model.auth.ChangePasswordWithCurrentPassword;
import org.sagebionetworks.repo.model.auth.JSONWebTokenHelper;
import org.sagebionetworks.repo.model.auth.LoginResponse;
import org.sagebionetworks.repo.model.auth.NewUser;
import org.sagebionetworks.repo.model.auth.SecretKey;
import org.sagebionetworks.repo.model.auth.UserEntityPermissions;
import org.sagebionetworks.repo.model.auth.Username;
import org.sagebionetworks.repo.model.dao.WikiPageKey;
import org.sagebionetworks.repo.model.dataaccess.AccessApprovalNotificationRequest;
import org.sagebionetworks.repo.model.dataaccess.AccessApprovalNotificationResponse;
import org.sagebionetworks.repo.model.dataaccess.AccessRequirementConversionRequest;
import org.sagebionetworks.repo.model.dataaccess.AccessRequirementStatus;
import org.sagebionetworks.repo.model.dataaccess.AccessorGroupRequest;
import org.sagebionetworks.repo.model.dataaccess.AccessorGroupResponse;
import org.sagebionetworks.repo.model.dataaccess.AccessorGroupRevokeRequest;
import org.sagebionetworks.repo.model.dataaccess.CreateSubmissionRequest;
import org.sagebionetworks.repo.model.dataaccess.OpenSubmissionPage;
import org.sagebionetworks.repo.model.dataaccess.Request;
import org.sagebionetworks.repo.model.dataaccess.RequestInterface;
import org.sagebionetworks.repo.model.dataaccess.ResearchProject;
import org.sagebionetworks.repo.model.dataaccess.SubmissionInfoPage;
import org.sagebionetworks.repo.model.dataaccess.SubmissionInfoPageRequest;
import org.sagebionetworks.repo.model.dataaccess.SubmissionOrder;
import org.sagebionetworks.repo.model.dataaccess.SubmissionPage;
import org.sagebionetworks.repo.model.dataaccess.SubmissionPageRequest;
import org.sagebionetworks.repo.model.dataaccess.SubmissionState;
import org.sagebionetworks.repo.model.dataaccess.SubmissionStateChangeRequest;
import org.sagebionetworks.repo.model.discussion.CreateDiscussionReply;
import org.sagebionetworks.repo.model.discussion.CreateDiscussionThread;
import org.sagebionetworks.repo.model.discussion.DiscussionFilter;
import org.sagebionetworks.repo.model.discussion.DiscussionReplyBundle;
import org.sagebionetworks.repo.model.discussion.DiscussionReplyOrder;
import org.sagebionetworks.repo.model.discussion.DiscussionSearchRequest;
import org.sagebionetworks.repo.model.discussion.DiscussionSearchResponse;
import org.sagebionetworks.repo.model.discussion.DiscussionThreadBundle;
import org.sagebionetworks.repo.model.discussion.DiscussionThreadOrder;
import org.sagebionetworks.repo.model.discussion.EntityThreadCounts;
import org.sagebionetworks.repo.model.discussion.Forum;
import org.sagebionetworks.repo.model.discussion.MessageURL;
import org.sagebionetworks.repo.model.discussion.ReplyCount;
import org.sagebionetworks.repo.model.discussion.ThreadCount;
import org.sagebionetworks.repo.model.discussion.UpdateReplyMessage;
import org.sagebionetworks.repo.model.discussion.UpdateThreadMessage;
import org.sagebionetworks.repo.model.discussion.UpdateThreadTitle;
import org.sagebionetworks.repo.model.docker.DockerCommit;
import org.sagebionetworks.repo.model.docker.DockerCommitSortBy;
import org.sagebionetworks.repo.model.doi.v2.Doi;
import org.sagebionetworks.repo.model.doi.v2.DoiAssociation;
import org.sagebionetworks.repo.model.doi.v2.DoiRequest;
import org.sagebionetworks.repo.model.doi.v2.DoiResponse;
import org.sagebionetworks.repo.model.download.AddBatchOfFilesToDownloadListRequest;
import org.sagebionetworks.repo.model.download.AddBatchOfFilesToDownloadListResponse;
import org.sagebionetworks.repo.model.download.AddToDownloadListRequest;
import org.sagebionetworks.repo.model.download.AddToDownloadListResponse;
import org.sagebionetworks.repo.model.download.DownloadListManifestRequest;
import org.sagebionetworks.repo.model.download.DownloadListManifestResponse;
import org.sagebionetworks.repo.model.download.DownloadListPackageRequest;
import org.sagebionetworks.repo.model.download.DownloadListPackageResponse;
import org.sagebionetworks.repo.model.download.DownloadListQueryRequest;
import org.sagebionetworks.repo.model.download.DownloadListQueryResponse;
import org.sagebionetworks.repo.model.download.RemoveBatchOfFilesFromDownloadListRequest;
import org.sagebionetworks.repo.model.download.RemoveBatchOfFilesFromDownloadListResponse;
import org.sagebionetworks.repo.model.entity.BindSchemaToEntityRequest;
import org.sagebionetworks.repo.model.entity.EntityLookupRequest;
import org.sagebionetworks.repo.model.entity.FileHandleUpdateRequest;
import org.sagebionetworks.repo.model.entity.query.SortDirection;
import org.sagebionetworks.repo.model.entitybundle.v2.EntityBundle;
import org.sagebionetworks.repo.model.entitybundle.v2.EntityBundleCreate;
import org.sagebionetworks.repo.model.entitybundle.v2.EntityBundleRequest;
import org.sagebionetworks.repo.model.favorite.SortBy;
import org.sagebionetworks.repo.model.file.AddFileToDownloadListRequest;
import org.sagebionetworks.repo.model.file.AddFileToDownloadListResponse;
import org.sagebionetworks.repo.model.file.AddPartResponse;
import org.sagebionetworks.repo.model.file.BatchFileHandleCopyRequest;
import org.sagebionetworks.repo.model.file.BatchFileHandleCopyResult;
import org.sagebionetworks.repo.model.file.BatchFileRequest;
import org.sagebionetworks.repo.model.file.BatchFileResult;
import org.sagebionetworks.repo.model.file.BatchPresignedUploadUrlRequest;
import org.sagebionetworks.repo.model.file.BatchPresignedUploadUrlResponse;
import org.sagebionetworks.repo.model.file.BulkFileDownloadRequest;
import org.sagebionetworks.repo.model.file.BulkFileDownloadResponse;
import org.sagebionetworks.repo.model.file.CloudProviderFileHandleInterface;
import org.sagebionetworks.repo.model.file.DownloadList;
import org.sagebionetworks.repo.model.file.DownloadOrder;
import org.sagebionetworks.repo.model.file.DownloadOrderSummaryRequest;
import org.sagebionetworks.repo.model.file.DownloadOrderSummaryResponse;
import org.sagebionetworks.repo.model.file.ExternalFileHandle;
import org.sagebionetworks.repo.model.file.ExternalObjectStoreFileHandle;
import org.sagebionetworks.repo.model.file.FileHandle;
import org.sagebionetworks.repo.model.file.FileHandleAssociation;
import org.sagebionetworks.repo.model.file.FileHandleAssociationList;
import org.sagebionetworks.repo.model.file.FileHandleRestoreRequest;
import org.sagebionetworks.repo.model.file.FileHandleRestoreResponse;
import org.sagebionetworks.repo.model.file.FileHandleResults;
import org.sagebionetworks.repo.model.file.GoogleCloudFileHandle;
import org.sagebionetworks.repo.model.file.MultipartUploadRequest;
import org.sagebionetworks.repo.model.file.MultipartUploadStatus;
import org.sagebionetworks.repo.model.file.ProxyFileHandle;
import org.sagebionetworks.repo.model.file.S3FileHandle;
import org.sagebionetworks.repo.model.file.UploadDestination;
import org.sagebionetworks.repo.model.file.UploadDestinationLocation;
import org.sagebionetworks.repo.model.form.FormChangeRequest;
import org.sagebionetworks.repo.model.form.FormData;
import org.sagebionetworks.repo.model.form.FormGroup;
import org.sagebionetworks.repo.model.form.FormRejection;
import org.sagebionetworks.repo.model.form.ListRequest;
import org.sagebionetworks.repo.model.form.ListResponse;
import org.sagebionetworks.repo.model.message.MessageBundle;
import org.sagebionetworks.repo.model.message.MessageRecipientSet;
import org.sagebionetworks.repo.model.message.MessageSortBy;
import org.sagebionetworks.repo.model.message.MessageStatus;
import org.sagebionetworks.repo.model.message.MessageStatusType;
import org.sagebionetworks.repo.model.message.MessageToUser;
import org.sagebionetworks.repo.model.message.NotificationSettingsSignedToken;
import org.sagebionetworks.repo.model.oauth.JsonWebKeySet;
import org.sagebionetworks.repo.model.oauth.OAuthAccountCreationRequest;
import org.sagebionetworks.repo.model.oauth.OAuthAuthorizationResponse;
import org.sagebionetworks.repo.model.oauth.OAuthClient;
import org.sagebionetworks.repo.model.oauth.OAuthClientAuthorizationHistoryList;
import org.sagebionetworks.repo.model.oauth.OAuthClientIdAndSecret;
import org.sagebionetworks.repo.model.oauth.OAuthClientList;
import org.sagebionetworks.repo.model.oauth.OAuthConsentGrantedResponse;
import org.sagebionetworks.repo.model.oauth.OAuthGrantType;
import org.sagebionetworks.repo.model.oauth.OAuthProvider;
import org.sagebionetworks.repo.model.oauth.OAuthRefreshTokenInformation;
import org.sagebionetworks.repo.model.oauth.OAuthRefreshTokenInformationList;
import org.sagebionetworks.repo.model.oauth.OAuthTokenRevocationRequest;
import org.sagebionetworks.repo.model.oauth.OAuthUrlRequest;
import org.sagebionetworks.repo.model.oauth.OAuthUrlResponse;
import org.sagebionetworks.repo.model.oauth.OAuthValidationRequest;
import org.sagebionetworks.repo.model.oauth.OIDCAuthorizationRequest;
import org.sagebionetworks.repo.model.oauth.OIDCAuthorizationRequestDescription;
import org.sagebionetworks.repo.model.oauth.OIDCTokenResponse;
import org.sagebionetworks.repo.model.oauth.OIDConnectConfiguration;
import org.sagebionetworks.repo.model.principal.AccountSetupInfo;
import org.sagebionetworks.repo.model.principal.AliasCheckRequest;
import org.sagebionetworks.repo.model.principal.AliasCheckResponse;
import org.sagebionetworks.repo.model.principal.AliasList;
import org.sagebionetworks.repo.model.principal.EmailValidationSignedToken;
import org.sagebionetworks.repo.model.principal.NotificationEmail;
import org.sagebionetworks.repo.model.principal.PrincipalAlias;
import org.sagebionetworks.repo.model.principal.PrincipalAliasRequest;
import org.sagebionetworks.repo.model.principal.PrincipalAliasResponse;
import org.sagebionetworks.repo.model.principal.TypeFilter;
import org.sagebionetworks.repo.model.principal.UserGroupHeaderResponse;
import org.sagebionetworks.repo.model.project.ProjectSetting;
import org.sagebionetworks.repo.model.project.ProjectSettingsType;
import org.sagebionetworks.repo.model.project.StorageLocationSetting;
import org.sagebionetworks.repo.model.provenance.Activity;
import org.sagebionetworks.repo.model.query.QueryTableResults;
import org.sagebionetworks.repo.model.quiz.PassingRecord;
import org.sagebionetworks.repo.model.quiz.Quiz;
import org.sagebionetworks.repo.model.quiz.QuizResponse;
import org.sagebionetworks.repo.model.report.DownloadStorageReportRequest;
import org.sagebionetworks.repo.model.report.DownloadStorageReportResponse;
import org.sagebionetworks.repo.model.report.StorageReportType;
import org.sagebionetworks.repo.model.request.ReferenceList;
import org.sagebionetworks.repo.model.schema.CreateOrganizationRequest;
import org.sagebionetworks.repo.model.schema.CreateSchemaRequest;
import org.sagebionetworks.repo.model.schema.CreateSchemaResponse;
import org.sagebionetworks.repo.model.schema.JsonSchema;
import org.sagebionetworks.repo.model.schema.JsonSchemaObjectBinding;
import org.sagebionetworks.repo.model.schema.ListJsonSchemaInfoRequest;
import org.sagebionetworks.repo.model.schema.ListJsonSchemaInfoResponse;
import org.sagebionetworks.repo.model.schema.ListJsonSchemaVersionInfoRequest;
import org.sagebionetworks.repo.model.schema.ListJsonSchemaVersionInfoResponse;
import org.sagebionetworks.repo.model.schema.ListOrganizationsRequest;
import org.sagebionetworks.repo.model.schema.ListOrganizationsResponse;
import org.sagebionetworks.repo.model.schema.ListValidationResultsRequest;
import org.sagebionetworks.repo.model.schema.ListValidationResultsResponse;
import org.sagebionetworks.repo.model.schema.Organization;
import org.sagebionetworks.repo.model.schema.ValidationResults;
import org.sagebionetworks.repo.model.schema.ValidationSummaryStatistics;
import org.sagebionetworks.repo.model.search.SearchResults;
import org.sagebionetworks.repo.model.search.query.SearchQuery;
import org.sagebionetworks.repo.model.statistics.ObjectStatisticsRequest;
import org.sagebionetworks.repo.model.statistics.ObjectStatisticsResponse;
import org.sagebionetworks.repo.model.status.StackStatus;
import org.sagebionetworks.repo.model.sts.StsCredentials;
import org.sagebionetworks.repo.model.sts.StsPermission;
import org.sagebionetworks.repo.model.subscription.SortByType;
import org.sagebionetworks.repo.model.subscription.SubscriberCount;
import org.sagebionetworks.repo.model.subscription.SubscriberPagedResults;
import org.sagebionetworks.repo.model.subscription.Subscription;
import org.sagebionetworks.repo.model.subscription.SubscriptionObjectType;
import org.sagebionetworks.repo.model.subscription.SubscriptionPagedResults;
import org.sagebionetworks.repo.model.subscription.SubscriptionRequest;
import org.sagebionetworks.repo.model.subscription.Topic;
import org.sagebionetworks.repo.model.table.AppendableRowSet;
import org.sagebionetworks.repo.model.table.AppendableRowSetRequest;
import org.sagebionetworks.repo.model.table.ColumnModel;
import org.sagebionetworks.repo.model.table.ColumnModelPage;
import org.sagebionetworks.repo.model.table.CsvTableDescriptor;
import org.sagebionetworks.repo.model.table.DownloadFromTableRequest;
import org.sagebionetworks.repo.model.table.DownloadFromTableResult;
import org.sagebionetworks.repo.model.table.PaginatedColumnModels;
import org.sagebionetworks.repo.model.table.Query;
import org.sagebionetworks.repo.model.table.QueryBundleRequest;
import org.sagebionetworks.repo.model.table.QueryNextPageToken;
import org.sagebionetworks.repo.model.table.QueryOptions;
import org.sagebionetworks.repo.model.table.QueryResult;
import org.sagebionetworks.repo.model.table.QueryResultBundle;
import org.sagebionetworks.repo.model.table.RowReference;
import org.sagebionetworks.repo.model.table.RowReferenceSet;
import org.sagebionetworks.repo.model.table.RowReferenceSetResults;
import org.sagebionetworks.repo.model.table.RowSelection;
import org.sagebionetworks.repo.model.table.SnapshotRequest;
import org.sagebionetworks.repo.model.table.SnapshotResponse;
import org.sagebionetworks.repo.model.table.SqlTransformRequest;
import org.sagebionetworks.repo.model.table.SqlTransformResponse;
import org.sagebionetworks.repo.model.table.TableFileHandleResults;
import org.sagebionetworks.repo.model.table.TableUpdateRequest;
import org.sagebionetworks.repo.model.table.TableUpdateResponse;
import org.sagebionetworks.repo.model.table.TableUpdateTransactionRequest;
import org.sagebionetworks.repo.model.table.TableUpdateTransactionResponse;
import org.sagebionetworks.repo.model.table.UploadToTablePreviewRequest;
import org.sagebionetworks.repo.model.table.UploadToTablePreviewResult;
import org.sagebionetworks.repo.model.table.UploadToTableRequest;
import org.sagebionetworks.repo.model.table.UploadToTableResult;
import org.sagebionetworks.repo.model.table.ViewColumnModelRequest;
import org.sagebionetworks.repo.model.table.ViewColumnModelResponse;
import org.sagebionetworks.repo.model.table.ViewEntityType;
import org.sagebionetworks.repo.model.table.ViewScope;
import org.sagebionetworks.repo.model.table.ViewType;
import org.sagebionetworks.repo.model.v2.wiki.V2WikiHeader;
import org.sagebionetworks.repo.model.v2.wiki.V2WikiHistorySnapshot;
import org.sagebionetworks.repo.model.v2.wiki.V2WikiOrderHint;
import org.sagebionetworks.repo.model.v2.wiki.V2WikiPage;
import org.sagebionetworks.repo.model.verification.VerificationPagedResults;
import org.sagebionetworks.repo.model.verification.VerificationState;
import org.sagebionetworks.repo.model.verification.VerificationStateEnum;
import org.sagebionetworks.repo.model.verification.VerificationSubmission;
import org.sagebionetworks.repo.model.versionInfo.SynapseVersionInfo;
import org.sagebionetworks.repo.model.wiki.WikiPage;
import org.sagebionetworks.repo.web.NotFoundException;
import org.sagebionetworks.schema.adapter.JSONEntity;
import org.sagebionetworks.schema.adapter.JSONObjectAdapterException;
import org.sagebionetworks.schema.adapter.org.json.EntityFactory;
import org.sagebionetworks.simpleHttpClient.SimpleHttpClientConfig;
import org.sagebionetworks.simpleHttpClient.SimpleHttpResponse;
import org.sagebionetworks.util.FileProviderImpl;
import org.sagebionetworks.util.ValidateArgument;
import com.google.common.base.Joiner;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.JwsHeader;
import io.jsonwebtoken.Jwt;
/**
* Low-level Java Client API for Synapse REST APIs
*/
public class SynapseClientImpl extends BaseClientImpl implements SynapseClient {
public static final String SYNAPSE_JAVA_CLIENT = "Synapse-Java-Client/";
public static final String APPLICATION_OCTET_STREAM = "application/octet-stream";
private static final String TERMS_OF_USE_V2 = "/termsOfUse2";
private static final String ACCOUNT = "/account";
private static final String ACCOUNT_V2 = "/account2";
private static final String EMAIL_VALIDATION = "/emailValidation";
private static final String ACCOUNT_EMAIL_VALIDATION = ACCOUNT
+ EMAIL_VALIDATION;
private static final String EMAIL = "/email";
private static final String PORTAL_ENDPOINT_PARAM = "portalEndpoint";
private static final String SET_AS_NOTIFICATION_EMAIL_PARAM = "setAsNotificationEmail";
private static final String EMAIL_PARAM = "email";
private static final String PARAM_GENERATED_BY = "generatedBy";
private static final String PARAM_NEW_VERSION = "newVersion";
private static final String QUERY = "/query";
private static final String QUERY_URI = QUERY + "?query=";
private static final String REPO_SUFFIX_VERSION = "/version";
protected static final String STACK_STATUS = "/status";
private static final String ENTITY = "/entity";
private static final String GENERATED_BY_SUFFIX = "/generatedBy";
private static final String ENTITY_URI_PATH = "/entity";
private static final String ENTITY_ACL_PATH_SUFFIX = "/acl";
private static final String BUNDLE = "/bundle";
private static final String BUNDLE_V2 = "/bundle2";
private static final String BENEFACTOR = "/benefactor"; // from
// org.sagebionetworks.repo.web.UrlHelpers
private static final String CREATE = "/create";
private static final String ACTIVITY_URI_PATH = "/activity";
private static final String GENERATED_PATH = "/generated";
private static final String FAVORITE_URI_PATH = "/favorite";
private static final String PROJECTS_URI_PATH = "/projects";
public static final String PRINCIPAL = "/principal";
public static final String PRINCIPAL_AVAILABLE = PRINCIPAL + "/available";
public static final String NOTIFICATION_EMAIL = "/notificationEmail";
private static final String WIKI_URI_TEMPLATE = "/%1$s/%2$s/wiki";
private static final String WIKI_ID_URI_TEMPLATE = "/%1$s/%2$s/wiki/%3$s";
private static final String WIKI_URI_TEMPLATE_V2 = "/%1$s/%2$s/wiki2";
private static final String WIKI_ID_URI_TEMPLATE_V2 = "/%1$s/%2$s/wiki2/%3$s";
private static final String WIKI_ID_VERSION_URI_TEMPLATE_V2 = "/%1$s/%2$s/wiki2/%3$s/%4$s";
private static final String WIKI_TREE_URI_TEMPLATE_V2 = "/%1$s/%2$s/wikiheadertree2";
private static final String WIKI_ORDER_HINT_URI_TEMPLATE_V2 = "/%1$s/%2$s/wiki2orderhint";
private static final String WIKI_HISTORY_V2 = "/wikihistory";
private static final String ATTACHMENT_HANDLES = "/attachmenthandles";
private static final String ATTACHMENT_FILE = "/attachment";
private static final String MARKDOWN_FILE = "/markdown";
private static final String ATTACHMENT_FILE_PREVIEW = "/attachmentpreview";
private static final String FILE_NAME_PARAMETER = "?fileName=";
private static final String REDIRECT_PARAMETER = "redirect=";
private static final String OFFSET_PARAMETER = "offset=";
private static final String LIMIT_PARAMETER = "limit=";
private static final String VERSION_PARAMETER = "?wikiVersion=";
private static final String AND_VERSION_PARAMETER = "&wikiVersion=";
private static final String AND_LIMIT_PARAMETER = "&" + LIMIT_PARAMETER;
private static final String AND_REDIRECT_PARAMETER = "&"
+ REDIRECT_PARAMETER;
private static final String QUERY_REDIRECT_PARAMETER = "?"
+ REDIRECT_PARAMETER;
private static final String EVALUATION_URI_PATH = "/evaluation";
private static final String EVALUATION_ROUND = "/round";
private static final String AVAILABLE_EVALUATION_URI_PATH = "/evaluation/available";
private static final String NAME = "name";
private static final String ALL = "/all";
private static final String STATUS = "/status";
private static final String STATUS_BATCH = "/statusBatch";
private static final String LOCK_ACCESS_REQUIREMENT = "/lockAccessRequirement";
private static final String SUBMISSION = "submission";
private static final String SUBMISSION_BUNDLE = SUBMISSION + BUNDLE;
private static final String SUBMISSION_ALL = SUBMISSION + ALL;
private static final String SUBMISSION_STATUS_ALL = SUBMISSION + STATUS
+ ALL;
private static final String SUBMISSION_BUNDLE_ALL = SUBMISSION + BUNDLE
+ ALL;
private static final String STATUS_SUFFIX = "?status=";
private static final String EVALUATION_ACL_URI_PATH = "/evaluation/acl";
private static final String EVALUATION_QUERY_URI_PATH = EVALUATION_URI_PATH
+ "/" + SUBMISSION + QUERY_URI;
private static final String EVALUATION_IDS_FILTER_PARAM = "evaluationIds";
private static final String SUBMISSION_ELIGIBILITY = "/submissionEligibility";
private static final String SUBMISSION_ELIGIBILITY_HASH = "submissionEligibilityHash";
private static final String MESSAGE = "/message";
private static final String FORWARD = "/forward";
private static final String CONVERSATION = "/conversation";
private static final String MESSAGE_STATUS = MESSAGE + "/status";
private static final String MESSAGE_INBOX = MESSAGE + "/inbox";
private static final String MESSAGE_OUTBOX = MESSAGE + "/outbox";
private static final String MESSAGE_INBOX_FILTER_PARAM = "inboxFilter";
private static final String MESSAGE_ORDER_BY_PARAM = "orderBy";
private static final String MESSAGE_DESCENDING_PARAM = "descending";
protected static final String ASYNC_START = "/async/start";
protected static final String ASYNC_GET = "/async/get/";
protected static final String COLUMN = "/column";
protected static final String COLUMN_BATCH = COLUMN + "/batch";
protected static final String COLUMN_VIEW_DEFAULT = COLUMN + "/tableview/defaults";
protected static final String TABLE = "/table";
protected static final String ROW_ID = "/row";
protected static final String ROW_VERSION = "/version";
protected static final String TABLE_QUERY = TABLE + "/query";
protected static final String TABLE_QUERY_NEXTPAGE = TABLE_QUERY
+ "/nextPage";
protected static final String TABLE_DOWNLOAD_CSV = TABLE + "/download/csv";
protected static final String TABLE_UPLOAD_CSV = TABLE + "/upload/csv";
protected static final String TABLE_UPLOAD_CSV_PREVIEW = TABLE
+ "/upload/csv/preview";
protected static final String TABLE_APPEND = TABLE + "/append";
protected static final String TABLE_TRANSACTION = TABLE+"/transaction";
protected static final String ASYNCHRONOUS_JOB = "/asynchronous/job";
private static final String USER_PROFILE_PATH = "/userProfile";
private static final String NOTIFICATION_SETTINGS = "/notificationSettings";
private static final String PROFILE_IMAGE = "/image";
private static final String PROFILE_IMAGE_PREVIEW = PROFILE_IMAGE+"/preview";
private static final String USER_GROUP_HEADER_BATCH_PATH = "/userGroupHeaders/batch?ids=";
private static final String USER_GROUP_HEADER_PREFIX_PATH = "/userGroupHeaders?prefix=";
private static final String USER_GROUP_HEADER_BY_ALIAS = "/userGroupHeaders/aliases";
private static final String ACCESS_REQUIREMENT = "/accessRequirement";
private static final String ACCESS_APPROVAL = "/accessApproval";
private static final String VERSION_INFO = "/version";
private static final String FILE_HANDLE = "/fileHandle";
private static final String FILE = "/file";
private static final String FILE_PREVIEW = "/filepreview";
private static final String EXTERNAL_FILE_HANDLE = "/externalFileHandle";
private static final String EXTERNAL_FILE_HANDLE_S3 = "/externalFileHandle/s3";
private static final String EXTERNAL_FILE_HANDLE_GOOGLE_CLOUD = "/externalFileHandle/googleCloud";
private static final String FILE_HANDLES = "/filehandles";
protected static final String S3_FILE_COPY = FILE + "/s3FileCopy";
private static final String FILE_HANDLES_COPY = FILE_HANDLES+"/copy";
protected static final String FILE_BULK = FILE+"/bulk";
private static final String TRASHCAN_TRASH = "/trashcan/trash";
private static final String TRASHCAN_RESTORE = "/trashcan/restore";
private static final String TRASHCAN_VIEW = "/trashcan/view";
private static final String TRASHCAN_PURGE = "/trashcan/purge";
private static final String CHALLENGE = "/challenge";
private static final String REGISTRATABLE_TEAM = "/registratableTeam";
private static final String CHALLENGE_TEAM = "/challengeTeam";
private static final String SUBMISSION_TEAMS = "/submissionTeams";
private static final String LOG = "/log";
protected static final String DOI = "/doi";
private static final String DOI_ASSOCIATION = DOI + "/association";
private static final String DOI_LOCATE = DOI + "/locate";
private static final String ETAG = "etag";
private static final String PROJECT_SETTINGS = "/projectSettings";
private static final String STORAGE_LOCATION = "/storageLocation";
public static final String AUTH_OAUTH_2 = "/oauth2";
public static final String AUTH_OAUTH_2_AUTH_URL = AUTH_OAUTH_2+"/authurl";
public static final String AUTH_OAUTH_2_SESSION_V2 = AUTH_OAUTH_2+"/session2";
public static final String AUTH_OAUTH_2_ACCOUNT_V2 = AUTH_OAUTH_2+"/account2";
public static final String AUTH_OAUTH_2_ALIAS = AUTH_OAUTH_2+"/alias";
public static final String AUTH_OPENID_CONFIG = "/.well-known/openid-configuration";
public static final String AUTH_OAUTH_2_JWKS = AUTH_OAUTH_2+"/jwks";
public static final String AUTH_OAUTH_2_CLIENT = AUTH_OAUTH_2+"/client";
public static final String AUTH_OAUTH_2_CLIENT_SECRET = AUTH_OAUTH_2_CLIENT+"/secret/";
public static final String AUTH_OAUTH_2_REQUEST_DESCRIPTION = AUTH_OAUTH_2+"/description";
public static final String AUTH_OAUTH_2_REQUEST_CONSENT = AUTH_OAUTH_2+"/consent";
private static final String AUTH_OAUTH_2_CONSENT_CHECK = AUTH_OAUTH_2+"/consentcheck";
public static final String AUTH_OAUTH_2_TOKEN = AUTH_OAUTH_2+"/token";
public static final String AUTH_OAUTH_2_USER_INFO = AUTH_OAUTH_2+"/userinfo";
public static final String AUTH_OAUTH_2_AUDIT = AUTH_OAUTH_2 + "/audit";
public static final String AUTH_OAUTH_2_AUDIT_TOKENS = AUTH_OAUTH_2_AUDIT + "/tokens";
public static final String AUTH_OAUTH_2_AUDIT_CLIENTS = AUTH_OAUTH_2_AUDIT + "/grantedClients";
public static final String METADATA = "/metadata";
public static final String REVOKE = "/revoke";
public static final String TOKENS = "/tokens";
public static final String AUTH_OAUTH_2_GRANT_TYPE_PARAM = "grant_type";
public static final String AUTH_OAUTH_2_CODE_PARAM = "code";
public static final String AUTH_OAUTH_2_REDIRECT_URI_PARAM = "redirect_uri";
public static final String AUTH_OAUTH_2_REfRESH_TOKEN_PARAM = "refresh_token";
public static final String AUTH_OAUTH_2_SCOPE_PARAM = "scope";
public static final String AUTH_OAUTH_2_CLAIMS_PARAM = "claims";
public static final String AUTH_PERSONAL_ACCESS_TOKEN = "/personalAccessToken";
private static final String VERIFICATION_SUBMISSION = "/verificationSubmission";
private static final String CURRENT_VERIFICATION_STATE = "currentVerificationState";
private static final String VERIFICATION_STATE = "/state";
private static final String VERIFIED_USER_ID = "verifiedUserId";
private static final String USER_BUNDLE = "/bundle";
private static final String FILE_ASSOCIATE_TYPE = "fileAssociateType";
private static final String FILE_ASSOCIATE_ID = "fileAssociateId";
public static final String FILE_HANDLE_BATCH = "/fileHandle/batch";
// web request pagination parameters
public static final String LIMIT = "limit";
public static final String OFFSET = "offset";
// Team
protected static final String TEAM = "/team";
protected static final String TEAMS = "/teams";
private static final String TEAM_LIST = "/teamList";
private static final String MEMBER_LIST = "/memberList";
protected static final String USER = "/user";
protected static final String NAME_FRAGMENT_FILTER = "fragment";
protected static final String NAME_MEMBERTYPE_FILTER = "memberType";
protected static final String ICON = "/icon";
protected static final String TEAM_MEMBERS = "/teamMembers";
protected static final String MEMBER = "/member";
protected static final String PERMISSION = "/permission";
protected static final String MEMBERSHIP_STATUS = "/membershipStatus";
protected static final String TEAM_MEMBERSHIP_PERMISSION = "isAdmin";
// membership invitation
private static final String MEMBERSHIP_INVITATION = "/membershipInvitation";
private static final String OPEN_MEMBERSHIP_INVITATION = "/openInvitation";
private static final String TEAM_ID_REQUEST_PARAMETER = "teamId";
private static final String INVITEE_ID_REQUEST_PARAMETER = "inviteeId";
private static final String OPEN_MEMBERSHIP_INVITATION_COUNT = MEMBERSHIP_INVITATION + "/openInvitationCount";
// membership request
private static final String MEMBERSHIP_REQUEST = "/membershipRequest";
private static final String OPEN_MEMBERSHIP_REQUEST = "/openRequest";
private static final String REQUESTOR_ID_REQUEST_PARAMETER = "requestorId";
private static final String OPEN_MEMBERSHIP_REQUEST_COUNT = MEMBERSHIP_REQUEST + "/openRequestCount";
public static final String ACCEPT_INVITATION_ENDPOINT_PARAM = "acceptInvitationEndpoint";
public static final String ACCEPT_REQUEST_ENDPOINT_PARAM = "acceptRequestEndpoint";
public static final String NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM = "notificationUnsubscribeEndpoint";
public static final String TEAM_ENDPOINT_PARAM = "teamEndpoint";
public static final String CHALLENGE_ENDPOINT_PARAM = "challengeEndpoint";
private static final String CERTIFIED_USER_TEST = "/certifiedUserTest";
private static final String CERTIFIED_USER_TEST_RESPONSE = "/certifiedUserTestResponse";
private static final String CERTIFIED_USER_PASSING_RECORD = "/certifiedUserPassingRecord";
private static final String PROJECT = "/project";
private static final String FORUM = "/forum";
private static final String THREAD = "/thread";
private static final String THREADS = "/threads";
private static final String THREAD_COUNT = "/threadcount";
private static final String THREAD_TITLE = "/title";
private static final String DISCUSSION_MESSAGE = "/message";
private static final String REPLY = "/reply";
private static final String REPLIES = "/replies";
private static final String REPLY_COUNT = "/replycount";
private static final String URL = "/messageUrl";
private static final String PIN = "/pin";
private static final String UNPIN = "/unpin";
private static final String RESTORE = "/restore";
private static final String MODERATORS = "/moderators";
private static final String STATISTICS = "/statistics";
private static final String THREAD_COUNTS = "/threadcounts";
private static final String ENTITY_THREAD_COUNTS = ENTITY + THREAD_COUNTS;
private static final String SUBSCRIPTION = "/subscription";
private static final String LIST = "/list";
private static final String OBJECT_TYPE_PARAM = "objectType";
private static final String OBJECT = "/object";
private static final String PRINCIPAL_ID_REQUEST_PARAM = "principalId";
private static final String DOCKER_COMMIT = "/dockerCommit";
private static final String DOCKER_TAG = "/dockerTag";
private static final String NEXT_PAGE_TOKEN_PARAM = "nextPageToken=";
/**
* Note: 5 MB is currently the minimum size of a single part of S3
* Multi-part upload, so any file chunk must be at least this size.
*/
public static final int MINIMUM_CHUNK_SIZE_BYTES = ((int) Math.pow(2, 20)) * 5;
private static final String RESEARCH_PROJECT = "/researchProject";
private static final String DATA_ACCESS_REQUEST = "/dataAccessRequest";
private static final String DATA_ACCESS_SUBMISSION = "/dataAccessSubmission";
public static final String DOWNLOAD_LIST = "/download/list";
public static final String DOWNLOAD_LIST_ADD = DOWNLOAD_LIST+"/add";
public static final String DOWNLOAD_LIST_PACKAGE = DOWNLOAD_LIST+"/package";
public static final String DOWNLOAD_LIST_MANIFEST = DOWNLOAD_LIST+"/manifest";
public static final String DOWNLOAD_LIST_REMOVE = DOWNLOAD_LIST+"/remove";
public static final String DOWNLOAD_LIST_CLEAR = DOWNLOAD_LIST+"/clear";
public static final String DOWNLOAD_LIST_QUERY = DOWNLOAD_LIST+"/query";
public static final String DOWNLOAD_ORDER = "/download/order";
public static final String DOWNLOAD_ORDER_ID = DOWNLOAD_ORDER+"/{orderId}";
public static final String DOWNLOAD_ORDER_HISTORY = DOWNLOAD_ORDER+"/history";
public static final String STORAGE_REPORT = "/storageReport";
public static final String ANNOTATIONS_V2 = "/annotations2";
public static final String SCHEMA_TYPE_CREATE = "/schema/type/create/";
public static final String SCHEMA_TYPE_VALIDATION = "/schema/type/validation/";
public static final String VIEW_COLUMNS = "/column/view/scope/";
public static final String FILE_HANDLE_RESTORE = FILE_HANDLE + "/restore";
/**
* Default constructor uses the default repository and file services endpoints.
*/
public SynapseClientImpl() {
this(null);
}
public SynapseClientImpl(SimpleHttpClientConfig config) {
super(SYNAPSE_JAVA_CLIENT + ClientVersionInfo.getClientVersionInfo(), config);
}
/**
* Lookup the endpoint for a given type.
* @param type
* @return
*/
protected String getEndpointForType(RestEndpointType type){
switch(type){
case auth:
return getAuthEndpoint();
case repo:
return getRepoEndpoint();
case file:
return getFileEndpoint();
default:
throw new IllegalArgumentException("Unknown type: "+type);
}
}
/********************
* Mid Level Repository Service APIs
*
* @throws SynapseException
********************/
@Override
public AliasCheckResponse checkAliasAvailable(AliasCheckRequest request)
throws SynapseException {
return postJSONEntity(getRepoEndpoint(), PRINCIPAL_AVAILABLE, request,
AliasCheckResponse.class);
}
/**
* Send an email validation message as a precursor to creating a new user
* account.
*
* @param user
* the first name, last name and email address for the new user
* @param portalEndpoint
* the GUI endpoint (is the basis for the link in the email
* message) Must generate a valid email when a set of request
* parameters is appended to the end.
*/
@Override
public void newAccountEmailValidation(NewUser user, String portalEndpoint)
throws SynapseException {
ValidateArgument.required(user, "NewUser");
ValidateArgument.required(portalEndpoint, "portalEndpoint");
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put(PORTAL_ENDPOINT_PARAM, portalEndpoint);
voidPost(getRepoEndpoint(), ACCOUNT_EMAIL_VALIDATION, user, paramMap);
}
/**
* Create a new account, following email validation. Sets the password and
* logs the user in, returning a valid access token
*
* @param accountSetupInfo
* Note: Caller may override the first/last name, but not the
* email, given in 'newAccountEmailValidation'
* @return session
* @throws NotFoundException
*/
@Override
public LoginResponse createNewAccountForAccessToken(AccountSetupInfo accountSetupInfo)
throws SynapseException {
ValidateArgument.required(accountSetupInfo, "accountSetupInfo");
return postJSONEntity(getRepoEndpoint(), ACCOUNT_V2, accountSetupInfo, LoginResponse.class);
}
/**
* Send an email validation as a precursor to adding a new email address to
* an existing account.
*
* @param email
* the email which is claimed by the user
* @param portalEndpoint
* the GUI endpoint (is the basis for the link in the email
* message) Must generate a valid email when a set of request
* parameters is appended to the end.
* @throws NotFoundException
*/
@Override
public void additionalEmailValidation(Long userId, String email,
String portalEndpoint) throws SynapseException {
ValidateArgument.required(userId, "userId");
ValidateArgument.required(email, "email");
ValidateArgument.required(portalEndpoint, "portalEndpoint");
String uri = ACCOUNT + "/" + userId + EMAIL_VALIDATION;
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put(PORTAL_ENDPOINT_PARAM, portalEndpoint);
Username emailRequestBody = new Username();
emailRequestBody.setEmail(email);
voidPost(getRepoEndpoint(), uri, emailRequestBody, paramMap);
}
/**
* Add a new email address to an existing account.
*
* @param emailValidationSignedToken
* the token sent to the user via email
* @param setAsNotificationEmail
* if true then set the new email address to be the user's
* notification address
* @throws NotFoundException
*/
@Override
public void addEmail(EmailValidationSignedToken emailValidationSignedToken,
Boolean setAsNotificationEmail) throws SynapseException {
ValidateArgument.required(emailValidationSignedToken, "emailValidationSignedToken");
Map<String, String> paramMap = new HashMap<String, String>();
if (setAsNotificationEmail != null) {
paramMap.put(SET_AS_NOTIFICATION_EMAIL_PARAM, setAsNotificationEmail.toString());
}
voidPost(getRepoEndpoint(), EMAIL, emailValidationSignedToken, paramMap);
}
/**
* Remove an email address from an existing account.
*
* @param email
* the email to remove. Must be an established email address for
* the user
* @throws NotFoundException
*/
@Override
public void removeEmail(String email) throws SynapseException {
ValidateArgument.required(email, "email");
Map<String, String> paramMap = new HashMap<String, String>();
paramMap.put(EMAIL_PARAM, email);
super.deleteUri(getRepoEndpoint(), EMAIL, paramMap);
}
/**
* This sets the email used for user notifications, i.e. when a Synapse
* message is sent and if the user has elected to receive messages by email,
* then this is the email address at which the user will receive the
* message. Note: The given email address must already be established as
* being owned by the user.
*/
public void setNotificationEmail(String email) throws SynapseException {
ValidateArgument.required(email, "email");
Username username = new Username();
username.setEmail(email);
voidPut(getRepoEndpoint(), NOTIFICATION_EMAIL, username);
}
/**
* This gets the email used for user notifications, i.e. when a Synapse
* message is sent and if the user has elected to receive messages by email,
* then this is the email address at which the user will receive the
* message.
*
* @throws SynapseException
*/
public NotificationEmail getNotificationEmail() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), NOTIFICATION_EMAIL, NotificationEmail.class);
}
/**
* Create a new Entity.
*
* @param <T>
* @param entity
* @return the newly created entity
* @throws SynapseException
*/
@Override
public <T extends Entity> T createEntity(T entity) throws SynapseException {
return createEntity(entity, null);
}
/**
* Create a new Entity.
*
* @param <T>
* @param entity
* @param activityId
* set generatedBy relationship to the new entity
* @return the newly created entity
* @throws SynapseException
*/
@SuppressWarnings("unchecked")
@Override
public <T extends Entity> T createEntity(T entity, String activityId)
throws SynapseException {
ValidateArgument.required(entity, "entity");
entity.setConcreteType(entity.getClass().getName());
String uri = ENTITY_URI_PATH;
if (activityId != null) {
uri += "?" + PARAM_GENERATED_BY + "=" + activityId;
}
return (T) postJSONEntity(getRepoEndpoint(), uri, entity, entity.getClass());
}
/**
* Create an Entity, Annotations, and ACL with a single call.
*
* @param ebc
* @return
* @throws SynapseException
*/
@Override
public EntityBundle createEntityBundleV2(EntityBundleCreate ebc)
throws SynapseException {
return createEntityBundleV2(ebc, null);
}
/**
* Create an Entity, Annotations, and ACL with a single call.
*
* @param ebc
* @param activityId
* the activity to create a generatedBy relationship with the
* entity in the Bundle.
* @return
* @throws SynapseException
*/
@Override
public EntityBundle createEntityBundleV2(EntityBundleCreate ebc,
String activityId) throws SynapseException {
ValidateArgument.required(ebc, "EntityBundleV2Create");
String url = ENTITY_URI_PATH + BUNDLE_V2 + CREATE;
if (activityId != null) {
url += "?" + PARAM_GENERATED_BY + "=" + activityId;
}
return postJSONEntity(getRepoEndpoint(), url, ebc, EntityBundle.class);
}
/**
* Update an Entity, Annotations, and ACL with a single call.
*
* @param ebc
* @return
* @throws SynapseException
*/
@Override
public EntityBundle updateEntityBundleV2(String entityId,
EntityBundleCreate ebc) throws SynapseException {
return updateEntityBundleV2(entityId, ebc, null);
}
/**
* Update an Entity, Annotations, and ACL with a single call.
*
* @param ebc
* @param activityId
* the activity to create a generatedBy relationship with the
* entity in the Bundle.
* @return
* @throws SynapseException
*/
@Override
public EntityBundle updateEntityBundleV2(String entityId,
EntityBundleCreate ebc, String activityId) throws SynapseException {
ValidateArgument.required(ebc, "EntityBundleV2Create");
String url = ENTITY_URI_PATH + "/" + entityId + BUNDLE_V2;
return putJSONEntity(getRepoEndpoint(), url, ebc, EntityBundle.class);
}
/**
* Get an entity using its ID.
*
* @param entityId
* @return the entity
* @throws SynapseException
*/
@Override
public Entity getEntityById(String entityId) throws SynapseException {
return getEntityByIdForVersion(entityId, null);
}
/**
* Get a specific version of an entity using its ID an version number.
*
* @param entityId
* @param versionNumber
* @return the entity
* @throws SynapseException
*/
@Override
public Entity getEntityByIdForVersion(String entityId, Long versionNumber)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = ENTITY_URI_PATH + "/" + entityId;
if (versionNumber != null) {
url += REPO_SUFFIX_VERSION + "/" + versionNumber;
}
return getJSONEntity(getRepoEndpoint(), url, Entity.class);
}
/**
* Get a bundle of information about an entity in a single call.
*
* @param entityId
* @param bundleV2Request
* @return
* @throws SynapseException
*/
@Override
public EntityBundle getEntityBundleV2(String entityId, EntityBundleRequest bundleV2Request)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = ENTITY_URI_PATH + "/" + entityId + BUNDLE_V2;
return postJSONEntity(getRepoEndpoint(), url, bundleV2Request, EntityBundle.class);
}
/**
* Get a bundle of information about an entity in a single call.
*
* @param entityId
* - the entity id to retrieve
* @param versionNumber
* - the specific version to retrieve
* @return
* @throws SynapseException
*/
@Override
public EntityBundle getEntityBundleV2(String entityId, Long versionNumber,
EntityBundleRequest bundleV2Request) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(versionNumber, "versionNumber");
String url = ENTITY_URI_PATH + "/" + entityId + REPO_SUFFIX_VERSION
+ "/" + versionNumber + BUNDLE_V2;
return postJSONEntity(getRepoEndpoint(), url, bundleV2Request, EntityBundle.class);
}
/**
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public PaginatedResults<VersionInfo> getEntityVersions(String entityId,
int offset, int limit) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = ENTITY_URI_PATH + "/" + entityId + REPO_SUFFIX_VERSION
+ "?" + OFFSET + "=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, VersionInfo.class);
}
@Override
public AccessControlList getACL(String entityId) throws SynapseException {
String uri = ENTITY_URI_PATH + "/" + entityId + ENTITY_ACL_PATH_SUFFIX;
return getJSONEntity(getRepoEndpoint(), uri, AccessControlList.class);
}
@Override
public EntityHeader getEntityBenefactor(String entityId)
throws SynapseException {
String uri = ENTITY_URI_PATH + "/" + entityId + BENEFACTOR;
return getJSONEntity(getRepoEndpoint(), uri, EntityHeader.class);
}
@Override
public UserProfile getMyProfile() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), USER_PROFILE_PATH, UserProfile.class);
}
@Override
public void updateMyProfile(UserProfile userProfile) throws SynapseException {
voidPut(getRepoEndpoint(), USER_PROFILE_PATH, userProfile);
}
@Override
public ResponseMessage updateNotificationSettings(NotificationSettingsSignedToken token) throws SynapseException {
return putJSONEntity(getRepoEndpoint(), NOTIFICATION_SETTINGS, token, ResponseMessage.class);
}
@Override
public StsCredentials getTemporaryCredentialsForEntity(String entityId, StsPermission permission)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(permission, "permission");
String uri = ENTITY_URI_PATH + "/" + entityId + "/sts?permission=" + permission.name();
return getJSONEntity(getRepoEndpoint(), uri, StsCredentials.class);
}
@Override
public UserProfile getUserProfile(String ownerId) throws SynapseException {
String uri = USER_PROFILE_PATH + "/" + ownerId;
return getJSONEntity(getRepoEndpoint(), uri, UserProfile.class);
}
/**
* Batch get headers for users/groups matching a list of Synapse IDs.
*
* @param ids
* @return
* @throws JSONException
* @throws SynapseException
*/
@Override
public UserGroupHeaderResponsePage getUserGroupHeadersByIds(List<String> ids)
throws SynapseException {
String uri = listToString(ids);
return getJSONEntity(getRepoEndpoint(), uri, UserGroupHeaderResponsePage.class);
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#getUserProfilePictureUrl(java.lang.String)
*/
@Override
public URL getUserProfilePictureUrl(String ownerId) throws ClientProtocolException, MalformedURLException, IOException, SynapseException {
return getUrl(getRepoEndpoint(),
USER_PROFILE_PATH+"/"+ownerId+PROFILE_IMAGE+"?"+REDIRECT_PARAMETER+"false");
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#getUserProfilePicturePreviewUrl(java.lang.String)
*/
@Override
public URL getUserProfilePicturePreviewUrl(String ownerId) throws ClientProtocolException, MalformedURLException, IOException, SynapseException {
return getUrl(getRepoEndpoint(),
USER_PROFILE_PATH+"/"+ownerId+PROFILE_IMAGE_PREVIEW+"?"+REDIRECT_PARAMETER+"false");
}
private String listToString(List<String> ids) {
StringBuilder sb = new StringBuilder();
sb.append(USER_GROUP_HEADER_BATCH_PATH);
for (String id : ids) {
sb.append(id);
sb.append(',');
}
// Remove the trailing comma
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
@Override
public UserGroupHeaderResponsePage getUserGroupHeadersByPrefix(String prefix)
throws SynapseException, UnsupportedEncodingException {
return getUserGroupHeadersByPrefix(prefix, null, null, null);
}
@Override
public UserGroupHeaderResponsePage getUserGroupHeadersByPrefix(
String prefix, TypeFilter type, Long limit, Long offset) throws SynapseException,
UnsupportedEncodingException {
String encodedPrefix = URLEncoder.encode(prefix, "UTF-8");
StringBuilder builder = new StringBuilder();
builder.append(USER_GROUP_HEADER_PREFIX_PATH);
builder.append(encodedPrefix);
if(limit != null){
builder.append("&" + LIMIT_PARAMETER + limit);
}
if(offset != null){
builder.append( "&" + OFFSET_PARAMETER + offset);
}
if(type != null){
builder.append("&typeFilter="+type.name());
}
return getJSONEntity(getRepoEndpoint(), builder.toString(), UserGroupHeaderResponsePage.class);
}
@Override
public List<UserGroupHeader> getUserGroupHeadersByAliases(
List<String> aliases) throws SynapseException {
ValidateArgument.required(aliases, "aliases");
AliasList list = new AliasList();
list.setList(aliases);
UserGroupHeaderResponse response = postJSONEntity(getRepoEndpoint(),
USER_GROUP_HEADER_BY_ALIAS, list, UserGroupHeaderResponse.class);
return response.getList();
}
/**
* Update an ACL.
*/
@Override
public AccessControlList updateACL(AccessControlList acl)
throws SynapseException {
String uri = ENTITY_URI_PATH + "/" + acl.getId() + ENTITY_ACL_PATH_SUFFIX;
return putJSONEntity(getRepoEndpoint(), uri, acl, AccessControlList.class);
}
@Override
public void deleteACL(String entityId) throws SynapseException {
String uri = ENTITY_URI_PATH + "/" + entityId + ENTITY_ACL_PATH_SUFFIX;
deleteUri(getRepoEndpoint(), uri);
}
@Override
public AccessControlList createACL(AccessControlList acl)
throws SynapseException {
String uri = ENTITY_URI_PATH + "/" + acl.getId() + ENTITY_ACL_PATH_SUFFIX;
return postJSONEntity(getRepoEndpoint(), uri, acl, AccessControlList.class);
}
@Override
public PaginatedResults<UserProfile> getUsers(int offset, int limit)
throws SynapseException {
String uri = "/user?" + OFFSET + "=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), uri, UserProfile.class);
}
@Override
public List<UserProfile> listUserProfiles(List<Long> userIds) throws SynapseException {
IdList idList = new IdList();
idList.setList(userIds);
return getListOfJSONEntity(getRepoEndpoint(), USER_PROFILE_PATH, idList, UserProfile.class);
}
@Override
public PaginatedResults<UserGroup> getGroups(int offset, int limit)
throws SynapseException {
String uri = "/userGroup?" + OFFSET + "=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), uri, UserGroup.class);
}
/**
* Get the current user's permission for a given entity.
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public UserEntityPermissions getUsersEntityPermissions(String entityId)
throws SynapseException {
String url = ENTITY_URI_PATH + "/" + entityId + "/permissions";
return getJSONEntity(getRepoEndpoint(), url, UserEntityPermissions.class);
}
/**
* Get the current user's permission for a given entity.
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public boolean canAccess(String entityId, ACCESS_TYPE accessType)
throws SynapseException {
return canAccess(entityId, ObjectType.ENTITY, accessType);
}
@Override
public boolean canAccess(String id, ObjectType type, ACCESS_TYPE accessType)
throws SynapseException {
ValidateArgument.required(id, "id");
ValidateArgument.required(type, "ObjectType");
ValidateArgument.required(accessType, "AccessType");
switch (type) {
case ENTITY:
return canAccess(ENTITY_URI_PATH + "/" + id + "/access?accessType=" + accessType.name());
case EVALUATION:
return canAccess(EVALUATION_URI_PATH + "/" + id + "/access?accessType=" + accessType.name());
default:
throw new IllegalArgumentException("ObjectType not supported: " + type.toString());
}
}
private boolean canAccess(String serviceUrl) throws SynapseException {
return getBooleanResult(getRepoEndpoint(), serviceUrl);
}
/**
* Get the annotations for an entity.
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public Annotations getAnnotationsV2(String entityId) throws SynapseException {
String url = ENTITY_URI_PATH + "/" + entityId + ANNOTATIONS_V2;
return getJSONEntity(getRepoEndpoint(), url, Annotations.class);
}
/**
* Update the annotations of an entity.
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public Annotations updateAnnotationsV2(String entityId, Annotations updated)
throws SynapseException {
String url = ENTITY_URI_PATH + "/" + entityId + ANNOTATIONS_V2;
return putJSONEntity(getRepoEndpoint(), url, updated, Annotations.class);
}
@SuppressWarnings("unchecked")
@Override
public <T extends AccessRequirement> T createAccessRequirement(T ar)
throws SynapseException {
ValidateArgument.required(ar, "AccessRequirement");
ar.setConcreteType(ar.getClass().getName());
return (T) postJSONEntity(getRepoEndpoint(), ACCESS_REQUIREMENT, ar, ar.getClass());
}
@SuppressWarnings("unchecked")
@Override
public <T extends AccessRequirement> T updateAccessRequirement(T ar)
throws SynapseException {
ValidateArgument.required(ar, "AccessRequirement");
String url = createEntityUri(ACCESS_REQUIREMENT, ar.getId().toString());
return (T) putJSONEntity(getRepoEndpoint(), url, ar, ar.getClass());
}
@Override
public LockAccessRequirement createLockAccessRequirement(String entityId)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
return postJSONEntity(getRepoEndpoint(),
ENTITY + "/" + entityId + LOCK_ACCESS_REQUIREMENT, null,
LockAccessRequirement.class);
}
@Override
public void deleteAccessRequirement(Long arId) throws SynapseException {
deleteUri(getRepoEndpoint(), ACCESS_REQUIREMENT + "/" + arId);
}
@Override
public AccessRequirement getAccessRequirement(Long requirementId)
throws SynapseException {
String uri = ACCESS_REQUIREMENT + "/" + requirementId;
return getJSONEntity(getRepoEndpoint(), uri, AccessRequirement.class);
}
@Override
public PaginatedResults<AccessRequirement> getAccessRequirements(
RestrictableObjectDescriptor subjectId, Long limit, Long offset) throws SynapseException {
String uri = null;
switch (subjectId.getType()){
case ENTITY:
uri = ENTITY + "/" + subjectId.getId() + ACCESS_REQUIREMENT;
break;
case EVALUATION:
uri = EVALUATION_URI_PATH + "/" + subjectId.getId() + ACCESS_REQUIREMENT;
break;
case TEAM:
uri = TEAM + "/" + subjectId.getId() + ACCESS_REQUIREMENT;
break;
default:
throw new SynapseClientException("Unsupported type "+ subjectId.getType());
}
uri += "?limit="+limit+"&offset="+offset;
return getPaginatedResults(getRepoEndpoint(), uri, AccessRequirement.class);
}
@SuppressWarnings("unchecked")
@Override
public <T extends AccessApproval> T createAccessApproval(T aa) throws SynapseException {
ValidateArgument.required(aa, "AccessApproval");
return (T) postJSONEntity(getRepoEndpoint(), ACCESS_APPROVAL, aa, aa.getClass());
}
@Override
public AccessApproval getAccessApproval(Long approvalId)
throws SynapseException {
String uri = ACCESS_APPROVAL + "/" + approvalId;
return getJSONEntity(getRepoEndpoint(), uri, AccessApproval.class);
}
@Override
public void revokeAccessApprovals(String requirementId, String accessorId) throws SynapseException {
String url = ACCESS_APPROVAL + "?requirementId=" + requirementId + "&accessorId=" + accessorId;
deleteUri(getRepoEndpoint(), url);
}
@Override
public JSONObject getEntity(String uri) throws SynapseException {
return getJson(getRepoEndpoint(), uri);
}
/**
* Get an entity given an Entity ID and the class of the Entity.
*
* @param <T>
* @param entityId
* @param clazz
* @return the entity
* @throws SynapseException
*/
@Override
public <T extends JSONEntity> T getEntity(String entityId,
Class<? extends T> clazz) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(clazz, "Entity class");
String uri = createEntityUri(ENTITY_URI_PATH, entityId);
return getJSONEntity(getRepoEndpoint(), uri, clazz);
}
/**
* Helper to create an Entity URI.
*
* @param prefix
* @param id
* @return
*/
private static String createEntityUri(String prefix, String id) {
StringBuilder uri = new StringBuilder();
uri.append(prefix);
uri.append("/");
uri.append(id);
return uri.toString();
}
/**
* Update a dataset, layer, preview, annotations, etc...
*
* @param <T>
* @param entity
* @return the updated entity
* @throws SynapseException
*/
@Override
public <T extends Entity> T putEntity(T entity) throws SynapseException {
return putEntity(entity, null, null);
}
/**
* Update a dataset, layer, preview, annotations, etc...
*
* @param <T>
* @param entity
* @param activityId
* activity to create generatedBy conenction to
* @param newVersion
* force update a FileEntity to a new version. May be null.
* @return the updated entity
* @throws SynapseException
*/
@Override
@SuppressWarnings("unchecked")
public <T extends Entity> T putEntity(T entity, String activityId, Boolean newVersion)
throws SynapseException {
ValidateArgument.required(entity, "entity");
URIBuilder uri = new URIBuilder();
uri.setPath(createEntityUri(ENTITY_URI_PATH, entity.getId()));
if (activityId != null) {
uri.setParameter(PARAM_GENERATED_BY, activityId);
}
if (newVersion != null) {
uri.setParameter(PARAM_NEW_VERSION, newVersion.toString());
}
return (T) putJSONEntity(getRepoEndpoint(), uri.toString(), entity, entity.getClass());
}
/**
* Deletes a dataset, layer, etc.. This only moves the entity to the trash
* can. To permanently delete the entity, use deleteAndPurgeEntity().
*/
@Override
public <T extends Entity> void deleteEntity(T entity)
throws SynapseException {
deleteEntity(entity, null);
}
/**
* Deletes a dataset, layer, etc.. By default, it moves the entity to the
* trash can. There is the option to skip the trash and delete the entity
* permanently.
*/
@Override
public <T extends Entity> void deleteEntity(T entity, Boolean skipTrashCan)
throws SynapseException {
ValidateArgument.required(entity, "entity");
deleteEntityById(entity.getId(), skipTrashCan);
}
/**
* Deletes a dataset, layer, etc.. This only moves the entity to the trash
* can. To permanently delete the entity, use deleteAndPurgeEntity().
*/
@Override
public void deleteEntityById(String entityId) throws SynapseException {
deleteEntityById(entityId, null);
}
/**
* Deletes a dataset, layer, etc.. By default, it moves the entity to the
* trash can. There is the option to skip the trash and delete the entity
* permanently.
*/
@Override
public void deleteEntityById(String entityId, Boolean skipTrashCan)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String uri = createEntityUri(ENTITY_URI_PATH, entityId);
if (skipTrashCan != null && skipTrashCan) {
uri = uri + "?" + ServiceConstants.SKIP_TRASH_CAN_PARAM + "=true";
}
deleteUri(getRepoEndpoint(), uri);
}
@Override
public <T extends Entity> void deleteEntityVersion(T entity,
Long versionNumber) throws SynapseException {
ValidateArgument.required(entity, "entity");
deleteEntityVersionById(entity.getId(), versionNumber);
}
@Override
public void deleteEntityVersionById(String entityId, Long versionNumber)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(versionNumber, "versionNumber");
String uri = createEntityUri(ENTITY_URI_PATH, entityId);
uri += REPO_SUFFIX_VERSION + "/" + versionNumber;
deleteUri(getRepoEndpoint(), uri);
}
/**
* Get the hierarchical path to this entity
*
* @param entity
* @return
* @throws SynapseException
*/
@Override
public EntityPath getEntityPath(Entity entity) throws SynapseException {
return getEntityPath(entity.getId());
}
/**
* Get the hierarchical path to this entity via its id and urlPrefix
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public EntityPath getEntityPath(String entityId) throws SynapseException {
String url = ENTITY_URI_PATH + "/" + entityId + "/path";
return getJSONEntity(getRepoEndpoint(), url, EntityPath.class);
}
@Deprecated
/* wrong use of PaginatedResults since expected returned data is not a page */
@Override
public PaginatedResults<EntityHeader> getEntityTypeBatch(List<String> entityIds)
throws SynapseException {
String url = ENTITY_URI_PATH + "/type";
url += "?"
+ ServiceConstants.BATCH_PARAM
+ "="
+ StringUtils.join(entityIds,
ServiceConstants.BATCH_PARAM_VALUE_SEPARATOR);
return getPaginatedResults(getRepoEndpoint(), url, EntityHeader.class);
}
@Deprecated
/* wrong use of PaginatedResults since expected returned data is not a page */
@Override
public PaginatedResults<EntityHeader> getEntityHeaderBatch(
List<Reference> references) throws SynapseException {
ReferenceList list = new ReferenceList();
list.setReferences(references);
String url = ENTITY_URI_PATH + "/header";
return getPaginatedResults(getRepoEndpoint(), url, list, EntityHeader.class);
}
@Override
public URL getFileHandleTemporaryUrl(String fileHandleId)
throws IOException, SynapseException {
String uri = getFileHandleTemporaryURI(fileHandleId, false);
return getUrl(getFileEndpoint(), uri);
}
private String getFileHandleTemporaryURI(String fileHandleId,
boolean redirect) {
return FILE_HANDLE + "/" + fileHandleId + "/url"
+ QUERY_REDIRECT_PARAMETER + redirect;
}
@Override
public void downloadFromFileHandleTemporaryUrl(String fileHandleId,
File destinationFile) throws SynapseException {
String uri = getFileEndpoint() + getFileHandleTemporaryURI(fileHandleId, false);
downloadFromSynapse(uri, null, destinationFile);
}
/**
* Put the contents of the passed file to the passed URL.
*
* @param url
* @param file
* @throws IOException
* @throws ClientProtocolException
*/
@Override
public String putFileToURL(URL url, File file, String contentType) throws SynapseException {
return super.putFileToURL(url, file, contentType);
}
/**
* Create an External File Handle. This is used to references a file that is
* not stored in Synapse.
*
* @param efh
* @return
* @throws SynapseException
*/
@Override
public ExternalFileHandle createExternalFileHandle(ExternalFileHandle efh)
throws SynapseException {
return postJSONEntity(getFileEndpoint(), EXTERNAL_FILE_HANDLE, efh, ExternalFileHandle.class);
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#createExternalS3FileHandle(org.sagebionetworks.repo.model.file.S3FileHandle)
*/
@Override
public S3FileHandle createExternalS3FileHandle(S3FileHandle handle) throws SynapseException{
return postJSONEntity(getFileEndpoint(), EXTERNAL_FILE_HANDLE_S3, handle, S3FileHandle.class);
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#createExternalGoogleCloudFileHandle(org.sagebionetworks.repo.model.file.GoogleCloudFileHandle)
*/
@Override
public GoogleCloudFileHandle createExternalGoogleCloudFileHandle(GoogleCloudFileHandle handle) throws SynapseException{
return postJSONEntity(getFileEndpoint(), EXTERNAL_FILE_HANDLE_GOOGLE_CLOUD, handle, GoogleCloudFileHandle.class);
}
@Override
public ProxyFileHandle createExternalProxyFileHandle(ProxyFileHandle handle) throws SynapseException{
return postJSONEntity(getFileEndpoint(), EXTERNAL_FILE_HANDLE, handle, ProxyFileHandle.class);
}
@Override
public ExternalObjectStoreFileHandle createExternalObjectStoreFileHandle(ExternalObjectStoreFileHandle handle) throws SynapseException{
return postJSONEntity(getFileEndpoint(), EXTERNAL_FILE_HANDLE, handle, ExternalObjectStoreFileHandle.class);
}
@Override
public S3FileHandle createS3FileHandleCopy(String originalFileHandleId, String name, String contentType)
throws SynapseException {
String uri = FILE_HANDLE + "/" + originalFileHandleId + "/copy";
S3FileHandle changes = new S3FileHandle();
changes.setFileName(name);
changes.setContentType(contentType);
return postJSONEntity(getFileEndpoint(), uri, changes, S3FileHandle.class);
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#startBulkFileDownload(org.sagebionetworks.repo.model.file.BulkFileDownloadRequest)
*/
@Override
public String startBulkFileDownload(BulkFileDownloadRequest request) throws SynapseException{
return startAsynchJob(AsynchJobType.BulkFileDownload, request);
}
@Override
public BulkFileDownloadResponse getBulkFileDownloadResults(String asyncJobToken) throws SynapseException, SynapseResultNotReadyException {
return (BulkFileDownloadResponse) getAsyncResult(AsynchJobType.BulkFileDownload, asyncJobToken, (String) null);
}
/**
* Get the raw file handle. Note: Only the creator of a the file handle can
* get the raw file handle.
*
* @param fileHandleId
* @return
* @throws SynapseException
*/
@Override
public FileHandle getRawFileHandle(String fileHandleId) throws SynapseException {
return getJSONEntity(getFileEndpoint(), FILE_HANDLE + "/" + fileHandleId, FileHandle.class);
}
/**
* Delete a raw file handle. Note: Only the creator of a the file handle can
* delete the file handle.
*
* @param fileHandleId
* @throws SynapseException
*/
@Override
public void deleteFileHandle(String fileHandleId) throws SynapseException {
deleteUri(getFileEndpoint(), FILE_HANDLE + "/" + fileHandleId);
}
/**
* Delete the preview associated with the given file handle. Note: Only the
* creator of a the file handle can delete the preview.
*
* @param fileHandleId
* @throws SynapseException
*/
@Override
public void clearPreview(String fileHandleId) throws SynapseException {
deleteUri(getFileEndpoint(), FILE_HANDLE + "/" + fileHandleId + FILE_PREVIEW);
}
/**
* Guess the content type of a file by reading the start of the file stream
* using URLConnection.guessContentTypeFromStream(is); If URLConnection
* fails to return a content type then "application/octet-stream" will be
* returned.
*
* @param file
* @return
* @throws FileNotFoundException
* @throws IOException
*/
public static String guessContentTypeFromStream(File file)
throws FileNotFoundException, IOException {
InputStream is = new BufferedInputStream(new FileInputStream(file));
try {
// Let java guess from the stream.
String contentType = URLConnection.guessContentTypeFromStream(is);
// If Java fails then set the content type to be octet-stream
if (contentType == null) {
contentType = APPLICATION_OCTET_STREAM;
}
return contentType;
} finally {
is.close();
}
}
/**
*
* Create a wiki page for a given owner object.
*
* @param ownerId
* @param ownerType
* @param toCreate
* @return
* @throws SynapseException
*/
@Override
public WikiPage createWikiPage(String ownerId, ObjectType ownerType,
WikiPage toCreate) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
ValidateArgument.required(toCreate, "WikiPage");
String uri = createWikiURL(ownerId, ownerType);
return postJSONEntity(getRepoEndpoint(), uri, toCreate, WikiPage.class);
}
/**
* Helper to create a wiki URL that does not include the wiki id.
*
* @param ownerId
* @param ownerType
* @return
*/
private String createWikiURL(String ownerId, ObjectType ownerType) {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
return String.format(WIKI_URI_TEMPLATE, ownerType.name().toLowerCase(), ownerId);
}
/**
* Get a WikiPage using its key
*
* @param key
* @return
* @throws SynapseException
*/
@Override
public WikiPage getWikiPage(WikiPageKey key) throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createWikiURL(key);
return getJSONEntity(getRepoEndpoint(), uri, WikiPage.class);
}
@Override
public WikiPage getWikiPageForVersion(WikiPageKey key,
Long version) throws SynapseException {
String uri = createWikiURL(key) + VERSION_PARAMETER + version;
return getJSONEntity(getRepoEndpoint(), uri, WikiPage.class);
}
@Override
public WikiPageKey getRootWikiPageKey(String ownerId, ObjectType ownerType) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
String uri = createWikiURL(ownerId, ownerType)+"key";
return getJSONEntity(getRepoEndpoint(), uri, WikiPageKey.class);
}
/**
* Get a the root WikiPage for a given owner.
*
* @param ownerId
* @param ownerType
* @return
* @throws SynapseException
*/
@Override
public WikiPage getRootWikiPage(String ownerId, ObjectType ownerType)
throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
String uri = createWikiURL(ownerId, ownerType);
return getJSONEntity(getRepoEndpoint(), uri, WikiPage.class);
}
/**
* Get all of the FileHandles associated with a WikiPage, including any
* PreviewHandles.
*
* @param key
* @return
* @throws SynapseException
*/
@Override
public FileHandleResults getWikiAttachmenthHandles(WikiPageKey key)
throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createWikiURL(key) + ATTACHMENT_HANDLES;
return getJSONEntity(getRepoEndpoint(), uri, FileHandleResults.class);
}
private static String createWikiAttachmentURI(WikiPageKey key,
String fileName, boolean redirect) throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createWikiURL(key) + ATTACHMENT_FILE + FILE_NAME_PARAMETER
+ encodedName + AND_REDIRECT_PARAMETER + redirect;
}
/**
* Get the temporary URL for a WikiPage attachment. This is an alternative
* to downloading the attachment to a file.
*
* @param key
* - Identifies a wiki page.
* @param fileName
* - The name of the attachment file.
* @return
* @throws IOException
* @throws ClientProtocolException
* @throws SynapseException
*/
@Override
public URL getWikiAttachmentTemporaryUrl(WikiPageKey key, String fileName)
throws ClientProtocolException, IOException, SynapseException {
return getUrl(getRepoEndpoint(),
createWikiAttachmentURI(key, fileName, false));
}
@Override
public void downloadWikiAttachment(WikiPageKey key, String fileName,
File target) throws SynapseException {
String uri = createWikiAttachmentURI(key, fileName, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
private static String createWikiAttachmentPreviewURI(WikiPageKey key,
String fileName, boolean redirect) throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createWikiURL(key) + ATTACHMENT_FILE_PREVIEW
+ FILE_NAME_PARAMETER + encodedName + AND_REDIRECT_PARAMETER
+ redirect;
}
/**
* Get the temporary URL for a WikiPage attachment preview. This is an
* alternative to downloading the attachment to a file.
*
* @param key
* - Identifies a wiki page.
* @param fileName
* - The name of the attachment file.
* @return
* @throws IOException
* @throws ClientProtocolException
* @throws SynapseException
*/
@Override
public URL getWikiAttachmentPreviewTemporaryUrl(WikiPageKey key,
String fileName) throws ClientProtocolException, IOException,
SynapseException {
return getUrl(getRepoEndpoint(),
createWikiAttachmentPreviewURI(key, fileName, false));
}
@Override
public void downloadWikiAttachmentPreview(WikiPageKey key, String fileName,
File target) throws SynapseException {
String uri = createWikiAttachmentPreviewURI(key, fileName, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
/**
* Get the temporary URL for the data file of a FileEntity for the current
* version of the entity.. This is an alternative to downloading the file.
*
* @param entityId
* @return
* @throws ClientProtocolException
* @throws MalformedURLException
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getFileEntityTemporaryUrlForCurrentVersion(String entityId)
throws ClientProtocolException, MalformedURLException, IOException,
SynapseException {
return getUrl(getRepoEndpoint(),
ENTITY + "/" + entityId + FILE + QUERY_REDIRECT_PARAMETER + "false");
}
@Deprecated
@Override
public void downloadFromFileEntityCurrentVersion(String fileEntityId,
File destinationFile) throws SynapseException {
String uri = ENTITY + "/" + fileEntityId + FILE + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
@Deprecated
@Override
public void downloadFromFileEntityForVersion(String entityId,
Long versionNumber, File destinationFile) throws SynapseException {
String uri = ENTITY + "/" + entityId + VERSION_INFO + "/"
+ versionNumber + FILE + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
/**
* Get the temporary URL for the data file preview of a FileEntity for the
* current version of the entity.. This is an alternative to downloading the
* file.
*
* @param entityId
* @return
* @throws ClientProtocolException
* @throws MalformedURLException
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getFileEntityPreviewTemporaryUrlForCurrentVersion(String entityId)
throws ClientProtocolException, MalformedURLException, IOException,
SynapseException {
String uri = ENTITY + "/" + entityId + FILE_PREVIEW
+ QUERY_REDIRECT_PARAMETER + "false";
return getUrl(getRepoEndpoint(), uri);
}
@Override
public void downloadFromFileEntityPreviewCurrentVersion(
String fileEntityId, File destinationFile) throws SynapseException {
String uri = ENTITY + "/" + fileEntityId + FILE_PREVIEW + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
/**
* Get the temporary URL for the data file of a FileEntity for a given
* version number. This is an alternative to downloading the file.
*
* @param entityId
* @return
* @throws ClientProtocolException
* @throws MalformedURLException
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getFileEntityTemporaryUrlForVersion(String entityId,
Long versionNumber) throws ClientProtocolException,
MalformedURLException, IOException, SynapseException {
String uri = ENTITY + "/" + entityId + VERSION_INFO + "/"
+ versionNumber + FILE + QUERY_REDIRECT_PARAMETER + "false";
return getUrl(getRepoEndpoint(), uri);
}
/**
* Get the temporary URL for the data file of a FileEntity for a given
* version number. This is an alternative to downloading the file.
*
* @param entityId
* @return
* @throws ClientProtocolException
* @throws MalformedURLException
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getFileEntityPreviewTemporaryUrlForVersion(String entityId,
Long versionNumber) throws ClientProtocolException,
MalformedURLException, IOException, SynapseException {
String uri = ENTITY + "/" + entityId + VERSION_INFO + "/"
+ versionNumber + FILE_PREVIEW + QUERY_REDIRECT_PARAMETER
+ "false";
return getUrl(getRepoEndpoint(), uri);
}
@Override
public void downloadFromFileEntityPreviewForVersion(String entityId,
Long versionNumber, File destinationFile) throws SynapseException {
String uri = ENTITY + "/" + entityId + VERSION_INFO + "/"
+ versionNumber + FILE_PREVIEW + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
/**
* Update a WikiPage
*
* @param ownerId
* @param ownerType
* @param toUpdate
* @return
* @throws SynapseException
*/
@Override
public WikiPage updateWikiPage(String ownerId, ObjectType ownerType,
WikiPage toUpdate) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
ValidateArgument.required(toUpdate, "WikiPage");
ValidateArgument.required(toUpdate.getId(), "WikiPage Id");
String uri = String.format(WIKI_ID_URI_TEMPLATE, ownerType.name()
.toLowerCase(), ownerId, toUpdate.getId());
return putJSONEntity(getRepoEndpoint(), uri, toUpdate, WikiPage.class);
}
/**
* Delete a WikiPage
*
* @param key
* @throws SynapseException
*/
@Override
public void deleteWikiPage(WikiPageKey key) throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createWikiURL(key);
deleteUri(getRepoEndpoint(), uri);
}
/**
* Helper to build a URL for a wiki page.
*
* @param key
* @return
*/
private static String createWikiURL(WikiPageKey key) {
ValidateArgument.required(key, "key");
return String.format(WIKI_ID_URI_TEMPLATE, key.getOwnerObjectType()
.name().toLowerCase(), key.getOwnerObjectId(),
key.getWikiPageId());
}
/**
* Get the file handles for the current version of an entity.
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public FileHandleResults getEntityFileHandlesForCurrentVersion(
String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String uri = ENTITY_URI_PATH + "/" + entityId + FILE_HANDLES;
return getJSONEntity(getRepoEndpoint(), uri, FileHandleResults.class);
}
/**
* Get the file hanldes for a given version of an entity.
*
* @param entityId
* @param versionNumber
* @return
* @throws SynapseException
*/
@Override
public FileHandleResults getEntityFileHandlesForVersion(String entityId,
Long versionNumber) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String uri = ENTITY_URI_PATH + "/" + entityId + "/version/"
+ versionNumber + FILE_HANDLES;
return getJSONEntity(getRepoEndpoint(), uri, FileHandleResults.class);
}
// V2 WIKIPAGE METHODS
/**
* Helper to create a V2 Wiki URL (No ID)
*/
private String createV2WikiURL(String ownerId, ObjectType ownerType) {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
return String.format(WIKI_URI_TEMPLATE_V2, ownerType.name()
.toLowerCase(), ownerId);
}
/**
* Helper to build a URL for a V2 Wiki page, with ID
*
* @param key
* @return
*/
private static String createV2WikiURL(WikiPageKey key) {
ValidateArgument.required(key, "key");
return String.format(WIKI_ID_URI_TEMPLATE_V2, key.getOwnerObjectType()
.name().toLowerCase(), key.getOwnerObjectId(),
key.getWikiPageId());
}
/**
*
* Create a V2 WikiPage for a given owner object.
*
* @param ownerId
* @param ownerType
* @param toCreate
* @return
* @throws SynapseException
*/
@Override
public V2WikiPage createV2WikiPage(String ownerId, ObjectType ownerType,
V2WikiPage toCreate) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
ValidateArgument.required(toCreate, "WikiPage");
String uri = createV2WikiURL(ownerId, ownerType);
return postJSONEntity(getRepoEndpoint(), uri, toCreate, V2WikiPage.class);
}
/**
* Get a V2 WikiPage using its key
*
* @param key
* @return
* @throws SynapseException
*/
@Override
public V2WikiPage getV2WikiPage(WikiPageKey key)
throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createV2WikiURL(key);
return getJSONEntity(getRepoEndpoint(), uri, V2WikiPage.class);
}
/**
* Get a version of a V2 WikiPage using its key and version number
*/
@Override
public V2WikiPage getVersionOfV2WikiPage(WikiPageKey key, Long version)
throws SynapseException {
ValidateArgument.required(key, "key");
ValidateArgument.required(version, "version");
String uri = createV2WikiURL(key) + VERSION_PARAMETER + version;
return getJSONEntity(getRepoEndpoint(), uri, V2WikiPage.class);
}
/**
* Get a the root V2 WikiPage for a given owner.
*
* @param ownerId
* @param ownerType
* @return
* @throws SynapseException
*/
@Override
public V2WikiPage getV2RootWikiPage(String ownerId, ObjectType ownerType)
throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
String uri = createV2WikiURL(ownerId, ownerType);
return getJSONEntity(getRepoEndpoint(), uri, V2WikiPage.class);
}
/**
* Update a V2 WikiPage
*
* @param ownerId
* @param ownerType
* @param toUpdate
* @return
* @throws SynapseException
*/
@Override
public V2WikiPage updateV2WikiPage(String ownerId, ObjectType ownerType,
V2WikiPage toUpdate) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
ValidateArgument.required(toUpdate, "WikiPage");
ValidateArgument.required(toUpdate.getId(), "WikiPage Id");
String uri = String.format(WIKI_ID_URI_TEMPLATE_V2, ownerType.name()
.toLowerCase(), ownerId, toUpdate.getId());
return putJSONEntity(getRepoEndpoint(), uri, toUpdate, V2WikiPage.class);
}
@Override
public V2WikiOrderHint updateV2WikiOrderHint(V2WikiOrderHint toUpdate)
throws SynapseException {
ValidateArgument.required(toUpdate, "toUpdate");
ValidateArgument.required(toUpdate.getOwnerId(), "V2WikiOrderHint.ownerId");
ValidateArgument.required(toUpdate.getOwnerObjectType(), "V2WikiOrderHint.ownerObjectType");
String uri = String.format(WIKI_ORDER_HINT_URI_TEMPLATE_V2, toUpdate
.getOwnerObjectType().name().toLowerCase(),
toUpdate.getOwnerId());
return putJSONEntity(getRepoEndpoint(), uri, toUpdate, V2WikiOrderHint.class);
}
/**
* Restore contents of a V2 WikiPage to the contents of a particular
* version.
*
* @param ownerId
* @param ownerType
* @param wikiId
* @param versionToRestore
* @return
* @throws SynapseException
*/
@Override
public V2WikiPage restoreV2WikiPage(String ownerId, ObjectType ownerType,
String wikiId, Long versionToRestore)
throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
ValidateArgument.required(wikiId, "wikiId");
ValidateArgument.required(versionToRestore, "versionToRestore");
String uri = String.format(WIKI_ID_VERSION_URI_TEMPLATE_V2, ownerType
.name().toLowerCase(), ownerId, wikiId, String
.valueOf(versionToRestore));
return putJSONEntity(getRepoEndpoint(), uri, null, V2WikiPage.class);
}
/**
* Get all of the FileHandles associated with a V2 WikiPage, including any
* PreviewHandles.
*
* @param key
* @return
* @throws SynapseException
*/
@Override
public FileHandleResults getV2WikiAttachmentHandles(WikiPageKey key)
throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createV2WikiURL(key) + ATTACHMENT_HANDLES;
return getJSONEntity(getRepoEndpoint(), uri, FileHandleResults.class);
}
@Override
public FileHandleResults getVersionOfV2WikiAttachmentHandles(
WikiPageKey key, Long version) throws SynapseException {
ValidateArgument.required(key, "key");
ValidateArgument.required(version, "version");
String uri = createV2WikiURL(key) + ATTACHMENT_HANDLES
+ VERSION_PARAMETER + version + AND_REDIRECT_PARAMETER + "false";
return getJSONEntity(getRepoEndpoint(), uri, FileHandleResults.class);
}
@Override
public String downloadV2WikiMarkdown(WikiPageKey key)
throws ClientProtocolException, FileNotFoundException, IOException,
SynapseException {
ValidateArgument.required(key, "key");
String uri = createV2WikiURL(key) + MARKDOWN_FILE + QUERY_REDIRECT_PARAMETER + "false";
return downloadFileToString(getRepoEndpoint(), uri, /*gunzip*/true);
}
@Override
public String downloadVersionOfV2WikiMarkdown(WikiPageKey key, Long version)
throws ClientProtocolException, FileNotFoundException, IOException,
SynapseException {
ValidateArgument.required(key, "key");
ValidateArgument.required(version, "version");
String uri = createV2WikiURL(key) + MARKDOWN_FILE + VERSION_PARAMETER
+ version + AND_REDIRECT_PARAMETER + "false";
return downloadFileToString(getRepoEndpoint(), uri, /*gunzip*/true);
}
private static String createV2WikiAttachmentURI(WikiPageKey key,
String fileName, boolean redirect) throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createV2WikiURL(key) + ATTACHMENT_FILE + FILE_NAME_PARAMETER
+ encodedName + AND_REDIRECT_PARAMETER + redirect;
}
/**
* Get the temporary URL for a V2 WikiPage attachment. This is an
* alternative to downloading the attachment to a file.
*
* @param key
* - Identifies a V2 wiki page.
* @param fileName
* - The name of the attachment file.
* @return
* @throws IOException
* @throws ClientProtocolException
* @throws SynapseException
*/
@Override
public URL getV2WikiAttachmentTemporaryUrl(WikiPageKey key, String fileName)
throws ClientProtocolException, IOException, SynapseException {
return getUrl(getRepoEndpoint(), createV2WikiAttachmentURI(key, fileName, false));
}
@Override
public void downloadV2WikiAttachment(WikiPageKey key, String fileName,
File target) throws SynapseException {
String uri = createV2WikiAttachmentURI(key, fileName, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
private static String createV2WikiAttachmentPreviewURI(WikiPageKey key,
String fileName, boolean redirect) throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createV2WikiURL(key) + ATTACHMENT_FILE_PREVIEW
+ FILE_NAME_PARAMETER + encodedName + AND_REDIRECT_PARAMETER
+ redirect;
}
/**
* Get the temporary URL for a V2 WikiPage attachment preview. This is an
* alternative to downloading the attachment to a file.
*
* @param key
* - Identifies a V2 wiki page.
* @param fileName
* - The name of the attachment file.
* @return
* @throws IOException
* @throws ClientProtocolException
* @throws SynapseException
*/
@Override
public URL getV2WikiAttachmentPreviewTemporaryUrl(WikiPageKey key,
String fileName) throws ClientProtocolException, IOException,
SynapseException {
return getUrl(getRepoEndpoint(), createV2WikiAttachmentPreviewURI(key, fileName, false));
}
@Override
public void downloadV2WikiAttachmentPreview(WikiPageKey key,
String fileName, File target) throws SynapseException {
String uri = createV2WikiAttachmentPreviewURI(key, fileName, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
private static String createVersionOfV2WikiAttachmentPreviewURI(
WikiPageKey key, String fileName, Long version, boolean redirect)
throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createV2WikiURL(key) + ATTACHMENT_FILE_PREVIEW
+ FILE_NAME_PARAMETER + encodedName + AND_REDIRECT_PARAMETER
+ redirect + AND_VERSION_PARAMETER + version;
}
@Override
public URL getVersionOfV2WikiAttachmentPreviewTemporaryUrl(WikiPageKey key,
String fileName, Long version) throws ClientProtocolException,
IOException, SynapseException {
return getUrl(getRepoEndpoint(),
createVersionOfV2WikiAttachmentPreviewURI(key, fileName, version, false));
}
@Override
public void downloadVersionOfV2WikiAttachmentPreview(WikiPageKey key,
String fileName, Long version, File target) throws SynapseException {
String uri = createVersionOfV2WikiAttachmentPreviewURI(key, fileName, version, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
private static String createVersionOfV2WikiAttachmentURI(WikiPageKey key,
String fileName, Long version, boolean redirect)
throws SynapseClientException {
ValidateArgument.required(key, "key");
ValidateArgument.required(fileName, "fileName");
String encodedName;
try {
encodedName = URLEncoder.encode(fileName, "UTF-8");
} catch (IOException e) {
throw new SynapseClientException("Failed to encode " + fileName, e);
}
return createV2WikiURL(key) + ATTACHMENT_FILE + FILE_NAME_PARAMETER
+ encodedName + AND_REDIRECT_PARAMETER + redirect
+ AND_VERSION_PARAMETER + version;
}
@Override
public URL getVersionOfV2WikiAttachmentTemporaryUrl(WikiPageKey key,
String fileName, Long version) throws ClientProtocolException,
IOException, SynapseException {
return getUrl(getRepoEndpoint(),
createVersionOfV2WikiAttachmentURI(key, fileName, version, false));
}
// alternative to getVersionOfV2WikiAttachmentTemporaryUrl
@Override
public void downloadVersionOfV2WikiAttachment(WikiPageKey key,
String fileName, Long version, File target) throws SynapseException {
String uri = createVersionOfV2WikiAttachmentURI(key, fileName, version, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
/**
* Delete a V2 WikiPage
*
* @param key
* @throws SynapseException
*/
@Override
public void deleteV2WikiPage(WikiPageKey key) throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createV2WikiURL(key);
deleteUri(getRepoEndpoint(), uri);
}
/**
* Get the WikiHeader tree for a given owner object.
*
* @param ownerId
* @param ownerType
* @return
* @throws SynapseException
*/
@Override
public PaginatedResults<V2WikiHeader> getV2WikiHeaderTree(String ownerId,
ObjectType ownerType, Long limit, Long offset) throws SynapseException {
ValidateArgument.required(ownerId, "ownerId");
ValidateArgument.required(ownerType, "ownerType");
String uri = String.format(WIKI_TREE_URI_TEMPLATE_V2, ownerType.name()
.toLowerCase(), ownerId) + "?offset" + "=" + offset + "&limit="
+ limit;
return getPaginatedResults(getRepoEndpoint(), uri, V2WikiHeader.class);
}
@Override
public V2WikiOrderHint getV2OrderHint(WikiPageKey key)
throws SynapseException {
ValidateArgument.required(key, "key");
String uri = String.format(WIKI_ORDER_HINT_URI_TEMPLATE_V2, key
.getOwnerObjectType().name().toLowerCase(),
key.getOwnerObjectId());
return getJSONEntity(getRepoEndpoint(), uri, V2WikiOrderHint.class);
}
/**
* Get the tree of snapshots (outlining each modification) for a particular
* V2 WikiPage
*
* @param key
* @return
* @throws SynapseException
*/
@Override
public PaginatedResults<V2WikiHistorySnapshot> getV2WikiHistory(
WikiPageKey key, Long limit, Long offset) throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createV2WikiURL(key) + WIKI_HISTORY_V2 + "?"
+ OFFSET_PARAMETER + offset + AND_LIMIT_PARAMETER + limit;
return getPaginatedResults(getRepoEndpoint(), uri, V2WikiHistorySnapshot.class);
}
/******************** Low Level APIs ********************/
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#startAsynchJob(org.sagebionetworks.client.AsynchJobType, org.sagebionetworks.repo.model.asynch.AsynchronousRequestBody)
*/
public String startAsynchJob(AsynchJobType type, AsynchronousRequestBody request)
throws SynapseException {
String url = type.getStartUrl(request);
String endpoint = getEndpointForType(type.getRestEndpoint());
AsyncJobId jobId = postJSONEntity(endpoint, url, request, AsyncJobId.class);
return jobId.getToken();
}
@Override
public void cancelAsynchJob(String jobId) throws SynapseException {
String url = ASYNCHRONOUS_JOB + "/" + jobId + "/cancel";
getJson(getRepoEndpoint(), url);
}
@Override
public AsynchronousResponseBody getAsyncResult(AsynchJobType type, String jobId, AsynchronousRequestBody request)
throws SynapseException, SynapseClientException, SynapseResultNotReadyException {
String url = type.getResultUrl(jobId, request);
String endpoint = getEndpointForType(type.getRestEndpoint());
return getAsynchJobResponse(url, type.getReponseClass(), endpoint);
}
@Override
public AsynchronousResponseBody getAsyncResult(AsynchJobType type, String jobId, String entityId)
throws SynapseException, SynapseClientException, SynapseResultNotReadyException {
String url = type.getResultUrl(jobId, entityId);
String endpoint = getEndpointForType(type.getRestEndpoint());
return getAsynchJobResponse(url, type.getReponseClass(), endpoint);
}
@Override
public AsynchronousResponseBody getAsyncResult(AsynchJobType type, String jobId)
throws SynapseException, SynapseClientException, SynapseResultNotReadyException {
return getAsyncResult(type, jobId, (String) null);
}
/**
* Get a job response body for a url.
* @param url
* @param clazz
* @return
* @throws SynapseException
*/
private AsynchronousResponseBody getAsynchJobResponse(String url, Class<? extends AsynchronousResponseBody> clazz, String endpoint) throws SynapseException {
JSONObject jsonObject = getJson(endpoint, url);
try {
return EntityFactory.createEntityFromJSONObject(jsonObject, AsynchronousResponseBody.class);
} catch (JSONObjectAdapterException e) {
try {
AsynchronousJobStatus status = EntityFactory.createEntityFromJSONObject(jsonObject, AsynchronousJobStatus.class);
throw new SynapseResultNotReadyException(status);
} catch (JSONObjectAdapterException e2) {
throw new SynapseClientException(e2.getMessage(), e2);
}
}
}
/**
* @return status
* @throws SynapseException
*/
@Override
public StackStatus getCurrentStackStatus() throws SynapseException{
return getJSONEntity(getRepoEndpoint(), STACK_STATUS, StackStatus.class);
}
@Override
public SearchResults search(SearchQuery searchQuery) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), "/search", searchQuery, SearchResults.class);
}
/**
* Helper for pagination of messages
*/
private String setMessageParameters(String path,
List<MessageStatusType> inboxFilter, MessageSortBy orderBy,
Boolean descending, Long limit, Long offset) {
ValidateArgument.required(path, "path");
URIBuilder builder = new URIBuilder();
builder.setPath(path);
if (inboxFilter != null) {
builder.setParameter(MESSAGE_INBOX_FILTER_PARAM,
StringUtils.join(inboxFilter.toArray(), ','));
}
if (orderBy != null) {
builder.setParameter(MESSAGE_ORDER_BY_PARAM, orderBy.name());
}
if (descending != null) {
builder.setParameter(MESSAGE_DESCENDING_PARAM, "" + descending);
}
if (limit != null) {
builder.setParameter(LIMIT, "" + limit);
}
if (offset != null) {
builder.setParameter(OFFSET, "" + offset);
}
return builder.toString();
}
@Override
public MessageToUser sendMessage(MessageToUser message)
throws SynapseException {
return postJSONEntity(getRepoEndpoint(), MESSAGE, message, MessageToUser.class);
}
/**
* Convenience function to upload a simple string message body, then send
* message using resultant fileHandleId
*
* @param message
* @param messageBody
* @return the created message
* @throws SynapseException
*/
@Override
public MessageToUser sendStringMessage(MessageToUser message,
String messageBody) throws SynapseException {
message.setFileHandleId(uploadStringToS3(messageBody));
return sendMessage(message);
}
private String uploadStringToS3(String toUpload) throws SynapseException {
try {
byte[] messageByteArray = toUpload.getBytes("UTF-8");
return multipartUpload(new ByteArrayInputStream(messageByteArray),
(long) messageByteArray.length, "content", "text/plain; charset=UTF-8", null, false, false).getId();
} catch (UnsupportedEncodingException e) {
throw new SynapseClientException(e);
}
}
/**
* Convenience function to upload a simple string message body, then send
* message to entity owner using resultant fileHandleId
*
* @param message
* @param entityId
* @param messageBody
* @return the created message
* @throws SynapseException
*/
@Override
public MessageToUser sendStringMessage(MessageToUser message,
String entityId, String messageBody) throws SynapseException {
message.setFileHandleId(uploadStringToS3(messageBody));
return sendMessage(message, entityId);
}
@Override
public MessageToUser sendMessage(MessageToUser message, String entityId)
throws SynapseException {
String uri = ENTITY + "/" + entityId + "/" + MESSAGE;
return postJSONEntity(getRepoEndpoint(), uri, message, MessageToUser.class);
}
@Override
public PaginatedResults<MessageBundle> getInbox(
List<MessageStatusType> inboxFilter, MessageSortBy orderBy,
Boolean descending, long limit, long offset)
throws SynapseException {
String uri = setMessageParameters(MESSAGE_INBOX, inboxFilter, orderBy,
descending, limit, offset);
return getPaginatedResults(getRepoEndpoint(), uri, MessageBundle.class);
}
@Override
public PaginatedResults<MessageToUser> getOutbox(MessageSortBy orderBy,
Boolean descending, long limit, long offset)
throws SynapseException {
String uri = setMessageParameters(MESSAGE_OUTBOX, null, orderBy,
descending, limit, offset);
return getPaginatedResults(getRepoEndpoint(), uri, MessageToUser.class);
}
@Override
public MessageToUser getMessage(String messageId) throws SynapseException {
String uri = MESSAGE + "/" + messageId;
return getJSONEntity(getRepoEndpoint(), uri, MessageToUser.class);
}
@Override
public MessageToUser forwardMessage(String messageId,
MessageRecipientSet recipients) throws SynapseException {
String uri = MESSAGE + "/" + messageId + FORWARD;
return postJSONEntity(getRepoEndpoint(), uri, recipients, MessageToUser.class);
}
@Override
public PaginatedResults<MessageToUser> getConversation(
String associatedMessageId, MessageSortBy orderBy,
Boolean descending, long limit, long offset)
throws SynapseException {
String uri = setMessageParameters(MESSAGE + "/" + associatedMessageId
+ CONVERSATION, null, orderBy, descending, limit, offset);
return getPaginatedResults(getRepoEndpoint(), uri, MessageToUser.class);
}
@Override
public void updateMessageStatus(MessageStatus status) throws SynapseException {
voidPut(getRepoEndpoint(), MESSAGE_STATUS, status);
}
private static String createDownloadMessageURI(String messageId, boolean redirect) {
return MESSAGE + "/" + messageId + FILE + "?" + REDIRECT_PARAMETER + redirect;
}
@Override
public String getMessageTemporaryUrl(String messageId)
throws SynapseException, MalformedURLException, IOException {
String uri = createDownloadMessageURI(messageId, false);
return getStringDirect(getRepoEndpoint(), uri);
}
@Override
public String downloadMessage(String messageId) throws SynapseException,
MalformedURLException, IOException {
String uri = createDownloadMessageURI(messageId, false);
return downloadFileToString(getRepoEndpoint(), uri, /*gunzip*/false);
}
@Override
public void downloadMessageToFile(String messageId, File target)
throws SynapseException {
String uri = createDownloadMessageURI(messageId, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
/**
* Get the appropriate piece of the URL based on the attachment type
*
* @param type
* @return
*/
public static String getAttachmentTypeURL(ServiceConstants.AttachmentType type) {
switch (type) {
case ENTITY:
return ENTITY;
case USER_PROFILE:
return USER_PROFILE_PATH;
default:
throw new IllegalArgumentException("Unrecognized attachment type: " + type);
}
}
/**
* @return version
* @throws SynapseException
*/
@Override
public SynapseVersionInfo getVersionInfo() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), VERSION_INFO, SynapseVersionInfo.class);
}
/**
* Get the activity generatedBy an Entity
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public Activity getActivityForEntity(String entityId)
throws SynapseException {
return getActivityForEntityVersion(entityId, null);
}
/**
* Get the activity generatedBy an Entity
*
* @param entityId
* @param versionNumber
* @return
* @throws SynapseException
*/
@Override
public Activity getActivityForEntityVersion(String entityId,
Long versionNumber) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = createEntityUri(ENTITY_URI_PATH, entityId);
if (versionNumber != null) {
url += REPO_SUFFIX_VERSION + "/" + versionNumber;
}
url += GENERATED_BY_SUFFIX;
return getJSONEntity(getRepoEndpoint(), url, Activity.class);
}
/**
* Set the activity generatedBy an Entity
*
* @param entityId
* @param activityId
* @return
* @throws SynapseException
*/
@Override
public Activity setActivityForEntity(String entityId, String activityId)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(activityId, "activityId");
String url = createEntityUri(ENTITY_URI_PATH, entityId) + GENERATED_BY_SUFFIX;
if (activityId != null) {
url += "?" + PARAM_GENERATED_BY + "=" + activityId;
}
return putJSONEntity(getRepoEndpoint(), url, null, Activity.class);
}
/**
* Delete the generatedBy relationship for an Entity (does not delete the
* activity)
*
* @param entityId
* @throws SynapseException
*/
@Override
public void deleteGeneratedByForEntity(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String uri = createEntityUri(ENTITY_URI_PATH, entityId) + GENERATED_BY_SUFFIX;
deleteUri(getRepoEndpoint(), uri);
}
/**
* Create an activity
*
* @param activity
* @return
* @throws SynapseException
*/
@Override
public Activity createActivity(Activity activity) throws SynapseException {
ValidateArgument.required(activity, "activity");
return postJSONEntity(getRepoEndpoint(), ACTIVITY_URI_PATH, activity, Activity.class);
}
/**
* Get activity by id
*
* @param activityId
* @return
* @throws SynapseException
*/
@Override
public Activity getActivity(String activityId) throws SynapseException {
ValidateArgument.required(activityId, "Activity ID");
String url = createEntityUri(ACTIVITY_URI_PATH, activityId);
return getJSONEntity(getRepoEndpoint(), url, Activity.class);
}
/**
* Update an activity
*
* @param activity
* @return
* @throws SynapseException
*/
@Override
public Activity putActivity(Activity activity) throws SynapseException {
ValidateArgument.required(activity, "Activity");
String url = createEntityUri(ACTIVITY_URI_PATH, activity.getId());
return putJSONEntity(getRepoEndpoint(), url, activity, Activity.class);
}
/**
* Delete an activity. This will remove all generatedBy connections to this
* activity as well.
*
* @param activityId
* @throws SynapseException
*/
@Override
public void deleteActivity(String activityId) throws SynapseException {
ValidateArgument.required(activityId, "activityId");
String uri = createEntityUri(ACTIVITY_URI_PATH, activityId);
deleteUri(getRepoEndpoint(), uri);
}
@Override
public PaginatedResults<Reference> getEntitiesGeneratedBy(
String activityId, Integer limit, Integer offset)
throws SynapseException {
ValidateArgument.required(activityId, "activityId");
String url = createEntityUri(ACTIVITY_URI_PATH, activityId
+ GENERATED_PATH + "?" + OFFSET + "=" + offset + "&limit="
+ limit);
return getPaginatedResults(getRepoEndpoint(), url, Reference.class);
}
@Override
public Evaluation createEvaluation(Evaluation eval) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), EVALUATION_URI_PATH, eval, Evaluation.class);
}
@Override
public Evaluation getEvaluation(String evalId) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = createEntityUri(EVALUATION_URI_PATH, evalId);
return getJSONEntity(getRepoEndpoint(), url, Evaluation.class);
}
@Override
public PaginatedResults<Evaluation> getEvaluationByContentSource(String id,
int offset, int limit) throws SynapseException {
return getEvaluationByContentSource(id, null, offset, limit);
}
@Override
public PaginatedResults<Evaluation> getEvaluationByContentSource(String id, ACCESS_TYPE accessType,
int offset, int limit) throws SynapseException {
return getEvaluationByContentSource(id, accessType, false, null, offset, limit);
}
@Override
public PaginatedResults<Evaluation> getEvaluationByContentSource(String id, ACCESS_TYPE accessType,
boolean activeOnly, List<Long> evaluationIds,
int offset, int limit) throws SynapseException {
String url = ENTITY_URI_PATH + "/" + id + EVALUATION_URI_PATH + "?"
+ OFFSET + "=" + offset + "&limit=" + limit + "&activeOnly="+activeOnly;
if (accessType != null) {
url += "&accessType=" + accessType.name();
}
if (evaluationIds != null && !evaluationIds.isEmpty()) {
String evaluationIdsString = evaluationIds.stream()
.map(Object::toString)
.collect(Collectors.joining(","));
url += "&evaluationIds=" + evaluationIdsString;
}
return getPaginatedResults(getRepoEndpoint(), url, Evaluation.class);
}
@Override
public PaginatedResults<Evaluation> getAvailableEvaluationsPaginated(
int offset, int limit) throws SynapseException {
String url = AVAILABLE_EVALUATION_URI_PATH + "?" + OFFSET + "="
+ offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, Evaluation.class);
}
private String idsToString(List<String> ids) {
StringBuilder sb = new StringBuilder();
boolean firsttime = true;
for (String s : ids) {
if (firsttime) {
firsttime = false;
} else {
sb.append(",");
}
sb.append(s);
}
return sb.toString();
}
@Override
public PaginatedResults<Evaluation> getAvailableEvaluationsPaginated(
int offset, int limit, List<String> evaluationIds)
throws SynapseException {
String url = AVAILABLE_EVALUATION_URI_PATH + "?" + OFFSET + "="
+ offset + "&limit=" + limit + "&"
+ EVALUATION_IDS_FILTER_PARAM + "="
+ idsToString(evaluationIds);
return getPaginatedResults(getRepoEndpoint(), url, Evaluation.class);
}
@Override
public Evaluation findEvaluation(String name) throws SynapseException,
UnsupportedEncodingException {
ValidateArgument.required(name, "Evaluation name");
String encodedName = URLEncoder.encode(name, "UTF-8");
String url = EVALUATION_URI_PATH + "/" + NAME + "/" + encodedName;
return getJSONEntity(getRepoEndpoint(), url, Evaluation.class);
}
@Override
public Evaluation updateEvaluation(Evaluation eval) throws SynapseException {
ValidateArgument.required(eval, "Evaluation");
String url = createEntityUri(EVALUATION_URI_PATH, eval.getId());
return putJSONEntity(getRepoEndpoint(), url, eval, Evaluation.class);
}
@Override
public void deleteEvaluation(String evalId) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String uri = createEntityUri(EVALUATION_URI_PATH, evalId);
deleteUri(getRepoEndpoint(), uri);
}
@Override
public EvaluationRound createEvaluationRound(EvaluationRound round) throws SynapseException {
ValidateArgument.required(round, "round");
ValidateArgument.required(round.getEvaluationId(), "round.evaluationId");
String uri = EVALUATION_URI_PATH + "/" + round.getEvaluationId() + EVALUATION_ROUND;
return postJSONEntity(getRepoEndpoint(), uri, round, EvaluationRound.class);
}
@Override
public EvaluationRound getEvaluationRound(String evalId, String roundId) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
ValidateArgument.required(roundId, "EvaluationRound ID");
String uri = EVALUATION_URI_PATH + "/" + evalId + EVALUATION_ROUND + "/" + roundId;
return getJSONEntity(getRepoEndpoint(), uri, EvaluationRound.class);
}
@Override
public EvaluationRoundListResponse getAllEvaluationRounds(String evalId, EvaluationRoundListRequest request) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
ValidateArgument.required(request, "request");
String uri = EVALUATION_URI_PATH + "/" + evalId + EVALUATION_ROUND + LIST;
return postJSONEntity(getRepoEndpoint(), uri, request, EvaluationRoundListResponse.class);
}
@Override
public EvaluationRound updateEvaluationRound(EvaluationRound round) throws SynapseException {
ValidateArgument.required(round, "round");
ValidateArgument.required(round.getEvaluationId(), "round.evaluationId");
ValidateArgument.required(round.getId(), "round.id");
String uri = EVALUATION_URI_PATH + "/" + round.getEvaluationId() + EVALUATION_ROUND + "/" + round.getId();
return putJSONEntity(getRepoEndpoint(), uri, round, EvaluationRound.class);
}
@Override
public void deleteEvaluationRound(String evalId, String roundId) throws SynapseException {
ValidateArgument.required(evalId, "evalId");
ValidateArgument.required(roundId, "roundId");
String uri = EVALUATION_URI_PATH + "/" + evalId + EVALUATION_ROUND + "/" + roundId;
deleteUri(getRepoEndpoint(), uri);
}
@Override
public Submission createIndividualSubmission(Submission sub, String etag,
String challengeEndpoint, String notificationUnsubscribeEndpoint)
throws SynapseException {
ValidateArgument.required(etag, "etag");
ValidateArgument.requirement(sub.getTeamId()==null,
"For an individual submission Team ID must be null.");
ValidateArgument.requirement(sub.getContributors()==null || sub.getContributors().isEmpty(),
"For an individual submission, contributors may not be specified.");
String uri = EVALUATION_URI_PATH + "/" + SUBMISSION + "?" + ETAG + "=" + etag;
if (challengeEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "&" + CHALLENGE_ENDPOINT_PARAM + "=" + urlEncode(challengeEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" +
urlEncode(notificationUnsubscribeEndpoint);
}
return postJSONEntity(getRepoEndpoint(), uri, sub, Submission.class);
}
@Override
public TeamSubmissionEligibility getTeamSubmissionEligibility(String evaluationId, String teamId)
throws SynapseException {
ValidateArgument.required(evaluationId, "evaluationId");
ValidateArgument.required(teamId, "teamId");
String url = EVALUATION_URI_PATH+"/"+evaluationId+TEAM+"/"+teamId+
SUBMISSION_ELIGIBILITY;
return getJSONEntity(getRepoEndpoint(),url, TeamSubmissionEligibility.class);
}
@Override
public Submission createTeamSubmission(Submission sub, String etag, String submissionEligibilityHash,
String challengeEndpoint, String notificationUnsubscribeEndpoint)
throws SynapseException {
ValidateArgument.required(etag, "etag");
ValidateArgument.requirement(submissionEligibilityHash!=null,
"For a Team submission 'submissionEligibilityHash' is required.");
ValidateArgument.requirement(sub.getTeamId()!=null,
"For a Team submission Team ID is required.");
String uri = EVALUATION_URI_PATH + "/" + SUBMISSION + "?" + ETAG + "="
+ etag + "&" + SUBMISSION_ELIGIBILITY_HASH+"="+submissionEligibilityHash;
if (challengeEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "&" + CHALLENGE_ENDPOINT_PARAM + "=" + urlEncode(challengeEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" +
urlEncode(notificationUnsubscribeEndpoint);
}
return postJSONEntity(getRepoEndpoint(), uri, sub, Submission.class);
}
@Override
public Submission getSubmission(String subId) throws SynapseException {
ValidateArgument.required(subId, "Submission Id");
String url = EVALUATION_URI_PATH + "/" + SUBMISSION + "/" + subId;
return getJSONEntity(getRepoEndpoint(), url, Submission.class);
}
@Override
public SubmissionStatus getSubmissionStatus(String subId)
throws SynapseException {
ValidateArgument.required(subId, "Submission Id");
String url = EVALUATION_URI_PATH + "/" + SUBMISSION + "/" + subId + "/"
+ STATUS;
return getJSONEntity(getRepoEndpoint(), url, SubmissionStatus.class);
}
@Override
public SubmissionStatus updateSubmissionStatus(SubmissionStatus status)
throws SynapseException {
ValidateArgument.required(status, "SubmissionStatus");
if (status.getAnnotations() != null) {
AnnotationsUtils.validateAnnotations(status.getAnnotations());
}
String url = EVALUATION_URI_PATH + "/" + SUBMISSION + "/" + status.getId() + STATUS;
return putJSONEntity(getRepoEndpoint(), url, status, SubmissionStatus.class);
}
public BatchUploadResponse updateSubmissionStatusBatch(String evaluationId,
SubmissionStatusBatch batch) throws SynapseException {
ValidateArgument.required(evaluationId, "evaluationId");
ValidateArgument.required(batch, "SubmissionStatusBatch");
ValidateArgument.required(batch.getIsFirstBatch(), "isFirstBatch");
ValidateArgument.required(batch.getIsLastBatch(), "isLastBatch");
ValidateArgument.requirement(batch.getIsFirstBatch() || batch.getBatchToken() != null,
"batchToken cannot be null for any but the first batch.");
List<SubmissionStatus> statuses = batch.getStatuses();
ValidateArgument.requirement(statuses != null && statuses.size() > 0,
"SubmissionStatusBatch must contain at least one SubmissionStatus.");
for (SubmissionStatus status : statuses) {
if (status.getAnnotations() != null) {
AnnotationsUtils.validateAnnotations(status.getAnnotations());
}
}
String url = EVALUATION_URI_PATH + "/" + evaluationId + STATUS_BATCH;
return putJSONEntity(getRepoEndpoint(), url, batch, BatchUploadResponse.class);
}
@Override
public void deleteSubmission(String subId) throws SynapseException {
ValidateArgument.required(subId, "Submission Id");
String uri = EVALUATION_URI_PATH + "/" + SUBMISSION + "/" + subId;
deleteUri(getRepoEndpoint(), uri);
}
@Override
public PaginatedResults<Submission> getAllSubmissions(String evalId,
long offset, long limit) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/" + SUBMISSION_ALL
+ "?offset" + "=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, Submission.class);
}
@Override
public PaginatedResults<SubmissionStatus> getAllSubmissionStatuses(
String evalId, long offset, long limit) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/"
+ SUBMISSION_STATUS_ALL + "?offset" + "=" + offset + "&limit="
+ limit;
return getPaginatedResults(getRepoEndpoint(), url, SubmissionStatus.class);
}
@Override
public PaginatedResults<SubmissionBundle> getAllSubmissionBundles(
String evalId, long offset, long limit) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/"
+ SUBMISSION_BUNDLE_ALL + "?offset" + "=" + offset + "&limit="
+ limit;
return getPaginatedResults(getRepoEndpoint(), url, SubmissionBundle.class);
}
@Override
public PaginatedResults<Submission> getAllSubmissionsByStatus(
String evalId, SubmissionStatusEnum status, long offset, long limit)
throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/" + SUBMISSION_ALL
+ STATUS_SUFFIX + status.toString() + "&offset=" + offset
+ "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, Submission.class);
}
@Override
public PaginatedResults<SubmissionStatus> getAllSubmissionStatusesByStatus(
String evalId, SubmissionStatusEnum status, long offset, long limit)
throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/"
+ SUBMISSION_STATUS_ALL + STATUS_SUFFIX + status.toString()
+ "&offset=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, SubmissionStatus.class);
}
@Override
public PaginatedResults<SubmissionBundle> getAllSubmissionBundlesByStatus(
String evalId, SubmissionStatusEnum status, long offset, long limit)
throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/"
+ SUBMISSION_BUNDLE_ALL + STATUS_SUFFIX + status.toString()
+ "&offset=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, SubmissionBundle.class);
}
@Override
public PaginatedResults<Submission> getMySubmissions(String evalId,
long offset, long limit) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/" + SUBMISSION
+ "?offset" + "=" + offset + "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, Submission.class);
}
@Override
public PaginatedResults<SubmissionBundle> getMySubmissionBundles(
String evalId, long offset, long limit) throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/"
+ SUBMISSION_BUNDLE + "?offset" + "=" + offset + "&limit="
+ limit;
return getPaginatedResults(getRepoEndpoint(), url, SubmissionBundle.class);
}
/**
* Get a temporary URL to access a File contained in a Submission.
*
* @param submissionId
* @param fileHandleId
* @return
* @throws ClientProtocolException
* @throws MalformedURLException
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getFileTemporaryUrlForSubmissionFileHandle(String submissionId,
String fileHandleId) throws ClientProtocolException,
MalformedURLException, IOException, SynapseException {
String url = EVALUATION_URI_PATH + "/" + SUBMISSION + "/"
+ submissionId + FILE + "/" + fileHandleId
+ QUERY_REDIRECT_PARAMETER + "false";
return getUrl(getRepoEndpoint(), url);
}
@Override
public void downloadFromSubmission(String submissionId,
String fileHandleId, File destinationFile) throws SynapseException {
String uri = EVALUATION_URI_PATH + "/" + SUBMISSION + "/"
+ submissionId + FILE + "/" + fileHandleId + QUERY_REDIRECT_PARAMETER + "false";
super.downloadFromSynapse(
getRepoEndpoint() + uri, null, destinationFile);
}
/**
* Execute a user query over the Submissions of a specified Evaluation.
*
* @param query
* @return
* @throws SynapseException
*/
@Override
public QueryTableResults queryEvaluation(String query)
throws SynapseException {
ValidateArgument.required(query, "query");
String queryUri;
try {
queryUri = EVALUATION_QUERY_URI_PATH + URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new SynapseClientException(e);
}
return getJSONEntity(getRepoEndpoint(), queryUri, QueryTableResults.class);
}
/**
* Moves an entity and its descendants to the trash can.
*
* @param entityId
* The ID of the entity to be moved to the trash can
*/
@Override
public void moveToTrash(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = TRASHCAN_TRASH + "/" + entityId;
voidPut(getRepoEndpoint(), url, null);
}
/**
* Moves an entity and its descendants out of the trash can. The entity will
* be restored to the specified parent. If the parent is not specified, it
* will be restored to the original parent.
*/
@Override
public void restoreFromTrash(String entityId, String newParentId)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = TRASHCAN_RESTORE + "/" + entityId;
if (newParentId != null && !newParentId.isEmpty()) {
url = url + "/" + newParentId;
}
voidPut(getRepoEndpoint(), url, null);
}
/**
* Retrieves entities (in the trash can) deleted by the user.
*/
@Override
public PaginatedResults<TrashedEntity> viewTrashForUser(long offset,
long limit) throws SynapseException {
String url = TRASHCAN_VIEW + "?" + OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, TrashedEntity.class);
}
@Override
public void flagForPurge(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = TRASHCAN_PURGE + "/" + entityId;
voidPut(getRepoEndpoint(), url, null);
}
/**
* Purges the specified entity from the trash can. After purging, the entity
* will be permanently deleted.
*/
@Override
public void purgeTrashForUser(String entityId) throws SynapseException {
flagForPurge(entityId);
}
@Override
public void logError(LogEntry logEntry) throws SynapseException {
voidPost(getRepoEndpoint(), LOG, logEntry, null);
}
@Override
@Deprecated
public List<UploadDestination> getUploadDestinations(String parentEntityId) throws SynapseException {
// Get the json for this entity as a list wrapper
String url = ENTITY + "/" + parentEntityId + "/uploadDestinations";
return getListOfJSONEntity(getFileEndpoint(), url, UploadDestination.class);
}
@SuppressWarnings("unchecked")
@Override
public <T extends StorageLocationSetting> T createStorageLocationSetting(T storageLocation)
throws SynapseException {
return (T) postJSONEntity(getRepoEndpoint(), STORAGE_LOCATION, storageLocation, StorageLocationSetting.class);
}
@SuppressWarnings("unchecked")
@Override
public <T extends StorageLocationSetting> T getMyStorageLocationSetting(Long storageLocationId) throws SynapseException {
String url = STORAGE_LOCATION + "/" + storageLocationId;
return (T) getJSONEntity(getRepoEndpoint(), url, StorageLocationSetting.class);
}
@Override
public List<StorageLocationSetting> getMyStorageLocationSettings() throws SynapseException {
return getListOfJSONEntity(getRepoEndpoint(), STORAGE_LOCATION, StorageLocationSetting.class);
}
@Override
public UploadDestinationLocation[] getUploadDestinationLocations(String parentEntityId) throws SynapseException {
// Get the json for this entity as a list wrapper
String url = ENTITY + "/" + parentEntityId + "/uploadDestinationLocations";
List<UploadDestinationLocation> locations = getListOfJSONEntity(getFileEndpoint(), url, UploadDestinationLocation.class);
return locations.toArray(new UploadDestinationLocation[locations.size()]);
}
@Override
public UploadDestination getUploadDestination(String parentEntityId, Long storageLocationId) throws SynapseException {
String uri = ENTITY + "/" + parentEntityId + "/uploadDestination/" + storageLocationId;
return getJSONEntity(getFileEndpoint(), uri, UploadDestination.class);
}
@Override
public UploadDestination getDefaultUploadDestination(String parentEntityId) throws SynapseException {
String uri = ENTITY + "/" + parentEntityId + "/uploadDestination";
return getJSONEntity(getFileEndpoint(), uri, UploadDestination.class);
}
@Override
public ProjectSetting getProjectSetting(String projectId, ProjectSettingsType projectSettingsType) throws SynapseException {
String uri = PROJECT_SETTINGS + "/" + projectId + "/type/" + projectSettingsType;
return getJSONEntity(getRepoEndpoint(), uri, ProjectSetting.class);
}
@Override
public ProjectSetting createProjectSetting(ProjectSetting projectSetting)
throws SynapseException {
return postJSONEntity(getRepoEndpoint(), PROJECT_SETTINGS, projectSetting, ProjectSetting.class);
}
@Override
public void updateProjectSetting(ProjectSetting projectSetting) throws SynapseException {
voidPut(getRepoEndpoint(), PROJECT_SETTINGS, projectSetting);
}
@Override
public void deleteProjectSetting(String projectSettingsId) throws SynapseException {
String uri = PROJECT_SETTINGS + "/" + projectSettingsId;
deleteUri(getRepoEndpoint(), uri);
}
/**
* Add the entity to this user's Favorites list
*
* @param entityId
* @return
* @throws SynapseException
*/
@Override
public EntityHeader addFavorite(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = createEntityUri(FAVORITE_URI_PATH, entityId);
return postJSONEntity(getRepoEndpoint(), url, null, EntityHeader.class);
}
/**
* Remove the entity from this user's Favorites list
*
* @param entityId
* @throws SynapseException
*/
@Override
public void removeFavorite(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String uri = createEntityUri(FAVORITE_URI_PATH, entityId);
deleteUri(getRepoEndpoint(), uri);
}
/**
* Retrieve this user's Favorites list
*
* @param limit
* @param offset
* @return
* @throws SynapseException
*/
@Override
public PaginatedResults<EntityHeader> getFavorites(Integer limit,
Integer offset) throws SynapseException {
String url = FAVORITE_URI_PATH + "?" + OFFSET + "=" + offset
+ "&limit=" + limit;
return getPaginatedResults(getRepoEndpoint(), url, EntityHeader.class);
}
/**
* Retrieve this user's Favorites list
*
* @param limit
* @param offset
* @return
* @throws SynapseException
*/
@Override
public PaginatedResults<EntityHeader> getFavorites(Integer limit, Integer offset, SortBy sortBy,
org.sagebionetworks.repo.model.favorite.SortDirection sortDirection) throws SynapseException {
String url = FAVORITE_URI_PATH + "?" + OFFSET + "=" + offset
+ "&limit=" + limit
+ "&sort=" + sortBy.name()
+ "&sortDirection=" + sortDirection.name();
return getPaginatedResults(getRepoEndpoint(), url, EntityHeader.class);
}
/**
* Retrieve this user's Projects list
*
* @param type the type of list to get
* @param sortColumn the optional sort column (default by last activity)
* @param sortDirection the optional sort direction (default descending)
* @param nextPageToken
* @return
* @throws SynapseException
*/
@Override
public ProjectHeaderList getMyProjects(ProjectListType type, ProjectListSortColumn sortColumn, SortDirection sortDirection,
String nextPageToken) throws SynapseException {
return getProjects(type, null, null, sortColumn, sortDirection, nextPageToken);
}
/**
* Retrieve a user's Projects list
*
* @param userId the user for which to get the project list
* @param sortColumn the optional sort column (default by last activity)
* @param sortDirection the optional sort direction (default descending)
* @param nextPageToken
* @return
* @throws SynapseException
*/
@Override
public ProjectHeaderList getProjectsFromUser(Long userId, ProjectListSortColumn sortColumn, SortDirection sortDirection,
String nextPageToken) throws SynapseException {
return getProjects(ProjectListType.ALL, userId, null, sortColumn, sortDirection, nextPageToken);
}
/**
* Retrieve a teams's Projects list
*
* @param teamId the team for which to get the project list
* @param sortColumn the optional sort column (default by last activity)
* @param sortDirection the optional sort direction (default descending)
* @param nextPageToken
* @return
* @throws SynapseException
*/
@Override
public ProjectHeaderList getProjectsForTeam(Long teamId, ProjectListSortColumn sortColumn, SortDirection sortDirection,
String nextPageToken) throws SynapseException {
return getProjects(ProjectListType.TEAM, null, teamId, sortColumn, sortDirection, nextPageToken);
}
private ProjectHeaderList getProjects(ProjectListType type, Long userId, Long teamId, ProjectListSortColumn sortColumn,
SortDirection sortDirection, String nextPageToken) throws SynapseException, SynapseClientException {
String url = PROJECTS_URI_PATH;
if (userId != null) {
url += USER + '/' + userId;
}
if (sortColumn == null) {
sortColumn = ProjectListSortColumn.LAST_ACTIVITY;
}
if (sortDirection == null) {
sortDirection = SortDirection.DESC;
}
url += "?sort=" + sortColumn.name() + "&sortDirection=" + sortDirection.name();
if (nextPageToken != null) {
url += "&" + NEXT_PAGE_TOKEN_PARAM + nextPageToken;
}
if (teamId != null) {
url += "&teamId=" + teamId;
}
if (type!=null) {
url += "&filter="+type;
}
return getJSONEntity(getRepoEndpoint(), url, ProjectHeaderList.class);
}
@Deprecated
public PaginatedResults<ProjectHeader> getMyProjectsDeprecated(ProjectListType type, ProjectListSortColumn sortColumn, SortDirection sortDirection,
Integer limit, Integer offset) throws SynapseException {
return getProjectsDeprecated(type, null, null, sortColumn, sortDirection, limit, offset);
}
@Deprecated
public PaginatedResults<ProjectHeader> getProjectsFromUserDeprecated(Long userId, ProjectListSortColumn sortColumn, SortDirection sortDirection,
Integer limit, Integer offset) throws SynapseException {
return getProjectsDeprecated(ProjectListType.ALL, userId, null, sortColumn, sortDirection, limit, offset);
}
@Deprecated
public PaginatedResults<ProjectHeader> getProjectsForTeamDeprecated(Long teamId, ProjectListSortColumn sortColumn, SortDirection sortDirection,
Integer limit, Integer offset) throws SynapseException {
return getProjectsDeprecated(ProjectListType.TEAM, null, teamId, sortColumn, sortDirection, limit, offset);
}
private PaginatedResults<ProjectHeader> getProjectsDeprecated(ProjectListType type, Long userId, Long teamId, ProjectListSortColumn sortColumn,
SortDirection sortDirection, Integer limit, Integer offset) throws SynapseException, SynapseClientException {
String url = PROJECTS_URI_PATH+"/";
switch (type) {
case ALL:
default:
if (userId==null) {
url += ProjectListTypeDeprecated.MY_PROJECTS;
} else {
url += ProjectListTypeDeprecated.OTHER_USER_PROJECTS;
}
break;
case CREATED:
url += ProjectListTypeDeprecated.MY_CREATED_PROJECTS;
break;
case PARTICIPATED:
url += ProjectListTypeDeprecated.MY_PARTICIPATED_PROJECTS;
break;
case TEAM:
if (teamId==null) {
url += ProjectListTypeDeprecated.MY_TEAM_PROJECTS;
} else {
url += ProjectListTypeDeprecated.TEAM_PROJECTS;
}
break;
}
if (userId != null) {
url += USER + '/' + userId;
}
if (teamId != null) {
url += TEAM + '/' + teamId;
}
if (sortColumn == null) {
sortColumn = ProjectListSortColumn.LAST_ACTIVITY;
}
if (sortDirection == null) {
sortDirection = SortDirection.DESC;
}
url += "?sort=" + sortColumn.name() + "&sortDirection="+ sortDirection.name();
if (offset!=null) {
url += '&' + OFFSET_PARAMETER + offset ;
}
if (limit!=null) {
url += '&' + LIMIT_PARAMETER + limit;
}
return getPaginatedResults(getRepoEndpoint(), url, ProjectHeader.class);
}
/**
* Gets the DOI Association for the specified object. If object version is null, the call will return the DOI
* for the current version of the object.
*/
@Override
public DoiAssociation getDoiAssociation(String objectId, ObjectType objectType, Long objectVersion) throws SynapseException {
ValidateArgument.required(objectId, "objectId");
ValidateArgument.required(objectType, "objectType");
String url = DOI_ASSOCIATION + "?id=" + objectId + "&type=" + objectType;
if (objectVersion != null) {
url += "&version=" + objectVersion;
}
return getJSONEntity(getRepoEndpoint(), url, DoiAssociation.class);
}
/**
* Gets the DOI for the specified object. If object version is null, the call will return the DOI
* for the current version of the object.
*/
@Override
public Doi getDoi(String objectId, ObjectType objectType, Long objectVersion) throws SynapseException {
ValidateArgument.required(objectId, "objectId");
ValidateArgument.required(objectType, "objectType");
String url = DOI_ASSOCIATION + "?id=" + objectId + "&type=" + objectType;
if (objectVersion != null) {
url += "&version=" + objectVersion;
}
return getJSONEntity(getRepoEndpoint(), url, Doi.class);
}
/**
* Creates a DOI for the specified object. Idempotent.
*/
@Override
public String createOrUpdateDoiAsyncStart(Doi doi) throws SynapseException {
DoiRequest request = new DoiRequest();
request.setDoi(doi);
return startAsynchJob(AsynchJobType.Doi, request);
}
/**
* Retrieves the status of a createOrUpdateDoi call.
*/
@Override
public DoiResponse createOrUpdateDoiAsyncGet(String asyncJobToken) throws SynapseException {
String url = DOI + ASYNC_GET + asyncJobToken;
return getJSONEntity(getRepoEndpoint(), url, DoiResponse.class);
}
/**
*
*/
@Override
public String getPortalUrl(String objectId, ObjectType objectType, Long objectVersion) throws SynapseException {
ValidateArgument.required(objectId, "objectId");
ValidateArgument.required(objectType, "objectType");
String requestUrl = DOI_LOCATE + "?id=" + objectId + "&type=" + objectType;
if (objectVersion != null) {
requestUrl += "&version=" + objectVersion;
}
requestUrl += "&redirect=false";
return getStringDirect(getRepoEndpoint(), requestUrl);
}
/**
* Gets the header information of entities whose file's MD5 matches the
* given MD5 checksum.
*/
@Deprecated
/* wrong use of PaginatedResults since the expected returned data is not a page */
@Override
public List<EntityHeader> getEntityHeaderByMd5(String md5) throws SynapseException {
ValidateArgument.required(md5, "md5");
String url = ENTITY + "/md5/" + md5;
return getPaginatedResults(getRepoEndpoint(), url, EntityHeader.class).getResults();
}
@Override
public String retrieveApiKey() throws SynapseException {
return getJSONEntity(getAuthEndpoint(),"/secretKey", SecretKey.class).getSecretKey();
}
@Override
public String createPersonalAccessToken(AccessTokenGenerationRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getAuthEndpoint(), AUTH_PERSONAL_ACCESS_TOKEN, request, AccessTokenGenerationResponse.class).getToken();
}
@Override
public AccessTokenRecord retrievePersonalAccessTokenRecord(String tokenId) throws SynapseException {
ValidateArgument.required(tokenId, "tokenId");
return getJSONEntity(getAuthEndpoint(), AUTH_PERSONAL_ACCESS_TOKEN + "/" + tokenId, AccessTokenRecord.class);
}
@Override
public AccessTokenRecordList retrievePersonalAccessTokenRecords(String nextPageToken) throws SynapseException {
String uri = AUTH_PERSONAL_ACCESS_TOKEN;
if (nextPageToken != null) {
uri += "?" + NEXT_PAGE_TOKEN_PARAM + nextPageToken;
}
return getJSONEntity(getAuthEndpoint(), uri, AccessTokenRecordList.class);
}
@Override
public void revokePersonalAccessToken(String tokenId) throws SynapseException {
ValidateArgument.required(tokenId, "tokenId");
deleteUri(getAuthEndpoint(), AUTH_PERSONAL_ACCESS_TOKEN + "/" + tokenId);
}
@Override
public AccessControlList updateEvaluationAcl(AccessControlList acl)
throws SynapseException {
ValidateArgument.required(acl, "acl");
return putJSONEntity(getRepoEndpoint(), EVALUATION_ACL_URI_PATH, acl, AccessControlList.class);
}
@Override
public AccessControlList getEvaluationAcl(String evalId)
throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/acl";
return getJSONEntity(getRepoEndpoint(), url, AccessControlList.class);
}
@Override
public UserEvaluationPermissions getUserEvaluationPermissions(String evalId)
throws SynapseException {
ValidateArgument.required(evalId, "Evaluation ID");
String url = EVALUATION_URI_PATH + "/" + evalId + "/permissions";
return getJSONEntity(getRepoEndpoint(), url, UserEvaluationPermissions.class);
}
@Override
public String appendRowSetToTableStart(AppendableRowSet rowSet,
String tableId) throws SynapseException {
AppendableRowSetRequest request = new AppendableRowSetRequest();
request.setEntityId(tableId);
request.setToAppend(rowSet);
return startAsynchJob(AsynchJobType.TableAppendRowSet, request);
}
@Override
public RowReferenceSet appendRowSetToTableGet(String token, String tableId)
throws SynapseException, SynapseResultNotReadyException {
RowReferenceSetResults rrs = (RowReferenceSetResults) getAsyncResult(
AsynchJobType.TableAppendRowSet, token, tableId);
return rrs.getRowReferenceSet();
}
@Override
public String startTableTransactionJob(List<TableUpdateRequest> changes,
String tableId) throws SynapseException {
TableUpdateTransactionRequest request = new TableUpdateTransactionRequest();
request.setEntityId(tableId);
request.setChanges(changes);
return startAsynchJob(AsynchJobType.TableTransaction, request);
}
@Override
public List<TableUpdateResponse> getTableTransactionJobResults(String token, String tableId)
throws SynapseException, SynapseResultNotReadyException {
TableUpdateTransactionResponse response = (TableUpdateTransactionResponse) getAsyncResult(
AsynchJobType.TableTransaction, token, tableId);
return response.getResults();
}
@Override
public RowReferenceSet appendRowsToTable(AppendableRowSet rowSet,
long timeout, String tableId) throws SynapseException,
InterruptedException {
long start = System.currentTimeMillis();
// Start the job
String jobId = appendRowSetToTableStart(rowSet, tableId);
do {
try {
return appendRowSetToTableGet(jobId, tableId);
} catch (SynapseResultNotReadyException e) {
Thread.sleep(1000);
}
} while (System.currentTimeMillis() - start < timeout);
// ran out of time.
throw new SynapseClientException("Timed out waiting for jobId: " + jobId);
}
@Override
public RowReferenceSet deleteRowsFromTable(RowSelection toDelete) throws SynapseException {
ValidateArgument.required(toDelete, "RowSelection");
ValidateArgument.required(toDelete.getTableId(), "RowSelection.tableId");
String uri = ENTITY + "/" + toDelete.getTableId() + TABLE + "/deleteRows";
return postJSONEntity(getRepoEndpoint(), uri, toDelete, RowReferenceSet.class);
}
@Override
public TableFileHandleResults getFileHandlesFromTable(
RowReferenceSet fileHandlesToFind) throws SynapseException {
ValidateArgument.required(fileHandlesToFind, "RowReferenceSet");
String uri = ENTITY + "/" + fileHandlesToFind.getTableId() + TABLE + FILE_HANDLES;
return postJSONEntity(getRepoEndpoint(), uri, fileHandlesToFind, TableFileHandleResults.class);
}
/**
* Get the temporary URL for the data file of a file handle column for a
* row. This is an alternative to downloading the file.
*
* @param tableId
* @param row
* @param columnId
* @return
* @throws IOException
* @throws SynapseException
*/
@Override
public URL getTableFileHandleTemporaryUrl(String tableId, RowReference row,
String columnId) throws IOException, SynapseException {
String uri = getUriForFileHandle(tableId, row, columnId) + FILE
+ QUERY_REDIRECT_PARAMETER + "false";
return getUrl(getRepoEndpoint(), uri);
}
@Override
public void downloadFromTableFileHandleTemporaryUrl(String tableId,
RowReference row, String columnId, File destinationFile)
throws SynapseException {
String uri = getUriForFileHandle(tableId, row, columnId) + FILE + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
@Override
public URL getTableFileHandlePreviewTemporaryUrl(String tableId,
RowReference row, String columnId) throws IOException,
SynapseException {
String uri = getUriForFileHandle(tableId, row, columnId) + FILE_PREVIEW
+ QUERY_REDIRECT_PARAMETER + "false";
return getUrl(getRepoEndpoint(), uri);
}
@Override
public void downloadFromTableFileHandlePreviewTemporaryUrl(String tableId,
RowReference row, String columnId, File destinationFile)
throws SynapseException {
String uri = getUriForFileHandle(tableId, row, columnId) + FILE_PREVIEW + QUERY_REDIRECT_PARAMETER + "false";
downloadFromSynapse(getRepoEndpoint() + uri, null, destinationFile);
}
private static String getUriForFileHandle(String tableId, RowReference row,
String columnId) {
return ENTITY + "/" + tableId + TABLE + COLUMN + "/" + columnId
+ ROW_ID + "/" + row.getRowId() + ROW_VERSION + "/"
+ row.getVersionNumber();
}
@Override
public String queryTableEntityBundleAsyncStart(Query query, QueryOptions queryOptions, String tableId)
throws SynapseException {
QueryBundleRequest bundleRequest = new QueryBundleRequest();
bundleRequest.setEntityId(tableId);
bundleRequest.setQuery(query);
bundleRequest.setPartMask(queryOptions.getPartMask());
return startAsynchJob(AsynchJobType.TableQuery, bundleRequest);
}
@Override
public String queryTableEntityBundleAsyncStart(String sql, Long offset,
Long limit, int partsMask, String tableId)
throws SynapseException {
Query query = new Query();
query.setSql(sql);
query.setOffset(offset);
query.setLimit(limit);
QueryOptions queryOptions = new QueryOptions().withMask((long) partsMask);
return queryTableEntityBundleAsyncStart(query, queryOptions, tableId);
}
@Override
public QueryResultBundle queryTableEntityBundleAsyncGet(
String asyncJobToken, String tableId) throws SynapseException,
SynapseResultNotReadyException {
return (QueryResultBundle) getAsyncResult(AsynchJobType.TableQuery,
asyncJobToken, tableId);
}
@Override
public String queryTableEntityNextPageAsyncStart(String nextPageToken,
String tableId) throws SynapseException {
QueryNextPageToken queryNextPageToken = new QueryNextPageToken();
queryNextPageToken.setEntityId(tableId);
queryNextPageToken.setToken(nextPageToken);
return startAsynchJob(AsynchJobType.TableQueryNextPage, queryNextPageToken);
}
@Override
public QueryResult queryTableEntityNextPageAsyncGet(String asyncJobToken,
String tableId) throws SynapseException,
SynapseResultNotReadyException {
return (QueryResult) getAsyncResult(AsynchJobType.TableQueryNextPage,
asyncJobToken, tableId);
}
@Override
public String downloadCsvFromTableAsyncStart(String sql,
boolean writeHeader, boolean includeRowIdAndRowVersion,
CsvTableDescriptor csvDescriptor, String tableId)
throws SynapseException {
DownloadFromTableRequest downloadRequest = new DownloadFromTableRequest();
downloadRequest.setEntityId(tableId);
downloadRequest.setSql(sql);
downloadRequest.setWriteHeader(writeHeader);
downloadRequest.setIncludeRowIdAndRowVersion(includeRowIdAndRowVersion);
downloadRequest.setCsvTableDescriptor(csvDescriptor);
return startAsynchJob(AsynchJobType.TableCSVDownload, downloadRequest);
}
@Override
public DownloadFromTableResult downloadCsvFromTableAsyncGet(
String asyncJobToken, String tableId) throws SynapseException,
SynapseResultNotReadyException {
return (DownloadFromTableResult) getAsyncResult(
AsynchJobType.TableCSVDownload, asyncJobToken, tableId);
}
@Override
public String uploadCsvToTableAsyncStart(String tableId,
String fileHandleId, String etag, Long linesToSkip,
CsvTableDescriptor csvDescriptor, List<String> columnIds) throws SynapseException {
UploadToTableRequest uploadRequest = new UploadToTableRequest();
uploadRequest.setTableId(tableId);
uploadRequest.setUploadFileHandleId(fileHandleId);
uploadRequest.setUpdateEtag(etag);
uploadRequest.setLinesToSkip(linesToSkip);
uploadRequest.setCsvTableDescriptor(csvDescriptor);
uploadRequest.setColumnIds(columnIds);
return startAsynchJob(AsynchJobType.TableCSVUpload, uploadRequest);
}
@Override
public UploadToTableResult uploadCsvToTableAsyncGet(String asyncJobToken,
String tableId) throws SynapseException,
SynapseResultNotReadyException {
return (UploadToTableResult) getAsyncResult(
AsynchJobType.TableCSVUpload, asyncJobToken, tableId);
}
@Override
public String uploadCsvTablePreviewAsyncStart(UploadToTablePreviewRequest request) throws SynapseException {
return startAsynchJob(AsynchJobType.TableCSVUploadPreview, request);
}
@Override
public UploadToTablePreviewResult uploadCsvToTablePreviewAsyncGet(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
String entityId = null;
return (UploadToTablePreviewResult) getAsyncResult(
AsynchJobType.TableCSVUploadPreview, asyncJobToken, entityId);
}
@Override
public ColumnModel createColumnModel(ColumnModel model)
throws SynapseException {
ValidateArgument.required(model, "ColumnModel");
return postJSONEntity(getRepoEndpoint(), COLUMN, model, ColumnModel.class);
}
@Override
public List<ColumnModel> createColumnModels(List<ColumnModel> models)
throws SynapseException {
ValidateArgument.required(models, "ColumnModel");
return getListOfJSONEntity(getRepoEndpoint(), COLUMN_BATCH,
ListWrapper.wrap(models, ColumnModel.class), ColumnModel.class);
}
@Override
public ColumnModel getColumnModel(String columnId) throws SynapseException {
ValidateArgument.required(columnId, "ColumnId");
String url = COLUMN + "/" + columnId;
return getJSONEntity(getRepoEndpoint(), url, ColumnModel.class);
}
@Override
public List<ColumnModel> getColumnModelsForTableEntity(String tableEntityId)
throws SynapseException {
ValidateArgument.required(tableEntityId, "tableEntityId");
String url = ENTITY + "/" + tableEntityId + COLUMN;
return getJSONEntity(getRepoEndpoint(), url, PaginatedColumnModels.class).getResults();
}
@Override
public List<ColumnModel> getDefaultColumnsForView(ViewType viewType)
throws SynapseException {
ValidateArgument.required(viewType, "viewType");
String url = COLUMN_VIEW_DEFAULT+"/"+viewType.name();
return getListOfJSONEntity(getRepoEndpoint(), url, ColumnModel.class);
}
@Override
public List<ColumnModel> getDefaultColumnsForView(ViewEntityType viewEntityType, Long viewTypeMask)
throws SynapseException {
StringBuilder builder = new StringBuilder(COLUMN_VIEW_DEFAULT);
if (viewEntityType != null || viewTypeMask != null) {
builder.append("?");
}
if (viewEntityType != null) {
builder.append("viewEntityType=").append(viewEntityType.name());
}
if (viewTypeMask != null) {
if (viewEntityType != null) {
builder.append("&");
}
builder.append("viewTypeMask=").append(viewTypeMask);
}
String url = builder.toString();
return getListOfJSONEntity(getRepoEndpoint(), url, ColumnModel.class);
}
@Override
public PaginatedColumnModels listColumnModels(String prefix, Long limit,
Long offset) throws SynapseException {
String url = buildListColumnModelUrl(prefix, limit, offset);
return getJSONEntity(getRepoEndpoint(), url, PaginatedColumnModels.class);
}
/**
* Build up the URL for listing all ColumnModels
*
* @param prefix
* @param limit
* @param offset
* @return
*/
static String buildListColumnModelUrl(String prefix, Long limit, Long offset) {
StringBuilder builder = new StringBuilder();
builder.append(COLUMN);
int count = 0;
if (prefix != null || limit != null || offset != null) {
builder.append("?");
}
if (prefix != null) {
builder.append("prefix=");
builder.append(prefix);
count++;
}
if (limit != null) {
if (count > 0) {
builder.append("&");
}
builder.append("limit=");
builder.append(limit);
count++;
}
if (offset != null) {
if (count > 0) {
builder.append("&");
}
builder.append("offset=");
builder.append(offset);
}
return builder.toString();
}
/**
* Start a new Asynchronous Job
*
* @param jobBody
* @return
* @throws SynapseException
*/
@Override
public AsynchronousJobStatus startAsynchronousJob(
AsynchronousRequestBody jobBody) throws SynapseException {
ValidateArgument.required(jobBody, "jobBody");
return postJSONEntity(getRepoEndpoint(), ASYNCHRONOUS_JOB, jobBody, AsynchronousJobStatus.class);
}
/**
* Get the status of an Asynchronous Job from its ID.
*
* @param jobId
* @return
* @throws SynapseException
*/
@Override
public AsynchronousJobStatus getAsynchronousJobStatus(String jobId) throws SynapseException {
ValidateArgument.required(jobId, "jobId");
String url = ASYNCHRONOUS_JOB + "/" + jobId;
return getJSONEntity(getRepoEndpoint(), url, AsynchronousJobStatus.class);
}
@Override
public Team createTeam(Team team) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), TEAM, team, Team.class);
}
@Override
public Team getTeam(String id) throws SynapseException {
String url = TEAM + "/" + id;
return getJSONEntity(getRepoEndpoint(), url, Team.class);
}
@Override
public PaginatedResults<Team> getTeams(String fragment, long limit,
long offset) throws SynapseException {
String uri = null;
if (fragment == null) {
uri = TEAMS + "?" + OFFSET + "=" + offset + "&" + LIMIT + "="
+ limit;
} else {
uri = TEAMS + "?" + NAME_FRAGMENT_FILTER + "="
+ urlEncode(fragment) + "&" + OFFSET + "=" + offset + "&"
+ LIMIT + "=" + limit;
}
return getPaginatedResults(getRepoEndpoint(), uri, Team.class);
}
@Override
public List<Team> listTeams(List<Long> ids) throws SynapseException {
IdList idList = new IdList();
idList.setList(ids);
return getListOfJSONEntity(getRepoEndpoint(), TEAM_LIST, idList, Team.class);
}
@Override
public PaginatedResults<Team> getTeamsForUser(String memberId, long limit,
long offset) throws SynapseException {
String uri = USER + "/" + memberId + TEAM + "?" + OFFSET + "=" + offset
+ "&" + LIMIT + "=" + limit;
return getPaginatedResults(getRepoEndpoint(), uri, Team.class);
}
private static String createGetTeamIconURI(String teamId, boolean redirect) {
return TEAM + "/" + teamId + ICON + "?" + REDIRECT_PARAMETER + redirect;
}
@Override
public URL getTeamIcon(String teamId) throws SynapseException {
return getUrl(getRepoEndpoint(), createGetTeamIconURI(teamId, false));
}
// alternative to getTeamIcon
@Override
public void downloadTeamIcon(String teamId, File target) throws SynapseException {
String uri = createGetTeamIconURI(teamId, false);
downloadFromSynapse(getRepoEndpoint() + uri, null, target);
}
@Override
public Team updateTeam(Team team) throws SynapseException {
return putJSONEntity(getRepoEndpoint(), TEAM, team, Team.class);
}
@Override
public void deleteTeam(String teamId) throws SynapseException {
deleteUri(getRepoEndpoint(), TEAM + "/" + teamId);
}
@Override
public void addTeamMember(String teamId, String memberId,
String teamEndpoint, String notificationUnsubscribeEndpoint)
throws SynapseException {
String uri = TEAM + "/" + teamId + MEMBER + "/" + memberId;
if (teamEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "?" + TEAM_ENDPOINT_PARAM + "=" + urlEncode(teamEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" +
urlEncode(notificationUnsubscribeEndpoint);
}
voidPut(getRepoEndpoint(), uri, null);
}
@Override
public ResponseMessage addTeamMember(JoinTeamSignedToken joinTeamSignedToken,
String teamEndpoint, String notificationUnsubscribeEndpoint)
throws SynapseException {
String uri = TEAM + "Member";
if (teamEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "?" + TEAM_ENDPOINT_PARAM + "=" + urlEncode(teamEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" + urlEncode(notificationUnsubscribeEndpoint);
}
return putJSONEntity(getRepoEndpoint(), uri, joinTeamSignedToken, ResponseMessage.class);
}
private static String urlEncode(String s) {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
/**
*
* @deprecated Use {@link #getTeamMembers(String, String, TeamMemberTypeFilterOptions, long, long) getTeamMembers} instead
*/
@Deprecated
@Override
public PaginatedResults<TeamMember> getTeamMembers(String teamId, String fragment, long limit, long offset) throws SynapseException {
return getTeamMembers(teamId, fragment, TeamMemberTypeFilterOptions.ALL, limit, offset);
}
@Override
public PaginatedResults<TeamMember> getTeamMembers(String teamId,
String fragment, TeamMemberTypeFilterOptions memberType,
long limit, long offset) throws SynapseException {
URIBuilder uri = new URIBuilder();
uri.setPath(TEAM_MEMBERS + "/" + teamId);
if (fragment != null) {
uri.setParameter(NAME_FRAGMENT_FILTER, urlEncode(fragment));
}
if (memberType != null) {
uri.setParameter(NAME_MEMBERTYPE_FILTER, memberType.toString());
}
uri.setParameter(OFFSET, String.valueOf(offset));
uri.setParameter(LIMIT, String.valueOf(limit));
return getPaginatedResults(getRepoEndpoint(), uri.toString(), TeamMember.class);
}
/**
*
* @param teamId
* @param fragment
* @return the number of members in the given team, optionally filtered by the given prefix
* @throws SynapseException
*/
@Override
public long countTeamMembers(String teamId, String fragment) throws SynapseException {
String uri = null;
if (fragment == null) {
uri = TEAM_MEMBERS + "/count/" + teamId;
} else {
uri = TEAM_MEMBERS + "/count/" + teamId + "?" + NAME_FRAGMENT_FILTER
+ "=" + urlEncode(fragment) ;
}
Count tmc = getJSONEntity(getRepoEndpoint(), uri, Count.class);
return tmc.getCount();
}
@Override
public List<TeamMember> listTeamMembers(String teamId, List<Long> ids) throws SynapseException {
IdList idList = new IdList();
idList.setList(ids);
String url = TEAM+"/"+teamId+MEMBER_LIST;
return getListOfJSONEntity(getRepoEndpoint(), url, idList, TeamMember.class);
}
@Override
public List<TeamMember> listTeamMembers(List<Long> teamIds, String userId) throws SynapseException {
IdList idList = new IdList();
idList.setList(teamIds);
String url = USER+"/"+userId+MEMBER_LIST;
return getListOfJSONEntity(getRepoEndpoint(), url, idList, TeamMember.class);
}
public TeamMember getTeamMember(String teamId, String memberId)
throws SynapseException {
String url = TEAM + "/" + teamId + MEMBER + "/" + memberId;
return getJSONEntity(getRepoEndpoint(), url, TeamMember.class);
}
@Override
public void removeTeamMember(String teamId, String memberId) throws SynapseException {
deleteUri(getRepoEndpoint(), TEAM + "/" + teamId + MEMBER + "/" + memberId);
}
@Override
public void setTeamMemberPermissions(String teamId, String memberId,
boolean isAdmin) throws SynapseException {
String url = TEAM + "/" + teamId + MEMBER + "/" + memberId + PERMISSION + "?"
+ TEAM_MEMBERSHIP_PERMISSION + "=" + isAdmin;
voidPut(getRepoEndpoint(), url, null);
}
@Override
public TeamMembershipStatus getTeamMembershipStatus(String teamId,
String principalId) throws SynapseException {
String url = TEAM + "/" + teamId + MEMBER + "/" + principalId + MEMBERSHIP_STATUS;
return getJSONEntity(getRepoEndpoint(), url, TeamMembershipStatus.class);
}
@Override
public AccessControlList getTeamACL(String teamId) throws SynapseException {
ValidateArgument.required(teamId, "teamID");
String url = TEAM + "/" + teamId + "/acl";
return getJSONEntity(getRepoEndpoint(), url, AccessControlList.class);
}
@Override
public AccessControlList updateTeamACL(AccessControlList acl) throws SynapseException {
ValidateArgument.required(acl, "acl");
String url = TEAM+"/acl";
return putJSONEntity(getRepoEndpoint(), url, acl, AccessControlList.class);
}
@Override
public MembershipInvitation createMembershipInvitation(
MembershipInvitation invitation,
String acceptInvitationEndpoint,
String notificationUnsubscribeEndpoint) throws SynapseException {
String uri = MEMBERSHIP_INVITATION;
if (acceptInvitationEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "?" + ACCEPT_INVITATION_ENDPOINT_PARAM + "=" + urlEncode(acceptInvitationEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" + urlEncode(notificationUnsubscribeEndpoint);
}
return postJSONEntity(getRepoEndpoint(), uri, invitation, MembershipInvitation.class);
}
@Override
public MembershipInvitation getMembershipInvitation(String invitationId)
throws SynapseException {
String url = MEMBERSHIP_INVITATION + "/" + invitationId;
return getJSONEntity(getRepoEndpoint(), url, MembershipInvitation.class);
}
@Override
public MembershipInvitation getMembershipInvitation(MembershipInvtnSignedToken token) throws SynapseException {
String uri = MEMBERSHIP_INVITATION + "/" + token.getMembershipInvitationId();
return postJSONEntity(getRepoEndpoint(), uri, token, MembershipInvitation.class);
}
@Override
public PaginatedResults<MembershipInvitation> getOpenMembershipInvitations(
String memberId, String teamId, long limit, long offset)
throws SynapseException {
String uri = null;
if (teamId == null) {
uri = USER + "/" + memberId + OPEN_MEMBERSHIP_INVITATION + "?"
+ OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
} else {
uri = USER + "/" + memberId + OPEN_MEMBERSHIP_INVITATION + "?"
+ TEAM_ID_REQUEST_PARAMETER + "=" + teamId + "&" + OFFSET
+ "=" + offset + "&" + LIMIT + "=" + limit;
}
return getPaginatedResults(getRepoEndpoint(), uri, MembershipInvitation.class);
}
@Override
public PaginatedResults<MembershipInvitation> getOpenMembershipInvitationSubmissions(
String teamId, String inviteeId, long limit, long offset)
throws SynapseException {
String uri = null;
if (inviteeId == null) {
uri = TEAM + "/" + teamId + OPEN_MEMBERSHIP_INVITATION + "?"
+ OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
} else {
uri = TEAM + "/" + teamId + OPEN_MEMBERSHIP_INVITATION + "?"
+ INVITEE_ID_REQUEST_PARAMETER + "=" + inviteeId + "&"
+ OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
}
return getPaginatedResults(getRepoEndpoint(), uri, MembershipInvitation.class);
}
@Override
public void deleteMembershipInvitation(String invitationId) throws SynapseException {
deleteUri(getRepoEndpoint(), MEMBERSHIP_INVITATION + "/" + invitationId);
}
@Override
public Count getOpenMembershipInvitationCount() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), OPEN_MEMBERSHIP_INVITATION_COUNT, Count.class);
}
@Override
public InviteeVerificationSignedToken getInviteeVerificationSignedToken(String membershipInvitationId) throws SynapseException {
String uri = MEMBERSHIP_INVITATION + "/" + membershipInvitationId + "/inviteeVerificationSignedToken";
return getJSONEntity(getRepoEndpoint(), uri, InviteeVerificationSignedToken.class);
}
@Override
public void updateInviteeId(String membershipInvitationId, InviteeVerificationSignedToken token) throws SynapseException {
String uri = MEMBERSHIP_INVITATION + "/" + membershipInvitationId + "/inviteeId";
voidPut(getRepoEndpoint(), uri, token);
}
@Override
public MembershipRequest createMembershipRequest(
MembershipRequest request,
String acceptRequestEndpoint,
String notificationUnsubscribeEndpoint) throws SynapseException {
String uri = MEMBERSHIP_REQUEST;
if (acceptRequestEndpoint!=null && notificationUnsubscribeEndpoint!=null) {
uri += "?" + ACCEPT_REQUEST_ENDPOINT_PARAM + "=" + urlEncode(acceptRequestEndpoint) +
"&" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" + urlEncode(notificationUnsubscribeEndpoint);
}
return postJSONEntity(getRepoEndpoint(), uri, request, MembershipRequest.class);
}
@Override
public MembershipRequest getMembershipRequest(String requestId)
throws SynapseException {
String url = MEMBERSHIP_REQUEST + "/" + requestId;
return getJSONEntity(getRepoEndpoint(), url, MembershipRequest.class);
}
@Override
public PaginatedResults<MembershipRequest> getOpenMembershipRequests(
String teamId, String requestorId, long limit, long offset)
throws SynapseException {
String uri = null;
if (requestorId == null) {
uri = TEAM + "/" + teamId + OPEN_MEMBERSHIP_REQUEST + "?" + OFFSET
+ "=" + offset + "&" + LIMIT + "=" + limit;
} else {
uri = TEAM + "/" + teamId + OPEN_MEMBERSHIP_REQUEST + "?"
+ REQUESTOR_ID_REQUEST_PARAMETER + "=" + requestorId + "&"
+ OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
}
return getPaginatedResults(getRepoEndpoint(), uri, MembershipRequest.class);
}
@Override
public PaginatedResults<MembershipRequest> getOpenMembershipRequestSubmissions(
String requesterId, String teamId, long limit, long offset)
throws SynapseException {
String uri = null;
if (teamId == null) {
uri = USER + "/" + requesterId + OPEN_MEMBERSHIP_REQUEST + "?"
+ OFFSET + "=" + offset + "&" + LIMIT + "=" + limit;
} else {
uri = USER + "/" + requesterId + OPEN_MEMBERSHIP_REQUEST + "?"
+ TEAM_ID_REQUEST_PARAMETER + "=" + teamId + "&" + OFFSET
+ "=" + offset + "&" + LIMIT + "=" + limit;
}
return getPaginatedResults(getRepoEndpoint(), uri, MembershipRequest.class);
}
@Override
public void deleteMembershipRequest(String requestId) throws SynapseException {
deleteUri(getRepoEndpoint(), MEMBERSHIP_REQUEST + "/" + requestId);
}
@Override
public Count getOpenMembershipRequestCount() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), OPEN_MEMBERSHIP_REQUEST_COUNT, Count.class);
}
@Override
public void sendNewPasswordResetEmail(String passwordResetEndpoint, String email) throws SynapseException {
Username user = new Username();
user.setEmail(email);
voidPost(getAuthEndpoint(), "/user/password/reset", user, Collections.singletonMap("passwordResetEndpoint", passwordResetEndpoint));
}
@Override
public void changePassword(String username, String currentPassword, String newPassword, String authenticationReceipt)
throws SynapseException {
ChangePasswordWithCurrentPassword changePasswordWithCurrentPassword = new ChangePasswordWithCurrentPassword();
changePasswordWithCurrentPassword.setUsername(username);
changePasswordWithCurrentPassword.setCurrentPassword(currentPassword);
changePasswordWithCurrentPassword.setNewPassword(newPassword);
changePasswordWithCurrentPassword.setAuthenticationReceipt(authenticationReceipt);
changePassword(changePasswordWithCurrentPassword);
}
@Override
public void changePassword(ChangePasswordInterface changePasswordRequest) throws SynapseException {
voidPost(getAuthEndpoint(), "/user/changePassword", changePasswordRequest, null);
}
@Override
public void signTermsOfUse(String accessToken) throws SynapseException {
AccessToken accessTokenWrapper = new AccessToken();
accessTokenWrapper.setAccessToken(accessToken);
voidPost(getAuthEndpoint(), TERMS_OF_USE_V2, accessTokenWrapper, null);
}
/*
* (non-Javadoc)
* @see org.sagebionetworks.client.SynapseClient#getOAuth2AuthenticationUrl(org.sagebionetworks.repo.model.oauth.OAuthUrlRequest)
*/
@Override
public OAuthUrlResponse getOAuth2AuthenticationUrl(OAuthUrlRequest request) throws SynapseException{
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_AUTH_URL, request, OAuthUrlResponse.class);
}
@Override
public LoginResponse validateOAuthAuthenticationCodeForAccessToken(OAuthValidationRequest request) throws SynapseException{
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_SESSION_V2, request, LoginResponse.class);
}
@Override
public LoginResponse createAccountViaOAuth2ForAccessToken(OAuthAccountCreationRequest request) throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_ACCOUNT_V2, request, LoginResponse.class);
}
@Override
public PrincipalAlias bindOAuthProvidersUserId(OAuthValidationRequest request)
throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_ALIAS, request, PrincipalAlias.class);
}
@Override
public void unbindOAuthProvidersUserId(OAuthProvider provider, String alias) throws SynapseException {
ValidateArgument.required(provider, "provider");
ValidateArgument.required(alias, "alias");
try {
String url = AUTH_OAUTH_2_ALIAS+"?provider="+
URLEncoder.encode(provider.name(), "UTF-8")+
"&"+"alias="+URLEncoder.encode(alias, "UTF-8");
deleteUri(getAuthEndpoint(), url);
} catch (UnsupportedEncodingException e) {
throw new SynapseClientException(e);
}
}
@Override
public OIDConnectConfiguration getOIDConnectConfiguration() throws SynapseException {
return getJSONEntity(getAuthEndpoint(), AUTH_OPENID_CONFIG, OIDConnectConfiguration.class);
}
@Override
public JsonWebKeySet getOIDCJsonWebKeySet() throws SynapseException {
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_JWKS, JsonWebKeySet.class);
}
@Override
public OAuthClient createOAuthClient(OAuthClient oauthClient) throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_CLIENT, oauthClient, OAuthClient.class);
}
@Override
public OAuthClientIdAndSecret createOAuthClientSecret(String clientId) throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_CLIENT_SECRET+clientId, null, OAuthClientIdAndSecret.class);
}
@Override
public OAuthClient getOAuthClient(String clientId) throws SynapseException {
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_CLIENT+"/"+clientId, OAuthClient.class);
}
@Override
public OAuthClientList listOAuthClients(String nextPageToken) throws SynapseException {
String uri = AUTH_OAUTH_2_CLIENT;
if (nextPageToken != null) {
uri += "?" + NEXT_PAGE_TOKEN_PARAM + nextPageToken;
}
return getJSONEntity(getAuthEndpoint(), uri, OAuthClientList.class);
}
@Override
public OAuthClient updateOAuthClient(OAuthClient oauthClient) throws SynapseException {
return putJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_CLIENT+"/"+oauthClient.getClient_id(), oauthClient, OAuthClient.class);
}
@Override
public void deleteOAuthClient(String clientId) throws SynapseException {
deleteUri(getAuthEndpoint(), AUTH_OAUTH_2_CLIENT+"/"+clientId);
}
@Override
public OIDCAuthorizationRequestDescription getAuthenticationRequestDescription(
OIDCAuthorizationRequest authorizationRequest) throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_REQUEST_DESCRIPTION, authorizationRequest, OIDCAuthorizationRequestDescription.class);
}
@Override
public boolean hasUserAuthorizedClient(OIDCAuthorizationRequest authorizationRequest) throws SynapseException {
OAuthConsentGrantedResponse response = postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_CONSENT_CHECK,
authorizationRequest, OAuthConsentGrantedResponse.class);
return response.getGranted();
}
@Override
public OAuthAuthorizationResponse authorizeClient(OIDCAuthorizationRequest authorizationRequest)
throws SynapseException {
return postJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_REQUEST_CONSENT, authorizationRequest, OAuthAuthorizationResponse.class);
}
@Override
public OIDCTokenResponse getTokenResponse(OAuthGrantType grant_type, String code, String redirectUri,
String refresh_token, String scope, String claims) throws SynapseException {
URIBuilder uri = new URIBuilder();
uri.setPath(AUTH_OAUTH_2_TOKEN);
if (grant_type != null) {
uri.setParameter(AUTH_OAUTH_2_GRANT_TYPE_PARAM, grant_type.name());
}
if (code != null) {
uri.setParameter(AUTH_OAUTH_2_CODE_PARAM, code);
}
if (redirectUri != null) {
uri.setParameter( AUTH_OAUTH_2_REDIRECT_URI_PARAM, redirectUri);
}
if (refresh_token != null) {
uri.setParameter(AUTH_OAUTH_2_REfRESH_TOKEN_PARAM, refresh_token);
}
if (scope != null) {
uri.setParameter(AUTH_OAUTH_2_SCOPE_PARAM, urlEncode(scope));
}
if (claims != null) {
uri.setParameter(AUTH_OAUTH_2_CLAIMS_PARAM, urlEncode(claims));
}
return postJSONEntity(getAuthEndpoint(), uri.toString(), null, OIDCTokenResponse.class);
}
/**
* Get the user information for the user specified by the authorization
* bearer token (which must be included as the authorization header).
*
* The result is expected to be a JWT token, which is invoked by the
* client having registered a 'user info signed response algorithm'.
*
* @return
*/
@Override
public Jwt<JwsHeader,Claims> getUserInfoAsJSONWebToken() throws SynapseException {
Map<String,String> requestHeaders = new HashMap<String,String>();
requestHeaders.put(AuthorizationConstants.AUTHORIZATION_HEADER_NAME, getAuthorizationHeader());
SimpleHttpResponse response = signAndDispatchSynapseRequest(
getAuthEndpoint(), AUTH_OAUTH_2_USER_INFO, GET, null, requestHeaders, null);
if (!ClientUtils.is200sStatusCode(response.getStatusCode())) {
ClientUtils.throwException(response.getStatusCode(), response.getContent());
}
validateContentType(response, APPLICATION_JWT);
String signedToken = response.getContent();
return JSONWebTokenHelper.parseJWT(signedToken, getOIDCJsonWebKeySet());
}
/**
* Get the user information for the user specified by the authorization
* bearer token (which must be included as the authorization header).
*
* The result is expected to be a Map, which is invoked by the
* client having omitted a 'user info signed response algorithm'.
*
* @return
*/
@Override
public JSONObject getUserInfoAsJSON() throws SynapseException {
return getJson(getAuthEndpoint(), AUTH_OAUTH_2_USER_INFO);
}
@Override
public OAuthClientAuthorizationHistoryList getClientAuthorizationHistory(String nextPageToken) throws SynapseException {
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_CLIENTS, OAuthClientAuthorizationHistoryList.class);
}
@Override
public OAuthRefreshTokenInformationList getRefreshTokenMetadataForAuthorizedClient(String clientId, String nextPageToken) throws SynapseException {
ValidateArgument.required(clientId, "clientId");
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_CLIENTS + "/" + clientId + TOKENS, OAuthRefreshTokenInformationList.class);
}
@Override
public void revokeMyRefreshTokensFromClient(String clientId) throws SynapseException {
ValidateArgument.required(clientId, "clientId");
voidPost(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_CLIENTS + "/" + clientId + REVOKE, null, null);
}
@Override
public void revokeRefreshToken(String refreshTokenId) throws SynapseException {
ValidateArgument.required(refreshTokenId, "refreshTokenId");
voidPost(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_TOKENS + "/" + refreshTokenId + REVOKE, null,null);
}
@Override
public void revokeToken(OAuthTokenRevocationRequest revocationRequest) throws SynapseException {
ValidateArgument.required(revocationRequest, "revocationRequest");
voidPost(getAuthEndpoint(), AUTH_OAUTH_2 + REVOKE, revocationRequest, null);
}
@Override
public OAuthRefreshTokenInformation updateRefreshTokenMetadata(OAuthRefreshTokenInformation metadata) throws SynapseException {
ValidateArgument.required(metadata, "metadata");
ValidateArgument.required(metadata.getTokenId(), "tokenId");
return putJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_TOKENS + "/" + metadata.getTokenId() + METADATA, metadata, OAuthRefreshTokenInformation.class);
}
@Override
public OAuthRefreshTokenInformation getRefreshTokenMetadata(String tokenId) throws SynapseException {
ValidateArgument.required(tokenId, "tokenId");
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_AUDIT_TOKENS + "/" + tokenId + METADATA, OAuthRefreshTokenInformation.class);
}
@Override
public OAuthRefreshTokenInformation getRefreshTokenMetadataAsOAuthClient(String tokenId) throws SynapseException {
ValidateArgument.required(tokenId, "tokenId");
return getJSONEntity(getAuthEndpoint(), AUTH_OAUTH_2_TOKEN + "/" + tokenId + METADATA, OAuthRefreshTokenInformation.class);
}
@Override
public Quiz getCertifiedUserTest() throws SynapseException {
return getJSONEntity(getRepoEndpoint(), CERTIFIED_USER_TEST, Quiz.class);
}
@Override
public PassingRecord submitCertifiedUserTestResponse(QuizResponse response)
throws SynapseException {
return postJSONEntity(getRepoEndpoint(), CERTIFIED_USER_TEST_RESPONSE,
response, PassingRecord.class);
}
@Override
public PassingRecord getCertifiedUserPassingRecord(String principalId)
throws SynapseException {
ValidateArgument.required(principalId, "principalId");
String url = USER + "/" + principalId + CERTIFIED_USER_PASSING_RECORD;
return getJSONEntity(getRepoEndpoint(), url, PassingRecord.class);
}
@Override
public Challenge createChallenge(Challenge challenge) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), CHALLENGE, challenge, Challenge.class);
}
/**
* Returns the Challenge given its ID. Caller must
* have READ permission on the associated Project.
*
* @param challengeId
* @return
* @throws SynapseException
*/
@Override
public Challenge getChallenge(String challengeId) throws SynapseException {
validateStringAsLong(challengeId);
String url = CHALLENGE+"/"+challengeId;
return getJSONEntity(getRepoEndpoint(), url, Challenge.class);
}
@Override
public Challenge getChallengeForProject(String projectId) throws SynapseException {
ValidateArgument.required(projectId, "projectId");
String url = ENTITY+"/"+projectId+CHALLENGE;
return getJSONEntity(getRepoEndpoint(), url, Challenge.class);
}
private static final void validateStringAsLong(String s) throws SynapseClientException {
if (s==null) throw new NullPointerException();
try {
Long.parseLong(s);
} catch (NumberFormatException e) {
throw new SynapseClientException("Expected integer but found "+s, e);
}
}
@Override
public PaginatedIds listChallengeParticipants(String challengeId, Boolean affiliated, Long limit, Long offset) throws SynapseException {
validateStringAsLong(challengeId);
String uri = CHALLENGE+"/"+challengeId+"/participant";
boolean anyParameters = false;
if (affiliated!=null) {
uri += "?affiliated="+affiliated;
anyParameters = true;
}
if (limit!=null) {
uri+=(anyParameters ?"&":"?")+LIMIT+"="+limit;
anyParameters = true;
}
if (offset!=null) {
uri+=(anyParameters ?"&":"?")+OFFSET+"="+offset;
anyParameters = true;
}
return getJSONEntity(getRepoEndpoint(), uri, PaginatedIds.class);
}
@Override
public ChallengePagedResults listChallengesForParticipant(String participantPrincipalId, Long limit, Long offset) throws SynapseException {
validateStringAsLong(participantPrincipalId);
String uri = CHALLENGE+"?participantId="+participantPrincipalId;
if (limit!=null) {
uri+= "&"+LIMIT+"="+limit;
}
if (offset!=null) {
uri+="&"+OFFSET+"="+offset;
}
return getJSONEntity(getRepoEndpoint(), uri, ChallengePagedResults.class);
}
@Override
public Challenge updateChallenge(Challenge challenge) throws SynapseException {
String uri = CHALLENGE+"/"+challenge.getId();
return putJSONEntity(getRepoEndpoint(), uri,challenge, Challenge.class);
}
@Override
public void deleteChallenge(String id) throws SynapseException {
deleteUri(getRepoEndpoint(), CHALLENGE + "/" + id);
}
/**
* Register a Team for a Challenge. The user making this request must be
* registered for the Challenge and be an administrator of the Team.
*
* @param challengeTeam
* @throws SynapseException
*/
@Override
public ChallengeTeam createChallengeTeam(ChallengeTeam challengeTeam) throws SynapseException {
String uri = CHALLENGE+"/"+challengeTeam.getChallengeId()+CHALLENGE_TEAM;
return postJSONEntity(getRepoEndpoint(), uri, challengeTeam, ChallengeTeam.class);
}
@Override
public ChallengeTeamPagedResults listChallengeTeams(String challengeId, Long limit, Long offset) throws SynapseException {
validateStringAsLong(challengeId);
String uri = CHALLENGE+"/"+challengeId+CHALLENGE_TEAM;
boolean anyParameters = false;
if (limit!=null) {
uri+= (anyParameters?"&":"?")+LIMIT+"="+limit;
anyParameters = true;
}
if (offset!=null) {
uri+=(anyParameters?"&":"?")+OFFSET+"="+offset;
anyParameters = true;
}
return getJSONEntity(getRepoEndpoint(), uri, ChallengeTeamPagedResults.class);
}
@Override
public PaginatedIds listRegistratableTeams(String challengeId, Long limit, Long offset) throws SynapseException {
validateStringAsLong(challengeId);
String uri = CHALLENGE+"/"+challengeId+REGISTRATABLE_TEAM;
boolean anyParameters = false;
if (limit!=null) {
uri+=(anyParameters ?"&":"?")+LIMIT+"="+limit;
anyParameters = true;
}
if (offset!=null) {
uri+=(anyParameters ?"&":"?")+OFFSET+"="+offset;
anyParameters = true;
}
return getJSONEntity(getRepoEndpoint(), uri, PaginatedIds.class);
}
@Override
public PaginatedIds listSubmissionTeams(String challengeId, String submitterPrincipalId, Long limit, Long offset) throws SynapseException {
validateStringAsLong(challengeId);
validateStringAsLong(submitterPrincipalId);
String uri = CHALLENGE+"/"+challengeId+SUBMISSION_TEAMS+"?submitterPrincipalId="+submitterPrincipalId;
if (limit!=null) {
uri += "&"+LIMIT+"="+limit;
}
if (offset!=null) {
uri += "&"+OFFSET+"="+offset;
}
return getJSONEntity(getRepoEndpoint(), uri, PaginatedIds.class);
}
@Override
public ChallengeTeam updateChallengeTeam(ChallengeTeam challengeTeam) throws SynapseException {
ValidateArgument.required(challengeTeam, "challengeTeam");
String challengeId = challengeTeam.getChallengeId();
ValidateArgument.required(challengeId, "challengeId");
String challengeTeamId = challengeTeam.getId();
ValidateArgument.required(challengeTeamId, "challengeTeamId");
String uri = CHALLENGE+"/"+challengeId+CHALLENGE_TEAM+"/"+challengeTeamId;
return putJSONEntity(getRepoEndpoint(), uri, challengeTeam, ChallengeTeam.class);
}
/**
* Remove a registered Team from a Challenge.
* The user making this request must be registered for the Challenge and
* be an administrator of the Team.
*
* @param challengeTeamId
* @throws SynapseException
*/
@Override
public void deleteChallengeTeam(String challengeTeamId) throws SynapseException {
validateStringAsLong(challengeTeamId);
deleteUri(getRepoEndpoint(), CHALLENGE_TEAM + "/" + challengeTeamId);
}
@Override
public VerificationSubmission createVerificationSubmission(
VerificationSubmission verificationSubmission,
String notificationUnsubscribeEndpoint)
throws SynapseException {
String uri = VERIFICATION_SUBMISSION;
if (notificationUnsubscribeEndpoint!=null) {
uri += "?" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" + urlEncode(notificationUnsubscribeEndpoint);
}
return postJSONEntity(getRepoEndpoint(), uri, verificationSubmission, VerificationSubmission.class);
}
@Override
public VerificationPagedResults listVerificationSubmissions(
VerificationStateEnum currentState, Long submitterId, Long limit,
Long offset) throws SynapseException {
String uri = VERIFICATION_SUBMISSION;
boolean anyParameters = false;
if (currentState!=null) {
uri+=(anyParameters ?"&":"?")+CURRENT_VERIFICATION_STATE+"="+currentState;
anyParameters = true;
}
if (submitterId!=null) {
uri+=(anyParameters ?"&":"?")+VERIFIED_USER_ID+"="+submitterId;
anyParameters = true;
}
if (limit!=null) {
uri+=(anyParameters ?"&":"?")+LIMIT+"="+limit;
anyParameters = true;
}
if (offset!=null) {
uri+=(anyParameters ?"&":"?")+OFFSET+"="+offset;
anyParameters = true;
}
return getJSONEntity(getRepoEndpoint(), uri, VerificationPagedResults.class);
}
@Override
public void updateVerificationState(long verificationId,
VerificationState verificationState,
String notificationUnsubscribeEndpoint) throws SynapseException {
String uri = VERIFICATION_SUBMISSION+"/"+verificationId+VERIFICATION_STATE;
if (notificationUnsubscribeEndpoint!=null) {
uri += "?" + NOTIFICATION_UNSUBSCRIBE_ENDPOINT_PARAM + "=" + urlEncode(notificationUnsubscribeEndpoint);
}
voidPost(getRepoEndpoint(), uri, verificationState, null);
}
@Override
public void deleteVerificationSubmission(long verificationId) throws SynapseException {
deleteUri(getRepoEndpoint(), VERIFICATION_SUBMISSION+"/"+verificationId);
}
@Override
public UserBundle getMyOwnUserBundle(int mask) throws SynapseException {
String url = USER+USER_BUNDLE+"?mask="+mask;
return getJSONEntity(getRepoEndpoint(), url, UserBundle.class);
}
@Override
public UserBundle getUserBundle(long principalId, int mask)
throws SynapseException {
String url = USER+"/"+principalId+USER_BUNDLE+"?mask="+mask;
return getJSONEntity(getRepoEndpoint(), url, UserBundle.class);
}
private static String createFileDownloadUri(FileHandleAssociation fileHandleAssociation, boolean redirect) {
return FILE + "/" + fileHandleAssociation.getFileHandleId() + "?" +
FILE_ASSOCIATE_TYPE + "=" + fileHandleAssociation.getAssociateObjectType() +
"&" + FILE_ASSOCIATE_ID + "=" + fileHandleAssociation.getAssociateObjectId() +
"&" + REDIRECT_PARAMETER + redirect;
}
@Override
public URL getFileURL(FileHandleAssociation fileHandleAssociation) throws SynapseException {
return getUrl(getFileEndpoint(), createFileDownloadUri(fileHandleAssociation, false));
}
@Override
public void downloadFile(FileHandleAssociation fileHandleAssociation, File target)
throws SynapseException {
String uri = createFileDownloadUri(fileHandleAssociation, false);
downloadFromSynapse(getFileEndpoint() + uri, null, target);
}
@Override
public Forum getForumByProjectId(String projectId) throws SynapseException {
ValidateArgument.required(projectId, "projectId");
return getJSONEntity(getRepoEndpoint(), PROJECT+"/"+projectId+FORUM, Forum.class);
}
@Override
public Forum getForum(String forumId) throws SynapseException {
ValidateArgument.required(forumId, "forumId");
return getJSONEntity(getRepoEndpoint(), FORUM+"/"+forumId, Forum.class);
}
@Override
public DiscussionThreadBundle createThread(CreateDiscussionThread toCreate)
throws SynapseException {
ValidateArgument.required(toCreate, "toCreate");
return postJSONEntity(getRepoEndpoint(), THREAD, toCreate, DiscussionThreadBundle.class);
}
@Override
public DiscussionThreadBundle getThread(String threadId) throws SynapseException {
ValidateArgument.required(threadId, "threadId");
String url = THREAD+"/"+threadId;
return getJSONEntity(getRepoEndpoint(), url, DiscussionThreadBundle.class);
}
@Override
public PaginatedResults<DiscussionThreadBundle> getThreadsForForum(
String forumId, Long limit, Long offset, DiscussionThreadOrder order,
Boolean ascending, DiscussionFilter filter) throws SynapseException {
ValidateArgument.required(forumId, "forumId");
ValidateArgument.required(limit, "limit");
ValidateArgument.required(offset, "offset");
ValidateArgument.required(filter, "filter");
String url = FORUM+"/"+forumId+THREADS
+"?"+LIMIT+"="+limit+"&"+OFFSET+"="+offset;
if (order != null) {
url += "&sort="+order.name();
}
if (ascending != null) {
url += "&ascending="+ascending;
}
url += "&filter="+filter.toString();
return getPaginatedResults(getRepoEndpoint(), url, DiscussionThreadBundle.class);
}
@Override
public DiscussionThreadBundle updateThreadTitle(String threadId,
UpdateThreadTitle newTitle) throws SynapseException {
ValidateArgument.required(threadId, "threadId");
ValidateArgument.required(newTitle, "newTitle");
return putJSONEntity(getRepoEndpoint(), THREAD+"/"+threadId+THREAD_TITLE, newTitle, DiscussionThreadBundle.class);
}
@Override
public DiscussionThreadBundle updateThreadMessage(String threadId,
UpdateThreadMessage newMessage) throws SynapseException {
ValidateArgument.required(threadId, "threadId");
ValidateArgument.required(newMessage, "newMessage");
return putJSONEntity(getRepoEndpoint(), THREAD+"/"+threadId+DISCUSSION_MESSAGE, newMessage, DiscussionThreadBundle.class);
}
@Override
public void markThreadAsDeleted(String threadId) throws SynapseException {
deleteUri(getRepoEndpoint(), THREAD+"/"+threadId);
}
@Override
public void restoreDeletedThread(String threadId) throws SynapseException {
putUri(getRepoEndpoint(), THREAD+"/"+threadId+RESTORE);
}
@Override
public DiscussionReplyBundle createReply(CreateDiscussionReply toCreate)
throws SynapseException {
ValidateArgument.required(toCreate, "toCreate");
return postJSONEntity(getRepoEndpoint(), REPLY, toCreate, DiscussionReplyBundle.class);
}
@Override
public DiscussionReplyBundle getReply(String replyId)
throws SynapseException {
ValidateArgument.required(replyId, "replyId");
return getJSONEntity(getRepoEndpoint(), REPLY+"/"+replyId, DiscussionReplyBundle.class);
}
@Override
public PaginatedResults<DiscussionReplyBundle> getRepliesForThread(
String threadId, Long limit, Long offset,
DiscussionReplyOrder order, Boolean ascending, DiscussionFilter filter)
throws SynapseException {
ValidateArgument.required(threadId, "threadId");
ValidateArgument.required(limit, "limit");
ValidateArgument.required(offset, "offset");
ValidateArgument.required(filter, "filter");
String url = THREAD+"/"+threadId+REPLIES
+"?"+LIMIT+"="+limit+"&"+OFFSET+"="+offset;
if (order != null) {
url += "&sort="+order.name();
}
if (ascending != null) {
url += "&ascending="+ascending;
}
url += "&filter="+filter;
return getPaginatedResults(getRepoEndpoint(), url, DiscussionReplyBundle.class);
}
@Override
public DiscussionReplyBundle updateReplyMessage(String replyId,
UpdateReplyMessage newMessage) throws SynapseException {
ValidateArgument.required(replyId, "replyId");
ValidateArgument.required(newMessage, "newMessage");
return putJSONEntity(getRepoEndpoint(), REPLY+"/"+replyId+DISCUSSION_MESSAGE, newMessage, DiscussionReplyBundle.class);
}
@Override
public void markReplyAsDeleted(String replyId) throws SynapseException {
deleteUri(getRepoEndpoint(), REPLY+"/"+replyId);
}
@Override
public DiscussionSearchResponse forumSearch(String forumId, DiscussionSearchRequest request) throws SynapseException {
ValidateArgument.required(forumId, "forumId");
ValidateArgument.required(request, "request");
return postJSONEntity(getRepoEndpoint(), FORUM + "/" + forumId +"/search", request, DiscussionSearchResponse.class);
}
@Override
public MultipartUploadStatus startMultipartUpload(
MultipartUploadRequest request, Boolean forceRestart) throws SynapseException {
ValidateArgument.required(request, "MultipartUploadRequest");
StringBuilder pathBuilder = new StringBuilder();
pathBuilder.append("/file/multipart");
//the restart parameter is optional.
if(forceRestart != null){
pathBuilder.append("?forceRestart=");
pathBuilder.append(forceRestart.toString());
}
return postJSONEntity(getFileEndpoint(), pathBuilder.toString(), request, MultipartUploadStatus.class);
}
@Override
public BatchPresignedUploadUrlResponse getMultipartPresignedUrlBatch(
BatchPresignedUploadUrlRequest request) throws SynapseException {
ValidateArgument.required(request, "BatchPresignedUploadUrlRequest");
ValidateArgument.required(request.getUploadId(), "BatchPresignedUploadUrlRequest.uploadId");
String path = String.format("/file/multipart/%1$s/presigned/url/batch", request.getUploadId());
return postJSONEntity(getFileEndpoint(),path,request, BatchPresignedUploadUrlResponse.class);
}
@Override
public AddPartResponse addPartToMultipartUpload(String uploadId,
int partNumber, String partMD5Hex) throws SynapseException {
ValidateArgument.required(uploadId, "uploadId");
ValidateArgument.required(partMD5Hex, "partMD5Hex");
String path = String.format("/file/multipart/%1$s/add/%2$d?partMD5Hex=%3$s", uploadId, partNumber, partMD5Hex);
return putJSONEntity(getFileEndpoint(), path, null, AddPartResponse.class);
}
@Override
public MultipartUploadStatus completeMultipartUpload(String uploadId) throws SynapseException {
ValidateArgument.required(uploadId, "uploadId");
String path = String.format("/file/multipart/%1$s/complete", uploadId);
return putJSONEntity(getFileEndpoint(), path, null, MultipartUploadStatus.class);
}
@Override
public CloudProviderFileHandleInterface multipartUpload(InputStream input, long fileSize, String fileName,
String contentType, Long storageLocationId, Boolean generatePreview, Boolean forceRestart) throws SynapseException {
return new MultipartUpload(this, input, fileSize, fileName, contentType, storageLocationId, generatePreview, forceRestart, new FileProviderImpl()).uploadFile();
}
@Override
public CloudProviderFileHandleInterface multipartUpload(File file,
Long storageLocationId, Boolean generatePreview,
Boolean forceRestart) throws SynapseException, IOException {
InputStream fileInputStream = null;
try{
fileInputStream = new FileInputStream(file);
String fileName = file.getName();
long fileSize = file.length();
String contentType = guessContentTypeFromStream(file);
return multipartUpload(fileInputStream, fileSize, fileName, contentType, storageLocationId, generatePreview, forceRestart);
}finally{
IOUtils.closeQuietly(fileInputStream);
}
}
@Override
public URL getReplyUrl(String messageKey) throws SynapseException {
try {
ValidateArgument.required(messageKey, "messageKey");
String url = REPLY+URL+"?messageKey="+messageKey;
return new URL(getJSONEntity(getRepoEndpoint(), url, MessageURL.class).getMessageUrl());
} catch (MalformedURLException e) {
throw new SynapseClientException(e);
}
}
@Override
public URL getThreadUrl(String messageKey) throws SynapseException {
try {
ValidateArgument.required(messageKey, "messageKey");
String url = THREAD+URL+"?messageKey="+messageKey;
return new URL(getJSONEntity(getRepoEndpoint(), url, MessageURL.class).getMessageUrl());
} catch (MalformedURLException e) {
throw new SynapseClientException(e);
}
}
@Override
public Subscription subscribe(Topic toSubscribe) throws SynapseException {
ValidateArgument.required(toSubscribe, "toSubscribe");
return postJSONEntity(getRepoEndpoint(), SUBSCRIPTION, toSubscribe, Subscription.class);
}
@Override
public Subscription subscribeAll(SubscriptionObjectType toSubscribe) throws SynapseException {
ValidateArgument.required(toSubscribe, "toSubscribe");
String url = SUBSCRIPTION+ALL+"?"+OBJECT_TYPE_PARAM+"="+toSubscribe;
return postJSONEntity(getRepoEndpoint(), url, null, Subscription.class);
}
@Override
public SubscriptionPagedResults getAllSubscriptions(
SubscriptionObjectType objectType, Long limit, Long offset, SortByType sortByType, org.sagebionetworks.repo.model.subscription.SortDirection sortDirection) throws SynapseException {
ValidateArgument.required(limit, "limit");
ValidateArgument.required(offset, "offset");
ValidateArgument.required(objectType, "objectType");
StringBuilder builder = new StringBuilder(SUBSCRIPTION+ALL);
builder.append("?");
builder.append(LIMIT).append("=").append(limit);
builder.append("&").append(OFFSET).append("=").append(offset);
builder.append("&").append(OBJECT_TYPE_PARAM).append("=").append(objectType.name());
if(sortByType != null) {
builder.append("&").append("sortBy").append("=").append(sortByType.name());
}
if(sortDirection != null) {
builder.append("&").append("sortDirection").append("=").append(sortDirection.name());
}
return getJSONEntity(getRepoEndpoint(), builder.toString(), SubscriptionPagedResults.class);
}
@Override
public SubscriptionPagedResults listSubscriptions(SubscriptionRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getObjectType(), "SubscriptionRequest.objectType");
ValidateArgument.required(request.getIdList(), "SubscriptionRequest.idList");
return postJSONEntity(getRepoEndpoint(), SUBSCRIPTION+LIST, request, SubscriptionPagedResults.class);
}
@Override
public void unsubscribe(Long subscriptionId) throws SynapseException {
ValidateArgument.required(subscriptionId, "subscriptionId");
deleteUri(getRepoEndpoint(), SUBSCRIPTION+"/"+subscriptionId);
}
@Override
public void unsubscribeAll() throws SynapseException {
deleteUri(getRepoEndpoint(), SUBSCRIPTION+ALL);
}
@Override
public Subscription getSubscription(String subscriptionId) throws SynapseException {
ValidateArgument.required(subscriptionId, "subscriptionId");
return getJSONEntity(getRepoEndpoint(), SUBSCRIPTION+"/"+subscriptionId, Subscription.class);
}
@Override
public EntityId getEntityIdByAlias(String alias) throws SynapseException {
ValidateArgument.required(alias, "alias");
String url = ENTITY+"/alias/"+alias;
return getJSONEntity(getRepoEndpoint(), url, EntityId.class);
}
@Override
public EntityId getEntityIdForDockerRepositoryName(String repositoryName) throws SynapseException {
ValidateArgument.required(repositoryName, "repositoryName");
String url = ENTITY+"/dockerRepo/id?repositoryName="+repositoryName;
return getJSONEntity(getRepoEndpoint(), url, EntityId.class);
}
@Override
public EntityChildrenResponse getEntityChildren(EntityChildrenRequest request) throws SynapseException{
ValidateArgument.required(request, "request");
String url = ENTITY+"/children";
return postJSONEntity(getRepoEndpoint(), url, request, EntityChildrenResponse.class);
}
@Override
public ThreadCount getThreadCountForForum(String forumId, DiscussionFilter filter) throws SynapseException {
ValidateArgument.required(forumId, "forumId");
ValidateArgument.required(filter, "filter");
String url = FORUM+"/"+forumId+THREAD_COUNT;
url += "?filter="+filter;
return getJSONEntity(getRepoEndpoint(), url, ThreadCount.class);
}
@Override
public ReplyCount getReplyCountForThread(String threadId, DiscussionFilter filter) throws SynapseException {
ValidateArgument.required(threadId, "threadId");
ValidateArgument.required(filter, "filter");
String url = THREAD+"/"+threadId+REPLY_COUNT;
url += "?filter="+filter;
return getJSONEntity(getRepoEndpoint(), url, ReplyCount.class);
}
@Override
public void pinThread(String threadId) throws SynapseException {
putUri(getRepoEndpoint(), THREAD+"/"+threadId+PIN);
}
@Override
public void unpinThread(String threadId) throws SynapseException {
putUri(getRepoEndpoint(), THREAD+"/"+threadId+UNPIN);
}
@Override
public PrincipalAliasResponse getPrincipalAlias(PrincipalAliasRequest request) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), PRINCIPAL+"/alias/", request, PrincipalAliasResponse.class);
}
@Override
public void addDockerCommit(String entityId, DockerCommit dockerCommit) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
voidPost(getRepoEndpoint(), ENTITY+"/"+entityId+DOCKER_COMMIT, dockerCommit, null);
}
@Override
public PaginatedResults<DockerCommit> listDockerTags(
String entityId, Long limit, Long offset, DockerCommitSortBy sortBy, Boolean ascending) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = ENTITY+"/"+entityId+DOCKER_TAG;
List<String> requestParams = new ArrayList<String>();
if (limit!=null) {
requestParams.add(LIMIT+"="+limit);
}
if (offset!=null) {
requestParams.add(OFFSET+"="+offset);
}
if (sortBy!=null) {
requestParams.add("sort="+sortBy.name());
}
if (ascending!=null) {
requestParams.add("ascending="+ascending);
}
if (!requestParams.isEmpty()) {
url += "?" + Joiner.on('&').join(requestParams);
}
return getPaginatedResults(getRepoEndpoint(), url, DockerCommit.class);
}
@Override
public PaginatedResults<DiscussionThreadBundle> getThreadsForEntity(String entityId, Long limit, Long offset,
DiscussionThreadOrder order, Boolean ascending, DiscussionFilter filter) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(limit, "limit");
ValidateArgument.required(offset, "offset");
ValidateArgument.required(filter, "filter");
String url = ENTITY+"/"+entityId+THREADS
+"?"+LIMIT+"="+limit+"&"+OFFSET+"="+offset;
if (order != null) {
url += "&sort="+order.name();
}
if (ascending != null) {
url += "&ascending="+ascending;
}
url += "&filter="+filter.toString();
return getPaginatedResults(getRepoEndpoint(), url, DiscussionThreadBundle.class);
}
@Override
public EntityThreadCounts getEntityThreadCount(List<String> entityIds) throws SynapseException {
EntityIdList idList = new EntityIdList();
idList.setIdList(entityIds);
return postJSONEntity(getRepoEndpoint(), ENTITY_THREAD_COUNTS, idList , EntityThreadCounts.class);
}
@Override
public PaginatedIds getModeratorsForForum(String forumId, Long limit, Long offset) throws SynapseException {
ValidateArgument.required(forumId, "forumId");
ValidateArgument.required(limit, "limit");
ValidateArgument.required(offset, "offset");
String url = FORUM+"/"+forumId+MODERATORS
+"?"+LIMIT+"="+limit+"&"+OFFSET+"="+offset;
return getJSONEntity(getRepoEndpoint(), url, PaginatedIds.class);
}
@Override
public BatchFileResult getFileHandleAndUrlBatch(BatchFileRequest request) throws SynapseException {
return postJSONEntity(getFileEndpoint(), FILE_HANDLE_BATCH, request , BatchFileResult.class);
}
@Override
public BatchFileHandleCopyResult copyFileHandles(BatchFileHandleCopyRequest request) throws SynapseException {
return postJSONEntity(getFileEndpoint(), FILE_HANDLES_COPY, request , BatchFileHandleCopyResult.class);
}
@Override
public void requestToCancelSubmission(String submissionId) throws SynapseException {
putUri(getRepoEndpoint(), EVALUATION_URI_PATH+"/"+SUBMISSION+"/"+submissionId+"/cancellation");
}
@Override
public ColumnModelPage getPossibleColumnModelsForViewScope(ViewScope scope, String nextPageToken) throws SynapseException{
StringBuilder url = new StringBuilder("/column/view/scope");
if(nextPageToken != null){
url.append("?nextPageToken=");
url.append(nextPageToken);
}
return postJSONEntity(getRepoEndpoint(), url.toString(), scope, ColumnModelPage.class);
}
@Override
public String startGetPossibleColumnModelsForViewScope(ViewColumnModelRequest request) throws SynapseException {
return startAsynchJob(AsynchJobType.ViewColumnModelRequest, request);
}
@Override
public ViewColumnModelResponse getPossibleColumnModelsForViewScopeResult(String asyncJobToken)
throws SynapseException {
ViewColumnModelResponse response = (ViewColumnModelResponse) getAsyncResult(AsynchJobType.ViewColumnModelRequest, asyncJobToken);
return response;
}
@Override
public String transformSqlRequest(SqlTransformRequest request) throws SynapseException {
SqlTransformResponse response = postJSONEntity(getRepoEndpoint(), "/table/sql/transform", request,
SqlTransformResponse.class);
return response.getTransformedSql();
}
@Override
public SubscriberPagedResults getSubscribers(Topic topic, String nextPageToken) throws SynapseException {
String url = SUBSCRIPTION+"/subscribers";
if (nextPageToken != null) {
url += "?" + NEXT_PAGE_TOKEN_PARAM + nextPageToken;
}
return postJSONEntity(getRepoEndpoint(), url, topic, SubscriberPagedResults.class);
}
@Override
public SubscriberCount getSubscriberCount(Topic topic) throws SynapseException {
return postJSONEntity(getRepoEndpoint(), SUBSCRIPTION+"/subscribers/count", topic, SubscriberCount.class);
}
@Override
public ResearchProject createOrUpdateResearchProject(ResearchProject toCreateOrUpdate) throws SynapseException {
ValidateArgument.required(toCreateOrUpdate, "toCreateOrUpdate");
return postJSONEntity(getRepoEndpoint(), RESEARCH_PROJECT, toCreateOrUpdate, ResearchProject.class);
}
@Override
public ResearchProject getResearchProjectForUpdate(String accessRequirementId) throws SynapseException {
ValidateArgument.required(accessRequirementId, "accessRequirementId");
String url = ACCESS_REQUIREMENT + "/" + accessRequirementId + "/researchProjectForUpdate";
return getJSONEntity(getRepoEndpoint(), url, ResearchProject.class);
}
@Override
public RequestInterface createOrUpdateRequest(RequestInterface toCreateOrUpdate)
throws SynapseException {
ValidateArgument.required(toCreateOrUpdate, "toCreateOrUpdate");
return postJSONEntity(getRepoEndpoint(), DATA_ACCESS_REQUEST, toCreateOrUpdate, Request.class);
}
@Override
public RequestInterface getRequestForUpdate(String accessRequirementId) throws SynapseException {
ValidateArgument.required(accessRequirementId, "accessRequirementId");
String url = ACCESS_REQUIREMENT + "/" + accessRequirementId + "/dataAccessRequestForUpdate";
return getJSONEntity(getRepoEndpoint(), url, RequestInterface.class);
}
@Override
public org.sagebionetworks.repo.model.dataaccess.SubmissionStatus submitRequest(CreateSubmissionRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getRequestId(), "requestId");
String url = DATA_ACCESS_REQUEST+"/"+request.getRequestId()+"/submission";
return postJSONEntity(getRepoEndpoint(), url, request, org.sagebionetworks.repo.model.dataaccess.SubmissionStatus.class);
}
@Override
public org.sagebionetworks.repo.model.dataaccess.SubmissionStatus cancelSubmission(String submissionId) throws SynapseException {
ValidateArgument.required(submissionId, "submissionId");
String url = DATA_ACCESS_SUBMISSION+"/"+submissionId+"/cancellation";
return putJSONEntity(getRepoEndpoint(), url, null, org.sagebionetworks.repo.model.dataaccess.SubmissionStatus.class);
}
@Override
public void deleteDataAccessSubmission(String submissionId) throws SynapseException {
ValidateArgument.required(submissionId, "submissionId");
String url = DATA_ACCESS_SUBMISSION+"/"+submissionId;
deleteUri(getRepoEndpoint(), url);
}
@Override
public org.sagebionetworks.repo.model.dataaccess.Submission updateSubmissionState(String submissionId, SubmissionState newState, String reason)
throws SynapseException {
ValidateArgument.required(submissionId, "submissionId");
SubmissionStateChangeRequest request = new SubmissionStateChangeRequest();
request.setSubmissionId(submissionId);
request.setNewState(newState);
request.setRejectedReason(reason);
String url = DATA_ACCESS_SUBMISSION+"/"+submissionId;
return putJSONEntity(getRepoEndpoint(), url, request, org.sagebionetworks.repo.model.dataaccess.Submission.class);
}
@Override
public SubmissionPage listSubmissions(String requirementId, String nextPageToken,
SubmissionState filter, SubmissionOrder order, Boolean isAscending)
throws SynapseException {
ValidateArgument.required(requirementId, "requirementId");
SubmissionPageRequest request = new SubmissionPageRequest();
request.setAccessRequirementId(requirementId);
request.setFilterBy(filter);
request.setOrderBy(order);
request.setIsAscending(isAscending);
request.setNextPageToken(nextPageToken);
String url = ACCESS_REQUIREMENT + "/" + requirementId + "/submissions";
return postJSONEntity(getRepoEndpoint(), url, request, SubmissionPage.class);
}
@Override
public SubmissionInfoPage listApprovedSubmissionInfo(String requirementId, String nextPageToken) throws SynapseException {
ValidateArgument.required(requirementId, "requirementId");
SubmissionInfoPageRequest request = new SubmissionInfoPageRequest();
request.setAccessRequirementId(requirementId);
request.setNextPageToken(nextPageToken);
String url = ACCESS_REQUIREMENT + "/" + requirementId + "/approvedSubmissionInfo";
return postJSONEntity(getRepoEndpoint(), url, request, SubmissionInfoPage.class);
}
@Override
public AccessRequirementStatus getAccessRequirementStatus(String requirementId) throws SynapseException {
ValidateArgument.required(requirementId, "requirementId");
String url = ACCESS_REQUIREMENT + "/" + requirementId + "/status";
return getJSONEntity(getRepoEndpoint(), url, AccessRequirementStatus.class);
}
@Override
public RestrictionInformationResponse getRestrictionInformation(RestrictionInformationRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getRepoEndpoint(), "/restrictionInformation", request, RestrictionInformationResponse.class);
}
@Override
public OpenSubmissionPage getOpenSubmissions(String nextPageToken) throws SynapseException {
String url = DATA_ACCESS_SUBMISSION+"/openSubmissions";
if (nextPageToken != null) {
url += "?nextPageToken="+nextPageToken;
}
return getJSONEntity(getRepoEndpoint(), url, OpenSubmissionPage.class);
}
@Override
public String lookupChild(String parentId, String entityName) throws SynapseException {
ValidateArgument.required(parentId, "parentId");
ValidateArgument.required(entityName, "entityName");
EntityLookupRequest request = new EntityLookupRequest();
request.setEntityName(entityName);
request.setParentId(parentId);
return postJSONEntity(getRepoEndpoint(), ENTITY+"/child", request, EntityId.class).getId();
}
@Override
public AccessorGroupResponse listAccessorGroup(AccessorGroupRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getRepoEndpoint(), ACCESS_APPROVAL+"/group", request, AccessorGroupResponse.class);
}
@Override
public void revokeGroup(String accessRequirementId, String submitterId) throws SynapseException {
ValidateArgument.required(accessRequirementId, "accessRequirementId");
ValidateArgument.required(submitterId, "submitterId");
AccessorGroupRevokeRequest request = new AccessorGroupRevokeRequest();
request.setAccessRequirementId(accessRequirementId);
request.setSubmitterId(submitterId);
voidPut(getRepoEndpoint(), ACCESS_APPROVAL+"/group/revoke", request);
}
@Override
public AccessRequirement convertAccessRequirement(AccessRequirementConversionRequest request)
throws SynapseException {
ValidateArgument.required(request, "request");
return putJSONEntity(getRepoEndpoint(), ACCESS_REQUIREMENT+"/conversion", request, AccessRequirement.class);
}
@Override
public BatchAccessApprovalInfoResponse getBatchAccessApprovalInfo(BatchAccessApprovalInfoRequest request)
throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getRepoEndpoint(), ACCESS_APPROVAL+"/information", request, BatchAccessApprovalInfoResponse.class);
}
@Override
public AccessApprovalNotificationResponse getAccessApprovalNotifications(AccessApprovalNotificationRequest request)
throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getRepoEndpoint(), ACCESS_APPROVAL+"/notifications", request, AccessApprovalNotificationResponse.class);
}
@Override
public RestrictableObjectDescriptorResponse getSubjects(String requirementId, String nextPageToken)
throws SynapseException {
ValidateArgument.required(requirementId, "requirementId");
String uri = ACCESS_REQUIREMENT+"/"+requirementId+"/subjects";
if (nextPageToken != null) {
uri += "?nextPageToken="+nextPageToken;
}
return getJSONEntity(getRepoEndpoint(), uri, RestrictableObjectDescriptorResponse.class);
}
@Override
public String startAddFilesToDownloadList(AddFileToDownloadListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.AddFileToDownloadList, request);
}
@Override
public AddFileToDownloadListResponse getAddFilesToDownloadListResponse(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
return (AddFileToDownloadListResponse) getAsyncResult(AsynchJobType.AddFileToDownloadList, asyncJobToken, (String) null);
}
@Override
public DownloadList addFilesToDownloadList(List<FileHandleAssociation> toAdd) throws SynapseException {
ValidateArgument.required(toAdd, "toAdd");
FileHandleAssociationList request = new FileHandleAssociationList();
request.setList(toAdd);
return postJSONEntity(getFileEndpoint(), DOWNLOAD_LIST_ADD, request, DownloadList.class);
}
@Override
public DownloadList removeFilesFromDownloadList(List<FileHandleAssociation> toRemove) throws SynapseException {
ValidateArgument.required(toRemove, "toRemove");
FileHandleAssociationList request = new FileHandleAssociationList();
request.setList(toRemove);
return postJSONEntity(getFileEndpoint(), DOWNLOAD_LIST_REMOVE, request, DownloadList.class);
}
@Override
public void clearDownloadList() throws SynapseException {
deleteUri(getFileEndpoint(), DOWNLOAD_LIST);
}
@Override
public DownloadList getDownloadList() throws SynapseException {
return getJSONEntity(getFileEndpoint(), DOWNLOAD_LIST, DownloadList.class);
}
@Override
public DownloadOrder createDownloadOrderFromUsersDownloadList(String zipFileName) throws SynapseException {
ValidateArgument.required(zipFileName, "zipFileName");
String url = DOWNLOAD_ORDER+"?zipFileName="+zipFileName;
return postJSONEntity(getFileEndpoint(), url, null, DownloadOrder.class);
}
@Override
public DownloadOrder getDownloadOrder(String orderId) throws SynapseException {
ValidateArgument.required(orderId, "orderId");
String url = DOWNLOAD_ORDER+"/"+orderId;
return getJSONEntity(getFileEndpoint(), url, DownloadOrder.class);
}
@Override
public DownloadOrderSummaryResponse getDownloadOrderHistory(DownloadOrderSummaryRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return postJSONEntity(getFileEndpoint(), DOWNLOAD_ORDER_HISTORY, request, DownloadOrderSummaryResponse.class);
}
@Override
public DataTypeResponse changeEntitysDataType(String entityId, DataType newDataType) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(newDataType, "newDataType");
String url = ENTITY + "/" + entityId + "/datatype?type="+newDataType.name();
return putJSONEntity(getRepoEndpoint(), url, null, DataTypeResponse.class);
}
@Override
public String generateStorageReportAsyncStart(StorageReportType reportType) throws SynapseException {
DownloadStorageReportRequest request = new DownloadStorageReportRequest();
request.setReportType(reportType);
return startAsynchJob(AsynchJobType.DownloadStorageReport, request);
}
@Override
public DownloadStorageReportResponse generateStorageReportAsyncGet(String asyncJobToken) throws SynapseException {
String url = STORAGE_REPORT + ASYNC_GET + asyncJobToken;
return getJSONEntity(getRepoEndpoint(), url, DownloadStorageReportResponse.class);
}
@Override
public SnapshotResponse createTableSnapshot(String tableId, SnapshotRequest request) throws SynapseException {
ValidateArgument.required(tableId, "tableId");
String url = "/entity/"+tableId+"/table/snapshot";
return postJSONEntity(getRepoEndpoint(), url, request, SnapshotResponse.class);
}
@Override
public ObjectStatisticsResponse getStatistics(ObjectStatisticsRequest request) throws SynapseException {
ValidateArgument.required(request, "The request body");
return postJSONEntity(getRepoEndpoint(), STATISTICS, request, ObjectStatisticsResponse.class);
}
@Override
public FormGroup createFormGroup(String name) throws SynapseException {
ValidateArgument.required(name, "name");
String url = "/form/group?name="+name;
return postJSONEntity(getRepoEndpoint(), url, null, FormGroup.class);
}
@Override
public FormGroup getFormGroup(String id) throws SynapseException {
ValidateArgument.required(id, "id");
String url = "/form/group/"+id;
return getJSONEntity(getRepoEndpoint(), url, FormGroup.class);
}
@Override
public AccessControlList getFormGroupAcl(String formGroupId) throws SynapseException {
ValidateArgument.required(formGroupId, "formGroupId");
String url = "/form/group/"+formGroupId+"/acl";
return getJSONEntity(getRepoEndpoint(), url, AccessControlList.class);
}
@Override
public AccessControlList updateFormGroupAcl(AccessControlList acl) throws SynapseException {
ValidateArgument.required(acl, "acl");
ValidateArgument.required(acl.getId(), "acl.id");
String url = "/form/group/"+acl.getId()+"/acl";
return putJSONEntity(getRepoEndpoint(), url, acl, AccessControlList.class);
}
@Override
public FormData createFormData(String groupId, FormChangeRequest request) throws SynapseException {
ValidateArgument.required(groupId, "groupId");
ValidateArgument.required(request, "request");
String url = "/form/data?groupId="+groupId;
return postJSONEntity(getRepoEndpoint(), url, request, FormData.class);
}
@Override
public FormData updateFormData(String formId, FormChangeRequest request) throws SynapseException {
ValidateArgument.required(formId, "formId");
ValidateArgument.required(request, "request");
String url = "/form/data/"+formId;
return putJSONEntity(getRepoEndpoint(), url, request, FormData.class);
}
@Override
public void deleteFormData(String formId) throws SynapseException {
ValidateArgument.required(formId, "formId");
String url = "/form/data/"+formId;
deleteUri(getRepoEndpoint(), url);
}
@Override
public FormData submitFormData(String formId) throws SynapseException {
ValidateArgument.required(formId, "formId");
String url = "/form/data/"+formId+"/submit";
return postJSONEntity(getRepoEndpoint(), url, null, FormData.class);
}
@Override
public ListResponse listFormStatusForCreator(ListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getGroupId(), "request.groupId");
ValidateArgument.required(request.getFilterByState(), "request.filterByState");
String url = "/form/data/list";
return postJSONEntity(getRepoEndpoint(), url, request, ListResponse.class);
}
@Override
public ListResponse listFormStatusForReviewer(ListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getGroupId(), "request.groupId");
ValidateArgument.required(request.getFilterByState(), "request.filterByState");
String url = "/form/data/list/reviewer";
return postJSONEntity(getRepoEndpoint(), url, request, ListResponse.class);
}
@Override
public FormData reviewerAcceptFormData(String formDataId) throws SynapseException {
ValidateArgument.required(formDataId, "formDataId");
String url = "/form/data/"+formDataId+"/accept";
return putJSONEntity(getRepoEndpoint(), url, null, FormData.class);
}
@Override
public FormData reviewerRejectFormData(String formDataId, FormRejection rejection) throws SynapseException {
ValidateArgument.required(formDataId, "formDataId");
String url = "/form/data/"+formDataId+"/reject";
return putJSONEntity(getRepoEndpoint(), url, rejection, FormData.class);
}
@Override
public Organization createOrganization(CreateOrganizationRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getOrganizationName(), "request.organizationName");
String url = "/schema/organization";
return postJSONEntity(getRepoEndpoint(), url, request, Organization.class);
}
@Override
public Organization getOrganizationByName(String organizationName) throws SynapseException {
ValidateArgument.required(organizationName, "organizationName");
String url = "/schema/organization?name="+organizationName;
return getJSONEntity(getRepoEndpoint(), url, Organization.class);
}
@Override
public void deleteOrganization(String id) throws SynapseException {
ValidateArgument.required(id, "id");
String url = "/schema/organization/"+id;
deleteUri(getRepoEndpoint(), url);
}
@Override
public AccessControlList getOrganizationAcl(String id) throws SynapseException {
ValidateArgument.required(id, "organizationName");
String url = "/schema/organization/"+id+"/acl";
return getJSONEntity(getRepoEndpoint(), url, AccessControlList.class);
}
@Override
public AccessControlList updateOrganizationAcl(String id, AccessControlList toUpdate) throws SynapseException {
ValidateArgument.required(id, "id");
ValidateArgument.required(toUpdate, "AccessControlList");
String url = "/schema/organization/"+id+"/acl";
return putJSONEntity(getRepoEndpoint(), url, toUpdate, AccessControlList.class);
}
@Override
public String startCreateSchemaJob(CreateSchemaRequest request) throws SynapseException {
return startAsynchJob(AsynchJobType.CreateJsonSchema, request);
}
@Override
public CreateSchemaResponse getCreateSchemaJobResult(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
String url = SCHEMA_TYPE_CREATE + ASYNC_GET + asyncJobToken;
return (CreateSchemaResponse) getAsynchJobResponse(url, CreateSchemaResponse.class, getRepoEndpoint());
}
@Override
public JsonSchema getJsonSchema(String organizationName, String schemaName, String semanticVersion) throws SynapseException {
ValidateArgument.required(organizationName, "organizationName");
ValidateArgument.required(schemaName, "schemaName");
StringBuilder builder = new StringBuilder();
builder.append("/schema/type/registered/");
builder.append(organizationName);
builder.append("-");
builder.append(schemaName);
if(semanticVersion != null) {
builder.append("-");
builder.append(semanticVersion);
}
return getJSONEntity(getRepoEndpoint(), builder.toString(), JsonSchema.class);
}
@Override
public void deleteSchema(String organizationName, String schemaName) throws SynapseException {
ValidateArgument.required(organizationName, "organizationName");
ValidateArgument.required(schemaName, "schemaName");
StringBuilder builder = new StringBuilder();
builder.append("/schema/type/registered/");
builder.append(organizationName);
builder.append("-");
builder.append(schemaName);
deleteUri(getRepoEndpoint(), builder.toString());
}
@Override
public void deleteSchemaVersion(String organizationName, String schemaName, String semanticVersion)
throws SynapseException {
ValidateArgument.required(organizationName, "organizationName");
ValidateArgument.required(schemaName, "schemaName");
ValidateArgument.required(semanticVersion, "semanticVersion");
StringBuilder builder = new StringBuilder();
builder.append("/schema/type/registered/");
builder.append(organizationName);
builder.append("-");
builder.append(schemaName);
if(semanticVersion != null) {
builder.append("-");
builder.append(semanticVersion);
}
deleteUri(getRepoEndpoint(), builder.toString());
}
@Override
public ListOrganizationsResponse listOrganizations(ListOrganizationsRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
String url = "/schema/organization/list";
return postJSONEntity(getRepoEndpoint(), url, request, ListOrganizationsResponse.class);
}
@Override
public ListJsonSchemaInfoResponse listSchemaInfo(ListJsonSchemaInfoRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
String url = "/schema/list";
return postJSONEntity(getRepoEndpoint(), url, request, ListJsonSchemaInfoResponse.class);
}
@Override
public ListJsonSchemaVersionInfoResponse listSchemaVersions(ListJsonSchemaVersionInfoRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
String url = "/schema/version/list";
return postJSONEntity(getRepoEndpoint(), url, request, ListJsonSchemaVersionInfoResponse.class);
}
@Override
public JsonSchemaObjectBinding bindJsonSchemaToEntity(BindSchemaToEntityRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getEntityId(), "request.entityId");
String url = "/entity/"+request.getEntityId()+"/schema/binding";
return putJSONEntity(getRepoEndpoint(), url, request, JsonSchemaObjectBinding.class);
}
@Override
public JsonSchemaObjectBinding getJsonSchemaBindingForEntity(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/schema/binding";
return getJSONEntity(getRepoEndpoint(), url, JsonSchemaObjectBinding.class);
}
@Override
public void clearSchemaBindingForEntity(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/schema/binding";
deleteUri(getRepoEndpoint(), url);
}
@Override
public JSONObject getEntityJson(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/json";
return getJson(getRepoEndpoint(), url);
}
@Override
public JSONObject updateEntityJson(String entityId, JSONObject json) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/json";
return putJson(getRepoEndpoint(), url, json.toString());
}
@Override
public ValidationResults getEntityValidationResults(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/schema/validation";
return getJSONEntity(getRepoEndpoint(), url, ValidationResults.class);
}
@Override
public ValidationSummaryStatistics getEntitySchemaValidationStatistics(String entityId) throws SynapseException {
ValidateArgument.required(entityId, "entityId");
String url = "/entity/"+entityId+"/schema/validation/statistics";
return getJSONEntity(getRepoEndpoint(), url, ValidationSummaryStatistics.class);
}
@Override
public ListValidationResultsResponse getInvalidValidationResults(ListValidationResultsRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
ValidateArgument.required(request.getContainerId(), "request.containerId");
String url = "/entity/"+request.getContainerId()+"/schema/validation/invalid";
return postJSONEntity(getRepoEndpoint(), url, request, ListValidationResultsResponse.class);
}
@Override
public void updateEntityFileHandle(String entityId, Long versionNumber, FileHandleUpdateRequest request)
throws SynapseException {
ValidateArgument.required(entityId, "entityId");
ValidateArgument.required(versionNumber, "versionNumber");
ValidateArgument.required(request, "request");
String url = "/entity/" + entityId + "/version/" + versionNumber + "/filehandle";
voidPut(getRepoEndpoint(), url, request);
}
@Override
public AddBatchOfFilesToDownloadListResponse addFilesToDownloadList(AddBatchOfFilesToDownloadListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
String url = "/download/list/add";
return postJSONEntity(getRepoEndpoint(), url, request, AddBatchOfFilesToDownloadListResponse.class);
}
@Override
public RemoveBatchOfFilesFromDownloadListResponse removeFilesFromDownloadList(RemoveBatchOfFilesFromDownloadListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
String url = "/download/list/remove";
return postJSONEntity(getRepoEndpoint(), url, request, RemoveBatchOfFilesFromDownloadListResponse.class);
}
@Override
public void clearUsersDownloadList() throws SynapseException {
String uri = "/download/list";
deleteUri(getRepoEndpoint(), uri);
}
@Override
public String startDownloadListQuery(DownloadListQueryRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.QueryDownloadList, request);
}
@Override
public DownloadListQueryResponse getDownloadListQueryResult(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
String url = DOWNLOAD_LIST_QUERY + ASYNC_GET + asyncJobToken;
return (DownloadListQueryResponse) getAsynchJobResponse(url, DownloadListQueryResponse.class, getRepoEndpoint());
}
@Override
public String startAddToDownloadList(AddToDownloadListRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.AddToDownloadList, request);
}
@Override
public AddToDownloadListResponse getAddToDownloadListResponse(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
String url = DOWNLOAD_LIST_ADD + ASYNC_GET + asyncJobToken;
return (AddToDownloadListResponse) getAsynchJobResponse(url, AddToDownloadListResponse.class, getRepoEndpoint());
}
@Override
public String startDownloadListPackage(DownloadListPackageRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.DownloadPackageList, request);
}
@Override
public DownloadListPackageResponse getDownloadListPackageResponse(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
String url = DOWNLOAD_LIST_PACKAGE + ASYNC_GET + asyncJobToken;
return (DownloadListPackageResponse) getAsynchJobResponse(url, DownloadListPackageResponse.class, getRepoEndpoint());
}
@Override
public String startDownloadListManifest(DownloadListManifestRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.DownloadPackageList, request);
}
@Override
public DownloadListManifestResponse getDownloadListManifestResponse(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
String url = DOWNLOAD_LIST_MANIFEST + ASYNC_GET + asyncJobToken;
return (DownloadListManifestResponse) getAsynchJobResponse(url, DownloadListManifestResponse.class, getRepoEndpoint());
}
@Override
public String startFileHandleRestoreRequest(FileHandleRestoreRequest request) throws SynapseException {
ValidateArgument.required(request, "request");
return startAsynchJob(AsynchJobType.FileHandleRestore, request);
}
@Override
public FileHandleRestoreResponse getFileHandleRestoreResponse(String asyncJobToken)
throws SynapseException, SynapseResultNotReadyException {
ValidateArgument.required(asyncJobToken, "asyncJobToken");
String url = FILE_HANDLE_RESTORE + ASYNC_GET + asyncJobToken;
return (FileHandleRestoreResponse) getAsynchJobResponse(url, FileHandleRestoreResponse.class, getRepoEndpoint());
}
}
|
Sage-Bionetworks/Synapse-Repository-Services
|
client/synapseJavaClient/src/main/java/org/sagebionetworks/client/SynapseClientImpl.java
|
Java
|
apache-2.0
| 233,910
|
package com.dell.dsg.api.provider;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.ext.Provider;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@Component
@Provider
public class RequestInterceptor implements ContainerRequestFilter {
static final Logger logger = Logger.getLogger(RequestInterceptor.class);
@Override
public void filter(ContainerRequestContext requestContext){
String type = requestContext.getHeaderString("Content-Type");
logger.debug("Content-Type:" + type);
}
}
|
vmirrow/dsgp-api
|
src/main/java/com/dell/dsg/api/provider/RequestInterceptor.java
|
Java
|
apache-2.0
| 612
|
package co.gobd.gofetch.model;
/**
* Created by tonmoy on 29-Feb-16.
*/
public class Point {
private String type;
private String[] coordinates;
public Point(String type, String[] coordinates) {
this.type = type;
this.coordinates = coordinates;
}
public String getType() {
return type;
}
public String[] getCoordinates() {
return coordinates;
}
@Override
public String toString() {
return "Point [type = " + type + ", coordinates = " + coordinates.toString() + "]";
}
}
|
NerdCats/RoboCat
|
app/src/main/java/co/gobd/gofetch/model/Point.java
|
Java
|
apache-2.0
| 561
|
/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.serialize.support.json;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import com.alibaba.dubbo.common.serialize.ObjectInput;
import com.alibaba.dubbo.common.utils.PojoUtils;
import com.alibaba.fastjson.JSON;
/**
* JsonObjectInput
*
* @author william.liangf
*/
public class FastJsonObjectInput implements ObjectInput {
private final BufferedReader reader;
public FastJsonObjectInput(InputStream in) {
this(new InputStreamReader(in));
}
public FastJsonObjectInput(Reader reader) {
this.reader = new BufferedReader(reader);
}
public boolean readBool() throws IOException {
try {
return readObject(boolean.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public byte readByte() throws IOException {
try {
return readObject(byte.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public short readShort() throws IOException {
try {
return readObject(short.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public int readInt() throws IOException {
try {
return readObject(int.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public long readLong() throws IOException {
try {
return readObject(long.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public float readFloat() throws IOException {
try {
return readObject(float.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public double readDouble() throws IOException {
try {
return readObject(double.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public String readUTF() throws IOException {
try {
return readObject(String.class);
} catch (ClassNotFoundException e) {
throw new IOException(e.getMessage());
}
}
public byte[] readBytes() throws IOException {
return readLine().getBytes();
}
public Object readObject() throws IOException, ClassNotFoundException {
String json = readLine();
return JSON.parse(json);
}
public <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException {
String json = readLine();
return JSON.parseObject(json, cls);
}
@SuppressWarnings("unchecked")
public <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException {
Object value = readObject(cls);
return (T) PojoUtils.realize(value, cls, type);
}
private String readLine() throws IOException, EOFException {
String line = reader.readLine();
if (line == null || line.trim().length() == 0) throw new EOFException();
return line;
}
}
|
lenovoDTC/dubbo-G
|
dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/json/FastJsonObjectInput.java
|
Java
|
apache-2.0
| 4,139
|
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt.
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace Sce.Atf.GraphicsApplications
{
/// <summary>
/// A utility class that uses a single system stop watch to time any number of distinct
/// types of events, identified by a supplied name. Can prepare a simple report.</summary>
public class PerformanceTimers
{
/// <summary>
/// Useful for counting start/stop cycles. Clears all timing data and phase names.
/// Is not necessary to call explicitly before StartPhase. StartPhase calls
/// this method if necessary.</summary>
public void Start()
{
m_times.Clear();
m_stopWatch.Reset();
m_startTime = m_stopWatch.ElapsedMilliseconds;
m_stopWatch.Start();
m_started = true;
}
/// <summary>
/// Increments the start/stop cycle count. The next call to StartPhase or Start clears
/// all timing data.</summary>
public void Stop()
{
m_stopWatch.Stop();
long time = m_stopWatch.ElapsedMilliseconds;
m_cycleTime = time - m_startTime;
m_startStopCycles++;
m_started = false;
}
/// <summary>
/// Clears all timing data, phase names, and the number of start/stop cycles except
/// for the CycleTime</summary>
public void Clear()
{
CheckNotStarted();
m_startStopCycles = 0;
m_times.Clear();
}
/// <summary>
/// The number of times Stop has been called since the last Clear or since this
/// object was created</summary>
public int StartStopCycles
{
get { return m_startStopCycles; }
}
/// <summary>
/// The time, in miliseconds, between the last Start and Stop calls</summary>
public long CycleTime
{
get { return m_cycleTime; }
}
/// <summary>
/// Begins timing a named phase. Call StopPhase when the phase ends.</summary>
/// <param name="name">Unique name of this phase. Is displayed to the user.</param>
public void StartPhase(string name)
{
CheckStarted();
long time = m_stopWatch.ElapsedMilliseconds;
m_times[name] = time;
}
/// <summary>
/// Stops the previously started phase</summary>
/// <param name="id">Unique ID of this phase. Is displayed to the user.</param>
public void StopPhase(string id)
{
CheckStarted();
long startTime;
if (!m_times.TryGetValue(id, out startTime))
startTime = m_startTime;
long time = m_stopWatch.ElapsedMilliseconds;
time = time - startTime;
m_times[id] = time;
}
/// <summary>
/// Gets the phase time, in miliseconds, for the given phase name</summary>
/// <param name="id">Phase name</param>
/// <returns>Phase time, in miliseconds, for the given phase name</returns>
public long GetPhaseTime(string id)
{
long time;
m_times.TryGetValue(id, out time);
return time;
}
/// <summary>
/// Formats a string useful for displaying results to the user, with phases sorted
/// in alphabetical order</summary>
/// <returns>Timing results of phases, sorted in alphabetical order</returns>
public string GetDisplayString()
{
StringBuilder sb = new StringBuilder();
List<KeyValuePair<string, long>> times = new List<KeyValuePair<string, long>>(m_times);
foreach (KeyValuePair<string, long> time in times)
{
sb.Append(time.Key);
sb.Append(": ");
sb.Append(time.Value.ToString());
sb.Append(" ms ");
}
return sb.ToString();
}
private void CheckStarted()
{
if (!m_started)
Start();
}
private void CheckNotStarted()
{
if (m_started)
Stop();
}
private readonly Stopwatch m_stopWatch = new Stopwatch();
private readonly SortedDictionary<string, long> m_times = new SortedDictionary<string, long>();
private long m_startTime;
private long m_cycleTime;
private int m_startStopCycles;
private bool m_started;
}
}
|
blue3k/ATF
|
Framework/Atf.Core/PerformanceTimers.cs
|
C#
|
apache-2.0
| 4,658
|
package com.javatao.jkami;
import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
/**
* 缓存类型MAP,在内存紧张是自动回收
*
* @see SoftReference
* @author tao
*/
public class CacheMap<K, V> implements Map<K, V>, Serializable {
private static final long serialVersionUID = 1091402635340146766L;
private Map<K, SoftReference<V>> map = new ConcurrentHashMap<>();
public V get(Object key) {
Object val = map.get(key);
if (val instanceof SoftReference) {
V v = ((SoftReference<V>) val).get();
return v;
}
return (V) val;
}
@Override
public boolean containsKey(Object key) {
Object val = map.get(key);
if (val == null) {
return false;
} else {
if (val instanceof SoftReference) {
Object v = ((SoftReference<?>) val).get();
if (v == null) {
return false;
}
}
return true;
}
}
@Override
public V put(K key, V value) {
SoftReference<V> reference = new SoftReference<>(value);
Object oldValue = map.put(key, reference);
if (oldValue instanceof SoftReference) {
return ((SoftReference<V>) oldValue).get();
} else {
return (V) oldValue;
}
}
@Override
public int size() {
return map.size();
}
@Override
public boolean isEmpty() {
return map.isEmpty();
}
@Override
public V remove(Object key) {
SoftReference<V> remove = map.remove(key);
V v = remove.get();
return v;
}
@Override
public void putAll(Map<? extends K, ? extends V> m) {
Set<?> entrySet = m.entrySet();
for (Object o : entrySet) {
if (o instanceof java.util.Map.Entry) {
Entry<K, V> entry = (Entry<K, V>) o;
K key = entry.getKey();
V value = entry.getValue();
SoftReference<V> reference = new SoftReference<>(value);
map.put(key, reference);
}
}
}
@Override
public void clear() {
map.clear();
}
@Override
public Set<K> keySet() {
return map.keySet();
}
@Override
public Collection<V> values() {
Set<V> out = new HashSet<>();
Set<java.util.Map.Entry<K, SoftReference<V>>> set = map.entrySet();
for (Entry<K, SoftReference<V>> entry : set) {
SoftReference<V> value = entry.getValue();
V v = value.get();
if (v != null) {
out.add(v);
}
}
return out;
}
@Override
public Set<java.util.Map.Entry<K, V>> entrySet() {
Set<java.util.Map.Entry<K, V>> out = new HashSet<>();
Set<java.util.Map.Entry<K, SoftReference<V>>> set = map.entrySet();
for (Entry<K, SoftReference<V>> entry : set) {
final K key = entry.getKey();
SoftReference<V> value = entry.getValue();
final V v = value.get();
if (v != null) {
java.util.Map.Entry<K, V> mp = new Entry<K, V>() {
@Override
public K getKey() {
return key;
}
@Override
public V getValue() {
return v;
}
@Override
public V setValue(V value) {
return value;
}
};
out.add(mp);
}
}
return out;
}
@Override
public boolean containsValue(Object value) {
if (value == null)
return false;
Set<java.util.Map.Entry<K, SoftReference<V>>> set = map.entrySet();
for (Entry<K, SoftReference<V>> entry : set) {
SoftReference<V> val = entry.getValue();
V v = val.get();
if (value.equals(v)) {
return true;
}
}
return false;
}
/**
* 缓存类型MAP,在内存紧张是自动回收<br>
* 定期清理被回收的数据
*
* @param timerMonitor
* 检测回收间隔时间
*/
public CacheMap(int timerMonitor) {
timerMonitor(timerMonitor);
}
/**
* 缓存类型MAP,在内存紧张是自动回收<br>
* 定期清理被回收的数据
*/
public CacheMap() {
super();
timerMonitor(60 * 1000 * 30);
}
// 定期清理被回收的数据
private void timerMonitor(int timerMonitor) {
Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
Set<java.util.Map.Entry<K, SoftReference<V>>> entrySet = map.entrySet();
for (Iterator<Entry<K, SoftReference<V>>> iterator = entrySet.iterator(); iterator.hasNext();) {
Entry<K, SoftReference<V>> entry = iterator.next();
SoftReference<V> value = entry.getValue();
V v = value.get();
if (v == null) {
iterator.remove();
}
}
}
}, 3000, timerMonitor);
}
}
|
lftao/jkami
|
src/main/java/com/javatao/jkami/CacheMap.java
|
Java
|
apache-2.0
| 5,602
|
<div class="cd"></div>
<!-- /.cd -->
|
artemsky/EvartFM
|
resources/views/dashboard/pages/radio/playlistContent.blade.php
|
PHP
|
apache-2.0
| 36
|
/**
Contains basic mapper (conversion) functionality that
allows for converting between regular streaming json content and
Java objects (beans or Tree Model: support for both is via
{@link com.google.ratel.deps.jackson.databind.ObjectMapper} class, as well
as convenience methods included in
{@link com.google.ratel.deps.jackson.core.JsonParser}
<p>
Object mapper will convert Json content to ant from
basic Java wrapper types (Integer, Boolean, Double),
Collection types (List, Map), Java Beans,
Strings and nulls.
<p>
Tree mapper builds dynamically typed tree of {@link com.google.ratel.deps.jackson.databind.JsonNode}s
from JSON content (and writes such trees as JSON),
similar to how DOM model works with XML.
Main benefits over Object mapping are:
<ul>
<li>No null checks are needed (dummy
nodes are created as necessary to represent "missing" Object fields
and Array elements)
</li>
<li>No type casts are usually needed: all public access methods are defined
in basic <code>JsonNode</code> class, and when "incompatible" method (such as Array
element access on, say, Boolean node) is used, returned node is
virtual "missing" node.
</li>
</ul>
Because of its dynamic nature, Tree mapping is often convenient
for basic path access and tree navigation, where structure of
the resulting tree is known in advance.
*/
package com.google.ratel.deps.jackson.databind;
|
sabob/ratel
|
ratel/src/com/google/ratel/deps/jackson/databind/package-info.java
|
Java
|
apache-2.0
| 1,373
|
[](https://travis-ci.org/socketio/socket.io-client-swift)
#Socket.IO-Client-Swift
Socket.IO-client for iOS/OS X.
##Example
```swift
let socket = SocketIOClient(socketURL: "localhost:8080")
socket.on("connect") {data, ack in
print("socket connected")
}
socket.on("currentAmount") {data, ack in
if let cur = data?[0] as? Double {
socket.emitWithAck("canUpdate", cur)(timeoutAfter: 0) {data in
socket.emit("update", ["amount": cur + 2.50])
}
ack?("Got your currentAmount", "dude")
}
}
socket.connect()
```
##Objective-C Example
```objective-c
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:@"localhost:8080" options:nil];
[socket onObjectiveC:@"connect" callback:^(NSArray* data, void (^ack)(NSArray*)) {
NSLog(@"socket connected");
}];
[socket onObjectiveC:@"currentAmount" callback:^(NSArray* data, void (^ack)(NSArray*)) {
double cur = [[data objectAtIndex:0] floatValue];
[socket emitWithAck:@"canUpdate" withItems:@[@(cur)]](0, ^(NSArray* data) {
[socket emit:@"update" withItems:@[@{@"amount": @(cur + 2.50)}]];
});
ack(@[@"Got your currentAmount, ", @"dude"]);
}];
[socket connect];
```
##Features
- Supports socket.io 1.0+
- Supports binary
- Supports Polling and WebSockets
- Supports TLS/SSL
- Can be used from Objective-C
##Installation
Requires Swift 2/Xcode 7
If you need Swift 1.2/Xcode 6.3/4 use v2.4.5 (Pre-Swift 2 support is no longer maintained)
If you need Swift 1.1/Xcode 6.2 use v1.5.2. (Pre-Swift 1.2 support is no longer maintained)
Carthage
-----------------
Add this line to your `Cartfile`:
```
github "socketio/socket.io-client-swift" ~> 3.0.2 # Or latest version
```
Run `carthage update --platform ios,macosx`.
Manually (iOS 7+)
-----------------
1. Copy the SocketIOClientSwift folder into your Xcode project. (Make sure you add the files to your target(s))
2. If you plan on using this from Objective-C, read [this](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) on exposing Swift code to Objective-C.
CocoaPods 0.36.0 or later (iOS 8+)
------------------
Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'Socket.IO-Client-Swift', '~> 3.0.2' # Or latest version
```
Install pods:
```
$ pod install
```
Import the module:
Swift:
```swift
import Socket_IO_Client_Swift
```
Objective-C:
```Objective-C
#import <Socket_IO_Client_Swift/Socket_IO_Client_Swift-Swift.h>
```
##API
Constructors
-----------
`init(socketURL: String, opts:NSDictionary? = nil)` - Constructs a new client for the given URL. opts can be omitted (will use default values) note: If your socket.io server is secure, you need to specify `https` in your socketURL.
`convenience init(socketURL: String, options:NSDictionary?)` - Same as above, but meant for Objective-C. See Objective-C Example.
Options
-------
- `connectParams: [String: AnyObject]?` - Dictionary whose contents will be passed with the connection.
- `reconnects: Bool` Default is `true`
- `reconnectAttempts: Int` Default is `-1` (infinite tries)
- `reconnectWait: Int` Default is `10`
- `forcePolling: Bool` Default is `false`. `true` forces the client to use xhr-polling.
- `forceWebsockets: Bool` Default is `false`. `true` forces the client to use WebSockets.
- `nsp: String` Default is `"/"`. Connects to a namespace.
- `cookies: [NSHTTPCookie]?` An array of NSHTTPCookies. Passed during the handshake. Default is nil.
- `log: Bool` If `true` socket will log debug messages. Default is false.
- `logger: SocketLogger` If you wish to implement your own logger that conforms to SocketLogger you can pass it in here. Will use the default logging defined under the protocol otherwise.
- `sessionDelegate: NSURLSessionDelegate` Sets an NSURLSessionDelegate for the underlying engine. Useful if you need to handle self-signed certs. Default is nil.
- `path: String` - If the server uses a custom path. ex: `"/swift"`. Default is `""`
- `extraHeaders: [String: String]?` - Adds custom headers to the initial request. Default is nil.
- `handleQueue: dispatch_queue_t` - The dispatch queue that handlers are run on. Default is the main queue.
Methods
-------
1. `on(name: String, callback: ((data: NSArray?, ack: AckEmitter?) -> Void))` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example.
2. `onObjectiveC(name: String, callback: ((data: NSArray?, ack: AckEmitter?) -> Void))` - Adds a handler for an event. Items are passed by an array. `ack` can be used to send an ack when one is requested. See example.
3. `onAny(callback:((event: String, items: AnyObject?)) -> Void)` - Adds a handler for all events. It will be called on any received event.
4. `emit(event: String, _ items: AnyObject...)` - Sends a message. Can send multiple items.
5. `emit(event: String, withItems items: [AnyObject])` - `emit` for Objective-C
6. `emitWithAck(event: String, _ items: AnyObject...) -> (timeoutAfter: UInt64, callback: (NSArray?) -> Void) -> Void` - Sends a message that requests an acknowledgement from the server. Returns a function which you can use to add a handler. See example. Note: The message is not sent until you call the returned function.
7. `emitWithAck(event: String, withItems items: [AnyObject]) -> (UInt64, (NSArray?) -> Void) -> Void` - `emitWithAck` for Objective-C. Note: The message is not sent until you call the returned function.
8. `connect()` - Establishes a connection to the server. A "connect" event is fired upon successful connection.
9. `connect(timeoutAfter timeoutAfter: Int, withTimeoutHandler handler: (() -> Void)?)` - Connect to the server. If it isn't connected after timeoutAfter seconds, the handler is called.
10. `close(fast fast: Bool)` - Closes the socket. Once a socket is closed it should not be reopened. Pass true to fast if you're closing from a background task.
11. `reconnect()` - Causes the client to reconnect to the server.
12. `joinNamespace()` - Causes the client to join nsp. Shouldn't need to be called unless you change nsp manually.
13. `leaveNamespace()` - Causes the client to leave the nsp and go back to /
Client Events
------
1. `connect` - Emitted when on a successful connection.
2. `disconnect` - Emitted when the connection is closed.
3. `error` - Emitted on an error.
4. `reconnect` - Emitted when the connection is starting to reconnect.
5. `reconnectAttempt` - Emitted when attempting to reconnect.
##Detailed Example
A more detailed example can be found [here](https://github.com/nuclearace/socket.io-client-swift-example)
##License
MIT
|
KevinMartin/socket.io-client-swift
|
README.md
|
Markdown
|
apache-2.0
| 6,820
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Creative - Start Bootstrap Theme</title>
<!-- Bootstrap Core CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
<!-- Custom Fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css" type="text/css">
<!-- Plugin CSS -->
<link rel="stylesheet" href="css/animate.min.css" type="text/css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/creative.css" type="text/css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body id="page-top">
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">Start Bootstrap</a>
<?php
session_start();
if(isset($_SESSION["nama"])){
$session_nama_pengguna=$_SESSION["nama"];
}
?>
<ul class="navbar-brand navbar-right">
<?php if(!isset($session_username)){?><li><a href="index.php?halaman=daftar">Daftar</a></li><?php } ?>
<?php if(isset($session_username)){?><li><a href="index.php?halaman=daftar">Hai,<?php echo $session_username;?></a></li><?php } ?>
<?php if(!isset($session_username)){?><li><a href="index.php?halaman=login">Masuk</a></li><?php } ?>
<?php if(isset($session_username)){?><li><a href="index.php?halaman=keluar">Keluar</a></li><?php } ?>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#portfolio">Portfolio</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<header>
<div class="header-content">
<div class="header-content-inner">
<h1>Selamat Datang Di Halaman Inventori Laboratorium Informatika</h1>
<hr>
<p>Pakai/Pinjamlah Barang Inventori Sesuai Dengan Kebutuhan, Agar Tidak Mengganggu Pengguna Yang Lainnya</p>
<a href="#about" class="btn btn-primary btn-xl page-scroll">Silahkan Meminjam</a>
</div>
</div>
</header>
<section class="bg-primary" id="about">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">Mohon Dibaca Dahulu</h2>
<hr class="light">
<p class="text-faded">Apabila meminjam barang harap dikembalikan sesuai waktu pengembalian, apabila barang kembali dengan keadaan tidak seperti waktu meminjam, peminjam wajib membayar ganti rugi sesuai kerusakan, apabila terlambat mengembalikan, pengguna wajib membayar denda. </p>
<a href="#services" class="btn btn-default btn-xl page-scroll">Lanjut</a>
</div>
</div>
</div>
</section>
<section id="services">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2 class="section-heading">Daftar Inventori</h2>
<hr class="primary">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<i class="fa fa-4x fa-diamond wow bounceIn text-primary"></i>
<h3>Penjam Alat Lab</h3>
<p class="text-muted">Our templates are updated regularly so they don't break.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<i class="fa fa-4x fa-paper-plane wow bounceIn text-primary " data-wow-delay=".1s"></i>
<h3>Pinjam Ruangan</h3>
<p class="text-muted">You can use this theme as is, or you can make changes!</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<i class="fa fa-4x fa-newspaper-o wow bounceIn text-primary" data-wow-delay=".2s"></i>
<h3>Jadwal</h3>
<p class="text-muted">We update dependencies to keep things fresh.</p>
</div>
</div>
<div class="col-lg-3 col-md-6 text-center">
<div class="service-box">
<i class="fa fa-4x fa-heart wow bounceIn text-primary" data-wow-delay=".3s"></i>
<h3>Log Book</h3>
<p class="text-muted">You have to make your websites with love these days!</p>
</div>
</div>
</div>
</div>
</section>
<section class="no-padding" id="portfolio">
<div class="container-fluid">
<div class="row no-gutter">
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/1.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/2.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/3.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/4.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/5.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
<div class="col-lg-4 col-sm-6">
<a href="#" class="portfolio-box">
<img src="img/portfolio/6.jpg" class="img-responsive" alt="">
<div class="portfolio-box-caption">
<div class="portfolio-box-caption-content">
<div class="project-category text-faded">
Category
</div>
<div class="project-name">
Project Name
</div>
</div>
</div>
</a>
</div>
</div>
</div>
</section>
<aside class="bg-dark">
<div class="container text-center">
<div class="call-to-action">
<h2>Ruang Lab TI Unesa</h2>
</div>
</div>
</aside>
<section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">Kontak Admin</h2>
<hr class="primary">
<p>Hubungilah Admin Apabila Ada Gangguan Atau Ada Kerusakan Pada Inventori</p>
</div>
<div class="col-lg-4 col-lg-offset-2 text-center">
<i class="fa fa-phone fa-3x wow bounceIn"></i>
<p>123-456-6789</p>
</div>
<div class="col-lg-4 text-center">
<i class="fa fa-envelope-o fa-3x wow bounceIn" data-wow-delay=".1s"></i>
<p><a href="mailto:your-email@your-domain.com">informatika@unesa.ac.id</a></p>
</div>
</div>
</div>
</section>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.magnific-popup.js" type="text/javascript"></script>
<!-- Plugin JavaScript -->
<script src="js/jquery.easing.min.js"></script>
<script src="js/jquery.fittext.js"></script>
<script src="js/wow.min.js"></script>
<script src="js/jquery.fancybox.js"></script>
<!-- Custom Theme JavaScript -->
<script src="js/creative.js"></script>
</body>
</html>
|
nikeessyana/silaboratorium
|
index.html
|
HTML
|
apache-2.0
| 13,242
|
package urchin.cli.permission;
import org.springframework.stereotype.Component;
import urchin.cli.BasicCommand;
import urchin.cli.Command;
import urchin.model.group.GroupName;
import urchin.model.permission.AclPermission;
import java.nio.file.Path;
@Component
public class SetAclGroupOnFolderCommand extends BasicCommand {
private final Command command;
protected SetAclGroupOnFolderCommand(Runtime runtime, Command command) {
super(runtime);
this.command = command;
}
public void execute(Path folder, GroupName groupName, AclPermission aclPermission) {
log.debug("Setting ACL permissions {} on {} for group {}", aclPermission, folder, groupName);
executeCommand(command.getPermissionCommand("set-acl-group-on-folder")
.replace("%folder%", folder.toAbsolutePath().toString())
.replace("%group%", groupName.getValue())
.replace("%permission%", aclPermission.getPermissions())
);
}
}
|
anhem/urchin
|
src/main/java/urchin/cli/permission/SetAclGroupOnFolderCommand.java
|
Java
|
apache-2.0
| 998
|
/*
* Copyright (c) 2008-2021, 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.client.impl.protocol.codec;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.Generated;
import com.hazelcast.client.impl.protocol.codec.builtin.*;
import com.hazelcast.client.impl.protocol.codec.custom.*;
import javax.annotation.Nullable;
import static com.hazelcast.client.impl.protocol.ClientMessage.*;
import static com.hazelcast.client.impl.protocol.codec.builtin.FixedSizeTypesCodec.*;
/*
* This file is auto-generated by the Hazelcast Client Protocol Code Generator.
* To change this file, edit the templates or the protocol
* definitions on the https://github.com/hazelcast/hazelcast-client-protocol
* and regenerate it.
*/
/**
* Removes the entry for a key only if currently mapped to a given value. The object to be removed will be removed
* from only the current transaction context until the transaction is committed.
*/
@Generated("999bb9e6355efdc0111f802463e56693")
public final class TransactionalMapRemoveIfSameCodec {
//hex: 0x0E0D00
public static final int REQUEST_MESSAGE_TYPE = 920832;
//hex: 0x0E0D01
public static final int RESPONSE_MESSAGE_TYPE = 920833;
private static final int REQUEST_TXN_ID_FIELD_OFFSET = PARTITION_ID_FIELD_OFFSET + INT_SIZE_IN_BYTES;
private static final int REQUEST_THREAD_ID_FIELD_OFFSET = REQUEST_TXN_ID_FIELD_OFFSET + UUID_SIZE_IN_BYTES;
private static final int REQUEST_INITIAL_FRAME_SIZE = REQUEST_THREAD_ID_FIELD_OFFSET + LONG_SIZE_IN_BYTES;
private static final int RESPONSE_RESPONSE_FIELD_OFFSET = RESPONSE_BACKUP_ACKS_FIELD_OFFSET + BYTE_SIZE_IN_BYTES;
private static final int RESPONSE_INITIAL_FRAME_SIZE = RESPONSE_RESPONSE_FIELD_OFFSET + BOOLEAN_SIZE_IN_BYTES;
private TransactionalMapRemoveIfSameCodec() {
}
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
public static class RequestParameters {
/**
* Name of the Transactional Map
*/
public java.lang.String name;
/**
* ID of the this transaction operation
*/
public java.util.UUID txnId;
/**
* The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.
*/
public long threadId;
/**
* The specified key
*/
public com.hazelcast.internal.serialization.Data key;
/**
* Remove the key if it has this value.
*/
public com.hazelcast.internal.serialization.Data value;
}
public static ClientMessage encodeRequest(java.lang.String name, java.util.UUID txnId, long threadId, com.hazelcast.internal.serialization.Data key, com.hazelcast.internal.serialization.Data value) {
ClientMessage clientMessage = ClientMessage.createForEncode();
clientMessage.setRetryable(false);
clientMessage.setOperationName("TransactionalMap.RemoveIfSame");
ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[REQUEST_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);
encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, REQUEST_MESSAGE_TYPE);
encodeInt(initialFrame.content, PARTITION_ID_FIELD_OFFSET, -1);
encodeUUID(initialFrame.content, REQUEST_TXN_ID_FIELD_OFFSET, txnId);
encodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET, threadId);
clientMessage.add(initialFrame);
StringCodec.encode(clientMessage, name);
DataCodec.encode(clientMessage, key);
DataCodec.encode(clientMessage, value);
return clientMessage;
}
public static TransactionalMapRemoveIfSameCodec.RequestParameters decodeRequest(ClientMessage clientMessage) {
ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
RequestParameters request = new RequestParameters();
ClientMessage.Frame initialFrame = iterator.next();
request.txnId = decodeUUID(initialFrame.content, REQUEST_TXN_ID_FIELD_OFFSET);
request.threadId = decodeLong(initialFrame.content, REQUEST_THREAD_ID_FIELD_OFFSET);
request.name = StringCodec.decode(iterator);
request.key = DataCodec.decode(iterator);
request.value = DataCodec.decode(iterator);
return request;
}
public static ClientMessage encodeResponse(boolean response) {
ClientMessage clientMessage = ClientMessage.createForEncode();
ClientMessage.Frame initialFrame = new ClientMessage.Frame(new byte[RESPONSE_INITIAL_FRAME_SIZE], UNFRAGMENTED_MESSAGE);
encodeInt(initialFrame.content, TYPE_FIELD_OFFSET, RESPONSE_MESSAGE_TYPE);
encodeBoolean(initialFrame.content, RESPONSE_RESPONSE_FIELD_OFFSET, response);
clientMessage.add(initialFrame);
return clientMessage;
}
/**
* True if the value was removed
*/
public static boolean decodeResponse(ClientMessage clientMessage) {
ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
ClientMessage.Frame initialFrame = iterator.next();
return decodeBoolean(initialFrame.content, RESPONSE_RESPONSE_FIELD_OFFSET);
}
}
|
emre-aydin/hazelcast
|
hazelcast/src/main/java/com/hazelcast/client/impl/protocol/codec/TransactionalMapRemoveIfSameCodec.java
|
Java
|
apache-2.0
| 5,907
|
/*
* Copyright 2017 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 org.apache.kafka.common.security.kerberos;
import javax.security.auth.kerberos.KerberosPrincipal;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.security.auth.kerberos.KerberosTicket;
import javax.security.auth.Subject;
import org.apache.kafka.common.KafkaException;
import org.apache.kafka.common.security.JaasUtils;
import org.apache.kafka.common.security.authenticator.AbstractLogin;
import org.apache.kafka.common.config.SaslConfigs;
import org.apache.kafka.common.utils.Shell;
import org.apache.kafka.common.utils.Time;
import org.apache.kafka.common.utils.SystemTime;
import org.apache.kafka.common.utils.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.security.AccessController;
import java.util.Comparator;
import java.util.Date;
import java.util.Random;
import java.util.Set;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* This class is responsible for refreshing Kerberos credentials for
* logins for both Kafka client and server.
*/
public class KerberosLogin extends AbstractLogin {
private static final Logger log = LoggerFactory.getLogger(KerberosLogin.class);
private static final Random RNG = new Random();
private final Time time = new SystemTime();
private Thread t;
private boolean isKrbTicket;
private boolean isUsingTicketCache;
private String loginContextName;
private String principal;
// LoginThread will sleep until 80% of time from last refresh to
// ticket's expiry has been reached, at which time it will wake
// and try to renew the ticket.
private double ticketRenewWindowFactor;
/**
* Percentage of random jitter added to the renewal time
*/
private double ticketRenewJitter;
// Regardless of ticketRenewWindowFactor setting above and the ticket expiry time,
// thread will not sleep between refresh attempts any less than 1 minute (60*1000 milliseconds = 1 minute).
// Change the '1' to e.g. 5, to change this to 5 minutes.
private long minTimeBeforeRelogin;
private String kinitCmd;
private volatile Subject subject;
private LoginContext loginContext;
private String serviceName;
private long lastLogin;
/**
* Login constructor. The constructor starts the thread used
* to periodically re-login to the Kerberos Ticket Granting Server.
* @param loginContextName
* name of section in JAAS file that will be use to login.
* Passed as first param to javax.security.auth.login.LoginContext().
* @param configs configure Login with the given key-value pairs.
* @throws javax.security.auth.login.LoginException
* Thrown if authentication fails.
*/
public void configure(Map<String, ?> configs, final String loginContextName) {
super.configure(configs, loginContextName);
this.loginContextName = loginContextName;
this.ticketRenewWindowFactor = (Double) configs.get(SaslConfigs.SASL_KERBEROS_TICKET_RENEW_WINDOW_FACTOR);
this.ticketRenewJitter = (Double) configs.get(SaslConfigs.SASL_KERBEROS_TICKET_RENEW_JITTER);
this.minTimeBeforeRelogin = (Long) configs.get(SaslConfigs.SASL_KERBEROS_MIN_TIME_BEFORE_RELOGIN);
this.kinitCmd = (String) configs.get(SaslConfigs.SASL_KERBEROS_KINIT_CMD);
this.serviceName = getServiceName(configs, loginContextName);
}
@Override
public LoginContext login() throws LoginException {
Subject existingSubject = Subject.getSubject(AccessController.getContext());
if (existingSubject != null) {
// Found a subject in the threads access control context. Check if it has a valid Kerberos ticket
SortedSet<KerberosTicket> tickets = new TreeSet<>(new Comparator<KerberosTicket>() {
@Override
public int compare(KerberosTicket ticket1, KerberosTicket ticket2) {
return Long.compare(ticket1.getEndTime().getTime(), ticket2.getEndTime().getTime());
}
});
for (KerberosTicket ticket : existingSubject.getPrivateCredentials(KerberosTicket.class)) {
// Filter out Kerberos TGTs
KerberosPrincipal principal = ticket.getServer();
String principalName = "krbtgt/" + principal.getRealm() + "@" + principal.getRealm();
if (principalName.equals(principal.getName())) {
tickets.add(ticket);
}
}
if (!tickets.isEmpty() && tickets.last().isCurrent()) {
log.debug("Found Subject with a valid Kerberos ticket");
subject = existingSubject;
// Note that it is the responsibility of the application to renew ticket and update the subject
return loginContext;
}
}
this.lastLogin = currentElapsedTime();
loginContext = super.login();
subject = loginContext.getSubject();
isKrbTicket = !subject.getPrivateCredentials(KerberosTicket.class).isEmpty();
AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry(loginContextName);
if (entries.length == 0) {
isUsingTicketCache = false;
principal = null;
} else {
// there will only be a single entry
AppConfigurationEntry entry = entries[0];
if (entry.getOptions().get("useTicketCache") != null) {
String val = (String) entry.getOptions().get("useTicketCache");
isUsingTicketCache = val.equals("true");
} else
isUsingTicketCache = false;
if (entry.getOptions().get("principal") != null)
principal = (String) entry.getOptions().get("principal");
else
principal = null;
}
if (!isKrbTicket) {
log.debug("It is not a Kerberos ticket");
t = null;
// if no TGT, do not bother with ticket management.
return loginContext;
}
log.debug("It is a Kerberos ticket");
// Refresh the Ticket Granting Ticket (TGT) periodically. How often to refresh is determined by the
// TGT's existing expiry date and the configured minTimeBeforeRelogin. For testing and development,
// you can decrease the interval of expiration of tickets (for example, to 3 minutes) by running:
// "modprinc -maxlife 3mins <principal>" in kadmin.
t = Utils.newThread("kafka-kerberos-refresh-thread", new Runnable() {
public void run() {
log.info("TGT refresh thread started.");
while (true) { // renewal thread's main loop. if it exits from here, thread will exit.
KerberosTicket tgt = getTGT();
long now = currentWallTime();
long nextRefresh;
Date nextRefreshDate;
if (tgt == null) {
nextRefresh = now + minTimeBeforeRelogin;
nextRefreshDate = new Date(nextRefresh);
log.warn("No TGT found: will try again at {}", nextRefreshDate);
} else {
nextRefresh = getRefreshTime(tgt);
long expiry = tgt.getEndTime().getTime();
Date expiryDate = new Date(expiry);
if (isUsingTicketCache && tgt.getRenewTill() != null && tgt.getRenewTill().getTime() < expiry) {
log.error("The TGT cannot be renewed beyond the next expiry date: {}." +
"This process will not be able to authenticate new SASL connections after that " +
"time (for example, it will not be able to authenticate a new connection with a Kafka " +
"Broker). Ask your system administrator to either increase the " +
"'renew until' time by doing : 'modprinc -maxrenewlife {} ' within " +
"kadmin, or instead, to generate a keytab for {}. Because the TGT's " +
"expiry cannot be further extended by refreshing, exiting refresh thread now.",
expiryDate, principal, principal);
return;
}
// determine how long to sleep from looking at ticket's expiry.
// We should not allow the ticket to expire, but we should take into consideration
// minTimeBeforeRelogin. Will not sleep less than minTimeBeforeRelogin, unless doing so
// would cause ticket expiration.
if ((nextRefresh > expiry) || (now + minTimeBeforeRelogin > expiry)) {
// expiry is before next scheduled refresh).
log.info("Refreshing now because expiry is before next scheduled refresh time.");
nextRefresh = now;
} else {
if (nextRefresh < (now + minTimeBeforeRelogin)) {
// next scheduled refresh is sooner than (now + MIN_TIME_BEFORE_LOGIN).
Date until = new Date(nextRefresh);
Date newUntil = new Date(now + minTimeBeforeRelogin);
log.warn("TGT refresh thread time adjusted from {} to {} since the former is sooner " +
"than the minimum refresh interval ({} seconds) from now.",
until, newUntil, minTimeBeforeRelogin / 1000);
}
nextRefresh = Math.max(nextRefresh, now + minTimeBeforeRelogin);
}
nextRefreshDate = new Date(nextRefresh);
if (nextRefresh > expiry) {
log.error("Next refresh: {} is later than expiry {}. This may indicate a clock skew problem." +
"Check that this host and the KDC hosts' clocks are in sync. Exiting refresh thread.",
nextRefreshDate, expiryDate);
return;
}
}
if (now < nextRefresh) {
Date until = new Date(nextRefresh);
log.info("TGT refresh sleeping until: {}", until);
try {
Thread.sleep(nextRefresh - now);
} catch (InterruptedException ie) {
log.warn("TGT renewal thread has been interrupted and will exit.");
return;
}
} else {
log.error("NextRefresh: {} is in the past: exiting refresh thread. Check"
+ " clock sync between this host and KDC - (KDC's clock is likely ahead of this host)."
+ " Manual intervention will be required for this client to successfully authenticate."
+ " Exiting refresh thread.", nextRefreshDate);
return;
}
if (isUsingTicketCache) {
String kinitArgs = "-R";
int retry = 1;
while (retry >= 0) {
try {
log.debug("Running ticket cache refresh command: {} {}", kinitCmd, kinitArgs);
Shell.execCommand(kinitCmd, kinitArgs);
break;
} catch (Exception e) {
if (retry > 0) {
--retry;
// sleep for 10 seconds
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException ie) {
log.error("Interrupted while renewing TGT, exiting Login thread");
return;
}
} else {
log.warn("Could not renew TGT due to problem running shell command: '" + kinitCmd
+ " " + kinitArgs + "'" + "; exception was: " + e + ". Exiting refresh thread.", e);
return;
}
}
}
}
try {
int retry = 1;
while (retry >= 0) {
try {
reLogin();
break;
} catch (LoginException le) {
if (retry > 0) {
--retry;
// sleep for 10 seconds.
try {
Thread.sleep(10 * 1000);
} catch (InterruptedException e) {
log.error("Interrupted during login retry after LoginException:", le);
throw le;
}
} else {
log.error("Could not refresh TGT for principal: " + principal + ".", le);
}
}
}
} catch (LoginException le) {
log.error("Failed to refresh TGT: refresh thread exiting now.", le);
return;
}
}
}
}, true);
t.start();
return loginContext;
}
@Override
public void close() {
if ((t != null) && (t.isAlive())) {
t.interrupt();
try {
t.join();
} catch (InterruptedException e) {
log.warn("Error while waiting for Login thread to shutdown: " + e, e);
}
}
}
@Override
public Subject subject() {
return subject;
}
@Override
public String serviceName() {
return serviceName;
}
private String getServiceName(Map<String, ?> configs, String loginContext) {
String jaasServiceName = null;
try {
jaasServiceName = JaasUtils.jaasConfig(loginContext, JaasUtils.SERVICE_NAME);
} catch (IOException e) {
//throw new KafkaException("Jaas configuration not found", e);
log.warn("Jaas configuration not found", e);
}
String configServiceName = (String) configs.get(SaslConfigs.SASL_KERBEROS_SERVICE_NAME);
if (jaasServiceName != null && configServiceName != null && !jaasServiceName.equals(configServiceName)) {
String message = "Conflicting serviceName values found in JAAS and Kafka configs " +
"value in JAAS file " + jaasServiceName + ", value in Kafka config " + configServiceName;
throw new IllegalArgumentException(message);
}
if (jaasServiceName != null)
return jaasServiceName;
if (configServiceName != null)
return configServiceName;
throw new IllegalArgumentException("No serviceName defined in either JAAS or Kafka config");
}
private long getRefreshTime(KerberosTicket tgt) {
long start = tgt.getStartTime().getTime();
long expires = tgt.getEndTime().getTime();
log.info("TGT valid starting at: {}", tgt.getStartTime());
log.info("TGT expires: {}", tgt.getEndTime());
long proposedRefresh = start + (long) ((expires - start) *
(ticketRenewWindowFactor + (ticketRenewJitter * RNG.nextDouble())));
if (proposedRefresh > expires)
// proposedRefresh is too far in the future: it's after ticket expires: simply return now.
return currentWallTime();
else
return proposedRefresh;
}
private synchronized KerberosTicket getTGT() {
Set<KerberosTicket> tickets = subject.getPrivateCredentials(KerberosTicket.class);
for (KerberosTicket ticket : tickets) {
KerberosPrincipal server = ticket.getServer();
if (server.getName().equals("krbtgt/" + server.getRealm() + "@" + server.getRealm())) {
log.debug("Found TGT with client principal '{}' and server principal '{}'.", ticket.getClient().getName(),
ticket.getServer().getName());
return ticket;
}
}
return null;
}
private boolean hasSufficientTimeElapsed() {
long now = currentElapsedTime();
if (now - lastLogin < minTimeBeforeRelogin) {
log.warn("Not attempting to re-login since the last re-login was attempted less than {} seconds before.",
minTimeBeforeRelogin / 1000);
return false;
}
return true;
}
/**
* Re-login a principal. This method assumes that {@link #login(String)} has happened already.
* @throws javax.security.auth.login.LoginException on a failure
*/
private synchronized void reLogin() throws LoginException {
if (!isKrbTicket) {
return;
}
if (loginContext == null) {
throw new LoginException("Login must be done first");
}
if (!hasSufficientTimeElapsed()) {
return;
}
log.info("Initiating logout for {}", principal);
synchronized (KerberosLogin.class) {
// register most recent relogin attempt
lastLogin = currentElapsedTime();
//clear up the kerberos state. But the tokens are not cleared! As per
//the Java kerberos login module code, only the kerberos credentials
//are cleared
loginContext.logout();
//login and also update the subject field of this instance to
//have the new credentials (pass it to the LoginContext constructor)
loginContext = new LoginContext(loginContextName, subject);
log.info("Initiating re-login for {}", principal);
loginContext.login();
}
}
private long currentElapsedTime() {
return time.nanoseconds() / 1000000;
}
private long currentWallTime() {
return time.milliseconds();
}
}
|
z123/datacollector
|
apache-kafka_0_10-lib/src/main/java/org/apache/kafka/common/security/kerberos/KerberosLogin.java
|
Java
|
apache-2.0
| 17,207
|
@(add_form: Form[Stand])
@import helper._
@main("Volk anlegen") {
<h1>Volk anlegen</h1>
@helper.form(routes.Stands.create) {
<div class="form_row">
@inputText(add_form("name"), '_label -> "Name")
</div>
<div class="form_row">
@inputText(add_form("street"), '_label -> "Straße")
</div>
<div class="form_row">
@inputText(add_form("zipCode"), '_label -> "Postleitzahl")
</div>
<div class="form_row">
@inputText(add_form("city"), '_label -> "Ort"
)
</div>
<div class="form_row">
<button type="submit">Speichern</button>
</div>
}
}
|
n4cer/estockkarte
|
app/views/stands/add.scala.html
|
HTML
|
apache-2.0
| 633
|
/*
* 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.query;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.mapper.ConstantFieldType;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.indices.TermsLookup;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* A filter for a field based on several terms matching on any of them.
*/
public class TermsQueryBuilder extends AbstractQueryBuilder<TermsQueryBuilder> {
public static final String NAME = "terms";
private static final Version VERSION_STORE_VALUES_AS_BYTES_REFERENCE = Version.V_7_12_0;
private final String fieldName;
private final Values values;
private final TermsLookup termsLookup;
private final Supplier<List<?>> supplier;
public TermsQueryBuilder(String fieldName, TermsLookup termsLookup) {
this(fieldName, null, termsLookup);
}
/**
* constructor used internally for serialization of both value / termslookup variants
*/
private TermsQueryBuilder(String fieldName, List<Object> values, TermsLookup termsLookup) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name cannot be null.");
}
if (values == null && termsLookup == null) {
throw new IllegalArgumentException("No value or termsLookup specified for terms query");
}
if (values != null && termsLookup != null) {
throw new IllegalArgumentException("Both values and termsLookup specified for terms query");
}
this.fieldName = fieldName;
//already converted in {@link fromXContent}
this.values = values == null ? null : new BinaryValues(values, false);
this.termsLookup = termsLookup;
this.supplier = null;
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, String... values) {
this(fieldName, values != null ? Arrays.asList(values) : null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, int... values) {
this(fieldName, values != null ? Arrays.stream(values).mapToObj(s -> s).collect(Collectors.toList()) : (Iterable<?>) null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, long... values) {
this(fieldName, values != null ? Arrays.stream(values).mapToObj(s -> s).collect(Collectors.toList()) : (Iterable<?>) null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, float... values) {
this(fieldName, values != null ? IntStream.range(0, values.length)
.mapToObj(i -> values[i]).collect(Collectors.toList()) : (Iterable<?>) null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, double... values) {
this(fieldName, values != null ? Arrays.stream(values).mapToObj(s -> s).collect(Collectors.toList()) : (Iterable<?>) null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, Object... values) {
this(fieldName, values != null ? Arrays.asList(values) : (Iterable<?>) null);
}
/**
* A filter for a field based on several terms matching on any of them.
*
* @param fieldName The field name
* @param values The terms
*/
public TermsQueryBuilder(String fieldName, Iterable<?> values) {
if (Strings.isEmpty(fieldName)) {
throw new IllegalArgumentException("field name cannot be null.");
}
if (values == null) {
throw new IllegalArgumentException("No value specified for terms query");
}
this.fieldName = fieldName;
if (values instanceof Values) {
this.values = (Values) values;
} else {
this.values = new BinaryValues(values, true);
}
this.termsLookup = null;
this.supplier = null;
}
private TermsQueryBuilder(String fieldName, Supplier<List<?>> supplier) {
this.fieldName = fieldName;
this.values = null;
this.termsLookup = null;
this.supplier = supplier;
}
/**
* Read from a stream.
*/
public TermsQueryBuilder(StreamInput in) throws IOException {
super(in);
this.fieldName = in.readString();
this.termsLookup = in.readOptionalWriteable(TermsLookup::new);
this.values = Values.readFrom(in);
this.supplier = null;
}
@Override
protected void doWriteTo(StreamOutput out) throws IOException {
if (supplier != null) {
throw new IllegalStateException("supplier must be null, can't serialize suppliers, missing a rewriteAndFetch?");
}
out.writeString(fieldName);
out.writeOptionalWriteable(termsLookup);
Values.writeTo(out, values);
}
public String fieldName() {
return this.fieldName;
}
public Values getValues() {
return values;
}
/**
* get readable values
* only for {@link #toXContent} and tests, don't use this to construct a query.
* use {@link #getValues()} instead.
*/
public List<Object> values() {
List<Object> readableValues = new ArrayList<>();
for (Object value : values) {
readableValues.add(AbstractQueryBuilder.maybeConvertToString(value));
}
return readableValues;
}
public TermsLookup termsLookup() {
return this.termsLookup;
}
@Override
protected void doXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(NAME);
if (this.termsLookup != null) {
builder.startObject(fieldName);
termsLookup.toXContent(builder, params);
builder.endObject();
} else {
builder.field(fieldName, values());
}
printBoostAndQueryName(builder);
builder.endObject();
}
public static TermsQueryBuilder fromXContent(XContentParser parser) throws IOException {
String fieldName = null;
List<Object> values = null;
TermsLookup termsLookup = null;
String queryName = null;
float boost = AbstractQueryBuilder.DEFAULT_BOOST;
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_ARRAY) {
if (fieldName != null) {
throw new ParsingException(parser.getTokenLocation(),
"[" + TermsQueryBuilder.NAME + "] query does not support multiple fields");
}
fieldName = currentFieldName;
values = parseValues(parser);
} else if (token == XContentParser.Token.START_OBJECT) {
if (fieldName != null) {
throw new ParsingException(parser.getTokenLocation(),
"[" + TermsQueryBuilder.NAME + "] query does not support more than one field. "
+ "Already got: [" + fieldName + "] but also found [" + currentFieldName +"]");
}
fieldName = currentFieldName;
termsLookup = TermsLookup.parseTermsLookup(parser);
} else if (token.isValue()) {
if (AbstractQueryBuilder.BOOST_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
boost = parser.floatValue();
} else if (AbstractQueryBuilder.NAME_FIELD.match(currentFieldName, parser.getDeprecationHandler())) {
queryName = parser.text();
} else {
throw new ParsingException(parser.getTokenLocation(),
"[" + TermsQueryBuilder.NAME + "] query does not support [" + currentFieldName + "]");
}
} else {
throw new ParsingException(parser.getTokenLocation(),
"[" + TermsQueryBuilder.NAME + "] unknown token [" + token + "] after [" + currentFieldName + "]");
}
}
if (fieldName == null) {
throw new ParsingException(parser.getTokenLocation(), "[" + TermsQueryBuilder.NAME + "] query requires a field name, " +
"followed by array of terms or a document lookup specification");
}
TermsQueryBuilder builder = new TermsQueryBuilder(fieldName, values, termsLookup)
.boost(boost)
.queryName(queryName);
return builder;
}
static List<Object> parseValues(XContentParser parser) throws IOException {
List<Object> values = new ArrayList<>();
while (parser.nextToken() != XContentParser.Token.END_ARRAY) {
Object value = maybeConvertToBytesRef(parser.objectBytes());
if (value == null) {
throw new ParsingException(parser.getTokenLocation(), "No value specified for terms query");
}
values.add(value);
}
return values;
}
@Override
public String getWriteableName() {
return NAME;
}
@Override
protected Query doToQuery(SearchExecutionContext context) throws IOException {
if (termsLookup != null || supplier != null || values == null || values.isEmpty()) {
throw new UnsupportedOperationException("query must be rewritten first");
}
int maxTermsCount = context.getIndexSettings().getMaxTermsCount();
if (values.size() > maxTermsCount){
throw new IllegalArgumentException(
"The number of terms [" + values.size() + "] used in the Terms Query request has exceeded " +
"the allowed maximum of [" + maxTermsCount + "]. " + "This maximum can be set by changing the [" +
IndexSettings.MAX_TERMS_COUNT_SETTING.getKey() + "] index level setting.");
}
MappedFieldType fieldType = context.getFieldType(fieldName);
if (fieldType == null) {
throw new IllegalStateException("Rewrite first");
}
return fieldType.termsQuery(values, context);
}
private void fetch(TermsLookup termsLookup, Client client, ActionListener<List<Object>> actionListener) {
GetRequest getRequest = new GetRequest(termsLookup.index(), termsLookup.id());
getRequest.preference("_local").routing(termsLookup.routing());
client.get(getRequest, actionListener.map(getResponse -> {
List<Object> terms = new ArrayList<>();
if (getResponse.isSourceEmpty() == false) { // extract terms only if the doc source exists
List<Object> extractedValues = XContentMapValues.extractRawValues(termsLookup.path(), getResponse.getSourceAsMap());
terms.addAll(extractedValues);
}
return terms;
}));
}
@Override
protected int doHashCode() {
return Objects.hash(fieldName, values, termsLookup, supplier);
}
@Override
protected boolean doEquals(TermsQueryBuilder other) {
return Objects.equals(fieldName, other.fieldName) &&
Objects.equals(values, other.values) &&
Objects.equals(termsLookup, other.termsLookup) &&
Objects.equals(supplier, other.supplier);
}
@Override
protected QueryBuilder doRewrite(QueryRewriteContext queryRewriteContext) {
if (supplier != null) {
return supplier.get() == null ? this : new TermsQueryBuilder(this.fieldName, supplier.get());
} else if (this.termsLookup != null) {
SetOnce<List<?>> supplier = new SetOnce<>();
queryRewriteContext.registerAsyncAction((client, listener) ->
fetch(termsLookup, client, listener.map(list -> {
supplier.set(list);
return null;
})));
return new TermsQueryBuilder(this.fieldName, supplier::get);
}
if (values == null || values.isEmpty()) {
return new MatchNoneQueryBuilder();
}
SearchExecutionContext context = queryRewriteContext.convertToSearchExecutionContext();
if (context != null) {
MappedFieldType fieldType = context.getFieldType(this.fieldName);
if (fieldType == null) {
return new MatchNoneQueryBuilder();
} else if (fieldType instanceof ConstantFieldType) {
// This logic is correct for all field types, but by only applying it to constant
// fields we also have the guarantee that it doesn't perform I/O, which is important
// since rewrites might happen on a network thread.
Query query = fieldType.termsQuery(values, context);
if (query instanceof MatchAllDocsQuery) {
return new MatchAllQueryBuilder();
} else if (query instanceof MatchNoDocsQuery) {
return new MatchNoneQueryBuilder();
} else {
assert false : "Constant fields must produce match-all or match-none queries, got " + query ;
}
}
}
return this;
}
private abstract static class Values extends AbstractCollection implements Writeable {
private static Values readFrom(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(VERSION_STORE_VALUES_AS_BYTES_REFERENCE)) {
return in.readOptionalWriteable(BinaryValues::new);
} else {
List<?> list = (List<?>)in.readGenericValue();
return list == null ? null : new ListValues(list);
}
}
private static void writeTo(StreamOutput out, Values values) throws IOException {
if (out.getVersion().onOrAfter(VERSION_STORE_VALUES_AS_BYTES_REFERENCE)) {
out.writeOptionalWriteable(values);
} else {
if (values == null) {
out.writeGenericValue(null);
} else {
values.writeTo(out);
}
}
}
protected static BytesReference serialize(Iterable<?> values, boolean convert) {
List<?> list;
if (values instanceof List<?>) {
list = (List<?>) values;
} else {
ArrayList<Object> arrayList = new ArrayList<>();
for (Object o : values) {
arrayList.add(o);
}
list = arrayList;
}
try (BytesStreamOutput output = new BytesStreamOutput()) {
if (convert) {
list = list.stream().map(AbstractQueryBuilder::maybeConvertToBytesRef).collect(Collectors.toList());
}
output.writeGenericValue(list);
return output.bytes();
} catch (IOException e) {
throw new UncheckedIOException("failed to serialize TermsQueryBuilder", e);
}
}
@Override
public final boolean add(Object o) {
throw new UnsupportedOperationException();
}
@Override
public final boolean remove(Object o) {
throw new UnsupportedOperationException();
}
@Override
public final boolean containsAll(Collection c) {
throw new UnsupportedOperationException();
}
@Override
public final boolean addAll(Collection c) {
throw new UnsupportedOperationException();
}
@Override
public final boolean removeAll(Collection c) {
throw new UnsupportedOperationException();
}
@Override
public final boolean retainAll(Collection c) {
throw new UnsupportedOperationException();
}
@Override
public final void clear() {
throw new UnsupportedOperationException();
}
}
/**
* Store terms as a {@link BytesReference}.
* <p>
* When users send a query contain a lot of terms, A {@link BytesReference} can help
* gc and reduce the cost of {@link #doWriteTo}, which can be slow for lots of terms.
*/
private static class BinaryValues extends Values {
private final BytesReference valueRef;
private final int size;
private BinaryValues(StreamInput in) throws IOException {
this(in.readBytesReference());
}
private BinaryValues(Iterable<?> values, boolean convert) {
this(serialize(values, convert));
}
private BinaryValues(BytesReference bytesRef) {
this.valueRef = bytesRef;
try (StreamInput in = valueRef.streamInput()) {
size = consumerHeadersAndGetListSize(in);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
@Override
public int size() {
return size;
}
@Override
public Iterator iterator() {
return new Iterator<>() {
private final StreamInput in;
private int pos = 0;
{
try {
in = valueRef.streamInput();
consumerHeadersAndGetListSize(in);
} catch (IOException e) {
throw new UncheckedIOException("failed to deserialize TermsQueryBuilder", e);
}
}
@Override
public boolean hasNext() {
return pos < size;
}
@Override
public Object next() {
try {
pos++;
return in.readGenericValue();
} catch (IOException e) {
throw new UncheckedIOException("failed to deserialize TermsQueryBuilder", e);
}
}
};
}
@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(VERSION_STORE_VALUES_AS_BYTES_REFERENCE)) {
out.writeBytesReference(valueRef);
} else {
valueRef.writeTo(out);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BinaryValues that = (BinaryValues) o;
return Objects.equals(valueRef, that.valueRef);
}
@Override
public int hashCode() {
return Objects.hash(valueRef);
}
private int consumerHeadersAndGetListSize(StreamInput in) throws IOException {
byte genericSign = in.readByte();
assert genericSign == 7;
return in.readVInt();
}
}
/**
* This is for lower version requests compatible.
* <p>
* If we do not keep this, it could be expensive when receiving a request from
* lower version.
* We have to read the value list by {@link StreamInput#readGenericValue},
* serialize it into {@link BytesReference}, and then deserialize it again when
* {@link #doToQuery} called}.
* <p>
*
* TODO: remove in 9.0.0
*/
private static class ListValues extends Values {
private final List<?> values;
private ListValues(List<?> values) throws IOException {
this.values = values;
}
@Override
public int size() {
return values.size();
}
@Override
public boolean contains(Object o) {
return values.contains(o);
}
@Override
public Iterator iterator() {
return values.iterator();
}
@Override
public Object[] toArray() {
return values.toArray();
}
@Override
public Object[] toArray(Object[] a) {
return values.toArray(a);
}
@Override
public Object[] toArray(IntFunction generator) {
return values.toArray(generator);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(VERSION_STORE_VALUES_AS_BYTES_REFERENCE)) {
BytesReference bytesRef = serialize(values, false);
out.writeBytesReference(bytesRef);
} else {
out.writeGenericValue(values);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ListValues that = (ListValues) o;
return Objects.equals(values, that.values);
}
@Override
public int hashCode() {
return Objects.hash(values);
}
}
}
|
nknize/elasticsearch
|
server/src/main/java/org/elasticsearch/index/query/TermsQueryBuilder.java
|
Java
|
apache-2.0
| 24,140
|
/**
* HomeworkAssignmentTwo APSHTTPClient Library
* Copyright (c) 2009-2015 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#import <Foundation/Foundation.h>
@interface APSHTTPPostForm : NSObject
@property(nonatomic, readonly) NSData *requestData;
@property(nonatomic, readonly) NSDictionary *requestHeaders;
@property(nonatomic, readonly) NSString *contentType;
-(void)setJSONData:(id)json;
-(void)setStringData:(NSString*)str;
-(void)appendData:(NSData*)data withContentType:(NSString*)contentType;
-(void)addDictionay:(NSDictionary*)dict;
-(void)addFormKey:(NSString*)key andValue:(NSString*)value;
-(void)addFormFile:(NSString*)path;
-(void)addFormFile:(NSString*)path fieldName:(NSString*)name;
-(void)addFormFile:(NSString*)path fieldName:(NSString*)name contentType:(NSString*)contentType;
-(void)addFormData:(NSData*)data;
-(void)addFormData:(NSData*)data fileName:(NSString*)fileName;
-(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName;
-(void)addFormData:(NSData*)data fileName:(NSString*)fileName fieldName:(NSString*)fieldName contentType:(NSString*)contentType;
-(void)addHeaderKey:(NSString*)key andHeaderValue:(NSString*)value;
@end
|
bakes/progAssgn3
|
build/iphone/Classes/APSHTTPClient/APSHTTPPostForm.h
|
C
|
apache-2.0
| 1,413
|
/*
* #%L
* wcm.io
* %%
* Copyright (C) 2014 wcm.io
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package io.wcm.handler.commons.dom;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class HtmlCommentTest {
@Test
void testSimpleAttributes() throws Exception {
HtmlComment comment = new HtmlComment("text1");
assertEquals("text1", comment.getText());
assertEquals("<!--text1-->", comment.toString());
}
}
|
cnagel/wcm-io-handler
|
commons/src/test/java/io/wcm/handler/commons/dom/HtmlCommentTest.java
|
Java
|
apache-2.0
| 1,004
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60-ea) on Thu Dec 15 09:48:34 EST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.wildfly.swarm.config.management (Public javadocs 2016.12.1 API)</title>
<meta name="date" content="2016-12-15">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../../../../org/wildfly/swarm/config/management/package-summary.html" target="classFrame">org.wildfly.swarm.config.management</a></h1>
<div class="indexContainer">
<h2 title="Interfaces">Interfaces</h2>
<ul title="Interfaces">
<li><a href="AuditAccessConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">AuditAccessConsumer</span></a></li>
<li><a href="AuditAccessSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">AuditAccessSupplier</span></a></li>
<li><a href="AuthorizationAccessConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">AuthorizationAccessConsumer</span></a></li>
<li><a href="AuthorizationAccessSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">AuthorizationAccessSupplier</span></a></li>
<li><a href="ConfigurationChangesServiceConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">ConfigurationChangesServiceConsumer</span></a></li>
<li><a href="ConfigurationChangesServiceSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">ConfigurationChangesServiceSupplier</span></a></li>
<li><a href="HTTPInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">HTTPInterfaceManagementInterfaceConsumer</span></a></li>
<li><a href="HTTPInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">HTTPInterfaceManagementInterfaceSupplier</span></a></li>
<li><a href="LdapConnectionConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">LdapConnectionConsumer</span></a></li>
<li><a href="LdapConnectionSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">LdapConnectionSupplier</span></a></li>
<li><a href="ManagementOperationsServiceConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">ManagementOperationsServiceConsumer</span></a></li>
<li><a href="ManagementOperationsServiceSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">ManagementOperationsServiceSupplier</span></a></li>
<li><a href="NativeInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">NativeInterfaceManagementInterfaceConsumer</span></a></li>
<li><a href="NativeInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">NativeInterfaceManagementInterfaceSupplier</span></a></li>
<li><a href="NativeRemotingInterfaceManagementInterfaceConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">NativeRemotingInterfaceManagementInterfaceConsumer</span></a></li>
<li><a href="NativeRemotingInterfaceManagementInterfaceSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">NativeRemotingInterfaceManagementInterfaceSupplier</span></a></li>
<li><a href="PropertyConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">PropertyConsumer</span></a></li>
<li><a href="PropertySupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">PropertySupplier</span></a></li>
<li><a href="SecurityRealmConsumer.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">SecurityRealmConsumer</span></a></li>
<li><a href="SecurityRealmSupplier.html" title="interface in org.wildfly.swarm.config.management" target="classFrame"><span class="interfaceName">SecurityRealmSupplier</span></a></li>
</ul>
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="AuditAccess.html" title="class in org.wildfly.swarm.config.management" target="classFrame">AuditAccess</a></li>
<li><a href="AuditAccess.AuditAccessResources.html" title="class in org.wildfly.swarm.config.management" target="classFrame">AuditAccess.AuditAccessResources</a></li>
<li><a href="AuthorizationAccess.html" title="class in org.wildfly.swarm.config.management" target="classFrame">AuthorizationAccess</a></li>
<li><a href="AuthorizationAccess.AuthorizationAccessResources.html" title="class in org.wildfly.swarm.config.management" target="classFrame">AuthorizationAccess.AuthorizationAccessResources</a></li>
<li><a href="ConfigurationChangesService.html" title="class in org.wildfly.swarm.config.management" target="classFrame">ConfigurationChangesService</a></li>
<li><a href="HTTPInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management" target="classFrame">HTTPInterfaceManagementInterface</a></li>
<li><a href="LdapConnection.html" title="class in org.wildfly.swarm.config.management" target="classFrame">LdapConnection</a></li>
<li><a href="LdapConnection.LdapConnectionResources.html" title="class in org.wildfly.swarm.config.management" target="classFrame">LdapConnection.LdapConnectionResources</a></li>
<li><a href="ManagementOperationsService.html" title="class in org.wildfly.swarm.config.management" target="classFrame">ManagementOperationsService</a></li>
<li><a href="ManagementOperationsService.ManagementOperationsServiceResources.html" title="class in org.wildfly.swarm.config.management" target="classFrame">ManagementOperationsService.ManagementOperationsServiceResources</a></li>
<li><a href="NativeInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management" target="classFrame">NativeInterfaceManagementInterface</a></li>
<li><a href="NativeRemotingInterfaceManagementInterface.html" title="class in org.wildfly.swarm.config.management" target="classFrame">NativeRemotingInterfaceManagementInterface</a></li>
<li><a href="Property.html" title="class in org.wildfly.swarm.config.management" target="classFrame">Property</a></li>
<li><a href="SecurityRealm.html" title="class in org.wildfly.swarm.config.management" target="classFrame">SecurityRealm</a></li>
<li><a href="SecurityRealm.SecurityRealmResources.html" title="class in org.wildfly.swarm.config.management" target="classFrame">SecurityRealm.SecurityRealmResources</a></li>
</ul>
<h2 title="Enums">Enums</h2>
<ul title="Enums">
<li><a href="AuthorizationAccess.PermissionCombinationPolicy.html" title="enum in org.wildfly.swarm.config.management" target="classFrame">AuthorizationAccess.PermissionCombinationPolicy</a></li>
<li><a href="AuthorizationAccess.Provider.html" title="enum in org.wildfly.swarm.config.management" target="classFrame">AuthorizationAccess.Provider</a></li>
<li><a href="LdapConnection.Referrals.html" title="enum in org.wildfly.swarm.config.management" target="classFrame">LdapConnection.Referrals</a></li>
</ul>
</div>
</body>
</html>
|
wildfly-swarm/wildfly-swarm-javadocs
|
2016.12.1/apidocs/org/wildfly/swarm/config/management/package-frame.html
|
HTML
|
apache-2.0
| 7,994
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Fri Sep 11 16:00:20 AEST 2020 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class au.gov.amsa.geo.adhoc.VesselsInGbrMain (parent 0.5.25 Test API)</title>
<meta name="date" content="2020-09-11">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class au.gov.amsa.geo.adhoc.VesselsInGbrMain (parent 0.5.25 Test API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../au/gov/amsa/geo/adhoc/VesselsInGbrMain.html" title="class in au.gov.amsa.geo.adhoc">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?au/gov/amsa/geo/adhoc/class-use/VesselsInGbrMain.html" target="_top">Frames</a></li>
<li><a href="VesselsInGbrMain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class au.gov.amsa.geo.adhoc.VesselsInGbrMain" class="title">Uses of Class<br>au.gov.amsa.geo.adhoc.VesselsInGbrMain</h2>
</div>
<div class="classUseContainer">No usage of au.gov.amsa.geo.adhoc.VesselsInGbrMain</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../au/gov/amsa/geo/adhoc/VesselsInGbrMain.html" title="class in au.gov.amsa.geo.adhoc">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?au/gov/amsa/geo/adhoc/class-use/VesselsInGbrMain.html" target="_top">Frames</a></li>
<li><a href="VesselsInGbrMain.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2020. All rights reserved.</small></p>
</body>
</html>
|
amsa-code/amsa-code.github.io
|
risky/testapidocs/au/gov/amsa/geo/adhoc/class-use/VesselsInGbrMain.html
|
HTML
|
apache-2.0
| 4,630
|
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Dec 14 21:00:24 CET 2021 -->
<title>Uses of Interface com.google.ortools.sat.SymmetryProtoOrBuilder (com.google.ortools:ortools-java 9.2.9969 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-12-14">
<meta name="description" content="use: package: com.google.ortools.sat, interface: SymmetryProtoOrBuilder">
<meta name="generator" content="javadoc/ClassUseWriter">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-use-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">Class</a></li>
<li class="nav-bar-cell1-rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#use">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="Uses of Interface com.google.ortools.sat.SymmetryProtoOrBuilder" class="title">Uses of Interface<br>com.google.ortools.sat.SymmetryProtoOrBuilder</h1>
</div>
<div class="caption"><span>Packages that use <a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Package</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><a href="#com.google.ortools.sat">com.google.ortools.sat</a></div>
<div class="col-last even-row-color"> </div>
</div>
<section class="class-uses">
<ul class="block-list">
<li>
<section class="detail" id="com.google.ortools.sat">
<h2>Uses of <a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a> in <a href="../package-summary.html">com.google.ortools.sat</a></h2>
<div class="caption"><span>Classes in <a href="../package-summary.html">com.google.ortools.sat</a> that implement <a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>final class </code></div>
<div class="col-second even-row-color"><code><a href="../SymmetryProto.html" class="type-name-link" title="class in com.google.ortools.sat">SymmetryProto</a></code></div>
<div class="col-last even-row-color">
<div class="block">
EXPERIMENTAL.</div>
</div>
<div class="col-first odd-row-color"><code>static final class </code></div>
<div class="col-second odd-row-color"><code><a href="../SymmetryProto.Builder.html" class="type-name-link" title="class in com.google.ortools.sat">SymmetryProto.Builder</a></code></div>
<div class="col-last odd-row-color">
<div class="block">
EXPERIMENTAL.</div>
</div>
</div>
<div class="caption"><span>Methods in <a href="../package-summary.html">com.google.ortools.sat</a> that return <a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code><a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></code></div>
<div class="col-second even-row-color"><span class="type-name-label">CpModelProto.Builder.</span><code><a href="../CpModelProto.Builder.html#getSymmetryOrBuilder()" class="member-name-link">getSymmetryOrBuilder</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">
For now, this is not meant to be filled by a client writing a model, but
by our preprocessing step.</div>
</div>
<div class="col-first odd-row-color"><code><a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></code></div>
<div class="col-second odd-row-color"><span class="type-name-label">CpModelProto.</span><code><a href="../CpModelProto.html#getSymmetryOrBuilder()" class="member-name-link">getSymmetryOrBuilder</a>()</code></div>
<div class="col-last odd-row-color">
<div class="block">
For now, this is not meant to be filled by a client writing a model, but
by our preprocessing step.</div>
</div>
<div class="col-first even-row-color"><code><a href="../SymmetryProtoOrBuilder.html" title="interface in com.google.ortools.sat">SymmetryProtoOrBuilder</a></code></div>
<div class="col-second even-row-color"><span class="type-name-label">CpModelProtoOrBuilder.</span><code><a href="../CpModelProtoOrBuilder.html#getSymmetryOrBuilder()" class="member-name-link">getSymmetryOrBuilder</a>()</code></div>
<div class="col-last even-row-color">
<div class="block">
For now, this is not meant to be filled by a client writing a model, but
by our preprocessing step.</div>
</div>
</div>
</section>
</li>
</ul>
</section>
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright © 2021. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>
|
google/or-tools
|
docs/javadoc/com/google/ortools/sat/class-use/SymmetryProtoOrBuilder.html
|
HTML
|
apache-2.0
| 7,098
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.6.0_27) on Thu Oct 17 21:45:00 EDT 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>Uses of Package org.apache.solr.spelling.suggest.tst (Solr 4.5.1 API)</title>
<meta name="date" content="2013-10-17">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package org.apache.solr.spelling.suggest.tst (Solr 4.5.1 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li class="navBarCell1Rev">Use</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/solr/spelling/suggest/tst/package-use.html" target="_top">FRAMES</a></li>
<li><a href="package-use.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Uses of Package org.apache.solr.spelling.suggest.tst" class="title">Uses of Package<br>org.apache.solr.spelling.suggest.tst</h1>
</div>
<div class="contentContainer">No usage of org.apache.solr.spelling.suggest.tst</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li class="navBarCell1Rev">Use</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>PREV</li>
<li>NEXT</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/solr/spelling/suggest/tst/package-use.html" target="_top">FRAMES</a></li>
<li><a href="package-use.html" target="_top">NO FRAMES</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<i>Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.</i>
<script src='../../../../../../prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
|
Hernrup/solr
|
docs/solr-core/org/apache/solr/spelling/suggest/tst/package-use.html
|
HTML
|
apache-2.0
| 4,556
|
#!/usr/bin/env python
#!-*- coding:utf-8 -*-
def read(filename):
dic=[]
with open(filename,'r') as fp:
while True:
lines = fp.readlines(10000)
if not lines :
break
for line in lines:
#line = line.strip('\n')
dic.append(line)
return dic
def Write(file,dic):
with open(file,'w') as fp:
for i in dic:
fp.write(i)
if __name__=='__main__':
test = read('output.txt')
test += read("dire.txt")
print test
Write('output.txt',set(test))
|
momomoxiaoxi/security
|
Scripts/Check.py
|
Python
|
apache-2.0
| 574
|
/*
* Copyright 2016 The Cartographer 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.
*/
#ifndef CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_
#define CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_
#include "Eigen/Core"
#include "Eigen/Geometry"
#include "cartographer/mapping_2d/probability_grid.h"
#include "cartographer/sensor/point_cloud.h"
#include "ceres/ceres.h"
#include "ceres/cubic_interpolation.h"
namespace cartographer {
namespace mapping_2d {
namespace scan_matching {
// Computes the cost of inserting occupied space described by the point cloud
// into the map. The cost increases with the amount of free space that would be
// replaced by occupied space.
class OccupiedSpaceCostFunctor {
public:
// Creates an OccupiedSpaceCostFunctor using the specified map, resolution
// level, and point cloud.
OccupiedSpaceCostFunctor(const double scaling_factor,
const sensor::PointCloud& point_cloud,
const ProbabilityGrid& probability_grid)
: scaling_factor_(scaling_factor),
point_cloud_(point_cloud),
probability_grid_(probability_grid) {}
OccupiedSpaceCostFunctor(const OccupiedSpaceCostFunctor&) = delete;
OccupiedSpaceCostFunctor& operator=(const OccupiedSpaceCostFunctor&) = delete;
template <typename T>
bool operator()(const T* const pose, T* residual) const {
Eigen::Matrix<T, 2, 1> translation(pose[0], pose[1]);
Eigen::Rotation2D<T> rotation(pose[2]);
Eigen::Matrix<T, 2, 2> rotation_matrix = rotation.toRotationMatrix();
Eigen::Matrix<T, 3, 3> transform;
transform << rotation_matrix, translation, T(0.), T(0.), T(1.);
const GridArrayAdapter adapter(probability_grid_);
ceres::BiCubicInterpolator<GridArrayAdapter> interpolator(adapter);
const MapLimits& limits = probability_grid_.limits();
for (size_t i = 0; i < point_cloud_.size(); ++i) {
// Note that this is a 2D point. The third component is a scaling factor.
const Eigen::Matrix<T, 3, 1> point((T(point_cloud_[i].x())),
(T(point_cloud_[i].y())), T(1.));
const Eigen::Matrix<T, 3, 1> world = transform * point;
interpolator.Evaluate(
(limits.max().x() - world[0]) / limits.resolution() - 0.5 +
T(kPadding),
(limits.max().y() - world[1]) / limits.resolution() - 0.5 +
T(kPadding),
&residual[i]);
residual[i] = scaling_factor_ * (1. - residual[i]);
}
return true;
}
private:
static constexpr int kPadding = INT_MAX / 4;
class GridArrayAdapter {
public:
enum { DATA_DIMENSION = 1 };
explicit GridArrayAdapter(const ProbabilityGrid& probability_grid)
: probability_grid_(probability_grid) {}
void GetValue(const int row, const int column, double* const value) const {
if (row < kPadding || column < kPadding || row >= NumRows() - kPadding ||
column >= NumCols() - kPadding) {
*value = mapping::kMinProbability;
} else {
*value = static_cast<double>(probability_grid_.GetProbability(
Eigen::Array2i(column - kPadding, row - kPadding)));
}
}
int NumRows() const {
return probability_grid_.limits().cell_limits().num_y_cells +
2 * kPadding;
}
int NumCols() const {
return probability_grid_.limits().cell_limits().num_x_cells +
2 * kPadding;
}
private:
const ProbabilityGrid& probability_grid_;
};
const double scaling_factor_;
const sensor::PointCloud& point_cloud_;
const ProbabilityGrid& probability_grid_;
};
} // namespace scan_matching
} // namespace mapping_2d
} // namespace cartographer
#endif // CARTOGRAPHER_MAPPING_2D_SCAN_MATCHING_OCCUPIED_SPACE_COST_FUNCTOR_H_
|
af-silva/cartographer_ros
|
thirdparty/cartographer/cartographer/mapping_2d/scan_matching/occupied_space_cost_functor.h
|
C
|
apache-2.0
| 4,353
|
/*
* 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.droids.monitor;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.droids.api.Task;
import org.apache.droids.api.WorkMonitor;
import org.apache.droids.api.Worker;
/**
* A simple
*/
public class SimpleWorkMonitor<T extends Task> implements WorkMonitor<T> {
Map<T,WorkBean<T>> working = new ConcurrentHashMap<T, WorkBean<T>>();
@Override
public void beforeExecute(T task, Worker<T> worker) {
WorkBean<T> bean = new WorkBean<T>( task, worker );
working.put( task, bean );
}
@Override
public void afterExecute(T task, Worker<T> worker, Exception ex) {
working.remove( task );
}
public Collection<WorkBean<T>> getRunningTasks()
{
return working.values();
}
public WorkBean<T> getWorkBean( T task )
{
return working.get( task );
}
}
|
fogbeam/Heceta_droids
|
droids-core/src/main/java/org/apache/droids/monitor/SimpleWorkMonitor.java
|
Java
|
apache-2.0
| 1,678
|
/*
* Copyright 2016 Centro, Inc.
*
* 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 net.centro.rtb.monitoringcenter.metrics.forwarding;
import com.codahale.metrics.Counter;
import com.google.common.base.Preconditions;
public class ForwardingReadOnlyCounter extends Counter {
private MetricProvider<Counter> metricProvider;
public ForwardingReadOnlyCounter(final Counter delegate) {
Preconditions.checkNotNull(delegate);
this.metricProvider = new MetricProvider<Counter>() {
@Override
public Counter get() {
return delegate;
}
};
}
public ForwardingReadOnlyCounter(MetricProvider<Counter> metricProvider) {
Preconditions.checkNotNull(metricProvider);
this.metricProvider = metricProvider;
}
@Override
public void inc() {
throw new UnsupportedOperationException("Operation is not allowed for a read-only counter");
}
@Override
public void inc(long n) {
throw new UnsupportedOperationException("Operation is not allowed for a read-only counter");
}
@Override
public void dec() {
throw new UnsupportedOperationException("Operation is not allowed for a read-only counter");
}
@Override
public void dec(long n) {
throw new UnsupportedOperationException("Operation is not allowed for a read-only counter");
}
@Override
public long getCount() {
return metricProvider.get().getCount();
}
}
|
centro/monitoring-center
|
src/main/java/net/centro/rtb/monitoringcenter/metrics/forwarding/ForwardingReadOnlyCounter.java
|
Java
|
apache-2.0
| 2,269
|
package bean;
import java.util.Map;
import javax.ejb.Local;
@Local
public interface AbstractTrialDataEditor extends AbstractTrialFormViewer {
public static final String SAVEDONCE = "savedOnce";
public void setUp();
public Map<String, Object> getDataMap();
public String save();
public boolean isSavedOnce();
public void setSavedOnce(boolean savedOnce);
}
|
patrickfav/tuwien
|
master/SPICSwound/src/action/bean/AbstractTrialDataEditor.java
|
Java
|
apache-2.0
| 375
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/ads/googleads/v10/services/keyword_plan_service.proto
package com.google.ads.googleads.v10.services;
/**
* <pre>
* The forecast of the campaign at a specific bid.
* </pre>
*
* Protobuf type {@code google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast}
*/
public final class KeywordPlanMaxCpcBidForecast extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)
KeywordPlanMaxCpcBidForecastOrBuilder {
private static final long serialVersionUID = 0L;
// Use KeywordPlanMaxCpcBidForecast.newBuilder() to construct.
private KeywordPlanMaxCpcBidForecast(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private KeywordPlanMaxCpcBidForecast() {
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new KeywordPlanMaxCpcBidForecast();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private KeywordPlanMaxCpcBidForecast(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
int mutable_bitField0_ = 0;
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 18: {
com.google.ads.googleads.v10.services.ForecastMetrics.Builder subBuilder = null;
if (maxCpcBidForecast_ != null) {
subBuilder = maxCpcBidForecast_.toBuilder();
}
maxCpcBidForecast_ = input.readMessage(com.google.ads.googleads.v10.services.ForecastMetrics.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(maxCpcBidForecast_);
maxCpcBidForecast_ = subBuilder.buildPartial();
}
break;
}
case 24: {
bitField0_ |= 0x00000001;
maxCpcBidMicros_ = input.readInt64();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ads.googleads.v10.services.KeywordPlanServiceProto.internal_static_google_ads_googleads_v10_services_KeywordPlanMaxCpcBidForecast_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ads.googleads.v10.services.KeywordPlanServiceProto.internal_static_google_ads_googleads_v10_services_KeywordPlanMaxCpcBidForecast_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.class, com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.Builder.class);
}
private int bitField0_;
public static final int MAX_CPC_BID_MICROS_FIELD_NUMBER = 3;
private long maxCpcBidMicros_;
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @return Whether the maxCpcBidMicros field is set.
*/
@java.lang.Override
public boolean hasMaxCpcBidMicros() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @return The maxCpcBidMicros.
*/
@java.lang.Override
public long getMaxCpcBidMicros() {
return maxCpcBidMicros_;
}
public static final int MAX_CPC_BID_FORECAST_FIELD_NUMBER = 2;
private com.google.ads.googleads.v10.services.ForecastMetrics maxCpcBidForecast_;
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
* @return Whether the maxCpcBidForecast field is set.
*/
@java.lang.Override
public boolean hasMaxCpcBidForecast() {
return maxCpcBidForecast_ != null;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
* @return The maxCpcBidForecast.
*/
@java.lang.Override
public com.google.ads.googleads.v10.services.ForecastMetrics getMaxCpcBidForecast() {
return maxCpcBidForecast_ == null ? com.google.ads.googleads.v10.services.ForecastMetrics.getDefaultInstance() : maxCpcBidForecast_;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
@java.lang.Override
public com.google.ads.googleads.v10.services.ForecastMetricsOrBuilder getMaxCpcBidForecastOrBuilder() {
return getMaxCpcBidForecast();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (maxCpcBidForecast_ != null) {
output.writeMessage(2, getMaxCpcBidForecast());
}
if (((bitField0_ & 0x00000001) != 0)) {
output.writeInt64(3, maxCpcBidMicros_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (maxCpcBidForecast_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getMaxCpcBidForecast());
}
if (((bitField0_ & 0x00000001) != 0)) {
size += com.google.protobuf.CodedOutputStream
.computeInt64Size(3, maxCpcBidMicros_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)) {
return super.equals(obj);
}
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast other = (com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast) obj;
if (hasMaxCpcBidMicros() != other.hasMaxCpcBidMicros()) return false;
if (hasMaxCpcBidMicros()) {
if (getMaxCpcBidMicros()
!= other.getMaxCpcBidMicros()) return false;
}
if (hasMaxCpcBidForecast() != other.hasMaxCpcBidForecast()) return false;
if (hasMaxCpcBidForecast()) {
if (!getMaxCpcBidForecast()
.equals(other.getMaxCpcBidForecast())) return false;
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
if (hasMaxCpcBidMicros()) {
hash = (37 * hash) + MAX_CPC_BID_MICROS_FIELD_NUMBER;
hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
getMaxCpcBidMicros());
}
if (hasMaxCpcBidForecast()) {
hash = (37 * hash) + MAX_CPC_BID_FORECAST_FIELD_NUMBER;
hash = (53 * hash) + getMaxCpcBidForecast().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* The forecast of the campaign at a specific bid.
* </pre>
*
* Protobuf type {@code google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecastOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.ads.googleads.v10.services.KeywordPlanServiceProto.internal_static_google_ads_googleads_v10_services_KeywordPlanMaxCpcBidForecast_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.ads.googleads.v10.services.KeywordPlanServiceProto.internal_static_google_ads_googleads_v10_services_KeywordPlanMaxCpcBidForecast_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.class, com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.Builder.class);
}
// Construct using com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
maxCpcBidMicros_ = 0L;
bitField0_ = (bitField0_ & ~0x00000001);
if (maxCpcBidForecastBuilder_ == null) {
maxCpcBidForecast_ = null;
} else {
maxCpcBidForecast_ = null;
maxCpcBidForecastBuilder_ = null;
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.ads.googleads.v10.services.KeywordPlanServiceProto.internal_static_google_ads_googleads_v10_services_KeywordPlanMaxCpcBidForecast_descriptor;
}
@java.lang.Override
public com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast getDefaultInstanceForType() {
return com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.getDefaultInstance();
}
@java.lang.Override
public com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast build() {
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast buildPartial() {
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast result = new com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast(this);
int from_bitField0_ = bitField0_;
int to_bitField0_ = 0;
if (((from_bitField0_ & 0x00000001) != 0)) {
result.maxCpcBidMicros_ = maxCpcBidMicros_;
to_bitField0_ |= 0x00000001;
}
if (maxCpcBidForecastBuilder_ == null) {
result.maxCpcBidForecast_ = maxCpcBidForecast_;
} else {
result.maxCpcBidForecast_ = maxCpcBidForecastBuilder_.build();
}
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast) {
return mergeFrom((com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast other) {
if (other == com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast.getDefaultInstance()) return this;
if (other.hasMaxCpcBidMicros()) {
setMaxCpcBidMicros(other.getMaxCpcBidMicros());
}
if (other.hasMaxCpcBidForecast()) {
mergeMaxCpcBidForecast(other.getMaxCpcBidForecast());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private long maxCpcBidMicros_ ;
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @return Whether the maxCpcBidMicros field is set.
*/
@java.lang.Override
public boolean hasMaxCpcBidMicros() {
return ((bitField0_ & 0x00000001) != 0);
}
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @return The maxCpcBidMicros.
*/
@java.lang.Override
public long getMaxCpcBidMicros() {
return maxCpcBidMicros_;
}
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @param value The maxCpcBidMicros to set.
* @return This builder for chaining.
*/
public Builder setMaxCpcBidMicros(long value) {
bitField0_ |= 0x00000001;
maxCpcBidMicros_ = value;
onChanged();
return this;
}
/**
* <pre>
* The max cpc bid in micros.
* </pre>
*
* <code>optional int64 max_cpc_bid_micros = 3;</code>
* @return This builder for chaining.
*/
public Builder clearMaxCpcBidMicros() {
bitField0_ = (bitField0_ & ~0x00000001);
maxCpcBidMicros_ = 0L;
onChanged();
return this;
}
private com.google.ads.googleads.v10.services.ForecastMetrics maxCpcBidForecast_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.services.ForecastMetrics, com.google.ads.googleads.v10.services.ForecastMetrics.Builder, com.google.ads.googleads.v10.services.ForecastMetricsOrBuilder> maxCpcBidForecastBuilder_;
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
* @return Whether the maxCpcBidForecast field is set.
*/
public boolean hasMaxCpcBidForecast() {
return maxCpcBidForecastBuilder_ != null || maxCpcBidForecast_ != null;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
* @return The maxCpcBidForecast.
*/
public com.google.ads.googleads.v10.services.ForecastMetrics getMaxCpcBidForecast() {
if (maxCpcBidForecastBuilder_ == null) {
return maxCpcBidForecast_ == null ? com.google.ads.googleads.v10.services.ForecastMetrics.getDefaultInstance() : maxCpcBidForecast_;
} else {
return maxCpcBidForecastBuilder_.getMessage();
}
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public Builder setMaxCpcBidForecast(com.google.ads.googleads.v10.services.ForecastMetrics value) {
if (maxCpcBidForecastBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
maxCpcBidForecast_ = value;
onChanged();
} else {
maxCpcBidForecastBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public Builder setMaxCpcBidForecast(
com.google.ads.googleads.v10.services.ForecastMetrics.Builder builderForValue) {
if (maxCpcBidForecastBuilder_ == null) {
maxCpcBidForecast_ = builderForValue.build();
onChanged();
} else {
maxCpcBidForecastBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public Builder mergeMaxCpcBidForecast(com.google.ads.googleads.v10.services.ForecastMetrics value) {
if (maxCpcBidForecastBuilder_ == null) {
if (maxCpcBidForecast_ != null) {
maxCpcBidForecast_ =
com.google.ads.googleads.v10.services.ForecastMetrics.newBuilder(maxCpcBidForecast_).mergeFrom(value).buildPartial();
} else {
maxCpcBidForecast_ = value;
}
onChanged();
} else {
maxCpcBidForecastBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public Builder clearMaxCpcBidForecast() {
if (maxCpcBidForecastBuilder_ == null) {
maxCpcBidForecast_ = null;
onChanged();
} else {
maxCpcBidForecast_ = null;
maxCpcBidForecastBuilder_ = null;
}
return this;
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public com.google.ads.googleads.v10.services.ForecastMetrics.Builder getMaxCpcBidForecastBuilder() {
onChanged();
return getMaxCpcBidForecastFieldBuilder().getBuilder();
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
public com.google.ads.googleads.v10.services.ForecastMetricsOrBuilder getMaxCpcBidForecastOrBuilder() {
if (maxCpcBidForecastBuilder_ != null) {
return maxCpcBidForecastBuilder_.getMessageOrBuilder();
} else {
return maxCpcBidForecast_ == null ?
com.google.ads.googleads.v10.services.ForecastMetrics.getDefaultInstance() : maxCpcBidForecast_;
}
}
/**
* <pre>
* The forecast for the Keyword Plan campaign at the specific bid.
* </pre>
*
* <code>.google.ads.googleads.v10.services.ForecastMetrics max_cpc_bid_forecast = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.services.ForecastMetrics, com.google.ads.googleads.v10.services.ForecastMetrics.Builder, com.google.ads.googleads.v10.services.ForecastMetricsOrBuilder>
getMaxCpcBidForecastFieldBuilder() {
if (maxCpcBidForecastBuilder_ == null) {
maxCpcBidForecastBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.ads.googleads.v10.services.ForecastMetrics, com.google.ads.googleads.v10.services.ForecastMetrics.Builder, com.google.ads.googleads.v10.services.ForecastMetricsOrBuilder>(
getMaxCpcBidForecast(),
getParentForChildren(),
isClean());
maxCpcBidForecast_ = null;
}
return maxCpcBidForecastBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)
}
// @@protoc_insertion_point(class_scope:google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast)
private static final com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast();
}
public static com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<KeywordPlanMaxCpcBidForecast>
PARSER = new com.google.protobuf.AbstractParser<KeywordPlanMaxCpcBidForecast>() {
@java.lang.Override
public KeywordPlanMaxCpcBidForecast parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new KeywordPlanMaxCpcBidForecast(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<KeywordPlanMaxCpcBidForecast> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<KeywordPlanMaxCpcBidForecast> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.ads.googleads.v10.services.KeywordPlanMaxCpcBidForecast getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
|
googleads/google-ads-java
|
google-ads-stubs-v10/src/main/java/com/google/ads/googleads/v10/services/KeywordPlanMaxCpcBidForecast.java
|
Java
|
apache-2.0
| 28,802
|
# Cousinia litvinovii Kult. ex Juz. SPECIES
#### Status
DOUBTFUL
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Cousinia/Cousinia litvinovii/README.md
|
Markdown
|
apache-2.0
| 191
|
# XLSX Reports
This is a simple Python library to create Excel reports.
## Introduction
Many times an Excel report is just a group of tables and charts with some
basic data, normally with a common style. It would be great if there was a way
to directly generate the Excel report from the data and some simple
configuration.
## Design
There are 3 basic elements:
* A _data table_ contains the data for the report
* A _style_ indicates how a single table is formatted
* A _layout_ indicates how different tables are formatted. Layouts are
structured as a tree. The layout references the data and style
A report is built from a single layout. A parent layout may contain child
layouts. Some of these may be table layouts which apply a table sytle to the
data to build the actual cells that are added to the spreadsheet.
The data table merely contains a list of columns and corresponding data rows,
with one value per column. The list of columns is used for the table headers
and each row is added as a row to the report table. Each data value in the
table is added to an individual cell.
The style contains information such as background and font color, as well
as any other visual information in the spreadsheet.
The layout can be one of a variety of types, for example, it can contain a
series of reports in the same row, structured in a column, with a fixed size, or
automatically expanding to include the full report.
## TO DO
Remaining style features:
- Hide gridlines
- Borders (in different color)
- Set row and column width
- Set fonts (different for headers and rows)
- Set font color
- Set bold font
- Set color for numbers (conditional formatting?)
- Table style with extra padding between columns
- Zebra striping
|
tordable/XlsxReports
|
README.md
|
Markdown
|
apache-2.0
| 1,754
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_20) on Wed May 05 11:17:09 PDT 2010 -->
<TITLE>
org.apache.pig.backend.hadoop.executionengine.util Class Hierarchy (Pig 0.7.0 API)
</TITLE>
<META NAME="date" CONTENT="2010-05-05">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.apache.pig.backend.hadoop.executionengine.util Class Hierarchy (Pig 0.7.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../org/apache/pig/backend/hadoop/executionengine/physicalLayer/util/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../../../org/apache/pig/backend/hadoop/hbase/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/pig/backend/hadoop/executionengine/util/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
Hierarchy For Package org.apache.pig.backend.hadoop.executionengine.util
</H2>
</CENTER>
<DL>
<DT><B>Package Hierarchies:</B><DD><A HREF="../../../../../../../overview-tree.html">All Packages</A></DL>
<HR>
<H2>
Class Hierarchy
</H2>
<UL>
<LI TYPE="circle">java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang"><B>Object</B></A><UL>
<LI TYPE="circle">org.apache.pig.backend.hadoop.executionengine.util.<A HREF="../../../../../../../org/apache/pig/backend/hadoop/executionengine/util/MapRedUtil.html" title="class in org.apache.pig.backend.hadoop.executionengine.util"><B>MapRedUtil</B></A></UL>
</UL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../org/apache/pig/backend/hadoop/executionengine/physicalLayer/util/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../../../org/apache/pig/backend/hadoop/hbase/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../../index.html?org/apache/pig/backend/hadoop/executionengine/util/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © ${year} The Apache Software Foundation
</BODY>
</HTML>
|
hirohanin/pig7hadoop21
|
docs/api/org/apache/pig/backend/hadoop/executionengine/util/package-tree.html
|
HTML
|
apache-2.0
| 6,797
|
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("MyVote.BusinessObjects.Tests")]
|
Magenic/MyVote
|
src/BusinessObjects/MyVote.BusinessObjects/AssemblyInfo.cs
|
C#
|
apache-2.0
| 105
|
# Logania dentata Hayata SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Loganiaceae/Logania/Logania dentata/README.md
|
Markdown
|
apache-2.0
| 172
|
# AUTOGENERATED FILE
FROM balenalib/beaglebone-pocket-ubuntu:focal-build
ENV NODE_VERSION 10.24.0
ENV YARN_VERSION 1.22.4
RUN for key in \
6A010C5166006599AA17F08146C2130DFD2497F5 \
; do \
gpg --keyserver pgp.mit.edu --recv-keys "$key" || \
gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \
done \
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& echo "02feb052d0e1eb77c9beea5cfe3b67b90d5209ab509797f4f6c892c75cc30fda node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \
&& rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
&& curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \
&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& mkdir -p /opt/yarn \
&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \
&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \
&& npm config set unsafe-perm true -g --unsafe-perm \
&& rm -rf /tmp/*
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh" \
&& echo "Running test-stack@node" \
&& chmod +x test-stack@node.sh \
&& bash test-stack@node.sh \
&& rm -rf test-stack@node.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Ubuntu focal \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v10.24.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh
|
nghiant2710/base-images
|
balena-base-images/node/beaglebone-pocket/ubuntu/focal/10.24.0/build/Dockerfile
|
Dockerfile
|
apache-2.0
| 2,768
|
# AUTOGENERATED FILE
FROM balenalib/artik533s-debian:buster-build
ENV GO_VERSION 1.15.6
RUN mkdir -p /usr/local/go \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/golang/v$GO_VERSION/go$GO_VERSION.linux-armv7hf.tar.gz" \
&& echo "7f60787d9d94ed040e2d58f7715a4dc1cdb9f9160504aec810712a7e20446bb7 go$GO_VERSION.linux-armv7hf.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-armv7hf.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-armv7hf.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Buster \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.15.6 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh
|
nghiant2710/base-images
|
balena-base-images/golang/artik533s/debian/buster/1.15.6/build/Dockerfile
|
Dockerfile
|
apache-2.0
| 2,027
|
<!DOCTYPE html>
<html lang="en">
{% include head.html %}
<body>
<div class="overlay-full">
<div id="search-container" class="search-box" style="z-index: 103">
<input type="text" id="search-input" size="25" autofocus>
<span id="cancel-search"><i class="fa fa-times" style="margin-left:-25px"></i></span>
<ul id="results-container"></ul>
</div>
</div>
{% include nav.html %}
<div style="background-image:url({{ page.bg-url }}); height:100%">
{{ content }}
<a class="scrollup" style="float:right; padding-right:30px; color:#f4f4f4"><i class="fa fa-chevron-circle-up fa-2x"></i></a>
{% include footer.html %}
</div>
<script>
$(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$('.scrollup').fadeIn();
} else {
$('.scrollup').fadeOut();
}
});
$('.scrollup').click(function() {
$("html, body").animate({
scrollTop: 0
}, 600);
return false;
});
SimpleJekyllSearch({
searchInput: document.getElementById("search-input"),
resultsContainer: document.getElementById("results-container"),
json: '/search.json'
});
$(".glyphicon-search").click(function() {
$(".search-box").slideToggle();
$("#results-container").slideToggle();
});
});
</script>
<script src="{{ site.baseurl }}/js/jekyll-search.js" type="text/javascript"></script>
</body>
</html>
|
fieldsofview/fieldsofview.github.io
|
_layouts/default-layout.html
|
HTML
|
apache-2.0
| 1,639
|
// Copyright 2017 Aleksandr Demeshko. All rights reserved.
// conway project
// life_test.go
package conway
import (
"fmt"
// "testing"
)
func Example_singleCell() {
var p = Population{cells: map[Cell]int{
Cell{0, 0}: 0,
},
popNumber: 0,
}
p.Next()
fmt.Println(p)
// Output: {map[] 1}
}
func Example_twoCells() {
var p = Population{cells: map[Cell]int{
Cell{0, 0}: 0,
Cell{0, 1}: 0,
},
popNumber: 0,
}
p.Next()
fmt.Println(p)
// Output: {map[] 1}
}
func Example_blinker() {
var p = Population{cells: map[Cell]int{
Cell{0, 0}: 0,
Cell{0, 1}: 0,
Cell{0, -1}: 0,
},
popNumber: 0,
}
p.SaveToFile("blinker0.log")
p.Next()
p.SaveToFile("blinker1.log")
fmt.Println(len(p.cells))
// Output: 3
}
|
jduitt/conway
|
life_test.go
|
GO
|
apache-2.0
| 734
|
/**
* DO NOT EDIT THIS FILE as it will be overwritten by the Pbj compiler.
* @link https://github.com/gdbots/pbjc-php
*
* Returns an array of curies using mixin "triniti:boost:mixin:search-sponsors-request:v1"
* @link http://schemas.triniti.io/json-schema/triniti/boost/mixin/search-sponsors-request/1-0-0.json#
*/
export default [
];
|
triniti/schemas
|
build/js/src/manifests/triniti/boost/mixin/search-sponsors-request/v1.js
|
JavaScript
|
apache-2.0
| 342
|
//
// YWMessageFriendsAddViewController.h
// YuWa
//
// Created by 蒋威 on 16/9/29.
// Copyright © 2016年 蒋威. All rights reserved.
//
#import "JWBasicViewController.h"
@interface YWMessageFriendsAddViewController : JWBasicViewController
@end
|
ShangDuRuiORG/DuRuiYuW
|
YuWa/YuWa/Contents/message/SubView/FriendsAddVC/YWMessageFriendsAddViewController.h
|
C
|
apache-2.0
| 257
|
---
layout: post
title: "MongoDB training1"
subtitle: ""
date: 2019-02-26 16:21:00
author: "Yuanbo"
header-img: "img/home-bg-o.jpg"
catalog: true
tags:
- training
- Tech
- mongoDB
---
## Course Description:
MongoDB is a high-performance and feature-rich NoSQL database that forms the backbone of the systems that power many different organizations
This Course starts with how to initialize the server in three different modes with various configurations. A new feature in MongoDB 3 is that you can connect to a single node using Python, set to make MongoDB even more popular with anyone working with Python.
You will then learn a range of further topics including advanced query operations, monitoring and backup using MMS, as well as some very useful administration recipes including SCRAM-SHA-1 Authentication.
This MongoDB Course will help you handle everything from administration to automation with MongoDB more effectively than ever before.
## Duration: 4 Days
## Pre-requisites:
⬥ The participants should have knowledge on either Java or Python and DataBase Concepts
Software & Hardware requirements:
Cloud Infrastructure:
Lab Requirements:
Min 4GB RAM
Windows OS
Arch: 64-Bit OS is preferred
Access to (10 Mbps+) Hi Speed Internet.
Os: Any Windows
Every participant must have the PuTTY[1] tool to connect to the remote 22 port (SSH Access) and Web Ports of external Cloud Servers (provided by Admatic for the Hands On Training).
[1] https://the.earth.li/~sgtatham/putty/latest/x86/putty.exe
High Level Course Contents
Install, configure, and administer MongoDB sharded clusters and replica sets
Begin writing applications using MongoDB in Java
Initialize the server in three different modes with various configurations
Discover frameworks and products built to improve developer productivity using Mongo
Take an in-depth look at the Mongo Java driver APIs
Set up enterprise class MultiNode MongoDB and monitoring and backups of MongoDB
Building a Web Application with MongoDB as backend
Day wise coverage:
Day 1
MongoDB Introduction - SQL/NoSQL
Datastore design considerations
Relational v/s NoSQL stores
Entities, Relationships and Database modeling
When to use Relational/NoSQL?
Categories of NoSQL stores
Examples of NoSQL stores
Data Formats
What are Data Formats?
Difference between Data Formats and Data Structures
Serializing and de-serializing data
The JSON Data Format
BSON Data Format
Advantages of BSON
MongoDB Concepts
Servers
Connections
Databases
Collections
Documents
CRUD
Indexes
Querying MongoDB
Query Expression Objects
Query Options
Cursors
Mongo Query Language
Dot Notation
Full Text Search
Data Types
Basic Data Types
Dates
Arrays
Embedded Documents
_id and ObjectIds
Using the MongoDB Shell
Tips for Using the Shell
Running Scripts with the Shell
Creating a .mongorc.js
Customizing Your Prompt
Editing Complex Variables
Inconvenient Collection Names
Creating, Updating, and Deleting Documents
Inserting Documents
Removing Documents
Updating Documents
Document Replacement
Using Update Operators
Upserts
Updating Multiple Documents
Returning Updated Documents
Day 2
Querying
Introduction to find
Query Criteria
Type-Specific Queries
null
Regular Expressions
Querying Arrays
Querying on Embedded Documents
$where Queries
Cursors
Limits, Skips, and Sorts
Avoiding Large Skips
Advanced Query Options
Immortal Cursors
Database Commands
Indexes
Introduction to Indexes
Creating an Index
Introduction to Compound Indexes
How MongoDB Selects an Index
Using Compound Indexes
How $-Operators Use Indexes
Indexing Objects and Arrays
Index Cardinality
Using explain()
When Not to Index
Types of Indexes
Index Administration
Advanced querying
Joins
Server-side v/s Client-side querying
Retrieving a subset of fields
Conditional operators
Aggregation
Grouping
Projections
Cursor Methods
MapReduce introduction
Installing and Starting the Server
Installing single node MongoDB
Starting a single node instance using command-line options
Single node installation of MongoDB with options from the config file
Connecting to a single node in the Mongo shell with JavaScript
Connecting to a single node using a Java client
Starting multiple instances as part of a replica set
Connecting to the replica set in the shell to query and insert data
Connecting to the replica set to query and insert data from a Java client
Connecting to the replica set to query and insert data using a Python client
Starting a simple sharded environment of two shards
Connecting to a shard in the shell and performing operations
Command-line Operations and Indexes
Introduction
Creating test data
Performing simple querying, projections, and pagination from Mongo shell
Updating and deleting data from the shell
Creating index and viewing plans of queries
Analyzing the plan
Improving the query execution time
Improvement using indexes
Improvement using covered indexes
Some caveats of index creations
Creating a background and foreground index in the shell
Creating and understanding sparse indexes
Expiring documents after a fixed interval using the TTL index
Expiring documents at a given time using the TTL index
Day 3
MongoDB Setup & Configuration
Basic configuration options
Replication
Master-Slave Replication
Adding and Removing Sources
Replica Sets
Nodes in a Replica Set
Using Slaves for Data Processing
How It Works
The Oplog
Syncing
Replication State and the Local Database
Blocking for Replication
Administration
Diagnostics
Changing the Oplog Size
Replication with Authentication
Administration Basics
Renaming a collection
Viewing collection stats
Viewing database stats
Manually padding a document
The mongostat and mongotop utilities
Getting current executing operations and killing them
Using profiler to profile operations
Setting up users in Mongo
Interprocess security in Mongo
Modifying collection behavior using the collMod command
Setting up MongoDB as a windows service
Replica set configurations
MongoDB through the JavaScript shell
Diving into the MongoDB shell
Creating and querying with indexes
Sharding
Introduction to Sharding
Autosharding in MongoDB
When to Shard
The Key to Sharding: Shard Keys
Sharding an Existing Collection
Incrementing Shard Keys Versus Random Shard Keys
How Shard Keys Affect Operations
Setting Up Sharding
Starting the Servers
Sharding Data
Production Configuration
A Robust Config
Many mongos
A Sturdy Shard
Physical Servers
Sharding Administration
config Collections Sharding Commands
Manage Sharding with Java API
Monitoring
Using the Admin Interface
serverStatus
mongostat
Third-Party Plug-Ins
Security and Authentication
Authentication Basics
How Authentication Works
Other Security Considerations
Backup and Repair
Data File Backup
mongodump and mongorestore
fsync and Lock
Slave Backups
Repair
Document-oriented data
Principles of schema design
Designing an e-commerce data model
Nuts and bolts: on databases, collections, and documents
Queries and aggregation
E-commerce queries
MongoDB’s query language
Aggregating orders
Aggregation in detail
Updates, atomic operations, and deletes
A brief tour of document updates
E-commerce updates
Atomic document processing
Nuts and bolts: MongoDB updates and deletes
Manage Aggregations with Java API
Day 4
MongoDB Java Driver
Synchronous and asynchronous Operations
Getting Started with Java Driver for MongoDB
Getting the Mongo JDBC driver
Creating your first project
Inserting a document
Querying data
Updating documents
Deleting documents
Performing operations on collections
Listing collections
Using the MongoDB Java driver version 3
Running the HelloWorld class with driver v.3
Managing collections
Inserting data into the database
Querying documents
Updating documents
Deleting documents
MongoDB CRUD Beyond the Basics
Seeing MongoDB through the Java lens
Extending the MongoDB core classes
Using the Gson API with MongoDB
Downloading the Gson API
Using Gson to map a MongoDB document
Inserting Java objects as a document
Mapping embedded documents
Custom field names in your Java classes
Mapping complex BSON types
Using indexes in your applications
Defining an index in your Java classes
Advanced Operations
Introduction
Atomic find and modify operations
Implementing atomic counters in Mongo
Implementing server-side scripts
Creating and tailing a capped collection cursors in MongoDB
Converting a normal collection to a capped collection
Storing binary data in Mongo
Mongo GridFS
Storing large data in Mongo using GridFS
Storing data to GridFS from Java client
Implementing triggers in Mongo using oplog
Implementing full text search in Mongo
Coding bulk operations
Managing Data Persistence with MongoDB and JPA
MongoDB Java Driver API
Connecting to Mongos from Java API
Mongos vs Mongo vs mongod Java API
ReplicaSets vs Sharding API
MongoDB UseCases:
Building a Spring Application with MongoDB as Backend
MongoDB Big Data Integration with Spark Stack
## Notes
MongoDB -> NOSQL
Data exposion cause further degradation of performance for RDBMS. Hence we introduce NOSQL.
RDBMS | MongoDB
------ | ------------------------------------
strict Schema - displine | Schema free/Dynamic schema
ACID | CAP theorem
Not natively distributed | Natively distributed
Single point of failure | No SPOF
Not scalable | Scalable
SQL | No SQL
### NOSQL category
* Key-value store
* key -> value
* redis, memcache
* caching/ lookup
* in memery DB
* Document oriented
* record/row
* atomic unit will be document
* MongoDB, couchDB, dynomDB
* Heavey reads than writes
* Column oriented
* Heavey writes than read
* atomic unit is column
* casandra/Hbase/Big table
* Graph oriented
* For connected data
* GiantDB
* NeoleJ
* Big table
* Inverted index
* enterprise search
* solr, elastic search
* Traditional RDBMS are always forward search
CAP theorem
-----------------------
* consistency | * cheap
* Availability | * good quality
* partition tolerance | * quick delivery
We can not enjoy all those three.
consistency vs. partition
Eventual consistency
Tunable consistency
## Features
Belongs to CP model
1. mongod (daemon, mongo db server instance)
2. mongo (CLI client to mongodb instance)
3. mongos (query & router)
mongod --datapath /data/db
partition is better to hosted in same geograpical localtion for consistency.
High scalability with sharding
---
### END
|
freerambo/freerambo.github.io
|
_posts/2019-02-26-MongoDB-Training1.markdown
|
Markdown
|
apache-2.0
| 10,534
|
---
layout: docwithnav
assignees:
- ashvayka
title: IoT Gateway Installation options
---
Thingsboard IoT Gateway is designed to run and utilize on majority of hardware, from local Raspberry PI to powerful servers.
Ways to set up a Thingsboard IoT Gateway include:
- [Windows](/docs/iot-gateway/install/windows/) - install Thingsboard IoT Gateway on Windows.
- [Linux (Ubuntu & CentOS)](/docs/iot-gateway/install/linux/) - install Thingsboard IoT Gateway on any pre-existing machines running Linux.
- [Raspberry Pi (Raspbian Jessie)](/docs/iot-gateway/install/rpi/) - install Thingsboard IoT Gateway on a Raspberry Pi.
|
haibaoyf/haibaoyf.github.io
|
docs/iot-gateway/installation.md
|
Markdown
|
apache-2.0
| 625
|
package com.github.riccardove.easyjasub;
/*
* #%L
* easyjasub-lib
* %%
* Copyright (C) 2014 Riccardo Vestrini
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.io.File;
import com.github.riccardove.easyjasub.commons.CommonsLangSystemUtils;
public final class EasyJaSubHomeDir {
public static File getDefaultHomeDir(String name) {
return CommonsLangSystemUtils.isWindows() ? getWindowsHomeDir(name)
: getUnixHomeDir(name);
}
private static File getUnixHomeDir(String name) {
return new File(SystemProperty.getUserDir(), "." + name);
}
private static File getWindowsHomeDir(String name) {
return new File(SystemEnv.getWindowsAppData(), name);
}
}
|
riccardove/easyjasub
|
easyjasub-lib/src/main/java/com/github/riccardove/easyjasub/EasyJaSubHomeDir.java
|
Java
|
apache-2.0
| 1,232
|
package Paws::ElasticTranscoder::CreateJobOutput;
use Moose;
has AlbumArt => (is => 'ro', isa => 'Paws::ElasticTranscoder::JobAlbumArt');
has Captions => (is => 'ro', isa => 'Paws::ElasticTranscoder::Captions');
has Composition => (is => 'ro', isa => 'ArrayRef[Paws::ElasticTranscoder::Clip]');
has Encryption => (is => 'ro', isa => 'Paws::ElasticTranscoder::Encryption');
has Key => (is => 'ro', isa => 'Str');
has PresetId => (is => 'ro', isa => 'Str');
has Rotate => (is => 'ro', isa => 'Str');
has SegmentDuration => (is => 'ro', isa => 'Str');
has ThumbnailEncryption => (is => 'ro', isa => 'Paws::ElasticTranscoder::Encryption');
has ThumbnailPattern => (is => 'ro', isa => 'Str');
has Watermarks => (is => 'ro', isa => 'ArrayRef[Paws::ElasticTranscoder::JobWatermark]');
1;
### main pod documentation begin ###
=head1 NAME
Paws::ElasticTranscoder::CreateJobOutput
=head1 USAGE
This class represents one of two things:
=head3 Arguments in a call to a service
Use the attributes of this class as arguments to methods. You shouldn't make instances of this class.
Each attribute should be used as a named argument in the calls that expect this type of object.
As an example, if Att1 is expected to be a Paws::ElasticTranscoder::CreateJobOutput object:
$service_obj->Method(Att1 => { AlbumArt => $value, ..., Watermarks => $value });
=head3 Results returned from an API call
Use accessors for each attribute. If Att1 is expected to be an Paws::ElasticTranscoder::CreateJobOutput object:
$result = $service_obj->Method(...);
$result->Att1->AlbumArt
=head1 DESCRIPTION
The C<CreateJobOutput> structure.
=head1 ATTRIBUTES
=head2 AlbumArt => L<Paws::ElasticTranscoder::JobAlbumArt>
Information about the album art that you want Elastic Transcoder to add
to the file during transcoding. You can specify up to twenty album
artworks for each output. Settings for each artwork must be defined in
the job for the current output.
=head2 Captions => L<Paws::ElasticTranscoder::Captions>
You can configure Elastic Transcoder to transcode captions, or
subtitles, from one format to another. All captions must be in UTF-8.
Elastic Transcoder supports two types of captions:
=over
=item *
B<Embedded:> Embedded captions are included in the same file as the
audio and video. Elastic Transcoder supports only one embedded caption
per language, to a maximum of 300 embedded captions per file.
Valid input values include: C<CEA-608 (EIA-608>, first non-empty
channel only), C<CEA-708 (EIA-708>, first non-empty channel only), and
C<mov-text>
Valid outputs include: C<mov-text>
Elastic Transcoder supports a maximum of one embedded format per
output.
=item *
B<Sidecar:> Sidecar captions are kept in a separate metadata file from
the audio and video data. Sidecar captions require a player that is
capable of understanding the relationship between the video file and
the sidecar file. Elastic Transcoder supports only one sidecar caption
per language, to a maximum of 20 sidecar captions per file.
Valid input values include: C<dfxp> (first div element only),
C<ebu-tt>, C<scc>, C<smpt>, C<srt>, C<ttml> (first div element only),
and C<webvtt>
Valid outputs include: C<dfxp> (first div element only), C<scc>,
C<srt>, and C<webvtt>.
=back
If you want ttml or smpte-tt compatible captions, specify dfxp as your
output format.
Elastic Transcoder does not support OCR (Optical Character
Recognition), does not accept pictures as a valid input for captions,
and is not available for audio-only transcoding. Elastic Transcoder
does not preserve text formatting (for example, italics) during the
transcoding process.
To remove captions or leave the captions empty, set C<Captions> to
null. To pass through existing captions unchanged, set the
C<MergePolicy> to C<MergeRetain>, and pass in a null C<CaptionSources>
array.
For more information on embedded files, see the Subtitles Wikipedia
page.
For more information on sidecar files, see the Extensible Metadata
Platform and Sidecar file Wikipedia pages.
=head2 Composition => ArrayRef[L<Paws::ElasticTranscoder::Clip>]
You can create an output file that contains an excerpt from the input
file. This excerpt, called a clip, can come from the beginning, middle,
or end of the file. The Composition object contains settings for the
clips that make up an output file. For the current release, you can
only specify settings for a single clip per output file. The
Composition object cannot be null.
=head2 Encryption => L<Paws::ElasticTranscoder::Encryption>
You can specify encryption settings for any output files that you want
to use for a transcoding job. This includes the output file and any
watermarks, thumbnails, album art, or captions that you want to use.
You must specify encryption settings for each file individually.
=head2 Key => Str
The name to assign to the transcoded file. Elastic Transcoder saves the
file in the Amazon S3 bucket specified by the C<OutputBucket> object in
the pipeline that is specified by the pipeline ID. If a file with the
specified name already exists in the output bucket, the job fails.
=head2 PresetId => Str
The C<Id> of the preset to use for this job. The preset determines the
audio, video, and thumbnail settings that Elastic Transcoder uses for
transcoding.
=head2 Rotate => Str
The number of degrees clockwise by which you want Elastic Transcoder to
rotate the output relative to the input. Enter one of the following
values: C<auto>, C<0>, C<90>, C<180>, C<270>. The value C<auto>
generally works only if the file that you're transcoding contains
rotation metadata.
=head2 SegmentDuration => Str
(Outputs in Fragmented MP4 or MPEG-TS format only.
If you specify a preset in C<PresetId> for which the value of
C<Container> is C<fmp4> (Fragmented MP4) or C<ts> (MPEG-TS),
C<SegmentDuration> is the target maximum duration of each segment in
seconds. For C<HLSv3> format playlists, each media segment is stored in
a separate C<.ts> file. For C<HLSv4> and C<Smooth> playlists, all media
segments for an output are stored in a single file. Each segment is
approximately the length of the C<SegmentDuration>, though individual
segments might be shorter or longer.
The range of valid values is 1 to 60 seconds. If the duration of the
video is not evenly divisible by C<SegmentDuration>, the duration of
the last segment is the remainder of total length/SegmentDuration.
Elastic Transcoder creates an output-specific playlist for each output
C<HLS> output that you specify in OutputKeys. To add an output to the
master playlist for this job, include it in the C<OutputKeys> of the
associated playlist.
=head2 ThumbnailEncryption => L<Paws::ElasticTranscoder::Encryption>
The encryption settings, if any, that you want Elastic Transcoder to
apply to your thumbnail.
=head2 ThumbnailPattern => Str
Whether you want Elastic Transcoder to create thumbnails for your
videos and, if so, how you want Elastic Transcoder to name the files.
If you don't want Elastic Transcoder to create thumbnails, specify "".
If you do want Elastic Transcoder to create thumbnails, specify the
information that you want to include in the file name for each
thumbnail. You can specify the following values in any sequence:
=over
=item *
B<C<{count}> (Required)>: If you want to create thumbnails, you must
include C<{count}> in the C<ThumbnailPattern> object. Wherever you
specify C<{count}>, Elastic Transcoder adds a five-digit sequence
number (beginning with B<00001>) to thumbnail file names. The number
indicates where a given thumbnail appears in the sequence of thumbnails
for a transcoded file.
If you specify a literal value and/or C<{resolution}> but you omit
C<{count}>, Elastic Transcoder returns a validation error and does not
create the job.
=item *
B<Literal values (Optional)>: You can specify literal values anywhere
in the C<ThumbnailPattern> object. For example, you can include them as
a file name prefix or as a delimiter between C<{resolution}> and
C<{count}>.
=item *
B<C<{resolution}> (Optional)>: If you want Elastic Transcoder to
include the resolution in the file name, include C<{resolution}> in the
C<ThumbnailPattern> object.
=back
When creating thumbnails, Elastic Transcoder automatically saves the
files in the format (.jpg or .png) that appears in the preset that you
specified in the C<PresetID> value of C<CreateJobOutput>. Elastic
Transcoder also appends the applicable file name extension.
=head2 Watermarks => ArrayRef[L<Paws::ElasticTranscoder::JobWatermark>]
Information about the watermarks that you want Elastic Transcoder to
add to the video during transcoding. You can specify up to four
watermarks for each output. Settings for each watermark must be defined
in the preset for the current output.
=head1 SEE ALSO
This class forms part of L<Paws>, describing an object used in L<Paws::ElasticTranscoder>
=head1 BUGS and CONTRIBUTIONS
The source code is located here: https://github.com/pplu/aws-sdk-perl
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues
=cut
|
ioanrogers/aws-sdk-perl
|
auto-lib/Paws/ElasticTranscoder/CreateJobOutput.pm
|
Perl
|
apache-2.0
| 9,105
|
/*
* Copyright 2016 Chirojeugd-Vlaanderen vzw. See the NOTICE file at the
* top-level directory of this distribution, and at
* https://gapwiki.chiro.be/copyright
*
* 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.
*/
using System.ServiceModel;
namespace Chiro.Gap.ServiceContracts
{
/// <summary>
/// Service met hacks voor dev- en testomgeving.
/// </summary>
/// <remarks>
/// DEZE FILE MAG NIET AANWEZIG ZIJN IN DE CODE VOOR DE LIVE-OMGEVING!
/// </remarks>
[ServiceContract]
public interface IDbHacksService
{
/// <summary>
/// Erg lelijke hack die direct in de database schrijft om de aangelogde gebruiker
/// toegang te geven tot een testgroep.
/// </summary>
[OperationContract]
void WillekeurigeGroepToekennen();
}
}
|
Chirojeugd-Vlaanderen/gap
|
Solution/Chiro.Gap.ServiceContracts/IDbHacksService.cs
|
C#
|
apache-2.0
| 1,333
|
/*
* Copyright 2003-2005 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.jdon.jivejdon.model;
import com.jdon.controller.model.Model;
public class Sequence extends Model {
/* Private Fields */
private String name;
private int nextId;
/* Constructors */
public Sequence() {
}
public Sequence(String name, int nextId) {
this.name = name;
this.nextId = nextId;
}
/* JavaBeans Properties */
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public int getNextId() { return nextId; }
public void setNextId(int nextId) { this.nextId = nextId; }
}
|
xfmysql/xfwdata
|
xfweb/src/com/jdon/jivejdon/model/Sequence.java
|
Java
|
apache-2.0
| 1,189
|
// Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
#![deny(warnings)]
// Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to include inner attributes from a common source.
#![deny(
clippy::all,
clippy::default_trait_access,
clippy::expl_impl_clone_on_copy,
clippy::if_not_else,
clippy::needless_continue,
clippy::unseparated_literal_suffix,
// TODO: Falsely triggers for async/await:
// see https://github.com/rust-lang/rust-clippy/issues/5360
// clippy::used_underscore_binding
)]
// It is often more clear to show that nothing is being moved.
#![allow(clippy::match_ref_pats)]
// Subjective style.
#![allow(
clippy::len_without_is_empty,
clippy::redundant_field_names,
clippy::too_many_arguments
)]
// Default isn't as big a deal as people seem to think it is.
#![allow(clippy::new_without_default, clippy::new_ret_no_self)]
// Arc<Mutex> can be more clear than needing to grok Orderings:
#![allow(clippy::mutex_atomic)]
use std::sync::Arc;
use parking_lot::Mutex;
use tokio::sync::watch;
///
/// An AsyncLatch is a simple condition that can be triggered once to release any threads that are
/// waiting for it.
///
/// Should be roughly equivalent to Java's CountDownLatch with a count of 1, or Python's Event
/// type (https://docs.python.org/2/library/threading.html#event-objects) without the ability to
/// "clear" the condition once it has been triggered.
///
#[derive(Clone)]
pub struct AsyncLatch {
sender: Arc<Mutex<Option<watch::Sender<()>>>>,
receiver: watch::Receiver<()>,
}
impl AsyncLatch {
pub fn new() -> AsyncLatch {
let (sender, receiver) = watch::channel(());
AsyncLatch {
sender: Arc::new(Mutex::new(Some(sender))),
receiver,
}
}
///
/// Mark this latch triggered, releasing all threads that are waiting for it to trigger.
///
/// All calls to trigger after the first one are noops.
///
pub fn trigger(&self) {
// To trigger the latch, we drop the Sender.
self.sender.lock().take();
}
///
/// Wait for another thread to trigger this latch.
///
pub async fn triggered(&self) {
// To see whether the latch is triggered, we clone the receiver, and then wait for our clone to
// return None, indicating that the Sender has been dropped.
let mut receiver = self.receiver.clone();
while receiver.recv().await.is_some() {}
}
///
/// Return true if the latch has been triggered.
///
pub fn poll_triggered(&self) -> bool {
self.sender.lock().is_none()
}
}
#[cfg(test)]
mod tests;
|
jsirois/pants
|
src/rust/engine/async_latch/src/lib.rs
|
Rust
|
apache-2.0
| 2,717
|
/**
* 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.log;
import java.util.Locale;
import java.util.Map;
import org.apache.camel.Endpoint;
import org.apache.camel.LoggingLevel;
import org.apache.camel.processor.DefaultExchangeFormatter;
import org.apache.camel.spi.CamelLogger;
import org.apache.camel.spi.ExchangeFormatter;
import org.apache.camel.spi.Metadata;
import org.apache.camel.support.DefaultComponent;
import org.slf4j.Logger;
/**
* The <a href="http://camel.apache.org/log.html">Log Component</a>
* is for logging message exchanges via the underlying logging mechanism.
*/
public class LogComponent extends DefaultComponent {
@Metadata(label = "advanced")
private ExchangeFormatter exchangeFormatter;
public LogComponent() {
}
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
LoggingLevel level = getLoggingLevel(parameters);
Logger providedLogger = getLogger(parameters);
if (providedLogger == null) {
// try to look up the logger in registry
Map<String, Logger> availableLoggers = getCamelContext().getRegistry().findByTypeWithName(Logger.class);
if (availableLoggers.size() == 1) {
providedLogger = availableLoggers.values().iterator().next();
log.info("Using custom Logger: {}", providedLogger);
} else if (availableLoggers.size() > 1) {
log.info("More than one {} instance found in the registry. Falling back to creating logger from URI {}.", Logger.class.getName(), uri);
}
}
LogEndpoint endpoint = new LogEndpoint(uri, this);
endpoint.setLevel(level.name());
setProperties(endpoint, parameters);
if (providedLogger == null) {
endpoint.setLoggerName(remaining);
} else {
endpoint.setProvidedLogger(providedLogger);
}
// first, try to pick up the ExchangeFormatter from the registry
ExchangeFormatter localFormatter = getCamelContext().getRegistry().lookupByNameAndType("logFormatter", ExchangeFormatter.class);
if (localFormatter != null) {
setProperties(localFormatter, parameters);
} else if (localFormatter == null && exchangeFormatter != null) {
// do not set properties, the exchangeFormatter is explicitly set, therefore the
// user would have set its properties explicitly too
localFormatter = exchangeFormatter;
} else {
// if no formatter is available in the Registry, create a local one of the default type, for a single use
localFormatter = new DefaultExchangeFormatter();
setProperties(localFormatter, parameters);
}
endpoint.setLocalFormatter(localFormatter);
return endpoint;
}
/**
* Gets the logging level, will default to use INFO if no level parameter provided.
*/
protected LoggingLevel getLoggingLevel(Map<String, Object> parameters) {
String levelText = getAndRemoveParameter(parameters, "level", String.class, "INFO");
return LoggingLevel.valueOf(levelText.toUpperCase(Locale.ENGLISH));
}
/**
* Gets optional {@link Logger} instance from parameters. If non-null, the provided instance will be used as
* {@link Logger} in {@link CamelLogger}
*
* @param parameters the parameters
* @return the Logger object from the parameter
*/
protected Logger getLogger(Map<String, Object> parameters) {
return getAndRemoveOrResolveReferenceParameter(parameters, "logger", Logger.class);
}
public ExchangeFormatter getExchangeFormatter() {
return exchangeFormatter;
}
/**
* Sets a custom {@link ExchangeFormatter} to convert the Exchange to a String suitable for logging.
* <p />
* If not specified, we default to {@link DefaultExchangeFormatter}.
*/
public void setExchangeFormatter(ExchangeFormatter exchangeFormatter) {
this.exchangeFormatter = exchangeFormatter;
}
}
|
kevinearls/camel
|
camel-core/src/main/java/org/apache/camel/component/log/LogComponent.java
|
Java
|
apache-2.0
| 4,907
|
//// [classImplementsClass6.ts]
class A {
static bar(): string {
return "";
}
foo(): number { return 1; }
}
class C implements A {
foo() {
return 1;
}
}
class C2 extends A {}
var c: C;
var c2: C2;
c = c2;
c2 = c;
c.bar(); // error
c2.bar(); // should error
//// [classImplementsClass6.js]
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
var A = (function () {
function A() {
}
A.bar = function () {
return "";
};
A.prototype.foo = function () { return 1; };
return A;
})();
var C = (function () {
function C() {
}
C.prototype.foo = function () {
return 1;
};
return C;
})();
var C2 = (function (_super) {
__extends(C2, _super);
function C2() {
_super.apply(this, arguments);
}
return C2;
})(A);
var c;
var c2;
c = c2;
c2 = c;
c.bar(); // error
c2.bar(); // should error
|
freedot/tstolua
|
tests/baselines/reference/classImplementsClass6.js
|
JavaScript
|
apache-2.0
| 1,078
|
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class Resource.Dimension
</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class Resource.Dimension
">
<meta name="generator" content="docfx 2.10.2.0">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="../toc.html">
<meta property="docfx:tocrel" content="toc.html">
</head>
<body data-spy="scroll" data-target="#affix">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content">
<h1 id="xAPIWrapper_Tests_Droid_Resource_Dimension" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension">Class Resource.Dimension
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">Resource.Dimension</span></div>
</div>
<h6><strong>Namespace</strong>:xAPIWrapper.Tests.Droid</h6>
<h6><strong>Assembly</strong>:xAPIWrapper.Tests.Droid.dll</h6>
<h5 id="xAPIWrapper_Tests_Droid_Resource_Dimension_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class Dimension : object</code></pre>
</div>
<h3 id="fields">Fields
</h3>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2699">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_content_inset_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_content_inset_material">abc_action_bar_content_inset_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_content_inset_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2702">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_default_height_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_default_height_material">abc_action_bar_default_height_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_default_height_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2705">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_default_padding_end_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_default_padding_end_material">abc_action_bar_default_padding_end_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_default_padding_end_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2708">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_default_padding_start_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_default_padding_start_material">abc_action_bar_default_padding_start_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_default_padding_start_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2711">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_icon_vertical_padding_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_icon_vertical_padding_material">abc_action_bar_icon_vertical_padding_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_icon_vertical_padding_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2714">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_overflow_padding_end_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_overflow_padding_end_material">abc_action_bar_overflow_padding_end_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_overflow_padding_end_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2717">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_overflow_padding_start_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_overflow_padding_start_material">abc_action_bar_overflow_padding_start_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_overflow_padding_start_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2720">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_progress_bar_size" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_progress_bar_size">abc_action_bar_progress_bar_size</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_progress_bar_size = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2723">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_stacked_max_height" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_stacked_max_height">abc_action_bar_stacked_max_height</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_stacked_max_height = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2726">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_stacked_tab_max_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_stacked_tab_max_width">abc_action_bar_stacked_tab_max_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_stacked_tab_max_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2729">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_subtitle_bottom_margin_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_subtitle_bottom_margin_material">abc_action_bar_subtitle_bottom_margin_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_subtitle_bottom_margin_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2732">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_bar_subtitle_top_margin_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_bar_subtitle_top_margin_material">abc_action_bar_subtitle_top_margin_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_bar_subtitle_top_margin_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2735">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_button_min_height_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_button_min_height_material">abc_action_button_min_height_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_button_min_height_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2738">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_button_min_width_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_button_min_width_material">abc_action_button_min_width_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_button_min_width_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2741">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_action_button_min_width_overflow_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_action_button_min_width_overflow_material">abc_action_button_min_width_overflow_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_action_button_min_width_overflow_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2744">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_alert_dialog_button_bar_height" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_alert_dialog_button_bar_height">abc_alert_dialog_button_bar_height</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_alert_dialog_button_bar_height = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2747">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_button_inset_horizontal_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_button_inset_horizontal_material">abc_button_inset_horizontal_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_button_inset_horizontal_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2750">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_button_inset_vertical_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_button_inset_vertical_material">abc_button_inset_vertical_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_button_inset_vertical_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2753">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_button_padding_horizontal_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_button_padding_horizontal_material">abc_button_padding_horizontal_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_button_padding_horizontal_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2756">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_button_padding_vertical_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_button_padding_vertical_material">abc_button_padding_vertical_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_button_padding_vertical_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2759">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_config_prefDialogWidth" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_config_prefDialogWidth">abc_config_prefDialogWidth</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_config_prefDialogWidth = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2762">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_control_corner_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_control_corner_material">abc_control_corner_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_control_corner_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2765">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_control_inset_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_control_inset_material">abc_control_inset_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_control_inset_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2768">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_control_padding_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_control_padding_material">abc_control_padding_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_control_padding_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2771">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dialog_list_padding_vertical_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dialog_list_padding_vertical_material">abc_dialog_list_padding_vertical_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dialog_list_padding_vertical_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2774">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dialog_min_width_major" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dialog_min_width_major">abc_dialog_min_width_major</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dialog_min_width_major = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2777">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dialog_min_width_minor" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dialog_min_width_minor">abc_dialog_min_width_minor</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dialog_min_width_minor = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2780">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dialog_padding_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dialog_padding_material">abc_dialog_padding_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dialog_padding_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2783">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dialog_padding_top_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dialog_padding_top_material">abc_dialog_padding_top_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dialog_padding_top_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2786">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_disabled_alpha_material_dark" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_disabled_alpha_material_dark">abc_disabled_alpha_material_dark</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_disabled_alpha_material_dark = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2789">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_disabled_alpha_material_light" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_disabled_alpha_material_light">abc_disabled_alpha_material_light</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_disabled_alpha_material_light = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2792">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dropdownitem_icon_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dropdownitem_icon_width">abc_dropdownitem_icon_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dropdownitem_icon_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2795">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dropdownitem_text_padding_left" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dropdownitem_text_padding_left">abc_dropdownitem_text_padding_left</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dropdownitem_text_padding_left = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2798">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_dropdownitem_text_padding_right" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_dropdownitem_text_padding_right">abc_dropdownitem_text_padding_right</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_dropdownitem_text_padding_right = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2801">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_edit_text_inset_bottom_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_edit_text_inset_bottom_material">abc_edit_text_inset_bottom_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_edit_text_inset_bottom_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2804">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_edit_text_inset_horizontal_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_edit_text_inset_horizontal_material">abc_edit_text_inset_horizontal_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_edit_text_inset_horizontal_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2807">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_edit_text_inset_top_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_edit_text_inset_top_material">abc_edit_text_inset_top_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_edit_text_inset_top_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2810">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_floating_window_z" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_floating_window_z">abc_floating_window_z</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_floating_window_z = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2813">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_list_item_padding_horizontal_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_list_item_padding_horizontal_material">abc_list_item_padding_horizontal_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_list_item_padding_horizontal_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2816">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_panel_menu_list_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_panel_menu_list_width">abc_panel_menu_list_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_panel_menu_list_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2819">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_search_view_preferred_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_search_view_preferred_width">abc_search_view_preferred_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_search_view_preferred_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2822">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_search_view_text_min_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_search_view_text_min_width">abc_search_view_text_min_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_search_view_text_min_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2825">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_switch_padding" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_switch_padding">abc_switch_padding</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_switch_padding = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2828">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_body_1_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_body_1_material">abc_text_size_body_1_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_body_1_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2831">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_body_2_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_body_2_material">abc_text_size_body_2_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_body_2_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2834">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_button_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_button_material">abc_text_size_button_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_button_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2837">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_caption_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_caption_material">abc_text_size_caption_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_caption_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2840">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_display_1_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_display_1_material">abc_text_size_display_1_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_display_1_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2843">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_display_2_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_display_2_material">abc_text_size_display_2_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_display_2_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2846">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_display_3_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_display_3_material">abc_text_size_display_3_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_display_3_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2849">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_display_4_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_display_4_material">abc_text_size_display_4_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_display_4_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2852">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_headline_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_headline_material">abc_text_size_headline_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_headline_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2855">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_large_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_large_material">abc_text_size_large_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_large_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2858">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_medium_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_medium_material">abc_text_size_medium_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_medium_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2861">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_menu_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_menu_material">abc_text_size_menu_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_menu_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2864">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_small_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_small_material">abc_text_size_small_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_small_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2867">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_subhead_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_subhead_material">abc_text_size_subhead_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_subhead_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2870">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_subtitle_material_toolbar" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_subtitle_material_toolbar">abc_text_size_subtitle_material_toolbar</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_subtitle_material_toolbar = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2873">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_title_material" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_title_material">abc_text_size_title_material</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_title_material = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2876">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_abc_text_size_title_material_toolbar" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.abc_text_size_title_material_toolbar">abc_text_size_title_material_toolbar</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int abc_text_size_title_material_toolbar = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2879">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_cardview_compat_inset_shadow" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.cardview_compat_inset_shadow">cardview_compat_inset_shadow</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int cardview_compat_inset_shadow = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2882">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_cardview_default_elevation" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.cardview_default_elevation">cardview_default_elevation</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int cardview_default_elevation = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2885">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_cardview_default_radius" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.cardview_default_radius">cardview_default_radius</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int cardview_default_radius = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2888">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_appbar_elevation" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_appbar_elevation">design_appbar_elevation</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_appbar_elevation = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2891">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_border_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_border_width">design_fab_border_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_border_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2894">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_content_size" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_content_size">design_fab_content_size</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_content_size = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2897">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_elevation" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_elevation">design_fab_elevation</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_elevation = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2900">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_size_mini" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_size_mini">design_fab_size_mini</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_size_mini = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2903">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_size_normal" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_size_normal">design_fab_size_normal</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_size_normal = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2906">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_fab_translation_z_pressed" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_fab_translation_z_pressed">design_fab_translation_z_pressed</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_fab_translation_z_pressed = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2909">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_elevation" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_elevation">design_navigation_elevation</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_elevation = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2912">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_icon_padding" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_icon_padding">design_navigation_icon_padding</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_icon_padding = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2915">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_icon_size" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_icon_size">design_navigation_icon_size</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_icon_size = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2918">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_max_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_max_width">design_navigation_max_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_max_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2921">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_padding_bottom" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_padding_bottom">design_navigation_padding_bottom</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_padding_bottom = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2924">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_padding_top_default" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_padding_top_default">design_navigation_padding_top_default</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_padding_top_default = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2927">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_navigation_separator_vertical_padding" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_navigation_separator_vertical_padding">design_navigation_separator_vertical_padding</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_navigation_separator_vertical_padding = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2930">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_action_inline_max_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_action_inline_max_width">design_snackbar_action_inline_max_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_action_inline_max_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2933">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_background_corner_radius" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_background_corner_radius">design_snackbar_background_corner_radius</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_background_corner_radius = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2936">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_elevation" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_elevation">design_snackbar_elevation</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_elevation = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2939">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_extra_spacing_horizontal" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_extra_spacing_horizontal">design_snackbar_extra_spacing_horizontal</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_extra_spacing_horizontal = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2942">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_max_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_max_width">design_snackbar_max_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_max_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2945">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_min_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_min_width">design_snackbar_min_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_min_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2948">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_padding_horizontal" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_padding_horizontal">design_snackbar_padding_horizontal</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_padding_horizontal = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2951">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_padding_vertical" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_padding_vertical">design_snackbar_padding_vertical</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_padding_vertical = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2954">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_padding_vertical_2lines" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_padding_vertical_2lines">design_snackbar_padding_vertical_2lines</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_padding_vertical_2lines = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2957">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_snackbar_text_size" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_snackbar_text_size">design_snackbar_text_size</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_snackbar_text_size = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2960">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_tab_max_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_tab_max_width">design_tab_max_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_tab_max_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2963">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_design_tab_min_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.design_tab_min_width">design_tab_min_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int design_tab_min_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2966">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_dialog_fixed_height_major" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.dialog_fixed_height_major">dialog_fixed_height_major</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int dialog_fixed_height_major = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2969">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_dialog_fixed_height_minor" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.dialog_fixed_height_minor">dialog_fixed_height_minor</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int dialog_fixed_height_minor = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2972">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_dialog_fixed_width_major" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.dialog_fixed_width_major">dialog_fixed_width_major</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int dialog_fixed_width_major = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2975">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_dialog_fixed_width_minor" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.dialog_fixed_width_minor">dialog_fixed_width_minor</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int dialog_fixed_width_minor = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2978">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_disabled_alpha_material_dark" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.disabled_alpha_material_dark">disabled_alpha_material_dark</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int disabled_alpha_material_dark = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2981">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_disabled_alpha_material_light" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.disabled_alpha_material_light">disabled_alpha_material_light</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int disabled_alpha_material_light = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2984">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_highlight_alpha_material_colored" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.highlight_alpha_material_colored">highlight_alpha_material_colored</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int highlight_alpha_material_colored = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2987">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_highlight_alpha_material_dark" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.highlight_alpha_material_dark">highlight_alpha_material_dark</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int highlight_alpha_material_dark = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2990">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_highlight_alpha_material_light" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.highlight_alpha_material_light">highlight_alpha_material_light</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int highlight_alpha_material_light = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2993">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_mr_media_route_controller_art_max_height" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.mr_media_route_controller_art_max_height">mr_media_route_controller_art_max_height</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int mr_media_route_controller_art_max_height = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2996">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_notification_large_icon_height" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.notification_large_icon_height">notification_large_icon_height</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int notification_large_icon_height = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2999">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_notification_large_icon_width" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.notification_large_icon_width">notification_large_icon_width</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int notification_large_icon_width = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=3002">View Source</a>
</span>
<h4 id="xAPIWrapper_Tests_Droid_Resource_Dimension_notification_subtext_size" data-uid="xAPIWrapper.Tests.Droid.Resource.Dimension.notification_subtext_size">notification_subtext_size</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const int notification_subtext_size = null</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://iworktech.visualstudio.com/DefaultCollection/_git/xAPI%20Wrapper%20Compoment?path=xAPIWrapper/xAPIWrapper.Tests.Droid/Resources/Resource.Designer.cs&version=GBmaster&line=2695" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
<span>Copyright © 2015-2016 Microsoft<br>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
|
iWorkTech/xapi-wrapper-xamarin
|
component/src/xAPIWrapper.Tests.Droid/_site/api/xAPIWrapper.Tests.Droid.Resource.Dimension.html
|
HTML
|
apache-2.0
| 151,215
|
package oz.tez.samples;
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocatedFileStatus;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.RemoteIterator;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.tez.client.TezClient;
import org.apache.tez.dag.api.DAG;
import org.apache.tez.dag.api.DataSinkDescriptor;
import org.apache.tez.dag.api.DataSourceDescriptor;
import org.apache.tez.dag.api.Edge;
import org.apache.tez.dag.api.ProcessorDescriptor;
import org.apache.tez.dag.api.TezConfiguration;
import org.apache.tez.dag.api.Vertex;
import org.apache.tez.dag.api.client.DAGClient;
import org.apache.tez.dag.api.client.DAGStatus;
import org.apache.tez.mapreduce.input.MRInput;
import org.apache.tez.mapreduce.output.MROutput;
import org.apache.tez.mapreduce.processor.SimpleMRProcessor;
import org.apache.tez.runtime.api.ProcessorContext;
import org.apache.tez.runtime.library.api.KeyValueReader;
import org.apache.tez.runtime.library.api.KeyValueWriter;
import org.apache.tez.runtime.library.api.KeyValuesReader;
import org.apache.tez.runtime.library.conf.OrderedPartitionedKVEdgeConfig;
import org.apache.tez.runtime.library.partitioner.HashPartitioner;
import org.apache.tez.runtime.library.processor.SimpleProcessor;
import oz.tez.deployment.utils.TezConstants;
import oz.tez.deployment.utils.YarnUtils;
import com.google.common.base.Preconditions;
public class TezWordCount {
private final static Log logger = LogFactory.getLog(TezWordCount.class);
static String INPUT = "Input";
static String OUTPUT = "Output";
static String TOKENIZER = "Tokenizer";
static String SUMMATION = "Summation";
public static void main(String[] args) throws Exception {
// [NOTE-1] When executing from the command line you may already have a generated JAR file for your project,
// so setting this property to false will not generate JAR from the current workspace. This is purely an IDE-dev feature.
System.setProperty(TezConstants.GENERATE_JAR, "true");
// [NOTE-2] This will 'always' update the classpath (see NOTE-3 below), thus ensuring that any changes you may have made (code or JAR)
// are always reflected when submitting Tez JOB
System.setProperty(TezConstants.UPDATE_CLASSPATH, "true");
String inputFile = "sample.txt";
String appName = "tez-wc";
String outputPath = appName + "_out";
final DAG dag = DAG.create(appName);
TezConfiguration tezConfiguration = new TezConfiguration(new YarnConfiguration());
FileSystem fs = FileSystem.get(tezConfiguration);
// delete output directory (in case it exists from previous run) - OPTIONAL (safe to comment)
fs.delete(new Path(outputPath), true);
// copy source file from local file system to HDFS - OPTIONAL (safe to comment if file is already there)
Path testFile = new Path(inputFile);
fs.copyFromLocalFile(false, true, new Path(inputFile), testFile);
System.out.println("STARTING JOB");
Path inputPath = fs.makeQualified(new Path(inputFile));
logger.info("Counting words in " + inputPath);
logger.info("Building local resources");
/*
* [NOTE-3] The line below is the key for transparent classpath management. Classpath is calculated
* and provisioned to HDFS returning map of LocalResources which will be later added
* to AM (via TezClient) and each Vertex before
*/
Map<String, LocalResource> localResources = YarnUtils.createLocalResources(fs, "spark-cp");
logger.info("Done building local resources");
final TezClient tezClient = TezClient.create("WordCount", tezConfiguration);
tezClient.addAppMasterLocalFiles(localResources);
tezClient.start();
logger.info("Generating DAG");
OrderedPartitionedKVEdgeConfig edgeConf = OrderedPartitionedKVEdgeConfig
.newBuilder(Text.class.getName(), IntWritable.class.getName(),
HashPartitioner.class.getName(), null).build();
DataSourceDescriptor dataSource = MRInput.createConfigBuilder(new Configuration(tezConfiguration), TextInputFormat.class, inputFile).build();
DataSinkDescriptor dataSink = MROutput.createConfigBuilder(new Configuration(tezConfiguration), TextOutputFormat.class, outputPath).build();
Vertex mapper = Vertex.create(TOKENIZER, ProcessorDescriptor.create(TokenProcessor.class.getName())).addDataSource(INPUT, dataSource);
mapper.addTaskLocalFiles(localResources);
dag.addVertex(mapper);
Vertex reducer = Vertex.create(SUMMATION,ProcessorDescriptor.create(SumProcessor.class.getName()), 1)
.addDataSink(OUTPUT, dataSink);
reducer.addTaskLocalFiles(localResources);
dag.addVertex(reducer);
dag.addEdge(Edge.create(mapper, reducer, edgeConf.createDefaultEdgeProperty()));
logger.info("Done generating DAG");
logger.info("Waitin for Tez session");
tezClient.waitTillReady();
logger.info("Submitting DAG");
long start = System.currentTimeMillis();
DAGClient dagClient = tezClient.submitDAG(dag);
DAGStatus dagStatus = dagClient.waitForCompletionWithStatusUpdates(null);
long stop = System.currentTimeMillis();
float elapsed = ((float)((stop-start)/(1000*60)));
logger.info("Finished DAG in " + elapsed + " minutes");
if (dagStatus.getState() != DAGStatus.State.SUCCEEDED) {
logger.info("DAG diagnostics: " + dagStatus.getDiagnostics());
}
tezClient.stop();
// The code below will simply read the output file printing sampled result to the console for validation
RemoteIterator<LocatedFileStatus> iter = fs.listFiles(new Path(outputPath), false);
int counter = 0;
while (iter.hasNext() && counter++ < 20) {
LocatedFileStatus status = iter.next();
if (status.isFile()) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(fs.open(status.getPath())));
String line;
logger.info("Sampled results from " + status.getPath() + ":");
while ((line = reader.readLine()) != null && counter++ < 20) {
logger.info(line);
}
logger.info(". . . . . .");
}
}
}
public static class TokenProcessor extends SimpleProcessor {
IntWritable count = new IntWritable(1);
Text word = new Text();
public TokenProcessor(ProcessorContext context) {
super(context);
}
@Override
public void run() throws Exception {
Preconditions.checkArgument(getInputs().size() == 1);
Preconditions.checkArgument(getOutputs().size() == 1);
// the recommended approach is to cast the reader/writer to a specific type instead
// of casting the input/output. This allows the actual input/output type to be replaced
// without affecting the semantic guarantees of the data type that are represented by
// the reader and writer.
// The inputs/outputs are referenced via the names assigned in the DAG.
KeyValueReader kvReader = (KeyValueReader) getInputs().values().iterator().next().getReader();
KeyValueWriter kvWriter = (KeyValueWriter) getOutputs().values().iterator().next().getWriter();
while (kvReader.next()) {
StringTokenizer itr = new StringTokenizer(kvReader.getCurrentValue().toString());
while (itr.hasMoreTokens()) {
word.set(itr.nextToken());
// Count 1 every time a word is observed. Word is the key a 1 is the value
kvWriter.write(word, count);
}
}
}
}
/*
* Example code to write a processor that commits final output to a data sink
* The SumProcessor aggregates the sum of individual word counts generated by
* the TokenProcessor.
* The SumProcessor is connected to a DataSink. In this case, its an Output that
* writes the data via an OutputFormat to a data sink (typically HDFS). Thats why
* it derives from SimpleMRProcessor that takes care of handling the necessary
* output commit operations that makes the final output available for consumers.
*/
public static class SumProcessor extends SimpleMRProcessor {
public SumProcessor(ProcessorContext context) {
super(context);
}
@Override
public void run() throws Exception {
Preconditions.checkArgument(getInputs().size() == 1);
Preconditions.checkArgument(getOutputs().size() == 1);
KeyValueWriter kvWriter = (KeyValueWriter) getOutputs().values().iterator().next().getWriter();
KeyValuesReader kvReader = (KeyValuesReader) getInputs().values().iterator().next().getReader();
while (kvReader.next()) {
Text word = (Text) kvReader.getCurrentKey();
int sum = 0;
for (Object value : kvReader.getCurrentValues()) {
sum += ((IntWritable) value).get();
}
kvWriter.write(word, new LongWritable(sum));
}
// deriving from SimpleMRProcessor takes care of committing the output
// It automatically invokes the commit logic for the OutputFormat if necessary.
}
}
}
|
olegz/tez-samples
|
src/main/java/oz/tez/samples/TezWordCount.java
|
Java
|
apache-2.0
| 9,479
|
# Vitis bloodworthiana Comeaux SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
Sida 14:460. 1991
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Vitales/Vitaceae/Vitis/Vitis bloodworthiana/README.md
|
Markdown
|
apache-2.0
| 191
|
# Hieracium armerioides subsp. siphonophorum Wilczek & Zahn SUBSPECIES
#### Status
ACCEPTED
#### According to
Euro+Med Plantbase
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Hieracium/Hieracium armerioides/Hieracium armerioides siphonophorum/README.md
|
Markdown
|
apache-2.0
| 197
|
# Oliverodoxa Kuntze GENUS
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Liliopsida/Zingiberales/Zingiberaceae/Oliverodoxa/README.md
|
Markdown
|
apache-2.0
| 166
|
# Cryptocarya kajewskii C.K.Allen SPECIES
#### Status
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Magnoliopsida/Laurales/Lauraceae/Cryptocarya/Cryptocarya kajewskii/README.md
|
Markdown
|
apache-2.0
| 181
|
# Porpax nummularia (Kraenzl.) Smitinand SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
mdoering/backbone
|
life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Porpax/Porpax elwesii/ Syn. Porpax nummularia/README.md
|
Markdown
|
apache-2.0
| 195
|
# SqlGenerater
根据实体生成对应的SQL语句, 为任意ORM框架提供一个SQL生成组件.
|
HarryCU/SqlGenerater
|
README.md
|
Markdown
|
apache-2.0
| 100
|
/*
* Copyright (c) 2008-2016, 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.spi;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.core.DistributedObjectListener;
import java.util.Collection;
/**
* A {@link com.hazelcast.spi.CoreService} responsible for managing the DistributedObject proxies.
*
* @author mdogan 1/14/13
*/
public interface ProxyService extends CoreService {
int getProxyCount();
void initializeDistributedObject(String serviceName, String objectId);
DistributedObject getDistributedObject(String serviceName, String objectId);
void destroyDistributedObject(String serviceName, String objectId);
Collection<DistributedObject> getDistributedObjects(String serviceName);
Collection<String> getDistributedObjectNames(String serviceName);
Collection<DistributedObject> getAllDistributedObjects();
String addProxyListener(DistributedObjectListener distributedObjectListener);
boolean removeProxyListener(String registrationId);
}
|
lmjacksoniii/hazelcast
|
hazelcast/src/main/java/com/hazelcast/spi/ProxyService.java
|
Java
|
apache-2.0
| 1,583
|
package me.chanjar.weixin.mp.bean.message;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;
@Data
@XStreamAlias("xml")
@JacksonXmlRootElement(localName = "xml")
@EqualsAndHashCode(callSuper = true)
public class WxMpXmlOutDeviceMessage extends WxMpXmlOutMessage {
private static final long serialVersionUID = -3093843149649157587L;
@XStreamAlias("DeviceType")
@XStreamConverter(value = XStreamCDataConverter.class)
@JacksonXmlProperty(localName = "DeviceType")
@JacksonXmlCData
private String deviceType;
@XStreamAlias("DeviceID")
@XStreamConverter(value = XStreamCDataConverter.class)
@JacksonXmlProperty(localName = "DeviceID")
@JacksonXmlCData
private String deviceId;
@XStreamAlias("Content")
@XStreamConverter(value = XStreamCDataConverter.class)
@JacksonXmlProperty(localName = "Content")
@JacksonXmlCData
private String content;
@XStreamAlias("SessionID")
@XStreamConverter(value = XStreamCDataConverter.class)
@JacksonXmlProperty(localName = "SessionID")
@JacksonXmlCData
private String sessionId;
public WxMpXmlOutDeviceMessage() {
this.msgType = WxConsts.XmlMsgType.DEVICE_TEXT;
}
}
|
Wechat-Group/WxJava
|
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/message/WxMpXmlOutDeviceMessage.java
|
Java
|
apache-2.0
| 1,609
|
# frozen_string_literal: true
Before("@cognitoidentity") do
@client = Aws::CognitoIdentity::Client.new
end
After("@cognitoidentity") do
end
Given(/^I have an Aws::CognitoIdenty::Client without credentials$/) do
@client = Aws::CognitoIdentity::Client.new(
credentials: nil,
validate_params: false
)
expect(@client.config.credentials).to be(nil)
end
When(/^I make a (\w+) request$/) do |operation|
begin
@client.send(AwsSdkCodeGenerator::Underscore.underscore(operation))
rescue => error
@error = error
end
end
Then(/^I should not receive an Aws::CognitoIdentity::Errors::MissingAuthenticationTokenException$/) do
expect(@error).not_to be_kind_of(Aws::CognitoIdentity::Errors::MissingAuthenticationTokenException)
end
Then(/^I should receive a missing credentials error$/) do
expect(@error).to be_kind_of(Aws::Errors::MissingCredentialsError)
end
|
aws/aws-sdk-ruby
|
gems/aws-sdk-cognitoidentity/features/step_definitions.rb
|
Ruby
|
apache-2.0
| 885
|
package integrationtest.generationgap.generatedbuilder;
public class StringPropertyBeanWithSomethingElseForGenerationGapTestBuilder extends integrationtest.generationgap.generatedbuilder.StringPropertyBeanWithSomethingElseForGenerationGapTestBaseBuilder<StringPropertyBeanWithSomethingElseForGenerationGapTestBuilder> {
public static StringPropertyBeanWithSomethingElseForGenerationGapTestBuilder aStringPropertyBeanWithSomethingElseForGenerationGapTest() {
return new StringPropertyBeanWithSomethingElseForGenerationGapTestBuilder();
}
}
|
uglycustard/buildergenerator
|
src/test/resources/integrationtest/generationgap/expectedbuilder/StringPropertyBeanWithSomethingElseForGenerationGapTestBuilder.java
|
Java
|
apache-2.0
| 556
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_43) on Tue Apr 09 16:55:12 ICT 2013 -->
<TITLE>
Uses of Class org.apache.hadoop.io.IntWritable (Hadoop 1.0.4-SNAPSHOT API)
</TITLE>
<META NAME="date" CONTENT="2013-04-09">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.hadoop.io.IntWritable (Hadoop 1.0.4-SNAPSHOT API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/io//class-useIntWritable.html" target="_top"><B>FRAMES</B></A>
<A HREF="IntWritable.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.hadoop.io.IntWritable</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.examples"><B>org.apache.hadoop.examples</B></A></TD>
<TD>Hadoop example code. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.mapreduce.lib.reduce"><B>org.apache.hadoop.mapreduce.lib.reduce</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.typedbytes"><B>org.apache.hadoop.typedbytes</B></A></TD>
<TD>Typed bytes are sequences of bytes in which the first byte is a type code. </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.hadoop.util"><B>org.apache.hadoop.util</B></A></TD>
<TD>Common utilities. </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.examples"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> in <A HREF="../../../../../org/apache/hadoop/examples/package-summary.html">org.apache.hadoop.examples</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/hadoop/examples/package-summary.html">org.apache.hadoop.examples</A> that return types with arguments of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/mapred/RecordReader.html" title="interface in org.apache.hadoop.mapred">RecordReader</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>,<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>></CODE></FONT></TD>
<TD><CODE><B>SleepJob.SleepInputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.SleepInputFormat.html#getRecordReader(org.apache.hadoop.mapred.InputSplit, org.apache.hadoop.mapred.JobConf, org.apache.hadoop.mapred.Reporter)">getRecordReader</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/InputSplit.html" title="interface in org.apache.hadoop.mapred">InputSplit</A> ignored,
<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> conf,
<A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/mapred/RecordReader.html" title="interface in org.apache.hadoop.mapred">RecordReader</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>,<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>></CODE></FONT></TD>
<TD><CODE><B>SleepJob.SleepInputFormat.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.SleepInputFormat.html#getRecordReader(org.apache.hadoop.mapred.InputSplit, org.apache.hadoop.mapred.JobConf, org.apache.hadoop.mapred.Reporter)">getRecordReader</A></B>(<A HREF="../../../../../org/apache/hadoop/mapred/InputSplit.html" title="interface in org.apache.hadoop.mapred">InputSplit</A> ignored,
<A HREF="../../../../../org/apache/hadoop/mapred/JobConf.html" title="class in org.apache.hadoop.mapred">JobConf</A> conf,
<A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/hadoop/examples/package-summary.html">org.apache.hadoop.examples</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>SleepJob.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.html#getPartition(org.apache.hadoop.io.IntWritable, org.apache.hadoop.io.NullWritable, int)">getPartition</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> k,
<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A> v,
int numPartitions)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B>SecondarySort.FirstPartitioner.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SecondarySort.FirstPartitioner.html#getPartition(org.apache.hadoop.examples.SecondarySort.IntPair, org.apache.hadoop.io.IntWritable, int)">getPartition</A></B>(<A HREF="../../../../../org/apache/hadoop/examples/SecondarySort.IntPair.html" title="class in org.apache.hadoop.examples">SecondarySort.IntPair</A> key,
<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> value,
int numPartitions)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SleepJob.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.html#map(org.apache.hadoop.io.IntWritable, org.apache.hadoop.io.IntWritable, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)">map</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> key,
<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> value,
<A HREF="../../../../../org/apache/hadoop/mapred/OutputCollector.html" title="interface in org.apache.hadoop.mapred">OutputCollector</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>,<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A>> output,
<A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SleepJob.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.html#reduce(org.apache.hadoop.io.IntWritable, java.util.Iterator, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)">reduce</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A><<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A>> values,
<A HREF="../../../../../org/apache/hadoop/mapred/OutputCollector.html" title="interface in org.apache.hadoop.mapred">OutputCollector</A><<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A>,<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A>> output,
<A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Method parameters in <A HREF="../../../../../org/apache/hadoop/examples/package-summary.html">org.apache.hadoop.examples</A> with type arguments of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SleepJob.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SleepJob.html#map(org.apache.hadoop.io.IntWritable, org.apache.hadoop.io.IntWritable, org.apache.hadoop.mapred.OutputCollector, org.apache.hadoop.mapred.Reporter)">map</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> key,
<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> value,
<A HREF="../../../../../org/apache/hadoop/mapred/OutputCollector.html" title="interface in org.apache.hadoop.mapred">OutputCollector</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>,<A HREF="../../../../../org/apache/hadoop/io/NullWritable.html" title="class in org.apache.hadoop.io">NullWritable</A>> output,
<A HREF="../../../../../org/apache/hadoop/mapred/Reporter.html" title="interface in org.apache.hadoop.mapred">Reporter</A> reporter)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>SecondarySort.Reduce.</B><B><A HREF="../../../../../org/apache/hadoop/examples/SecondarySort.Reduce.html#reduce(org.apache.hadoop.examples.SecondarySort.IntPair, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)">reduce</A></B>(<A HREF="../../../../../org/apache/hadoop/examples/SecondarySort.IntPair.html" title="class in org.apache.hadoop.examples">SecondarySort.IntPair</A> key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>> values,
<A HREF="../../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A> context)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>WordCount.IntSumReducer.</B><B><A HREF="../../../../../org/apache/hadoop/examples/WordCount.IntSumReducer.html#reduce(org.apache.hadoop.io.Text, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)">reduce</A></B>(<A HREF="../../../../../org/apache/hadoop/io/Text.html" title="class in org.apache.hadoop.io">Text</A> key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>> values,
<A HREF="../../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A> context)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.mapreduce.lib.reduce"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> in <A HREF="../../../../../org/apache/hadoop/mapreduce/lib/reduce/package-summary.html">org.apache.hadoop.mapreduce.lib.reduce</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Method parameters in <A HREF="../../../../../org/apache/hadoop/mapreduce/lib/reduce/package-summary.html">org.apache.hadoop.mapreduce.lib.reduce</A> with type arguments of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>IntSumReducer.</B><B><A HREF="../../../../../org/apache/hadoop/mapreduce/lib/reduce/IntSumReducer.html#reduce(Key, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)">reduce</A></B>(<A HREF="../../../../../org/apache/hadoop/mapreduce/lib/reduce/IntSumReducer.html" title="type parameter in IntSumReducer">Key</A> key,
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>> values,
<A HREF="../../../../../org/apache/hadoop/mapreduce/Reducer.Context.html" title="class in org.apache.hadoop.mapreduce">Reducer.Context</A> context)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.typedbytes"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> in <A HREF="../../../../../org/apache/hadoop/typedbytes/package-summary.html">org.apache.hadoop.typedbytes</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/hadoop/typedbytes/package-summary.html">org.apache.hadoop.typedbytes</A> that return <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></CODE></FONT></TD>
<TD><CODE><B>TypedBytesWritableInput.</B><B><A HREF="../../../../../org/apache/hadoop/typedbytes/TypedBytesWritableInput.html#readInt()">readInt</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></CODE></FONT></TD>
<TD><CODE><B>TypedBytesWritableInput.</B><B><A HREF="../../../../../org/apache/hadoop/typedbytes/TypedBytesWritableInput.html#readInt(org.apache.hadoop.io.IntWritable)">readInt</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> iw)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../../../org/apache/hadoop/typedbytes/package-summary.html">org.apache.hadoop.typedbytes</A> with parameters of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></CODE></FONT></TD>
<TD><CODE><B>TypedBytesWritableInput.</B><B><A HREF="../../../../../org/apache/hadoop/typedbytes/TypedBytesWritableInput.html#readInt(org.apache.hadoop.io.IntWritable)">readInt</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> iw)</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B>TypedBytesWritableOutput.</B><B><A HREF="../../../../../org/apache/hadoop/typedbytes/TypedBytesWritableOutput.html#writeInt(org.apache.hadoop.io.IntWritable)">writeInt</A></B>(<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> iw)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.hadoop.util"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Uses of <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A> in <A HREF="../../../../../org/apache/hadoop/util/package-summary.html">org.apache.hadoop.util</A></FONT></TH>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left" COLSPAN="2">Constructor parameters in <A HREF="../../../../../org/apache/hadoop/util/package-summary.html">org.apache.hadoop.util</A> with type arguments of type <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../org/apache/hadoop/util/MergeSort.html#MergeSort(java.util.Comparator)">MergeSort</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A><<A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io">IntWritable</A>> comparator)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../org/apache/hadoop/io/IntWritable.html" title="class in org.apache.hadoop.io"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/apache/hadoop/io//class-useIntWritable.html" target="_top"><B>FRAMES</B></A>
<A HREF="IntWritable.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009 The Apache Software Foundation
</BODY>
</HTML>
|
jrnz/hadoop
|
build/docs/api/org/apache/hadoop/io/class-use/IntWritable.html
|
HTML
|
apache-2.0
| 26,428
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.config.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.config.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* GetAggregateDiscoveredResourceCountsRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class GetAggregateDiscoveredResourceCountsRequestMarshaller {
private static final MarshallingInfo<String> CONFIGURATIONAGGREGATORNAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ConfigurationAggregatorName").build();
private static final MarshallingInfo<StructuredPojo> FILTERS_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Filters").build();
private static final MarshallingInfo<String> GROUPBYKEY_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("GroupByKey").build();
private static final MarshallingInfo<Integer> LIMIT_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Limit").build();
private static final MarshallingInfo<String> NEXTTOKEN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("NextToken").build();
private static final GetAggregateDiscoveredResourceCountsRequestMarshaller instance = new GetAggregateDiscoveredResourceCountsRequestMarshaller();
public static GetAggregateDiscoveredResourceCountsRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(GetAggregateDiscoveredResourceCountsRequest getAggregateDiscoveredResourceCountsRequest, ProtocolMarshaller protocolMarshaller) {
if (getAggregateDiscoveredResourceCountsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getAggregateDiscoveredResourceCountsRequest.getConfigurationAggregatorName(), CONFIGURATIONAGGREGATORNAME_BINDING);
protocolMarshaller.marshall(getAggregateDiscoveredResourceCountsRequest.getFilters(), FILTERS_BINDING);
protocolMarshaller.marshall(getAggregateDiscoveredResourceCountsRequest.getGroupByKey(), GROUPBYKEY_BINDING);
protocolMarshaller.marshall(getAggregateDiscoveredResourceCountsRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(getAggregateDiscoveredResourceCountsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
|
aws/aws-sdk-java
|
aws-java-sdk-config/src/main/java/com/amazonaws/services/config/model/transform/GetAggregateDiscoveredResourceCountsRequestMarshaller.java
|
Java
|
apache-2.0
| 3,616
|
/*
* Copyright 2014 jlamande.
*
* 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 prototypes.ws.proxy.soap.commons.io;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import prototypes.ws.proxy.soap.commons.messages.Messages;
public class Files {
private static final Logger LOGGER = LoggerFactory.getLogger(Files.class);
private static final int BUFFER_SIZE = 4096;
private Files() {
}
public static String[] findFilesInDirByExt(final String path,
final String ext) {
return findFilesInDirByExts(path, new String[]{ext});
}
public static String[] findFilesInDirByExts(final String path,
String[] extensions) {
File dir = new File(path);
if (dir.exists() && dir.isDirectory()) {
List<File> files = (List<File>) FileUtils.listFiles(dir,
extensions, true);
if ((files != null) && (files.size() > 0)) {
String[] fileNames = new String[files.size()];
int i = 0;
for (File file : files) {
fileNames[i++] = file.getAbsolutePath();
}
return fileNames;
}
} else {
LOGGER.warn("dir " + path + " does not exist or is not a directory");
}
return new String[0];
}
public static void createDirectory(String dirPath) throws IOException {
File temp = new File(dirPath);
if (!temp.exists()) {
temp.mkdir();
}
}
public static File createTempDirectory() throws IOException {
final File temp;
temp = File.createTempFile("temp", Long.toString(System.nanoTime()));
if (!(temp.delete())) {
throw new IOException("Could not delete temp file: "
+ temp.getAbsolutePath());
}
if (!(temp.mkdir())) {
throw new IOException("Could not create temp directory: "
+ temp.getAbsolutePath());
}
return (temp);
}
/**
* Extracts a zip file specified by the zipFilePath to a directory specified
* by destDirectory (will be created if does not exists)
*
* @param zipFilePath
* @return
*/
public static String unzip(String zipFilePath) {
try {
File folder = createTempDirectory();
if (!folder.exists()) {
folder.mkdir();
}
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(
zipFilePath));
ZipEntry entry = zipIn.getNextEntry();
// iterates over entries in the zip file
while (entry != null) {
String filePath = folder.getAbsolutePath() + File.separator
+ entry.getName();
if (!entry.isDirectory()) {
// if the entry is a file, extracts it
extractFile(zipIn, filePath);
} else {
// if the entry is a directory, make the directory
File dir = new File(filePath);
dir.mkdir();
}
zipIn.closeEntry();
entry = zipIn.getNextEntry();
}
zipIn.close();
return folder.getAbsolutePath();
} catch (FileNotFoundException ex) {
LOGGER.warn(Messages.MSG_ERROR_DETAILS, ex);
} catch (IOException ex) {
LOGGER.warn(Messages.MSG_ERROR_DETAILS, ex);
}
return null;
}
/**
* Extracts a zip entry (file entry)
*
* @param zipIn
* @param filePath
* @throws IOException
*/
private static void extractFile(ZipInputStream zipIn, String filePath)
throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(
new FileOutputStream(filePath));
byte[] bytesIn = new byte[BUFFER_SIZE];
int read = 0;
while ((read = zipIn.read(bytesIn)) != -1) {
bos.write(bytesIn, 0, read);
}
bos.close();
}
/**
*
* @param zipFile
* @return
*/
public static String unzipFile(String zipFile) {
FileOutputStream fos = null;
try {
File folder = createTempDirectory();
byte[] buffer = new byte[1024];
// create output directory is not exists
if (!folder.exists()) {
folder.mkdir();
}
// get the zip file content
ZipInputStream zis = new ZipInputStream(
new FileInputStream(zipFile));
// get the zipped file list entry
ZipEntry ze = zis.getNextEntry();
while (ze != null) {
String fileName = ze.getName();
File newFile = new File(folder.getAbsolutePath()
+ File.separator + fileName);
LOGGER.debug("file unzip : {}", newFile.getAbsoluteFile());
// create all non exists folders
// else you will hit FileNotFoundException for compressed folder
new File(newFile.getParent()).mkdirs();
fos = new FileOutputStream(newFile);
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
ze = zis.getNextEntry();
}
zis.closeEntry();
zis.close();
return folder.getAbsolutePath();
} catch (IOException ex) {
LOGGER.error(ex.getMessage(), ex);
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException ex) {
LOGGER.warn(Messages.MSG_ERROR_DETAILS, ex);
}
}
}
return null;
}
public static String download(String httpPath) {
String localPath = "";
LOGGER.debug("Remote file to download : {}", httpPath);
try {
File folder = createTempDirectory();
if (!folder.exists()) {
folder.mkdir();
}
URL url = new URL(httpPath);
String distantFile = url.getFile();
if (distantFile != null) {
int pos = distantFile.lastIndexOf('/');
if (pos != -1) {
distantFile = distantFile.substring(pos + 1,
distantFile.length());
}
}
localPath = folder.getAbsolutePath() + File.separator + distantFile;
LOGGER.debug("Local path to save to : {}", localPath);
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
FileOutputStream fos = new FileOutputStream(localPath);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
LOGGER.info("Remote file downloaded.");
} catch (IOException ex) {
LOGGER.error(ex.getMessage(), ex);
}
return localPath;
}
public static String readCompressed(String svgPath) {
return read(svgPath, true);
}
public static byte[] readBytesCompressed(String svgPath) {
return readBytes(svgPath, true);
}
public static String read(String svgPath) {
return read(svgPath, false);
}
public static String read(String svgPath, boolean compressed) {
String content = null;
try {
InputStream is = new FileInputStream(svgPath);
if (compressed) {
is = new GZIPInputStream(is);
}
content = Streams.getString(is);
} catch (IOException ex) {
LOGGER.warn("Error reading {}, {}", svgPath, ex);
}
return content;
}
public static byte[] readBytes(String svgPath, boolean compressed) {
byte[] content = new byte[0];
try {
InputStream is = new FileInputStream(svgPath);
if (compressed) {
is = new GZIPInputStream(is);
}
content = Streams.getBytes(is);
} catch (IOException ex) {
LOGGER.warn("Error reading {}, {}", svgPath, ex);
}
return content;
}
public static String writeCompressed(String svgPath, String content) {
return write(svgPath, content.getBytes(), true);
}
public static String writeCompressed(String svgPath, byte[] contentBytes) {
return write(svgPath, contentBytes, true);
}
public static String write(String svgPath, String content) {
return write(svgPath, content.getBytes(), false);
}
public static String write(String svgPath, byte[] contentBytes) {
return write(svgPath, contentBytes, false);
}
public static String write(String svgPath, byte[] content, boolean compressed) {
OutputStream os = null;
String finalFileName = svgPath;
try {
os = new FileOutputStream(new File(finalFileName));
if (compressed) {
os = new GZIPOutputStream(os);
}
os.write(content);
} catch (IOException ex) {
finalFileName = "-1";
LOGGER.error(ex.getMessage(), ex);
} finally {
try {
if (os != null) {
os.close();
}
} catch (IOException ex) {
LOGGER.error(ex.getMessage(), ex);
}
}
return finalFileName;
}
public static void deleteDirectory(String path) {
try {
LOGGER.debug("delete directory {} ", path);
FileUtils.deleteDirectory(new File(path));
} catch (IOException ex) {
LOGGER.warn("Cant delete directory {} : {}", path, ex);
}
}
public static void deleteFile(String path) {
try {
LOGGER.debug("delete file {} ", path);
FileUtils.forceDelete(new File(path));
} catch (IOException ex) {
LOGGER.warn("Cant delete file {} : {} ", path, ex);
}
}
/**
*
*
* @param classpathPath relative path of a file in classpath (no leading
* slash)
* @return found system file path or empty String if not found
*/
public static String findFromClasspath(String classpathPath) {
try {
URL url = Files.class.getClassLoader().getResource(classpathPath);
return url.toString();
} catch (Exception ex) {
LOGGER.warn(Messages.MSG_ERROR_DETAILS, ex);
return "";
}
}
}
|
jlmwork/proxy-soap
|
src/main/java/prototypes/ws/proxy/soap/commons/io/Files.java
|
Java
|
apache-2.0
| 12,189
|
/*
* 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 bingo.lang.builder;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import bingo.lang.Classes;
/**
* <p>
* Assists in implementing {@link Object#toString()} methods using reflection.
* </p>
* <p>
* This class uses reflection to determine the fields to append. Because these fields are usually private, the class
* uses {@link java.lang.reflect.AccessibleObject#setAccessible(java.lang.reflect.AccessibleObject[], boolean)} to
* change the visibility of the fields. This will fail under a security manager, unless the appropriate permissions are
* set up correctly.
* </p>
* <p>
* Using reflection to access (private) fields circumvents any synchronization protection guarding access to these
* fields. If a toString method cannot safely read a field, you should exclude it from the toString method, or use
* synchronization consistent with the class' lock management around the invocation of the method. Take special care to
* exclude non-thread-safe collection classes, because these classes may throw ConcurrentModificationException if
* modified while the toString method is executing.
* </p>
* <p>
* A typical invocation for this method would look like:
* </p>
*
* <pre>
* public String toString() {
* return ReflectionToStringBuilder.toString(this);
* }
* </pre>
* <p>
* You can also use the builder to debug 3rd party objects:
* </p>
*
* <pre>
* System.out.println("An object: " + ReflectionToStringBuilder.toString(anObject));
* </pre>
* <p>
* A subclass can control field output by overriding the methods:
* <ul>
* <li>{@link #accept(java.lang.reflect.Field)}</li>
* <li>{@link #getValue(java.lang.reflect.Field)}</li>
* </ul>
* </p>
* <p>
* For example, this method does <i>not</i> include the <code>password</code> field in the returned <code>String</code>:
* </p>
*
* <pre>
* public String toString() {
* return (new ReflectionToStringBuilder(this) {
* protected boolean accept(Field f) {
* return super.accept(f) && !f.getName().equals("password");
* }
* }).toString();
* }
* </pre>
* <p>
* The exact format of the <code>toString</code> is determined by the {@link ToStringStyle} passed into the constructor.
* </p>
*
* @since 2.0
* @version $Id: ReflectionToStringBuilder.java 1200177 2011-11-10 06:14:33Z ggregory $
*/
public class ReflectionToStringBuilder extends ToStringBuilder {
/**
* <p>
* Builds a <code>toString</code> value using the default <code>ToStringStyle</code> through reflection.
* </p>
*
* <p>
* It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
* throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.
* </p>
*
* <p>
* Transient members will be not be included, as they are likely derived. Static fields will not be included.
* Superclass fields will be appended.
* </p>
*
* @param object the Object to be output
* @return the String result
* @throws IllegalArgumentException if the Object is <code>null</code>
*/
public static String toString(Object object) {
return toString(object, null, false, false, null);
}
/**
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
*
* <p>
* It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
* throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.
* </p>
*
* <p>
* Transient members will be not be included, as they are likely derived. Static fields will not be included.
* Superclass fields will be appended.
* </p>
*
* <p>
* If the style is <code>null</code>, the default <code>ToStringStyle</code> is used.
* </p>
*
* @param object the Object to be output
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @return the String result
* @throws IllegalArgumentException if the Object or <code>ToStringStyle</code> is <code>null</code>
*/
public static String toString(Object object, ToStringStyle style) {
return toString(object, style, false, false, null);
}
/**
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
*
* <p>
* It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
* throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.
* </p>
*
* <p>
* If the <code>outputTransients</code> is <code>true</code>, transient members will be output, otherwise they are
* ignored, as they are likely derived fields, and not part of the value of the Object.
* </p>
*
* <p>
* Static fields will not be included. Superclass fields will be appended.
* </p>
*
* <p>
* If the style is <code>null</code>, the default <code>ToStringStyle</code> is used.
* </p>
*
* @param object the Object to be output
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @param outputTransients whether to include transient fields
* @return the String result
* @throws IllegalArgumentException if the Object is <code>null</code>
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients) {
return toString(object, style, outputTransients, false, null);
}
/**
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
*
* <p>
* It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
* throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.
* </p>
*
* <p>
* If the <code>outputTransients</code> is <code>true</code>, transient fields will be output, otherwise they are
* ignored, as they are likely derived fields, and not part of the value of the Object.
* </p>
*
* <p>
* If the <code>outputStatics</code> is <code>true</code>, static fields will be output, otherwise they are ignored.
* </p>
*
* <p>
* Static fields will not be included. Superclass fields will be appended.
* </p>
*
* <p>
* If the style is <code>null</code>, the default <code>ToStringStyle</code> is used.
* </p>
*
* @param object the Object to be output
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @param outputTransients whether to include transient fields
* @param outputStatics whether to include transient fields
* @return the String result
* @throws IllegalArgumentException if the Object is <code>null</code>
* @since 2.1
*/
public static String toString(Object object, ToStringStyle style, boolean outputTransients, boolean outputStatics) {
return toString(object, style, outputTransients, outputStatics, null);
}
/**
* <p>
* Builds a <code>toString</code> value through reflection.
* </p>
*
* <p>
* It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
* throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
* also not as efficient as testing explicitly.
* </p>
*
* <p>
* If the <code>outputTransients</code> is <code>true</code>, transient fields will be output, otherwise they are
* ignored, as they are likely derived fields, and not part of the value of the Object.
* </p>
*
* <p>
* If the <code>outputStatics</code> is <code>true</code>, static fields will be output, otherwise they are ignored.
* </p>
*
* <p>
* Superclass fields will be appended up to and including the specified superclass. A null superclass is treated as
* <code>java.lang.Object</code>.
* </p>
*
* <p>
* If the style is <code>null</code>, the default <code>ToStringStyle</code> is used.
* </p>
*
* @param <T> the type of the object
* @param object the Object to be output
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @param outputTransients whether to include transient fields
* @param outputStatics whether to include static fields
* @param reflectUpToClass the superclass to reflect up to (inclusive), may be <code>null</code>
* @return the String result
* @throws IllegalArgumentException if the Object is <code>null</code>
* @since 2.1
*/
public static <T> String toString(T object, ToStringStyle style, boolean outputTransients, boolean outputStatics,
Class<? super T> reflectUpToClass) {
return new ReflectionToStringBuilder(object, style, null, reflectUpToClass, outputTransients, outputStatics).toString();
}
/**
* Builds a String for a toString method excluding the given field names.
*
* @param object The object to "toString".
* @param excludeFieldNames The field names to exclude. Null excludes nothing.
* @return The toString value.
*/
public static String toStringExclude(Object object, Collection<String> excludeFieldNames) {
return toStringExclude(object, toNoNullStringArray(excludeFieldNames));
}
/**
* Converts the given Collection into an array of Strings. The returned array does not contain <code>null</code>
* entries. Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array element
* is <code>null</code>.
*
* @param collection The collection to convert
* @return A new array of Strings.
*/
static String[] toNoNullStringArray(Collection<String> collection) {
if (collection == null) {
return bingo.lang.Arrays.EMPTY_STRING_ARRAY;
}
return toNoNullStringArray(collection.toArray());
}
/**
* Returns a new array of Strings without null elements. Internal method used to normalize exclude lists (arrays and
* collections). Note that {@link Arrays#sort(Object[])} will throw an {@link NullPointerException} if an array
* element is <code>null</code>.
*
* @param array The array to check
* @return The given array or a new array without null.
*/
static String[] toNoNullStringArray(Object[] array) {
List<String> list = new ArrayList<String>(array.length);
for (Object e : array) {
if (e != null) {
list.add(e.toString());
}
}
return list.toArray(bingo.lang.Arrays.EMPTY_STRING_ARRAY);
}
/**
* Builds a String for a toString method excluding the given field names.
*
* @param object The object to "toString".
* @param excludeFieldNames The field names to exclude
* @return The toString value.
*/
public static String toStringExclude(Object object, String... excludeFieldNames) {
return new ReflectionToStringBuilder(object).setExcludeFieldNames(excludeFieldNames).toString();
}
/**
* Whether or not to append static fields.
*/
private boolean appendStatics = false;
/**
* Whether or not to append transient fields.
*/
private boolean appendTransients = false;
/**
* Which field names to exclude from output. Intended for fields like <code>"password"</code>.
*
* @since 3.0 this is protected instead of private
*/
protected String[] excludeFieldNames;
/**
* The last super class to stop appending fields for.
*/
private Class<?> upToClass = null;
/**
* <p>
* Constructor.
* </p>
*
* <p>
* This constructor outputs using the default style set with <code>setDefaultStyle</code>.
* </p>
*
* @param object the Object to build a <code>toString</code> for, must not be <code>null</code>
* @throws IllegalArgumentException if the Object passed in is <code>null</code>
*/
public ReflectionToStringBuilder(Object object) {
super(object);
}
/**
* <p>
* Constructor.
* </p>
*
* <p>
* If the style is <code>null</code>, the default style is used.
* </p>
*
* @param object the Object to build a <code>toString</code> for, must not be <code>null</code>
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @throws IllegalArgumentException if the Object passed in is <code>null</code>
*/
public ReflectionToStringBuilder(Object object, ToStringStyle style) {
super(object, style);
}
/**
* <p>
* Constructor.
* </p>
*
* <p>
* If the style is <code>null</code>, the default style is used.
* </p>
*
* <p>
* If the buffer is <code>null</code>, a new one is created.
* </p>
*
* @param object the Object to build a <code>toString</code> for
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @param buffer the <code>StringBuffer</code> to populate, may be <code>null</code>
* @throws IllegalArgumentException if the Object passed in is <code>null</code>
*/
public ReflectionToStringBuilder(Object object, ToStringStyle style, StringBuffer buffer) {
super(object, style, buffer);
}
/**
* Constructor.
*
* @param <T> the type of the object
* @param object the Object to build a <code>toString</code> for
* @param style the style of the <code>toString</code> to create, may be <code>null</code>
* @param buffer the <code>StringBuffer</code> to populate, may be <code>null</code>
* @param reflectUpToClass the superclass to reflect up to (inclusive), may be <code>null</code>
* @param outputTransients whether to include transient fields
* @param outputStatics whether to include static fields
* @since 2.1
*/
public <T> ReflectionToStringBuilder(T object, ToStringStyle style, StringBuffer buffer, Class<? super T> reflectUpToClass,
boolean outputTransients, boolean outputStatics) {
super(object, style, buffer);
this.setUpToClass(reflectUpToClass);
this.setAppendTransients(outputTransients);
this.setAppendStatics(outputStatics);
}
/**
* Returns whether or not to append the given <code>Field</code>.
* <ul>
* <li>Transient fields are appended only if {@link #isAppendTransients()} returns <code>true</code>.
* <li>Static fields are appended only if {@link #isAppendStatics()} returns <code>true</code>.
* <li>Inner class fields are not appened.</li>
* </ul>
*
* @param field The Field to test.
* @return Whether or not to append the given <code>Field</code>.
*/
protected boolean accept(Field field) {
if (field.getName().indexOf(Classes.INNER_CLASS_SEPARATOR_CHAR) != -1) {
// Reject field from inner class.
return false;
}
if (Modifier.isTransient(field.getModifiers()) && !this.isAppendTransients()) {
// Reject transient fields.
return false;
}
if (Modifier.isStatic(field.getModifiers()) && !this.isAppendStatics()) {
// Reject static fields.
return false;
}
if (this.excludeFieldNames != null && Arrays.binarySearch(this.excludeFieldNames, field.getName()) >= 0) {
// Reject fields from the getExcludeFieldNames list.
return false;
}
return true;
}
/**
* <p>
* Appends the fields and values defined by the given object of the given Class.
* </p>
*
* <p>
* If a cycle is detected as an object is "toString()'ed", such an object is rendered as if
* <code>Object.toString()</code> had been called and not implemented by the object.
* </p>
*
* @param clazz The class of object parameter
*/
protected void appendFieldsIn(Class<?> clazz) {
if (clazz.isArray()) {
this.reflectionAppendArray(this.getObject());
return;
}
Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
String fieldName = field.getName();
if (this.accept(field)) {
try {
// Warning: Field.get(Object) creates wrappers objects
// for primitive types.
Object fieldValue = this.getValue(field);
this.append(fieldName, fieldValue);
} catch (IllegalAccessException ex) {
//this can't happen. Would get a Security exception
// instead
//throw a runtime exception in case the impossible
// happens.
throw new InternalError("Unexpected IllegalAccessException: " + ex.getMessage());
}
}
}
}
/**
* @return Returns the excludeFieldNames.
*/
public String[] getExcludeFieldNames() {
return this.excludeFieldNames.clone();
}
/**
* <p>
* Gets the last super class to stop appending fields for.
* </p>
*
* @return The last super class to stop appending fields for.
*/
public Class<?> getUpToClass() {
return this.upToClass;
}
/**
* <p>
* Calls <code>java.lang.reflect.Field.get(Object)</code>.
* </p>
*
* @param field The Field to query.
* @return The Object from the given Field.
*
* @throws IllegalArgumentException see {@link java.lang.reflect.Field#get(Object)}
* @throws IllegalAccessException see {@link java.lang.reflect.Field#get(Object)}
*
* @see java.lang.reflect.Field#get(Object)
*/
protected Object getValue(Field field) throws IllegalArgumentException, IllegalAccessException {
return field.get(this.getObject());
}
/**
* <p>
* Gets whether or not to append static fields.
* </p>
*
* @return Whether or not to append static fields.
* @since 2.1
*/
public boolean isAppendStatics() {
return this.appendStatics;
}
/**
* <p>
* Gets whether or not to append transient fields.
* </p>
*
* @return Whether or not to append transient fields.
*/
public boolean isAppendTransients() {
return this.appendTransients;
}
/**
* <p>
* Append to the <code>toString</code> an <code>Object</code> array.
* </p>
*
* @param array the array to add to the <code>toString</code>
* @return this
*/
public ReflectionToStringBuilder reflectionAppendArray(Object array) {
this.getStyle().reflectionAppendArrayDetail(this.getStringBuffer(), null, array);
return this;
}
/**
* <p>
* Sets whether or not to append static fields.
* </p>
*
* @param appendStatics Whether or not to append static fields.
* @since 2.1
*/
public void setAppendStatics(boolean appendStatics) {
this.appendStatics = appendStatics;
}
/**
* <p>
* Sets whether or not to append transient fields.
* </p>
*
* @param appendTransients Whether or not to append transient fields.
*/
public void setAppendTransients(boolean appendTransients) {
this.appendTransients = appendTransients;
}
/**
* Sets the field names to exclude.
*
* @param excludeFieldNamesParam The excludeFieldNames to excluding from toString or <code>null</code>.
* @return <code>this</code>
*/
public ReflectionToStringBuilder setExcludeFieldNames(String... excludeFieldNamesParam) {
if (excludeFieldNamesParam == null) {
this.excludeFieldNames = null;
} else {
//clone and remove nulls
this.excludeFieldNames = toNoNullStringArray(excludeFieldNamesParam);
Arrays.sort(this.excludeFieldNames);
}
return this;
}
/**
* <p>
* Sets the last super class to stop appending fields for.
* </p>
*
* @param clazz The last super class to stop appending fields for.
*/
public void setUpToClass(Class<?> clazz) {
if (clazz != null) {
Object object = getObject();
if (object != null && clazz.isInstance(object) == false) {
throw new IllegalArgumentException("Specified class is not a superclass of the object");
}
}
this.upToClass = clazz;
}
/**
* <p>
* Gets the String built by this builder.
* </p>
*
* @return the built string
*/
@Override
public String toString() {
if (this.getObject() == null) {
return this.getStyle().getNullText();
}
Class<?> clazz = this.getObject().getClass();
this.appendFieldsIn(clazz);
while (clazz.getSuperclass() != null && clazz != this.getUpToClass()) {
clazz = clazz.getSuperclass();
this.appendFieldsIn(clazz);
}
return super.toString();
}
}
|
bingo-open-source/bingo-core
|
core-lang/src/main/java/bingo/lang/builder/ReflectionToStringBuilder.java
|
Java
|
apache-2.0
| 20,940
|
/*
* Copyright (c) [2011-2016] "Pivotal Software, Inc." / "Neo Technology" / "Graph Aware Ltd."
*
* This product is licensed to you under the Apache License, Version 2.0 (the "License").
* You may not use this product except in compliance with the License.
*
* This product may include a number of subcomponents with
* separate copyright notices and license terms. Your use of the source
* code for these subcomponents is subject to the terms and
* conditions of the subcomponent's license, as noted in the LICENSE file.
*
*/
package org.springframework.data.neo4j.repository.config;
import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport;
import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import java.lang.annotation.Annotation;
/**
* @author Vince Bickers
* @author Mark Angrish
*/
public class Neo4jRepositoriesRegistrar extends RepositoryBeanDefinitionRegistrarSupport {
@Override
protected Class<? extends Annotation> getAnnotation() {
return EnableNeo4jRepositories.class;
}
@Override
protected RepositoryConfigurationExtension getExtension() {
return new Neo4jRepositoryConfigurationExtension();
}
}
|
espiegelberg/spring-data-neo4j
|
spring-data-neo4j/src/main/java/org/springframework/data/neo4j/repository/config/Neo4jRepositoriesRegistrar.java
|
Java
|
apache-2.0
| 1,208
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.