repo_name stringlengths 5 108 | path stringlengths 6 333 | size stringlengths 1 6 | content stringlengths 4 977k | license stringclasses 15
values |
|---|---|---|---|---|
jiucai/appframework | src/main/java/org/jiucai/appframework/Version.java | 166 | package org.jiucai.appframework;
/**
* 版本信息
*
* @author zhaidangwei
*/
public class Version {
public static final String VersionNumber = "3.0.0";
}
| apache-2.0 |
cycourtot/Projet-BD | src/SimpleQuery.java | 1809 | import java.sql.*;
public class SimpleQuery {
static final String CONN_URL = "jdbc:oracle:thin:@ensioracle1.imag.fr:1521:ensioracle1";
static final String USER = "courtocy";
static final String PASSWD = "courtocy";
static final String PRE_STMT = "select Max(numRuche) from Ruche";
public SimpleQuery() {
try {
// Enregistrement du driver Oracle
System.out.print("Loading Oracle driver... ");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("loaded");
// Etablissement de la connection
System.out.print("Connecting to the database... ");
Connection conn = DriverManager.getConnection(CONN_URL, USER, PASSWD);
System.out.println("connected");
// Creation de la requete
PreparedStatement stmt = conn.prepareStatement(PRE_STMT);
// Execution de la requete
ResultSet rset = stmt.executeQuery();
// Affichage du resultat
System.out.println("Results:");
dumpResultSet(rset);
System.out.println("");
// Fermeture
rset.close();
stmt.close();
conn.close();
} catch (SQLException e) {
System.err.println("failed");
e.printStackTrace(System.err);
}
}
private void dumpResultSet(ResultSet rset) throws SQLException {
ResultSetMetaData rsetmd = rset.getMetaData();
int i = rsetmd.getColumnCount();
while (rset.next()) {
for (int j = 1; j <= i; j++) {
System.out.print(rset.getString(j) + "\t");
}
System.out.println();
}
}
public static void main(String args[]) {
new SimpleQuery();
}
}
| apache-2.0 |
jgrades/jgrades | jg-backend/interface/jg-rest-ws-api/src/main/java/org/jgrades/rest/api/config/IUserProfileService.java | 456 | /*
* Copyright (C) 2016 the original author or authors.
*
* This file is part of jGrades Application Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
package org.jgrades.rest.api.config;
import org.jgrades.config.api.model.UserData;
public interface IUserProfileService {
void setProfileData(UserData userData);
}
| apache-2.0 |
blackberry/JDE-Samples | com/rim/samples/device/nfcreaderdemo/DemoNDEFMessageListener.java | 2576 | /*
* DemoNDEFMessageListener.java
*
* Copyright © 1998-2011 Research In Motion Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Note: For the sake of simplicity, this sample application may not leverage
* resource bundles and resource strings. However, it is STRONGLY recommended
* that application developers make use of the localization features available
* within the BlackBerry development platform to ensure a seamless application
* experience across a variety of languages and geographies. For more information
* on localizing your application, please refer to the BlackBerry Java Development
* Environment Development Guide associated with this release.
*/
package com.rim.samples.device.nfcreaderdemo;
import net.rim.device.api.io.nfc.ndef.NDEFMessage;
import net.rim.device.api.io.nfc.ndef.NDEFMessageListener;
/**
* NFCMessageListener class that listens for an NDEFMessage that has an
* NDEFRecord with a record type of "plain/text".
*/
public class DemoNDEFMessageListener implements NDEFMessageListener {
private final NFCReaderScreen _screen;
/**
* Creates a new DemoNDEFMessageListener object
*
* @param screen
* The application's main screen
*/
public DemoNDEFMessageListener(final NFCReaderScreen screen) {
if (screen == null) {
throw new IllegalArgumentException("screen == null");
}
_screen = screen;
}
/**
* @see net.rim.device.api.io.nfc.ndef.NDEFMessageListener#onNDEFMessageDetected(NDEFMessage)
*/
public void onNDEFMessageDetected(final NDEFMessage message) {
// Delete all the fields in the output from the
// last time that a target was detected and read.
_screen.deleteFields();
// Do something with the detected NDEFMessage
final int recordAmount = message.getNumberOfRecords();
_screen.addTargetInfo("There are " + recordAmount
+ " records in this NDEF message");
}
}
| apache-2.0 |
vespa-engine/vespa | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java | 11072 | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.application.pkg;
import com.yahoo.config.application.api.DeploymentInstanceSpec;
import com.yahoo.config.application.api.DeploymentSpec;
import com.yahoo.config.application.api.Endpoint;
import com.yahoo.config.application.api.ValidationId;
import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.config.provision.CloudName;
import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.zone.ZoneApi;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.application.EndpointId;
import com.yahoo.vespa.hosted.controller.deployment.DeploymentSteps;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* This contains validators for a {@link ApplicationPackage} that depend on a {@link Controller} to perform validation.
*
* @author mpolden
*/
public class ApplicationPackageValidator {
private final Controller controller;
public ApplicationPackageValidator(Controller controller) {
this.controller = Objects.requireNonNull(controller, "controller must be non-null");
}
/**
* Validate the given application package
*
* @throws IllegalArgumentException if any validations fail
*/
public void validate(Application application, ApplicationPackage applicationPackage, Instant instant) {
validateSteps(applicationPackage.deploymentSpec());
validateEndpointRegions(applicationPackage.deploymentSpec());
validateEndpointChange(application, applicationPackage, instant);
validateCompactedEndpoint(applicationPackage);
validateSecurityClientsPem(applicationPackage);
}
/** Verify that we have the security/clients.pem file for public systems */
private void validateSecurityClientsPem(ApplicationPackage applicationPackage) {
if (!controller.system().isPublic() || applicationPackage.deploymentSpec().steps().isEmpty()) return;
if (applicationPackage.trustedCertificates().isEmpty())
throw new IllegalArgumentException("Missing required file 'security/clients.pem'");
}
/** Verify that each of the production zones listed in the deployment spec exist in this system */
private void validateSteps(DeploymentSpec deploymentSpec) {
for (var spec : deploymentSpec.instances()) {
new DeploymentSteps(spec, controller::system).jobs();
spec.zones().stream()
.filter(zone -> zone.environment() == Environment.prod)
.forEach(zone -> {
if ( ! controller.zoneRegistry().hasZone(ZoneId.from(zone.environment(),
zone.region().orElseThrow()))) {
throw new IllegalArgumentException("Zone " + zone + " in deployment spec was not found in this system!");
}
});
}
}
/** Verify that no single endpoint contains regions in different clouds */
private void validateEndpointRegions(DeploymentSpec deploymentSpec) {
for (var instance : deploymentSpec.instances()) {
for (var endpoint : instance.endpoints()) {
var clouds = new HashSet<CloudName>();
for (var region : endpoint.regions()) {
for (ZoneApi zone : controller.zoneRegistry().zones().all().in(Environment.prod).in(region).zones()) {
clouds.add(zone.getCloudName());
}
}
if (clouds.size() != 1) {
throw new IllegalArgumentException("Endpoint '" + endpoint.endpointId() + "' in " + instance +
" cannot contain regions in different clouds: " +
endpoint.regions().stream().sorted().collect(Collectors.toList()));
}
}
}
}
/** Verify endpoint configuration of given application package */
private void validateEndpointChange(Application application, ApplicationPackage applicationPackage, Instant instant) {
applicationPackage.deploymentSpec().instances().forEach(instance -> validateEndpointChange(application,
instance.name(),
applicationPackage,
instant));
}
/** Verify that compactable endpoint parts (instance name and endpoint ID) do not clash */
private void validateCompactedEndpoint(ApplicationPackage applicationPackage) {
Map<List<String>, InstanceEndpoint> instanceEndpoints = new HashMap<>();
for (var instanceSpec : applicationPackage.deploymentSpec().instances()) {
for (var endpoint : instanceSpec.endpoints()) {
List<String> nonCompactableIds = nonCompactableIds(instanceSpec.name(), endpoint);
InstanceEndpoint instanceEndpoint = new InstanceEndpoint(instanceSpec.name(), endpoint.endpointId());
InstanceEndpoint existingEndpoint = instanceEndpoints.get(nonCompactableIds);
if (existingEndpoint != null) {
throw new IllegalArgumentException("Endpoint with ID '" + endpoint.endpointId() + "' in instance '"
+ instanceSpec.name().value() +
"' clashes with endpoint '" + existingEndpoint.endpointId +
"' in instance '" + existingEndpoint.instance + "'");
}
instanceEndpoints.put(nonCompactableIds, instanceEndpoint);
}
}
}
/** Verify changes to endpoint configuration by comparing given application package to the existing one, if any */
private void validateEndpointChange(Application application, InstanceName instanceName, ApplicationPackage applicationPackage, Instant instant) {
var validationId = ValidationId.globalEndpointChange;
if (applicationPackage.validationOverrides().allows(validationId, instant)) return;
var endpoints = application.deploymentSpec().instance(instanceName)
.map(ApplicationPackageValidator::allEndpointsOf)
.orElseGet(List::of);
var newEndpoints = allEndpointsOf(applicationPackage.deploymentSpec().requireInstance(instanceName));
if (newEndpoints.containsAll(endpoints)) return; // Adding new endpoints is fine
if (containsAllDestinationsOf(endpoints, newEndpoints)) return; // Adding destinations is fine
var removedEndpoints = new ArrayList<>(endpoints);
removedEndpoints.removeAll(newEndpoints);
newEndpoints.removeAll(endpoints);
throw new IllegalArgumentException(validationId.value() + ": application '" + application.id() +
(instanceName.isDefault() ? "" : "." + instanceName.value()) +
"' has endpoints " + endpoints +
", but does not include all of these in deployment.xml. Deploying given " +
"deployment.xml will remove " + removedEndpoints +
(newEndpoints.isEmpty() ? "" : " and add " + newEndpoints) +
". " + ValidationOverrides.toAllowMessage(validationId));
}
/** Returns whether newEndpoints contains all destinations in endpoints */
private static boolean containsAllDestinationsOf(List<Endpoint> endpoints, List<Endpoint> newEndpoints) {
var containsAllRegions = true;
var hasSameCluster = true;
for (var endpoint : endpoints) {
var endpointContainsAllRegions = false;
var endpointHasSameCluster = false;
for (var newEndpoint : newEndpoints) {
if (endpoint.endpointId().equals(newEndpoint.endpointId())) {
endpointContainsAllRegions = newEndpoint.regions().containsAll(endpoint.regions());
endpointHasSameCluster = newEndpoint.containerId().equals(endpoint.containerId());
}
}
containsAllRegions &= endpointContainsAllRegions;
hasSameCluster &= endpointHasSameCluster;
}
return containsAllRegions && hasSameCluster;
}
/** Returns all configued endpoints of given deployment instance spec */
private static List<Endpoint> allEndpointsOf(DeploymentInstanceSpec deploymentInstanceSpec) {
var endpoints = new ArrayList<>(deploymentInstanceSpec.endpoints());
legacyEndpoint(deploymentInstanceSpec).ifPresent(endpoints::add);
return endpoints;
}
/** Returns global service ID as an endpoint, if any global service ID is set */
private static Optional<Endpoint> legacyEndpoint(DeploymentInstanceSpec instance) {
return instance.globalServiceId().map(globalServiceId -> {
var targets = instance.zones().stream()
.filter(zone -> zone.environment().isProduction())
.flatMap(zone -> zone.region().stream())
.distinct()
.map(region -> new Endpoint.Target(region, instance.name(), 1))
.collect(Collectors.toList());
return new Endpoint(EndpointId.defaultId().id(), globalServiceId, Endpoint.Level.instance, targets);
});
}
/** Returns a list of the non-compactable IDs of given instance and endpoint */
private static List<String> nonCompactableIds(InstanceName instance, Endpoint endpoint) {
List<String> ids = new ArrayList<>(2);
if (!instance.isDefault()) {
ids.add(instance.value());
}
if (!"default".equals(endpoint.endpointId())) {
ids.add(endpoint.endpointId());
}
return ids;
}
private static class InstanceEndpoint {
private final InstanceName instance;
private final String endpointId;
public InstanceEndpoint(InstanceName instance, String endpointId) {
this.instance = instance;
this.endpointId = endpointId;
}
}
}
| apache-2.0 |
adko-pl/rest-workshop | maturity-level-0/src/test/java/com/workshop/rest/level0/CommandRestTest.java | 1742 | package com.workshop.rest.level0;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.context.annotation.Primary;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.web.client.RestTemplate;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MaturityLevel0Application.class)
@WebIntegrationTest
public class CommandRestTest {
private RestTemplate restTemplate = new TestRestTemplate();
@Component
@Primary
static class UserServiceMock implements UserService {
@Override
public List<String> list() {
return Arrays.asList("John Snow");
}
@Override
public void create(String user) { }
}
@Test
public void shouldReturnJohnSnowInListOfUsers() {
// given
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity entity = new HttpEntity<>("{\"method\":\"listUsers\"}", headers);
// when
final String result = restTemplate.postForObject("http://localhost:7001/rest", entity, String.class);
// then
assertEquals("{\"result\":\"John Snow\"}", result);
}
}
| apache-2.0 |
jgrades/jgrades | jg-backend/implementation/base/jg-security/common-utils/src/main/java/org/jgrades/security/utils/CryptoDataConstants.java | 833 | /*
* Copyright (C) 2016 the original author or authors.
*
* This file is part of jGrades Application Project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
package org.jgrades.security.utils;
public final class CryptoDataConstants {
public static final String KEYSTORE_TYPE = "JCEKS";
public static final String ENCRYPTION_KEY_ALIAS = "jg-crypto";
public static final String SIGNATURE_KEY_ALIAS = "jg-signature";
public static final String CIPHER_PROVIDER_INTERFACE = "AES/ECB/PKCS5Padding";
public static final String SIGNATURE_PROVIDER_INTERFACE = "SHA256withRSA";
public static final String SIGNATURE_FILE_EXTENSION = ".sign";
private CryptoDataConstants() {
}
}
| apache-2.0 |
nafae/developer | modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/v201403/ReconciliationReportRowService.java | 755 | /**
* ReconciliationReportRowService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.dfp.axis.v201403;
public interface ReconciliationReportRowService extends javax.xml.rpc.Service {
public java.lang.String getReconciliationReportRowServiceInterfacePortAddress();
public com.google.api.ads.dfp.axis.v201403.ReconciliationReportRowServiceInterface getReconciliationReportRowServiceInterfacePort() throws javax.xml.rpc.ServiceException;
public com.google.api.ads.dfp.axis.v201403.ReconciliationReportRowServiceInterface getReconciliationReportRowServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
| apache-2.0 |
terrancesnyder/solr-analytics | lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java | 16669 | package org.apache.lucene.search;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.FilteredTermsEnum;
import org.apache.lucene.util.Attribute;
import org.apache.lucene.util.AttributeImpl;
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.UnicodeUtil;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.BasicOperations;
import org.apache.lucene.util.automaton.ByteRunAutomaton;
import org.apache.lucene.util.automaton.CompiledAutomaton;
import org.apache.lucene.util.automaton.LevenshteinAutomata;
/** Subclass of TermsEnum for enumerating all terms that are similar
* to the specified filter term.
*
* <p>Term enumerations are always ordered by
* {@link #getComparator}. Each term in the enumeration is
* greater than all that precede it.</p>
*/
public class FuzzyTermsEnum extends TermsEnum {
private TermsEnum actualEnum;
private BoostAttribute actualBoostAtt;
private final BoostAttribute boostAtt =
attributes().addAttribute(BoostAttribute.class);
private final MaxNonCompetitiveBoostAttribute maxBoostAtt;
private final LevenshteinAutomataAttribute dfaAtt;
private float bottom;
private BytesRef bottomTerm;
// TODO: chicken-and-egg
private final Comparator<BytesRef> termComparator = BytesRef.getUTF8SortedAsUnicodeComparator();
protected final float minSimilarity;
protected final float scale_factor;
protected final int termLength;
protected int maxEdits;
protected final boolean raw;
protected final Terms terms;
private final Term term;
protected final int termText[];
protected final int realPrefixLength;
private final boolean transpositions;
/**
* Constructor for enumeration of all terms from specified <code>reader</code> which share a prefix of
* length <code>prefixLength</code> with <code>term</code> and which have a fuzzy similarity >
* <code>minSimilarity</code>.
* <p>
* After calling the constructor the enumeration is already pointing to the first
* valid term if such a term exists.
*
* @param terms Delivers terms.
* @param atts {@link AttributeSource} created by the rewrite method of {@link MultiTermQuery}
* thats contains information about competitive boosts during rewrite. It is also used
* to cache DFAs between segment transitions.
* @param term Pattern term.
* @param minSimilarity Minimum required similarity for terms from the reader. Pass an integer value
* representing edit distance. Passing a fraction is deprecated.
* @param prefixLength Length of required common prefix. Default value is 0.
* @throws IOException if there is a low-level IO error
*/
public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term,
final float minSimilarity, final int prefixLength, boolean transpositions) throws IOException {
if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity)
throw new IllegalArgumentException("fractional edit distances are not allowed");
if (minSimilarity < 0.0f)
throw new IllegalArgumentException("minimumSimilarity cannot be less than 0");
if(prefixLength < 0)
throw new IllegalArgumentException("prefixLength cannot be less than 0");
this.terms = terms;
this.term = term;
// convert the string into a utf32 int[] representation for fast comparisons
final String utf16 = term.text();
this.termText = new int[utf16.codePointCount(0, utf16.length())];
for (int cp, i = 0, j = 0; i < utf16.length(); i += Character.charCount(cp))
termText[j++] = cp = utf16.codePointAt(i);
this.termLength = termText.length;
this.dfaAtt = atts.addAttribute(LevenshteinAutomataAttribute.class);
//The prefix could be longer than the word.
//It's kind of silly though. It means we must match the entire word.
this.realPrefixLength = prefixLength > termLength ? termLength : prefixLength;
// if minSimilarity >= 1, we treat it as number of edits
if (minSimilarity >= 1f) {
this.minSimilarity = 0; // just driven by number of edits
maxEdits = (int) minSimilarity;
raw = true;
} else {
this.minSimilarity = minSimilarity;
// calculate the maximum k edits for this similarity
maxEdits = initialMaxDistance(this.minSimilarity, termLength);
raw = false;
}
if (transpositions && maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) {
throw new UnsupportedOperationException("with transpositions enabled, distances > "
+ LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE + " are not supported ");
}
this.transpositions = transpositions;
this.scale_factor = 1.0f / (1.0f - this.minSimilarity);
this.maxBoostAtt = atts.addAttribute(MaxNonCompetitiveBoostAttribute.class);
bottom = maxBoostAtt.getMaxNonCompetitiveBoost();
bottomTerm = maxBoostAtt.getCompetitiveTerm();
bottomChanged(null, true);
}
/**
* return an automata-based enum for matching up to editDistance from
* lastTerm, if possible
*/
protected TermsEnum getAutomatonEnum(int editDistance, BytesRef lastTerm)
throws IOException {
final List<CompiledAutomaton> runAutomata = initAutomata(editDistance);
if (editDistance < runAutomata.size()) {
//if (BlockTreeTermsWriter.DEBUG) System.out.println("FuzzyTE.getAEnum: ed=" + editDistance + " lastTerm=" + (lastTerm==null ? "null" : lastTerm.utf8ToString()));
final CompiledAutomaton compiled = runAutomata.get(editDistance);
return new AutomatonFuzzyTermsEnum(terms.intersect(compiled, lastTerm == null ? null : compiled.floor(lastTerm, new BytesRef())),
runAutomata.subList(0, editDistance + 1).toArray(new CompiledAutomaton[editDistance + 1]));
} else {
return null;
}
}
/** initialize levenshtein DFAs up to maxDistance, if possible */
private List<CompiledAutomaton> initAutomata(int maxDistance) {
final List<CompiledAutomaton> runAutomata = dfaAtt.automata();
//System.out.println("cached automata size: " + runAutomata.size());
if (runAutomata.size() <= maxDistance &&
maxDistance <= LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) {
LevenshteinAutomata builder =
new LevenshteinAutomata(UnicodeUtil.newString(termText, realPrefixLength, termText.length - realPrefixLength), transpositions);
for (int i = runAutomata.size(); i <= maxDistance; i++) {
Automaton a = builder.toAutomaton(i);
//System.out.println("compute automaton n=" + i);
// constant prefix
if (realPrefixLength > 0) {
Automaton prefix = BasicAutomata.makeString(
UnicodeUtil.newString(termText, 0, realPrefixLength));
a = BasicOperations.concatenate(prefix, a);
}
runAutomata.add(new CompiledAutomaton(a, true, false));
}
}
return runAutomata;
}
/** swap in a new actual enum to proxy to */
protected void setEnum(TermsEnum actualEnum) {
this.actualEnum = actualEnum;
this.actualBoostAtt = actualEnum.attributes().addAttribute(BoostAttribute.class);
}
/**
* fired when the max non-competitive boost has changed. this is the hook to
* swap in a smarter actualEnum
*/
private void bottomChanged(BytesRef lastTerm, boolean init)
throws IOException {
int oldMaxEdits = maxEdits;
// true if the last term encountered is lexicographically equal or after the bottom term in the PQ
boolean termAfter = bottomTerm == null || (lastTerm != null && termComparator.compare(lastTerm, bottomTerm) >= 0);
// as long as the max non-competitive boost is >= the max boost
// for some edit distance, keep dropping the max edit distance.
while (maxEdits > 0 && (termAfter ? bottom >= calculateMaxBoost(maxEdits) : bottom > calculateMaxBoost(maxEdits)))
maxEdits--;
if (oldMaxEdits != maxEdits || init) { // the maximum n has changed
maxEditDistanceChanged(lastTerm, maxEdits, init);
}
}
protected void maxEditDistanceChanged(BytesRef lastTerm, int maxEdits, boolean init)
throws IOException {
TermsEnum newEnum = getAutomatonEnum(maxEdits, lastTerm);
// instead of assert, we do a hard check in case someone uses our enum directly
// assert newEnum != null;
if (newEnum == null) {
assert maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE;
throw new IllegalArgumentException("maxEdits cannot be > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE");
}
setEnum(newEnum);
}
// for some raw min similarity and input term length, the maximum # of edits
private int initialMaxDistance(float minimumSimilarity, int termLen) {
return (int) ((1D-minimumSimilarity) * termLen);
}
// for some number of edits, the maximum possible scaled boost
private float calculateMaxBoost(int nEdits) {
final float similarity = 1.0f - ((float) nEdits / (float) (termLength));
return (similarity - minSimilarity) * scale_factor;
}
private BytesRef queuedBottom = null;
@Override
public BytesRef next() throws IOException {
if (queuedBottom != null) {
bottomChanged(queuedBottom, false);
queuedBottom = null;
}
BytesRef term = actualEnum.next();
boostAtt.setBoost(actualBoostAtt.getBoost());
final float bottom = maxBoostAtt.getMaxNonCompetitiveBoost();
final BytesRef bottomTerm = maxBoostAtt.getCompetitiveTerm();
if (term != null && (bottom != this.bottom || bottomTerm != this.bottomTerm)) {
this.bottom = bottom;
this.bottomTerm = bottomTerm;
// clone the term before potentially doing something with it
// this is a rare but wonderful occurrence anyway
queuedBottom = BytesRef.deepCopyOf(term);
}
return term;
}
// proxy all other enum calls to the actual enum
@Override
public int docFreq() throws IOException {
return actualEnum.docFreq();
}
@Override
public long totalTermFreq() throws IOException {
return actualEnum.totalTermFreq();
}
@Override
public DocsEnum docs(Bits liveDocs, DocsEnum reuse, int flags) throws IOException {
return actualEnum.docs(liveDocs, reuse, flags);
}
@Override
public DocsAndPositionsEnum docsAndPositions(Bits liveDocs,
DocsAndPositionsEnum reuse, int flags) throws IOException {
return actualEnum.docsAndPositions(liveDocs, reuse, flags);
}
@Override
public void seekExact(BytesRef term, TermState state) throws IOException {
actualEnum.seekExact(term, state);
}
@Override
public TermState termState() throws IOException {
return actualEnum.termState();
}
@Override
public Comparator<BytesRef> getComparator() {
return actualEnum.getComparator();
}
@Override
public long ord() throws IOException {
return actualEnum.ord();
}
@Override
public boolean seekExact(BytesRef text, boolean useCache) throws IOException {
return actualEnum.seekExact(text, useCache);
}
@Override
public SeekStatus seekCeil(BytesRef text, boolean useCache) throws IOException {
return actualEnum.seekCeil(text, useCache);
}
@Override
public void seekExact(long ord) throws IOException {
actualEnum.seekExact(ord);
}
@Override
public BytesRef term() throws IOException {
return actualEnum.term();
}
/**
* Implement fuzzy enumeration with Terms.intersect.
* <p>
* This is the fastest method as opposed to LinearFuzzyTermsEnum:
* as enumeration is logarithmic to the number of terms (instead of linear)
* and comparison is linear to length of the term (rather than quadratic)
*/
private class AutomatonFuzzyTermsEnum extends FilteredTermsEnum {
private final ByteRunAutomaton matchers[];
private final BytesRef termRef;
private final BoostAttribute boostAtt =
attributes().addAttribute(BoostAttribute.class);
public AutomatonFuzzyTermsEnum(TermsEnum tenum, CompiledAutomaton compiled[]) {
super(tenum, false);
this.matchers = new ByteRunAutomaton[compiled.length];
for (int i = 0; i < compiled.length; i++)
this.matchers[i] = compiled[i].runAutomaton;
termRef = new BytesRef(term.text());
}
/** finds the smallest Lev(n) DFA that accepts the term. */
@Override
protected AcceptStatus accept(BytesRef term) {
//System.out.println("AFTE.accept term=" + term);
int ed = matchers.length - 1;
// we are wrapping either an intersect() TermsEnum or an AutomatonTermsENum,
// so we know the outer DFA always matches.
// now compute exact edit distance
while (ed > 0) {
if (matches(term, ed - 1)) {
ed--;
} else {
break;
}
}
//System.out.println("CHECK term=" + term.utf8ToString() + " ed=" + ed);
// scale to a boost and return (if similarity > minSimilarity)
if (ed == 0) { // exact match
boostAtt.setBoost(1.0F);
//System.out.println(" yes");
return AcceptStatus.YES;
} else {
final int codePointCount = UnicodeUtil.codePointCount(term);
final float similarity = 1.0f - ((float) ed / (float)
(Math.min(codePointCount, termLength)));
if (similarity > minSimilarity) {
boostAtt.setBoost((similarity - minSimilarity) * scale_factor);
//System.out.println(" yes");
return AcceptStatus.YES;
} else {
return AcceptStatus.NO;
}
}
}
/** returns true if term is within k edits of the query term */
final boolean matches(BytesRef term, int k) {
return k == 0 ? term.equals(termRef) : matchers[k].run(term.bytes, term.offset, term.length);
}
}
/** @lucene.internal */
public float getMinSimilarity() {
return minSimilarity;
}
/** @lucene.internal */
public float getScaleFactor() {
return scale_factor;
}
/**
* reuses compiled automata across different segments,
* because they are independent of the index
* @lucene.internal */
public static interface LevenshteinAutomataAttribute extends Attribute {
public List<CompiledAutomaton> automata();
}
/**
* Stores compiled automata as a list (indexed by edit distance)
* @lucene.internal */
public static final class LevenshteinAutomataAttributeImpl extends AttributeImpl implements LevenshteinAutomataAttribute {
private final List<CompiledAutomaton> automata = new ArrayList<CompiledAutomaton>();
public List<CompiledAutomaton> automata() {
return automata;
}
@Override
public void clear() {
automata.clear();
}
@Override
public int hashCode() {
return automata.hashCode();
}
@Override
public boolean equals(Object other) {
if (this == other)
return true;
if (!(other instanceof LevenshteinAutomataAttributeImpl))
return false;
return automata.equals(((LevenshteinAutomataAttributeImpl) other).automata);
}
@Override
public void copyTo(AttributeImpl target) {
final List<CompiledAutomaton> targetAutomata =
((LevenshteinAutomataAttribute) target).automata();
targetAutomata.clear();
targetAutomata.addAll(automata);
}
}
}
| apache-2.0 |
thlaegler/microservice | microservice-adapter/src/main/java/com/laegler/microservice/adapter/lib/javaee/v7/PersistenceUnitRefType.java | 7858 | //
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2016.09.10 um 03:14:29 AM CEST
//
package com.laegler.microservice.adapter.lib.javaee.v7;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
*
* [
* The persistence-unit-ref element contains a declaration
* of Deployment Component's reference to a persistence unit
* associated within a Deployment Component's
* environment. It consists of:
*
* - an optional description
* - the persistence unit reference name
* - an optional persistence unit name. If not specified,
* the default persistence unit is assumed.
* - optional injection targets
*
* Examples:
*
* <persistence-unit-ref>
* <persistence-unit-ref-name>myPersistenceUnit
* </persistence-unit-ref-name>
* </persistence-unit-ref>
*
* <persistence-unit-ref>
* <persistence-unit-ref-name>myPersistenceUnit
* </persistence-unit-ref-name>
* <persistence-unit-name>PersistenceUnit1
* </persistence-unit-name>
* </persistence-unit-ref>
*
*
*
*
* <p>Java-Klasse für persistence-unit-refType complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="persistence-unit-refType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="description" type="{http://xmlns.jcp.org/xml/ns/javaee}descriptionType" maxOccurs="unbounded" minOccurs="0"/>
* <element name="persistence-unit-ref-name" type="{http://xmlns.jcp.org/xml/ns/javaee}jndi-nameType"/>
* <element name="persistence-unit-name" type="{http://xmlns.jcp.org/xml/ns/javaee}string" minOccurs="0"/>
* <group ref="{http://xmlns.jcp.org/xml/ns/javaee}resourceBaseGroup"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "persistence-unit-refType", propOrder = {
"description",
"persistenceUnitRefName",
"persistenceUnitName",
"mappedName",
"injectionTarget"
})
public class PersistenceUnitRefType {
protected List<DescriptionType> description;
@XmlElement(name = "persistence-unit-ref-name", required = true)
protected JndiNameType persistenceUnitRefName;
@XmlElement(name = "persistence-unit-name")
protected com.laegler.microservice.adapter.lib.javaee.v7.String persistenceUnitName;
@XmlElement(name = "mapped-name")
protected XsdStringType mappedName;
@XmlElement(name = "injection-target")
protected List<InjectionTargetType> injectionTarget;
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected java.lang.String id;
/**
* Gets the value of the description property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the description property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDescription().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link DescriptionType }
*
*
*/
public List<DescriptionType> getDescription() {
if (description == null) {
description = new ArrayList<DescriptionType>();
}
return this.description;
}
/**
* Ruft den Wert der persistenceUnitRefName-Eigenschaft ab.
*
* @return
* possible object is
* {@link JndiNameType }
*
*/
public JndiNameType getPersistenceUnitRefName() {
return persistenceUnitRefName;
}
/**
* Legt den Wert der persistenceUnitRefName-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link JndiNameType }
*
*/
public void setPersistenceUnitRefName(JndiNameType value) {
this.persistenceUnitRefName = value;
}
/**
* Ruft den Wert der persistenceUnitName-Eigenschaft ab.
*
* @return
* possible object is
* {@link com.laegler.microservice.adapter.lib.javaee.v7.String }
*
*/
public com.laegler.microservice.adapter.lib.javaee.v7.String getPersistenceUnitName() {
return persistenceUnitName;
}
/**
* Legt den Wert der persistenceUnitName-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link com.laegler.microservice.adapter.lib.javaee.v7.String }
*
*/
public void setPersistenceUnitName(com.laegler.microservice.adapter.lib.javaee.v7.String value) {
this.persistenceUnitName = value;
}
/**
* Ruft den Wert der mappedName-Eigenschaft ab.
*
* @return
* possible object is
* {@link XsdStringType }
*
*/
public XsdStringType getMappedName() {
return mappedName;
}
/**
* Legt den Wert der mappedName-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link XsdStringType }
*
*/
public void setMappedName(XsdStringType value) {
this.mappedName = value;
}
/**
* Gets the value of the injectionTarget property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the injectionTarget property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getInjectionTarget().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link InjectionTargetType }
*
*
*/
public List<InjectionTargetType> getInjectionTarget() {
if (injectionTarget == null) {
injectionTarget = new ArrayList<InjectionTargetType>();
}
return this.injectionTarget;
}
/**
* Ruft den Wert der id-Eigenschaft ab.
*
* @return
* possible object is
* {@link java.lang.String }
*
*/
public java.lang.String getId() {
return id;
}
/**
* Legt den Wert der id-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link java.lang.String }
*
*/
public void setId(java.lang.String value) {
this.id = value;
}
}
| apache-2.0 |
apache/lenya | src/java/org/apache/lenya/lucene/FileDocument.java | 3099 | /*
* 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.
*
*/
/* $Id$ */
package org.apache.lenya.lucene;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import org.apache.lucene.document.DateField;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
/**
* A utility for making Lucene Documents from a File.
*/
public class FileDocument {
private FileDocument() {
}
/**
* Makes a document for a File.
*
* <p>
* The document has three fields:
*
* <ul>
* <li>
* <code>path</code>--containing the pathname of the file, as a stored, tokenized field;
* </li>
* <li>
* <code>modified</code>--containing the last modified date of the file as a keyword field as
* encoded by <a href="lucene.document.DateField.html">DateField</a>; and
* </li>
* <li>
* <code>contents</code>--containing the full contents of the file, as a Reader field.
* </li>
* </ul>
* </p>
*
* @param f DOCUMENT ME!
*
* @return DOCUMENT ME!
*
* @throws java.io.FileNotFoundException DOCUMENT ME!
*/
public static Document Document(File f) throws java.io.FileNotFoundException {
// make a new, empty document
Document doc = new Document();
// Add the path of the file as a field named "path". Use a Text field, so
// that the index stores the path, and so that the path is searchable
doc.add(Field.Text("path", f.getPath()));
// Add the last modified date of the file a field named "modified". Use a
// Keyword field, so that it's searchable, but so that no attempt is made
// to tokenize the field into words.
doc.add(Field.Keyword("modified", DateField.timeToString(f.lastModified())));
// Add the contents of the file a field named "contents". Use a Text
// field, specifying a Reader, so that the text of the file is tokenized.
// ?? why doesn't FileReader work here ??
FileInputStream is = new FileInputStream(f);
Reader reader = new BufferedReader(new InputStreamReader(is));
doc.add(Field.Text("contents", reader));
// return the document
return doc;
}
}
| apache-2.0 |
codehaus/griffon-git | src/main/rt/griffon/util/CollectionUtils.java | 8010 | /*
* Copyright 2010-2011 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 griffon.util;
import java.util.*;
/**
* <p>Utility class that simplifies creating collections in Java.</p>
* <p><strong>Creating Maps</strong><br/>
* <pre>
* Map<String, Object> m = map()
.e("foo", foo)
.e("bar", bar);
* </pre></p>
*
* <p><strong>Creating Lists</strong><br/>
* <pre>
* List<String> l = list()
.e("foo")
.e("bar");
* </pre></p>
*
* <p><strong>Creating Maps</strong><br/>
* <pre>
* Set<String> s = set()
.e("foo")
.e("bar");
* </pre></p>
*
* @author Andres Almiray
* @since 0.9.4
*/
public final class CollectionUtils {
public static <K, V> MapBuilder<K, V> map() {
return map(new LinkedHashMap<K, V>());
}
public static <K, V> MapBuilder<K, V> map(Map<K, V> delegate) {
return new MapBuilder<K, V>(delegate);
}
public static <E> ListBuilder<E> list() {
return list(new ArrayList<E>());
}
public static <E> ListBuilder<E> list(List<E> delegate) {
return new ListBuilder<E>(delegate);
}
public static <E> SetBuilder<E> set() {
return set(new HashSet<E>());
}
public static <E> SetBuilder<E> set(Set<E> delegate) {
return new SetBuilder<E>(delegate);
}
public static class MapBuilder<K, V> implements Map<K, V> {
private final Map<K, V> delegate;
public MapBuilder(Map<K, V> delegate) {
this.delegate = delegate;
}
public MapBuilder<K, V> e(K k, V v) {
delegate.put(k, v);
return this;
}
public int size() {
return delegate.size();
}
public boolean isEmpty() {
return delegate.isEmpty();
}
public boolean containsKey(Object o) {
return delegate.containsKey(o);
}
public boolean containsValue(Object o) {
return delegate.containsValue(o);
}
public V get(Object o) {
return delegate.get(o);
}
public V put(K k, V v) {
return delegate.put(k, v);
}
public V remove(Object o) {
return delegate.remove(o);
}
public void putAll(Map<? extends K, ? extends V> map) {
delegate.putAll(map);
}
public void clear() {
delegate.clear();
}
public Set<K> keySet() {
return delegate.keySet();
}
public Collection<V> values() {
return delegate.values();
}
public Set<Entry<K, V>> entrySet() {
return delegate.entrySet();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
}
public static class ListBuilder<E> implements List<E> {
private final List<E> delegate;
public ListBuilder(List<E> delegate) {
this.delegate = delegate;
}
public ListBuilder<E> e(E e) {
delegate.add(e);
return this;
}
public int size() {
return delegate.size();
}
public boolean isEmpty() {
return delegate.isEmpty();
}
public boolean contains(Object o) {
return delegate.contains(o);
}
public Iterator<E> iterator() {
return delegate.iterator();
}
public Object[] toArray() {
return delegate.toArray();
}
public <T> T[] toArray(T[] ts) {
return delegate.toArray(ts);
}
public boolean add(E e) {
return delegate.add(e);
}
public boolean remove(Object o) {
return delegate.remove(o);
}
public boolean containsAll(Collection<?> objects) {
return delegate.containsAll(objects);
}
public boolean addAll(Collection<? extends E> es) {
return delegate.addAll(es);
}
public boolean addAll(int i, Collection<? extends E> es) {
return delegate.addAll(i, es);
}
public boolean removeAll(Collection<?> objects) {
return delegate.removeAll(objects);
}
public boolean retainAll(Collection<?> objects) {
return delegate.retainAll(objects);
}
public void clear() {
delegate.clear();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
public E get(int i) {
return delegate.get(i);
}
public E set(int i, E e) {
return delegate.set(i, e);
}
public void add(int i, E e) {
delegate.add(i, e);
}
public E remove(int i) {
return delegate.remove(i);
}
public int indexOf(Object o) {
return delegate.indexOf(o);
}
public int lastIndexOf(Object o) {
return delegate.lastIndexOf(o);
}
public ListIterator<E> listIterator() {
return delegate.listIterator();
}
public ListIterator<E> listIterator(int i) {
return delegate.listIterator(i);
}
public List<E> subList(int i, int i1) {
return delegate.subList(i, i1);
}
}
public static class SetBuilder<E> implements Set<E> {
private final Set<E> delegate;
public SetBuilder(Set<E> delegate) {
this.delegate = delegate;
}
public SetBuilder<E> e(E e) {
delegate.add(e);
return this;
}
public int size() {
return delegate.size();
}
public boolean isEmpty() {
return delegate.isEmpty();
}
public boolean contains(Object o) {
return delegate.contains(o);
}
public Iterator<E> iterator() {
return delegate.iterator();
}
public Object[] toArray() {
return delegate.toArray();
}
public <T> T[] toArray(T[] ts) {
return delegate.toArray(ts);
}
public boolean add(E e) {
return delegate.add(e);
}
public boolean remove(Object o) {
return delegate.remove(o);
}
public boolean containsAll(Collection<?> objects) {
return delegate.containsAll(objects);
}
public boolean addAll(Collection<? extends E> es) {
return delegate.addAll(es);
}
public boolean retainAll(Collection<?> objects) {
return delegate.retainAll(objects);
}
public boolean removeAll(Collection<?> objects) {
return delegate.removeAll(objects);
}
public void clear() {
delegate.clear();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
}
}
| apache-2.0 |
katre/bazel | src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java | 31440 | // Copyright 2017 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.worker;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.base.Stopwatch;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import com.google.common.flogger.GoogleLogger;
import com.google.common.hash.HashCode;
import com.google.devtools.build.lib.actions.ActionExecutionMetadata;
import com.google.devtools.build.lib.actions.ActionInput;
import com.google.devtools.build.lib.actions.ActionInputHelper;
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.ForbiddenActionInputException;
import com.google.devtools.build.lib.actions.MetadataProvider;
import com.google.devtools.build.lib.actions.ResourceManager;
import com.google.devtools.build.lib.actions.ResourceManager.ResourceHandle;
import com.google.devtools.build.lib.actions.ResourceManager.ResourceHandleWithWorker;
import com.google.devtools.build.lib.actions.ResourceManager.ResourcePriority;
import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnExecutedEvent;
import com.google.devtools.build.lib.actions.SpawnMetrics;
import com.google.devtools.build.lib.actions.SpawnResult;
import com.google.devtools.build.lib.actions.SpawnResult.Status;
import com.google.devtools.build.lib.actions.Spawns;
import com.google.devtools.build.lib.actions.UserExecException;
import com.google.devtools.build.lib.buildtool.CollectMetricsEvent;
import com.google.devtools.build.lib.events.ExtendedEventHandler;
import com.google.devtools.build.lib.exec.BinTools;
import com.google.devtools.build.lib.exec.RunfilesTreeUpdater;
import com.google.devtools.build.lib.exec.SpawnExecutingEvent;
import com.google.devtools.build.lib.exec.SpawnRunner;
import com.google.devtools.build.lib.exec.SpawnSchedulingEvent;
import com.google.devtools.build.lib.exec.local.LocalEnvProvider;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.profiler.ProfilerTask;
import com.google.devtools.build.lib.profiler.SilentCloseable;
import com.google.devtools.build.lib.sandbox.SandboxHelpers;
import com.google.devtools.build.lib.sandbox.SandboxHelpers.SandboxInputs;
import com.google.devtools.build.lib.sandbox.SandboxHelpers.SandboxOutputs;
import com.google.devtools.build.lib.server.FailureDetails;
import com.google.devtools.build.lib.server.FailureDetails.FailureDetail;
import com.google.devtools.build.lib.server.FailureDetails.Worker.Code;
import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.io.FileOutErr;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.SyscallCache;
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkRequest;
import com.google.devtools.build.lib.worker.WorkerProtocol.WorkResponse;
import com.google.protobuf.ByteString;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* A spawn runner that launches Spawns the first time they are used in a persistent mode and then
* shards work over all the processes.
*/
final class WorkerSpawnRunner implements SpawnRunner {
private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
public static final String ERROR_MESSAGE_PREFIX =
"Worker strategy cannot execute this %s action, ";
public static final String REASON_NO_TOOLS = "because the action has no tools";
/**
* The verbosity level implied by `--worker_verbose`. This value allows for manually setting some
* only-slightly-verbose levels.
*/
private static final int VERBOSE_LEVEL = 10;
private final SandboxHelpers helpers;
private final Path execRoot;
private final WorkerPool workers;
private final ExtendedEventHandler reporter;
private final BinTools binTools;
private final ResourceManager resourceManager;
private final RunfilesTreeUpdater runfilesTreeUpdater;
private final WorkerOptions workerOptions;
private final WorkerParser workerParser;
private final AtomicInteger requestIdCounter = new AtomicInteger(1);
private final Runtime runtime;
private final SyscallCache syscallCache;
/** Mapping of worker ids to their metrics. */
private Map<Integer, WorkerMetric> workerIdToWorkerMetric = new ConcurrentHashMap<>();
public WorkerSpawnRunner(
SandboxHelpers helpers,
Path execRoot,
WorkerPool workers,
ExtendedEventHandler reporter,
LocalEnvProvider localEnvProvider,
BinTools binTools,
ResourceManager resourceManager,
RunfilesTreeUpdater runfilesTreeUpdater,
WorkerOptions workerOptions,
EventBus eventBus,
Runtime runtime,
SyscallCache syscallCache) {
this.helpers = helpers;
this.execRoot = execRoot;
this.workers = Preconditions.checkNotNull(workers);
this.reporter = reporter;
this.binTools = binTools;
this.resourceManager = resourceManager;
this.runfilesTreeUpdater = runfilesTreeUpdater;
this.syscallCache = syscallCache;
this.workerParser = new WorkerParser(execRoot, workerOptions, localEnvProvider, binTools);
this.workerOptions = workerOptions;
this.runtime = runtime;
this.resourceManager.setWorkerPool(workers);
eventBus.register(this);
}
@Override
public String getName() {
return "worker";
}
@Override
public boolean canExec(Spawn spawn) {
if (!Spawns.supportsWorkers(spawn) && !Spawns.supportsMultiplexWorkers(spawn)) {
return false;
}
if (spawn.getToolFiles().isEmpty()) {
return false;
}
return true;
}
@Override
public boolean handlesCaching() {
return false;
}
@Override
public SpawnResult exec(Spawn spawn, SpawnExecutionContext context)
throws ExecException, IOException, InterruptedException, ForbiddenActionInputException {
context.report(
SpawnSchedulingEvent.create(
WorkerKey.makeWorkerTypeName(
Spawns.supportsMultiplexWorkers(spawn), context.speculating())));
if (spawn.getToolFiles().isEmpty()) {
throw createUserExecException(
String.format(ERROR_MESSAGE_PREFIX + REASON_NO_TOOLS, spawn.getMnemonic()),
Code.NO_TOOLS);
}
Instant startTime = Instant.now();
SpawnMetrics.Builder spawnMetrics;
WorkResponse response;
try (SilentCloseable c =
Profiler.instance()
.profile(
String.format(
"%s worker %s", spawn.getMnemonic(), spawn.getResourceOwner().describe()))) {
runfilesTreeUpdater.updateRunfilesDirectory(
execRoot,
spawn.getRunfilesSupplier(),
binTools,
spawn.getEnvironment(),
context.getFileOutErr(),
syscallCache);
MetadataProvider inputFileCache = context.getMetadataProvider();
SandboxInputs inputFiles;
try (SilentCloseable c1 =
Profiler.instance().profile(ProfilerTask.WORKER_SETUP, "Setting up inputs")) {
inputFiles =
helpers.processInputFiles(
context.getInputMapping(PathFragment.EMPTY_FRAGMENT),
spawn,
context.getArtifactExpander(),
execRoot);
}
SandboxOutputs outputs = helpers.getOutputs(spawn);
WorkerParser.WorkerConfig workerConfig = workerParser.compute(spawn, context);
WorkerKey key = workerConfig.getWorkerKey();
List<String> flagFiles = workerConfig.getFlagFiles();
spawnMetrics =
SpawnMetrics.Builder.forWorkerExec()
.setInputFiles(inputFiles.getFiles().size() + inputFiles.getSymlinks().size());
response =
execInWorker(
spawn, key, context, inputFiles, outputs, flagFiles, inputFileCache, spawnMetrics);
FileOutErr outErr = context.getFileOutErr();
response.getOutputBytes().writeTo(outErr.getErrorStream());
}
Duration wallTime = Duration.between(startTime, Instant.now());
int exitCode = response.getExitCode();
SpawnResult.Builder builder =
new SpawnResult.Builder()
.setRunnerName(getName())
.setExitCode(exitCode)
.setStatus(exitCode == 0 ? Status.SUCCESS : Status.NON_ZERO_EXIT)
.setWallTime(wallTime)
.setSpawnMetrics(spawnMetrics.setTotalTime(wallTime).build());
if (exitCode != 0) {
builder.setFailureDetail(
FailureDetail.newBuilder()
.setMessage("worker spawn failed for " + spawn.getMnemonic())
.setSpawn(
FailureDetails.Spawn.newBuilder()
.setCode(FailureDetails.Spawn.Code.NON_ZERO_EXIT)
.setSpawnExitCode(exitCode))
.build());
}
SpawnResult result = builder.build();
reporter.post(new SpawnExecutedEvent(spawn, result, startTime));
return result;
}
private WorkRequest createWorkRequest(
Spawn spawn,
SpawnExecutionContext context,
List<String> flagfiles,
MetadataProvider inputFileCache,
WorkerKey key)
throws IOException {
WorkRequest.Builder requestBuilder = WorkRequest.newBuilder();
for (String flagfile : flagfiles) {
expandArgument(execRoot, flagfile, requestBuilder);
}
List<ActionInput> inputs =
ActionInputHelper.expandArtifacts(spawn.getInputFiles(), context.getArtifactExpander());
for (ActionInput input : inputs) {
byte[] digestBytes = inputFileCache.getMetadata(input).getDigest();
ByteString digest;
if (digestBytes == null) {
digest = ByteString.EMPTY;
} else {
digest = ByteString.copyFromUtf8(HashCode.fromBytes(digestBytes).toString());
}
requestBuilder.addInputsBuilder().setPath(input.getExecPathString()).setDigest(digest);
}
if (workerOptions.workerVerbose) {
requestBuilder.setVerbosity(VERBOSE_LEVEL);
}
if (key.isMultiplex()) {
requestBuilder.setRequestId(requestIdCounter.getAndIncrement());
}
return requestBuilder.build();
}
/**
* Recursively expands arguments by replacing @filename args with the contents of the referenced
* files. The @ itself can be escaped with @@. This deliberately does not expand --flagfile= style
* arguments, because we want to get rid of the expansion entirely at some point in time.
*
* <p>Also check that the argument is not an external repository label, because they start with
* `@` and are not flagfile locations.
*
* @param execRoot the current execroot of the build (relative paths will be assumed to be
* relative to this directory).
* @param arg the argument to expand.
* @param requestBuilder the WorkRequest to whose arguments the expanded arguments will be added.
* @throws java.io.IOException if one of the files containing options cannot be read.
*/
static void expandArgument(Path execRoot, String arg, WorkRequest.Builder requestBuilder)
throws IOException {
if (arg.startsWith("@") && !arg.startsWith("@@") && !isExternalRepositoryLabel(arg)) {
for (String line :
Files.readAllLines(
Paths.get(execRoot.getRelative(arg.substring(1)).getPathString()), UTF_8)) {
expandArgument(execRoot, line, requestBuilder);
}
} else {
requestBuilder.addArguments(arg);
}
}
private static boolean isExternalRepositoryLabel(String arg) {
return arg.matches("^@.*//.*");
}
private static UserExecException createEmptyResponseException(Path logfile) {
String message =
ErrorMessage.builder()
.message("Worker process did not return a WorkResponse:")
.logFile(logfile)
.logSizeLimit(4096)
.build()
.toString();
return createUserExecException(message, Code.NO_RESPONSE);
}
private static UserExecException createUnparsableResponseException(
String recordingStreamMessage, Path logfile, Exception e) {
String message =
ErrorMessage.builder()
.message(
"Worker process returned an unparseable WorkResponse!\n\n"
+ "Did you try to print something to stdout? Workers aren't allowed to "
+ "do this, as it breaks the protocol between Bazel and the worker "
+ "process.\n\n"
+ "---8<---8<--- Start of response ---8<---8<---\n"
+ recordingStreamMessage
+ "---8<---8<--- End of response ---8<---8<---\n\n")
.logFile(logfile)
.logSizeLimit(8192)
.exception(e)
.build()
.toString();
return createUserExecException(message, Code.PARSE_RESPONSE_FAILURE);
}
@VisibleForTesting
WorkResponse execInWorker(
Spawn spawn,
WorkerKey key,
SpawnExecutionContext context,
SandboxInputs inputFiles,
SandboxOutputs outputs,
List<String> flagFiles,
MetadataProvider inputFileCache,
SpawnMetrics.Builder spawnMetrics)
throws InterruptedException, ExecException {
WorkerOwner workerOwner = new WorkerOwner();
WorkResponse response;
WorkRequest request;
ActionExecutionMetadata owner = spawn.getResourceOwner();
try {
Stopwatch setupInputsStopwatch = Stopwatch.createStarted();
try (SilentCloseable c =
Profiler.instance().profile(ProfilerTask.WORKER_SETUP, "Preparing inputs")) {
try {
inputFiles.materializeVirtualInputs(execRoot);
} catch (IOException e) {
restoreInterrupt(e);
String message = "IOException while materializing virtual inputs:";
throw createUserExecException(e, message, Code.VIRTUAL_INPUT_MATERIALIZATION_FAILURE);
}
try {
context.prefetchInputsAndWait();
} catch (IOException e) {
restoreInterrupt(e);
String message = "IOException while prefetching for worker:";
throw createUserExecException(e, message, Code.PREFETCH_FAILURE);
} catch (ForbiddenActionInputException e) {
throw createUserExecException(
e, "Forbidden input found while prefetching for worker:", Code.FORBIDDEN_INPUT);
}
}
Duration setupInputsTime = setupInputsStopwatch.elapsed();
spawnMetrics.setSetupTime(setupInputsTime);
Stopwatch queueStopwatch = Stopwatch.createStarted();
if (workerOptions.workerAsResource) {
// Worker doesn't automatically return to pool after closing of the handle.
try (ResourceHandleWithWorker handle =
resourceManager.acquireWorkerResources(
owner,
spawn.getLocalResources(),
key,
context.speculating() ? ResourcePriority.DYNAMIC_WORKER : ResourcePriority.LOCAL)) {
workerOwner.setWorker(handle.getWorker());
workerOwner.getWorker().setReporter(workerOptions.workerVerbose ? reporter : null);
request = createWorkRequest(spawn, context, flagFiles, inputFileCache, key);
// We acquired a worker and resources -- mark that as queuing time.
spawnMetrics.setQueueTime(queueStopwatch.elapsed());
response =
executeRequest(
spawn, context, inputFiles, outputs, workerOwner, key, request, spawnMetrics);
} catch (IOException e) {
restoreInterrupt(e);
String message = "IOException while borrowing a worker from the pool:";
throw createUserExecException(e, message, Code.BORROW_FAILURE);
}
} else {
try (SilentCloseable c =
Profiler.instance().profile(ProfilerTask.WORKER_BORROW, "Waiting to borrow worker")) {
workerOwner.setWorker(workers.borrowObject(key));
workerOwner.getWorker().setReporter(workerOptions.workerVerbose ? reporter : null);
request = createWorkRequest(spawn, context, flagFiles, inputFileCache, key);
} catch (IOException e) {
restoreInterrupt(e);
String message = "IOException while borrowing a worker from the pool:";
throw createUserExecException(e, message, Code.BORROW_FAILURE);
}
try (ResourceHandle handle =
resourceManager.acquireResources(
owner,
spawn.getLocalResources(),
context.speculating() ? ResourcePriority.DYNAMIC_WORKER : ResourcePriority.LOCAL)) {
// We acquired a worker and resources -- mark that as queuing time.
spawnMetrics.setQueueTime(queueStopwatch.elapsed());
response =
executeRequest(
spawn, context, inputFiles, outputs, workerOwner, key, request, spawnMetrics);
}
}
if (response == null) {
throw createEmptyResponseException(workerOwner.getWorker().getLogFile());
}
if (response.getWasCancelled()) {
throw createUserExecException(
"Received cancel response for " + response.getRequestId() + " without having cancelled",
Code.FINISH_FAILURE);
}
try (SilentCloseable c =
Profiler.instance()
.profile(
ProfilerTask.WORKER_COPYING_OUTPUTS,
String.format(
"Worker #%d copying output files", workerOwner.getWorker().getWorkerId()))) {
Stopwatch processOutputsStopwatch = Stopwatch.createStarted();
context.lockOutputFiles(response.getExitCode(), response.getOutput(), null);
workerOwner.getWorker().finishExecution(execRoot, outputs);
spawnMetrics.setProcessOutputsTime(processOutputsStopwatch.elapsed());
} catch (IOException e) {
restoreInterrupt(e);
String message =
ErrorMessage.builder()
.message("IOException while finishing worker execution:")
.logFile(workerOwner.getWorker().getLogFile())
.exception(e)
.build()
.toString();
throw createUserExecException(message, Code.FINISH_FAILURE);
}
} catch (UserExecException e) {
if (workerOwner.getWorker() != null) {
try {
workers.invalidateObject(key, workerOwner.getWorker());
} catch (IOException e1) {
// The original exception is more important / helpful, so we'll just ignore this one.
restoreInterrupt(e1);
} finally {
workerOwner.setWorker(null);
}
}
throw e;
} finally {
if (workerOwner.getWorker() != null) {
workers.returnObject(key, workerOwner.getWorker());
}
}
return response;
}
/**
* Executes worker request in worker, waits until the response is ready. Worker and resources
* should be allocated before call.
*/
private WorkResponse executeRequest(
Spawn spawn,
SpawnExecutionContext context,
SandboxInputs inputFiles,
SandboxOutputs outputs,
WorkerOwner workerOwner,
WorkerKey key,
WorkRequest request,
SpawnMetrics.Builder spawnMetrics)
throws ExecException, InterruptedException {
WorkResponse response;
context.report(SpawnExecutingEvent.create(key.getWorkerTypeName()));
Worker worker = workerOwner.getWorker();
try (SilentCloseable c =
Profiler.instance()
.profile(
ProfilerTask.WORKER_SETUP,
String.format("Worker #%d preparing execution", worker.getWorkerId()))) {
// We consider `prepareExecution` to be also part of setup.
Stopwatch prepareExecutionStopwatch = Stopwatch.createStarted();
worker.prepareExecution(inputFiles, outputs, key.getWorkerFilesWithDigests().keySet());
initializeMetricsSet(key, worker);
spawnMetrics.addSetupTime(prepareExecutionStopwatch.elapsed());
} catch (IOException e) {
restoreInterrupt(e);
String message =
ErrorMessage.builder()
.message("IOException while preparing the execution environment of a worker:")
.logFile(worker.getLogFile())
.exception(e)
.build()
.toString();
throw createUserExecException(message, Code.PREPARE_FAILURE);
}
Stopwatch executionStopwatch = Stopwatch.createStarted();
try {
worker.putRequest(request);
} catch (IOException e) {
restoreInterrupt(e);
String message =
ErrorMessage.builder()
.message(
"Worker process quit or closed its stdin stream when we tried to send a"
+ " WorkRequest:")
.logFile(worker.getLogFile())
.exception(e)
.build()
.toString();
throw createUserExecException(message, Code.REQUEST_FAILURE);
}
try (SilentCloseable c =
Profiler.instance()
.profile(
ProfilerTask.WORKER_WORKING,
String.format("Worker #%d working", worker.getWorkerId()))) {
response = worker.getResponse(request.getRequestId());
} catch (InterruptedException e) {
if (worker.isSandboxed()) {
// Sandboxed workers can safely finish their work async.
finishWorkAsync(
key,
worker,
request,
workerOptions.workerCancellation && Spawns.supportsWorkerCancellation(spawn));
workerOwner.setWorker(null);
} else if (!context.speculating()) {
// Non-sandboxed workers interrupted outside of dynamic execution can only mean that
// the user interrupted the build, and we don't want to delay finishing. Instead we
// kill the worker.
// Technically, workers are always sandboxed under dynamic execution, at least for now.
try {
workers.invalidateObject(key, workerOwner.getWorker());
} catch (IOException e1) {
// Nothing useful we can do here, in fact it may not be possible to get here.
} finally {
workerOwner.setWorker(null);
}
}
throw e;
} catch (IOException e) {
restoreInterrupt(e);
// If protobuf or json reader couldn't parse the response, try to print whatever the
// failing worker wrote to stdout - it's probably a stack trace or some kind of error
// message that will help the user figure out why the compiler is failing.
String recordingStreamMessage = worker.getRecordingStreamMessage();
if (recordingStreamMessage.isEmpty()) {
throw createEmptyResponseException(worker.getLogFile());
} else {
throw createUnparsableResponseException(recordingStreamMessage, worker.getLogFile(), e);
}
}
spawnMetrics.setExecutionWallTime(executionStopwatch.elapsed());
return response;
}
/**
* Initializes metricsSet for workers. If worker metrics already exists for this worker, does
* nothing
*/
private void initializeMetricsSet(WorkerKey workerKey, Worker worker) {
if (workerIdToWorkerMetric.containsKey(worker.getWorkerId())) {
return;
}
long processId = worker.getProcessId();
WorkerMetric workerMetric =
new WorkerMetric(
worker.getWorkerId(),
processId,
workerKey.getMnemonic(),
workerKey.isMultiplex(),
workerKey.isSandboxed());
workerIdToWorkerMetric.put(worker.getWorkerId(), workerMetric);
}
// Collects process stats for each worker
@VisibleForTesting
public Map<Long, WorkerMetric.WorkerStat> collectStats(OS os, List<Long> processIds) {
Map<Long, WorkerMetric.WorkerStat> pidResults = new HashMap<>();
if (os != OS.LINUX && os != OS.DARWIN) {
return pidResults;
}
List<Long> filteredProcessIds =
processIds.stream().filter(p -> p > 0).collect(Collectors.toList());
String pids = Joiner.on(",").join(filteredProcessIds);
BufferedReader psOutput;
try {
String command = "ps -o pid,rss -p " + pids;
psOutput =
new BufferedReader(
new InputStreamReader(
runtime.exec(new String[] {"bash", "-c", command}).getInputStream(), "UTF-8"));
} catch (IOException e) {
logger.atWarning().withCause(e).log("Error while executing command for pids: %s", pids);
return pidResults;
}
try {
// The output of the above ps command looks similar to this:
// PID RSS
// 211706 222972
// 2612333 6180
// We skip over the first line (the header) and then parse the PID and the resident memory
// size in kilobytes.
Instant now = Instant.now();
String output = null;
boolean isFirst = true;
while ((output = psOutput.readLine()) != null) {
if (isFirst) {
isFirst = false;
continue;
}
List<String> line = Splitter.on(" ").trimResults().omitEmptyStrings().splitToList(output);
if (line.size() != 2) {
logger.atWarning().log("Unexpected length of split line %s %d", output, line.size());
continue;
}
long pid = Long.parseLong(line.get(0));
int memoryInKb = Integer.parseInt(line.get(1)) / 1000;
pidResults.put(pid, new WorkerMetric.WorkerStat(memoryInKb, now));
}
} catch (IllegalArgumentException | IOException e) {
logger.atWarning().withCause(e).log("Error while parsing psOutput: %s", psOutput);
}
return pidResults;
}
/**
* Starts a thread to collect the response from a worker when it's no longer of interest.
*
* <p>This can happen either when we lost the race in dynamic execution or the build got
* interrupted. This takes ownership of the worker for purposes of returning it to the worker
* pool.
*/
private void finishWorkAsync(
WorkerKey key, Worker worker, WorkRequest request, boolean canCancel) {
Thread reaper =
new Thread(
() -> {
Worker w = worker;
try {
if (canCancel) {
WorkRequest cancelRequest =
WorkRequest.newBuilder()
.setRequestId(request.getRequestId())
.setCancel(true)
.build();
w.putRequest(cancelRequest);
}
w.getResponse(request.getRequestId());
} catch (IOException | InterruptedException e1) {
// If this happens, we either can't trust the output of the worker, or we got
// interrupted while handling being interrupted. In the latter case, let's stop
// trying and just destroy the worker. If it's a singleplex worker, there will
// be a dangling response that we don't want to keep trying to read, so we destroy
// the worker.
try {
workers.invalidateObject(key, w);
w = null;
} catch (IOException | InterruptedException e2) {
// The reaper thread can't do anything useful about this.
}
} finally {
if (w != null) {
try {
workers.returnObject(key, w);
} catch (IllegalStateException e3) {
// The worker already not part of the pool
}
}
}
},
"AsyncFinish-Worker-" + worker.workerId);
reaper.start();
}
/**
* The structure helps to pass the worker's ownership from one function to another. If worker is
* set to null, then the ownership is taken by another function. E.g. used in finishWorkAsync.
*/
private static class WorkerOwner {
Worker worker;
public void setWorker(Worker worker) {
this.worker = worker;
}
public Worker getWorker() {
return worker;
}
}
private static void restoreInterrupt(IOException e) {
if (e instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
}
private static UserExecException createUserExecException(
IOException e, String message, Code detailedCode) {
return createUserExecException(
ErrorMessage.builder().message(message).exception(e).build().toString(), detailedCode);
}
private static UserExecException createUserExecException(
ForbiddenActionInputException e, String message, Code detailedCode) {
return createUserExecException(
ErrorMessage.builder().message(message).exception(e).build().toString(), detailedCode);
}
private static UserExecException createUserExecException(String message, Code detailedCode) {
return new UserExecException(
FailureDetail.newBuilder()
.setMessage(message)
.setWorker(FailureDetails.Worker.newBuilder().setCode(detailedCode))
.build());
}
@SuppressWarnings("unused")
@Subscribe
public void onCollectMetricsEvent(CollectMetricsEvent event) {
Map<Long, WorkerMetric.WorkerStat> workerStats =
collectStats(
OS.getCurrent(),
this.workerIdToWorkerMetric.values().stream()
.map(WorkerMetric::getProcessId)
.collect(Collectors.toList()));
for (WorkerMetric workerMetric : this.workerIdToWorkerMetric.values()) {
WorkerMetric.WorkerStat workerStat = workerStats.get(workerMetric.getProcessId());
if (workerStat == null) {
workerMetric.setIsMeasurable(false);
continue;
}
workerMetric.addWorkerStat(workerStat);
}
this.reporter.post(
new WorkerMetricsEvent(new ArrayList<>(this.workerIdToWorkerMetric.values())));
this.workerIdToWorkerMetric.clear();
// remove dead workers from metrics list
Map<Integer, WorkerMetric> measurableWorkerMetrics = new HashMap<>();
for (WorkerMetric workerMetric : workerIdToWorkerMetric.values()) {
if (workerMetric.getIsMeasurable()) {
measurableWorkerMetrics.put(workerMetric.getWorkerId(), workerMetric);
}
}
this.workerIdToWorkerMetric = measurableWorkerMetrics;
}
}
| apache-2.0 |
QACore/Java-Testing-Toolbox | src/main/java/com/github/qacore/testingtoolbox/junit/categories/Positive.java | 799 | package com.github.qacore.testingtoolbox.junit.categories;
import org.junit.experimental.categories.Categories;
import com.github.qacore.testingtoolbox.annotations.Tag;
import com.github.qacore.testingtoolbox.junit.runners.parallel.ParallelCategories;
/**
* Represents a positive test.
*
* @author Leonardo Carmona da Silva
* <ul>
* <li><a href="https://br.linkedin.com/in/l3ocarmona">https://br.linkedin.com/in/l3ocarmona</a></li>
* <li><a href="https://github.com/leocarmona">https://github.com/leocarmona</a></li>
* <li><a href="mailto:lcdesenv@gmail.com">lcdesenv@gmail.com</a></li>
* </ul>
*
* @see Categories
* @see ParallelCategories
*
* @since 1.1.0
*
*/
@Tag("Positive")
public interface Positive {
}
| apache-2.0 |
Geomatys/sis | core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java | 17098 | /*
* 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.sis.util.logging;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.LogRecord;
import java.util.NoSuchElementException;
import org.apache.sis.util.Localized;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.UnmodifiableArrayList;
/**
* Holds a list of {@link WarningListener} instances and provides convenience methods for emitting warnings.
* This is a helper class for {@link org.apache.sis.storage.DataStore} implementations or for other services
* susceptible to emit warnings.
* Observers can {@linkplain #addWarningListener can add listeners} for being notified about warnings, and
* processes can invoke one of the {@code warning(…)} methods for emitting warnings. All warnings are given
* to the listeners as {@link LogRecord} instances (this allows localizable messages and additional information
* like {@linkplain LogRecord#getMillis() timestamp} and {@linkplain LogRecord#getThrown() stack trace}).
* This {@code WarningListeners} class provides convenience methods like {@link #warning(String, Exception)},
* which builds {@code LogRecord} from an exception or from a string, but all those {@code warning(…)} methods
* ultimately delegate to {@link #warning(LogRecord)}, thus providing a single point that subclasses can override.
* When a warning is emitted, the default behavior is:
*
* <ul>
* <li>If at least one {@link WarningListener} is registered,
* then all listeners are notified and the warning is <strong>not</strong> logged.
* <li>Otherwise if the value returned by {@link LogRecord#getLoggerName()} is non-null,
* then the warning will be logged to that named logger.</li>
* <li>Otherwise the warning is logged to the logger returned by {@link #getLogger()}.</li>
* </ul>
*
* <div class="section">Thread safety</div>
* The same {@code WarningListeners} instance can be safely used by many threads without synchronization
* on the part of the caller. Subclasses should make sure that any overridden methods remain safe to call
* from multiple threads.
*
* @author Martin Desruisseaux (Geomatys)
* @version 0.8
*
* @param <S> the type of the source of warnings.
*
* @see WarningListener
* @see org.apache.sis.storage.DataStore#listeners
*
* @since 0.3
* @module
*/
public class WarningListeners<S> implements Localized {
/**
* The declared source of warnings. This is not necessarily the real source,
* but this is the source that the implementor wants to declare as public API.
*/
private final S source;
/**
* The listeners, or {@code null} if none. This is a <cite>copy on write</cite> array:
* no elements are modified once the array have been created.
*/
private WarningListener<? super S>[] listeners;
/**
* Creates a new instance without source. This constructor is for {@code EmptyWarningListeners}
* usage only, because it requires some method to be overloaded.
*/
WarningListeners() {
source = null;
}
/**
* Creates a new instance with initially no listener.
* Warnings will be logger to the destination given by {@link #getLogger()},
* unless at least one listener is {@linkplain #addWarningListener registered}.
*
* @param source the declared source of warnings. This is not necessarily the real source,
* but this is the source that the implementor wants to declare as public API.
*/
public WarningListeners(final S source) {
ArgumentChecks.ensureNonNull("source", source);
this.source = source;
}
/**
* Creates a new instance initialized with the same listeners than the given instance.
* This constructor is useful when a {@code DataStore} or other data producer needs to
* be duplicated for concurrency reasons.
*
* @param source the declared source of warnings. This is not necessarily the real source,
* but this is the source that the implementor wants to declare as public API.
* @param other the existing instance from which to copy the listeners, or {@code null} if none.
*
* @since 0.8
*/
public WarningListeners(final S source, final WarningListeners<? super S> other) {
this(source);
if (other != null) {
listeners = other.listeners;
}
}
/**
* Returns the source declared source of warnings.
* This value is specified at construction time.
*
* @return the declared source of warnings.
*
* @since 0.8
*/
public S getSource() {
return source;
}
/**
* The locale to use for formatting warning messages, or {@code null} for the default locale.
* If the {@code source} object given to the constructor implements the {@link Localized} interface,
* then this method delegates to its {@code getLocale()} method. Otherwise this method returns {@code null}.
*/
@Override
public Locale getLocale() {
return (source instanceof Localized) ? ((Localized) source).getLocale() : null;
}
/**
* Returns the logger where to send the warnings when no other destination is specified.
* This logger is used when:
*
* <ul>
* <li>no listener has been {@linkplain #addWarningListener registered}, and</li>
* <li>the {@code LogRecord} does not {@linkplain LogRecord#getLoggerName() specify a logger}.</li>
* </ul>
*
* The default implementation infers a logger name from the package name of the {@code source} object.
* Subclasses should override this method if they can provide a more determinist logger instance,
* typically from a static final constant.
*
* @return the logger where to send the warnings when there is no other destination.
*/
public Logger getLogger() {
return Logging.getLogger(source.getClass());
}
/**
* Reports a warning represented by the given log record. The default implementation forwards
* the given record to <strong>one</strong> of the following destinations, in preference order:
*
* <ol>
* <li><code>{@linkplain WarningListener#warningOccured WarningListener.warningOccured}(source, record)</code>
* on all {@linkplain #addWarningListener registered listeners} it at least one such listener exists.</li>
* <li><code>{@linkplain Logging#getLogger(String) Logging.getLogger}(record.{@linkplain LogRecord#getLoggerName
* getLoggerName()}).{@linkplain Logger#log(LogRecord) log}(record)</code> if the logger name is non-null.</li>
* <li><code>{@linkplain #getLogger()}.{@linkplain Logger#log(LogRecord) log}(record)</code> otherwise.</li>
* </ol>
*
* @param record the warning as a log record.
*/
public void warning(final LogRecord record) {
final WarningListener<?>[] current;
synchronized (this) {
current = listeners;
}
if (current != null) {
for (final WarningListener<? super S> listener : listeners) {
listener.warningOccured(source, record);
}
} else {
final String name = record.getLoggerName();
final Logger logger;
if (name != null) {
logger = Logging.getLogger(name);
} else {
logger = getLogger();
record.setLoggerName(logger.getName());
}
if (record instanceof QuietLogRecord) {
((QuietLogRecord) record).clearThrown();
}
logger.log(record);
}
}
/**
* Reports a warning represented by the given message and exception.
* At least one of {@code message} and {@code exception} shall be non-null.
* If both are non-null, then the exception message will be concatenated after the given message.
* If the exception is non-null, its stack trace will be omitted at logging time for avoiding to
* pollute console output (keeping in mind that this method should be invoked only for non-fatal
* warnings). See {@linkplain #warning(Level, String, Exception) below} for more explanation.
*
* <p>This method is a shortcut for <code>{@linkplain #warning(Level, String, Exception)
* warning}({@linkplain Level#WARNING}, message, exception)</code>.
*
* @param message the message to log, or {@code null} if none.
* @param exception the exception to log, or {@code null} if none.
*/
public void warning(String message, Exception exception) {
warning(Level.WARNING, message, exception);
}
/**
* Reports a warning at the given level represented by the given message and exception.
* At least one of {@code message} and {@code exception} shall be non-null.
* If both are non-null, then the exception message will be concatenated after the given message.
*
* <div class="section">Stack trace omission</div>
* If there is no registered listener, then the {@link #warning(LogRecord)} method will send the record to the
* {@linkplain #getLogger() logger}, but <em>without</em> the stack trace. This is done that way because stack
* traces consume lot of space in the logging files, while being considered implementation details in the context
* of {@code WarningListeners} (on the assumption that the logging message provides sufficient information).
* If the stack trace is desired, then users can either:
* <ul>
* <li>invoke {@code warning(LogRecord)} directly, or</li>
* <li>override {@code warning(LogRecord)} and invoke {@link LogRecord#setThrown(Throwable)} explicitely, or</li>
* <li>register a listener which will log the record itself.</li>
* </ul>
*
* @param level the warning level.
* @param message the message to log, or {@code null} if none.
* @param exception the exception to log, or {@code null} if none.
*/
public void warning(final Level level, String message, final Exception exception) {
ArgumentChecks.ensureNonNull("level", level);
final LogRecord record;
final StackTraceElement[] trace;
if (exception != null) {
trace = exception.getStackTrace();
message = Exceptions.formatChainedMessages(getLocale(), message, exception);
if (message == null) {
message = exception.toString();
}
record = new QuietLogRecord(level, message, exception);
} else {
ArgumentChecks.ensureNonEmpty("message", message);
trace = Thread.currentThread().getStackTrace();
record = new LogRecord(level, message);
}
for (final StackTraceElement e : trace) {
if (isPublic(e)) {
record.setSourceClassName(e.getClassName());
record.setSourceMethodName(e.getMethodName());
break;
}
}
warning(record);
}
/**
* Returns {@code true} if the given stack trace element describes a method considered part of public API.
* This method is invoked in order to infer the class and method names to declare in a {@link LogRecord}.
* We do not document this feature in public Javadoc because it is based on heuristic rules that may change.
*
* <p>The current implementation compares the class name against a hard-coded list of classes to hide.
* This implementation may change in any future SIS version.</p>
*
* @param e a stack trace element.
* @return {@code true} if the class and method specified by the given element can be considered public API.
*/
static boolean isPublic(final StackTraceElement e) {
final String classname = e.getClassName();
if (classname.startsWith("java") || classname.contains(".internal.") ||
classname.indexOf('$') >= 0 || e.getMethodName().indexOf('$') >= 0)
{
return false;
}
if (classname.startsWith(Modules.CLASSNAME_PREFIX + "util.logging.")) {
return classname.endsWith("Test"); // Consider JUnit tests as public.
}
return true; // TODO: with StackWalker on JDK9, check if the class is public.
}
/**
* Adds a listener to be notified when a warning occurred.
* When a warning occurs, there is a choice:
*
* <ul>
* <li>If this object has no warning listener, then the warning is logged at
* {@link java.util.logging.Level#WARNING}.</li>
* <li>If this object has at least one warning listener, then all listeners are notified
* and the warning is <strong>not</strong> logged by this object.</li>
* </ul>
*
* @param listener the listener to add.
* @throws IllegalArgumentException if the given listener is already registered.
*/
public synchronized void addWarningListener(final WarningListener<? super S> listener)
throws IllegalArgumentException
{
ArgumentChecks.ensureNonNull("listener", listener);
final WarningListener<? super S>[] current = listeners;
final int length = (current != null) ? current.length : 0;
@SuppressWarnings({"unchecked", "rawtypes"}) // Generic array creation.
final WarningListener<? super S>[] copy = new WarningListener[length + 1];
for (int i=0; i<length; i++) {
final WarningListener<? super S> c = current[i];
if (c == listener) {
throw new IllegalArgumentException(Errors.format(Errors.Keys.ElementAlreadyPresent_1, listener));
}
copy[i] = c;
}
copy[length] = listener;
listeners = copy;
}
/**
* Removes a previously registered listener.
*
* @param listener the listener to remove.
* @throws NoSuchElementException if the given listener is not registered.
*/
public synchronized void removeWarningListener(final WarningListener<? super S> listener)
throws NoSuchElementException
{
ArgumentChecks.ensureNonNull("listener", listener);
final WarningListener<? super S>[] current = listeners;
if (current != null) {
for (int i=0; i<current.length; i++) {
if (current[i] == listener) {
if (current.length == 1) {
listeners = null;
} else {
@SuppressWarnings({"unchecked", "rawtypes"}) // Generic array creation.
final WarningListener<? super S>[] copy = new WarningListener[current.length - 1];
System.arraycopy(current, 0, copy, 0, i);
System.arraycopy(current, i+1, copy, i, copy.length - i);
listeners = copy;
}
return;
}
}
}
throw new NoSuchElementException(Errors.format(Errors.Keys.ElementNotFound_1, listener));
}
/**
* Returns all registered warning listeners, or an empty list if none.
* This method returns an unmodifiable snapshot of the listener list at the time this method is invoked.
*
* @return immutable list of all registered warning listeners.
*
* @since 0.8
*/
public List<WarningListener<? super S>> getListeners() {
final WarningListener<? super S>[] current;
synchronized (this) {
current = listeners;
}
return (current != null) ? UnmodifiableArrayList.wrap(current) : Collections.<WarningListener<? super S>>emptyList();
}
/**
* Returns {@code true} if this object contains at least one listener.
*
* @return {@code true} if this object contains at least one listener, {@code false} otherwise.
*
* @since 0.4
*/
public synchronized boolean hasListeners() {
return listeners != null;
}
}
| apache-2.0 |
Loyagram/campaign-sdk | campaignsdk/src/main/java/com/loyagram/android/campaignsdk/models/ThankYouTranslation.java | 2472 | package com.loyagram.android.campaignsdk.models;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
import com.loyagram.android.campaignsdk.models.npssettings.ThankYouAndRedirectSettings;
/**
* Created by user1 on 19/5/17.
*/
public class ThankYouTranslation implements Parcelable {
@SerializedName("language_code")
private String code = null;
@SerializedName("text")
private ThankYouAndRedirectSettings thankYouAndRedirectSettings = null;
public void setCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public ThankYouAndRedirectSettings getThankYouAndRedirectSettings() {
return thankYouAndRedirectSettings;
}
public void setThankYouAndRedirectSettings(ThankYouAndRedirectSettings thankYouAndRedirectSettings) {
this.thankYouAndRedirectSettings = thankYouAndRedirectSettings;
}
protected ThankYouTranslation(Parcel in) {
boolean isPresent = false;
isPresent = in.readByte() == 1;
if (isPresent) {
this.code = in.readString();
} else {
this.code = null;
}
this.thankYouAndRedirectSettings = in.readParcelable(ThankYouAndRedirectSettings.class.getClassLoader());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ThankYouTranslation {\n");
sb.append(" code: ").append(code).append("\n");
sb.append(" translation: ").append(thankYouAndRedirectSettings).append("\n");
sb.append("}\n");
return sb.toString();
}
public static final Creator<ThankYouTranslation> CREATOR = new Creator<ThankYouTranslation>() {
@Override
public ThankYouTranslation createFromParcel(Parcel in) {
return new ThankYouTranslation(in);
}
@Override
public ThankYouTranslation[] newArray(int size) {
return new ThankYouTranslation[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
if (this.code == null) {
dest.writeByte((byte) 0);
} else {
dest.writeByte((byte) 1);
dest.writeString(this.code);
}
dest.writeParcelable(this.thankYouAndRedirectSettings, flags);
}
}
| apache-2.0 |
afiantara/apache-wicket-1.5.7 | src/wicket-core/src/test/java/org/apache/wicket/request/mapper/TestMapperContext.java | 6595 | /*
* 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.wicket.request.mapper;
import org.apache.wicket.MockPage;
import org.apache.wicket.RequestListenerInterface;
import org.apache.wicket.WicketRuntimeException;
import org.apache.wicket.markup.MarkupParser;
import org.apache.wicket.page.IPageManagerContext;
import org.apache.wicket.page.PageStoreManager;
import org.apache.wicket.pageStore.DefaultPageStore;
import org.apache.wicket.pageStore.IDataStore;
import org.apache.wicket.pageStore.IPageStore;
import org.apache.wicket.pageStore.memory.DummyPageManagerContext;
import org.apache.wicket.request.component.IRequestablePage;
import org.apache.wicket.request.handler.PageProvider;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.request.resource.ResourceReference;
import org.apache.wicket.request.resource.ResourceReference.Key;
import org.apache.wicket.request.resource.ResourceReferenceRegistry;
import org.apache.wicket.serialize.java.JavaSerializer;
import org.apache.wicket.versioning.InMemoryPageStore;
/**
* Simple {@link IMapperContext} implementation for testing purposes
*
* @author Matej Knopp
*/
public class TestMapperContext implements IMapperContext
{
private static final String APP_NAME = "test_app";
private static int count;
IDataStore dataStore;
IPageStore pageStore;
IPageManagerContext pageManagerContext;
PageStoreManager pageManager;
private String appName;
private boolean createMockPageIfInstanceNotFound = true;
private PageParameters currentPageParameters = null;
/**
* Construct.
*/
public TestMapperContext()
{
appName = APP_NAME + count++;
dataStore = new InMemoryPageStore();
pageStore = new DefaultPageStore(new JavaSerializer(appName), dataStore, 4);
pageManagerContext = new DummyPageManagerContext();
pageManager = new PageStoreManager(appName, pageStore, pageManagerContext);
}
/**
* just making sure the session cache will be empty by simulating an intermezzo request
*/
public void cleanSessionCache()
{
getPageManager().getContext().setRequestData(null);
MockPage other = new MockPage();
other.setPageId(Integer.MAX_VALUE);
getPageManager().touchPage(other);
getPageManager().commitRequest();
}
/**
* @return pageManager
*/
public PageStoreManager getPageManager()
{
return pageManager;
}
public String getBookmarkableIdentifier()
{
return "bookmarkable";
}
public String getNamespace()
{
return MarkupParser.WICKET;
}
public String getPageIdentifier()
{
return "page";
}
public String getResourceIdentifier()
{
return "resource";
}
public ResourceReferenceRegistry getResourceReferenceRegistry()
{
return registry;
}
private final ResourceReferenceRegistry registry = new ResourceReferenceRegistry()
{
@Override
protected ResourceReference createDefaultResourceReference(Key key)
{
// Do not create package resource here because it requires "real" application
return null;
}
};
private boolean bookmarkable = true;
/**
* Determines whether the newly created page will have bookmarkable flag set
*
* @param bookmarkable
*/
public void setBookmarkable(boolean bookmarkable)
{
this.bookmarkable = bookmarkable;
}
private boolean createdBookmarkable = true;
/**
* Determines whether the newly created page will have createdBookmarkable flag set
*
* @param createdBookmarkable
*/
public void setCreatedBookmarkable(boolean createdBookmarkable)
{
this.createdBookmarkable = createdBookmarkable;
}
private int nextPageRenderCount = 0;
/**
*
* @param nextPageRenderCount
*/
public void setNextPageRenderCount(int nextPageRenderCount)
{
this.nextPageRenderCount = nextPageRenderCount;
}
public IRequestablePage getPageInstance(int pageId)
{
IRequestablePage requestablePage = (IRequestablePage)pageManager.getPage(pageId);
if (requestablePage == null && createMockPageIfInstanceNotFound)
{
MockPage page = new MockPage();
page.setPageId(pageId);
page.setBookmarkable(bookmarkable);
page.setCreatedBookmarkable(createdBookmarkable);
page.setRenderCount(nextPageRenderCount);
requestablePage = page;
if (currentPageParameters != null)
{
page.getPageParameters().overwriteWith(currentPageParameters);
currentPageParameters = null;
}
}
return requestablePage;
}
int idCounter = 0;
public IRequestablePage newPageInstance(Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters)
{
try
{
MockPage page = (MockPage)pageClass.newInstance();
page.setPageId(++idCounter);
page.setBookmarkable(true);
page.setCreatedBookmarkable(true);
if (pageParameters != null)
{
page.getPageParameters().overwriteWith(pageParameters);
}
return page;
}
catch (Exception e)
{
throw new WicketRuntimeException(e);
}
}
public RequestListenerInterface requestListenerInterfaceFromString(String interfaceName)
{
return RequestListenerInterface.forName(interfaceName);
}
public String requestListenerInterfaceToString(RequestListenerInterface listenerInterface)
{
return listenerInterface.getName();
}
public Class<? extends IRequestablePage> getHomePageClass()
{
return MockPage.class;
}
public TestMapperContext setCurrentPageParameters(PageParameters parameters)
{
this.currentPageParameters = parameters;
return this;
}
/**
*
* Adapts {@link PageProvider} to this {@link IMapperContext}
*
* @author Pedro Santos
*/
public class TestPageProvider extends PageProvider
{
/**
* Construct.
*
* @param pageId
* @param renderCount
*/
public TestPageProvider(int pageId, Integer renderCount)
{
super(pageId, renderCount);
}
@Override
protected IPageSource getPageSource()
{
return TestMapperContext.this;
}
}
}
| apache-2.0 |
sergeydubouski/Java-a-to-z | chapter_001/src/test/java/ru/job4j/CounterTest.java | 1582 | package ru.job4j;
import org.junit.Test;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Test.
*
* @author Sergey Dubouski
* @version $Id$
* @since 13.01.2017
*/
public class CounterTest {
/**
* Test even-even range of numbers' sum.
*/
@Test
public void whenFirstNumberEvenSecondEvenThenSum() {
final int first = 4;
final int second = 6;
final int expectedResult = 0;
final Counter count = new Counter();
final int actualResult = count.add(first, second);
assertThat(actualResult, is(expectedResult));
}
/**
* Test odd-even range of numbers' sum.
*/
@Test
public void whenFirstNumberOddSecondEvenThenSum() {
final int first = 1;
final int second = 2;
final int expectedResult = 0;
final Counter count = new Counter();
final int actualResult = count.add(first, second);
assertThat(actualResult, is(expectedResult));
}
/**
* Test even-odd range of numbers' sum.
*/
@Test
public void whenFirstNumberEvenSecondOddThenSum() {
final int first = 2;
final int second = 7;
final int expectedResult = 10;
final Counter count = new Counter();
final int actualResult = count.add(first, second);
assertThat(actualResult, is(expectedResult));
}
/**
* Test odd-odd range of numbers' sum.
*/
@Test
public void whenFirstNumberOddSecondOddThenSum() {
final int first = 1;
final int second = 5;
final int expectedResult = 6;
final Counter count = new Counter();
final int actualResult = count.add(first, second);
assertThat(actualResult, is(expectedResult));
}
} | apache-2.0 |
joinAero/DroidTurbo | libopencv/src/main/java/cc/eevee/turbo/libopencv/calib/CameraCalibrator.java | 6350 | package cc.eevee.turbo.libopencv.calib;
import android.util.Log;
import org.opencv.calib3d.Calib3d;
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDouble;
import org.opencv.core.MatOfPoint2f;
import org.opencv.core.MatOfPoint3f;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;
import java.util.ArrayList;
import java.util.List;
public class CameraCalibrator {
private static final String TAG = "OCVSample::CamCalib";
private final Size mPatternSize = new Size(9, 6);
private final int mCornersSize = (int)(mPatternSize.width * mPatternSize.height);
private boolean mPatternWasFound = false;
private MatOfPoint2f mCorners = new MatOfPoint2f();
private List<Mat> mCornersBuffer = new ArrayList<Mat>();
private boolean mIsCalibrated = false;
private Mat mCameraMatrix = new Mat();
private Mat mDistortionCoefficients = new Mat();
private int mFlags;
private double mRms;
private double mSquareSize = 0.0181;
private Size mImageSize;
public CameraCalibrator(int width, int height) {
mImageSize = new Size(width, height);
mFlags = Calib3d.CALIB_FIX_PRINCIPAL_POINT +
Calib3d.CALIB_ZERO_TANGENT_DIST +
Calib3d.CALIB_FIX_ASPECT_RATIO +
Calib3d.CALIB_FIX_K4 +
Calib3d.CALIB_FIX_K5;
Mat.eye(3, 3, CvType.CV_64FC1).copyTo(mCameraMatrix);
mCameraMatrix.put(0, 0, 1.0);
Mat.zeros(5, 1, CvType.CV_64FC1).copyTo(mDistortionCoefficients);
Log.i(TAG, "Instantiated new " + this.getClass());
}
public void processFrame(Mat grayFrame, Mat rgbaFrame) {
findPattern(grayFrame);
renderFrame(rgbaFrame);
}
public void calibrate() {
ArrayList<Mat> rvecs = new ArrayList<Mat>();
ArrayList<Mat> tvecs = new ArrayList<Mat>();
Mat reprojectionErrors = new Mat();
ArrayList<Mat> objectPoints = new ArrayList<Mat>();
objectPoints.add(Mat.zeros(mCornersSize, 1, CvType.CV_32FC3));
calcBoardCornerPositions(objectPoints.get(0));
for (int i = 1; i < mCornersBuffer.size(); i++) {
objectPoints.add(objectPoints.get(0));
}
Calib3d.calibrateCamera(objectPoints, mCornersBuffer, mImageSize,
mCameraMatrix, mDistortionCoefficients, rvecs, tvecs, mFlags);
mIsCalibrated = Core.checkRange(mCameraMatrix)
&& Core.checkRange(mDistortionCoefficients);
mRms = computeReprojectionErrors(objectPoints, rvecs, tvecs, reprojectionErrors);
Log.i(TAG, String.format("Average re-projection error: %f", mRms));
Log.i(TAG, "Camera matrix: " + mCameraMatrix.dump());
Log.i(TAG, "Distortion coefficients: " + mDistortionCoefficients.dump());
}
public void clearCorners() {
mCornersBuffer.clear();
}
private void calcBoardCornerPositions(Mat corners) {
final int cn = 3;
float positions[] = new float[mCornersSize * cn];
for (int i = 0; i < mPatternSize.height; i++) {
for (int j = 0; j < mPatternSize.width * cn; j += cn) {
positions[(int) (i * mPatternSize.width * cn + j + 0)] =
(2 * (j / cn) + i % 2) * (float) mSquareSize;
positions[(int) (i * mPatternSize.width * cn + j + 1)] =
i * (float) mSquareSize;
positions[(int) (i * mPatternSize.width * cn + j + 2)] = 0;
}
}
corners.create(mCornersSize, 1, CvType.CV_32FC3);
corners.put(0, 0, positions);
}
private double computeReprojectionErrors(List<Mat> objectPoints,
List<Mat> rvecs, List<Mat> tvecs, Mat perViewErrors) {
MatOfPoint2f cornersProjected = new MatOfPoint2f();
double totalError = 0;
double error;
float viewErrors[] = new float[objectPoints.size()];
MatOfDouble distortionCoefficients = new MatOfDouble(mDistortionCoefficients);
int totalPoints = 0;
for (int i = 0; i < objectPoints.size(); i++) {
MatOfPoint3f points = new MatOfPoint3f(objectPoints.get(i));
Calib3d.projectPoints(points, rvecs.get(i), tvecs.get(i),
mCameraMatrix, distortionCoefficients, cornersProjected);
error = Core.norm(mCornersBuffer.get(i), cornersProjected, Core.NORM_L2);
int n = objectPoints.get(i).rows();
viewErrors[i] = (float) Math.sqrt(error * error / n);
totalError += error * error;
totalPoints += n;
}
perViewErrors.create(objectPoints.size(), 1, CvType.CV_32FC1);
perViewErrors.put(0, 0, viewErrors);
return Math.sqrt(totalError / totalPoints);
}
private void findPattern(Mat grayFrame) {
mPatternWasFound = Calib3d.findChessboardCorners(grayFrame, mPatternSize, mCorners,
Calib3d.CALIB_CB_ADAPTIVE_THRESH | Calib3d.CALIB_CB_FAST_CHECK | Calib3d.CALIB_CB_NORMALIZE_IMAGE);
/*mPatternWasFound = Calib3d.findCirclesGrid(grayFrame, mPatternSize,
mCorners, Calib3d.CALIB_CB_ASYMMETRIC_GRID);*/
}
public void addCorners() {
if (mPatternWasFound) {
mCornersBuffer.add(mCorners.clone());
}
}
private void drawPoints(Mat rgbaFrame) {
Calib3d.drawChessboardCorners(rgbaFrame, mPatternSize, mCorners, mPatternWasFound);
}
private void renderFrame(Mat rgbaFrame) {
drawPoints(rgbaFrame);
Imgproc.putText(rgbaFrame, "Touch to capture, Captured: " + mCornersBuffer.size(),
new Point(rgbaFrame.cols() / 2, rgbaFrame.rows() * 0.9),
Core.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar(255, 255, 0));
}
public Mat getCameraMatrix() {
return mCameraMatrix;
}
public Mat getDistortionCoefficients() {
return mDistortionCoefficients;
}
public int getCornersBufferSize() {
return mCornersBuffer.size();
}
public double getAvgReprojectionError() {
return mRms;
}
public boolean isCalibrated() {
return mIsCalibrated;
}
public void setCalibrated() {
mIsCalibrated = true;
}
}
| apache-2.0 |
tarksgit/Favorite-Android-Client-Example | FavoriteExample/src/com/tarks/favorite/example/pulltorefresh/library/PullToRefreshExpandableListView.java | 3490 | /*******************************************************************************
* Copyright 2011, 2012 Chris Banes.
//This is source code of favorite. Copyrightⓒ. Tarks. 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.tarks.favorite.example.pulltorefresh.library;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ExpandableListView;
import com.tarks.favorite.example.pulltorefresh.library.internal.EmptyViewMethodAccessor;
public class PullToRefreshExpandableListView extends PullToRefreshAdapterViewBase<ExpandableListView> {
public PullToRefreshExpandableListView(Context context) {
super(context);
}
public PullToRefreshExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public PullToRefreshExpandableListView(Context context, Mode mode) {
super(context, mode);
}
public PullToRefreshExpandableListView(Context context, Mode mode, AnimationStyle style) {
super(context, mode, style);
}
@Override
public final Orientation getPullToRefreshScrollDirection() {
return Orientation.VERTICAL;
}
@Override
protected ExpandableListView createRefreshableView(Context context, AttributeSet attrs) {
final ExpandableListView lv;
if (VERSION.SDK_INT >= VERSION_CODES.GINGERBREAD) {
lv = new InternalExpandableListViewSDK9(context, attrs);
} else {
lv = new InternalExpandableListView(context, attrs);
}
// Set it to this so it can be used in ListActivity/ListFragment
lv.setId(android.R.id.list);
return lv;
}
class InternalExpandableListView extends ExpandableListView implements EmptyViewMethodAccessor {
public InternalExpandableListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setEmptyView(View emptyView) {
PullToRefreshExpandableListView.this.setEmptyView(emptyView);
}
@Override
public void setEmptyViewInternal(View emptyView) {
super.setEmptyView(emptyView);
}
}
@TargetApi(9)
final class InternalExpandableListViewSDK9 extends InternalExpandableListView {
public InternalExpandableListViewSDK9(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {
final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
// Does all of the hard work...
OverscrollHelper.overScrollBy(PullToRefreshExpandableListView.this, deltaX, scrollX, deltaY, scrollY,
isTouchEvent);
return returnValue;
}
}
}
| apache-2.0 |
rbieniek/primefaces-traffic-monitor | snmp4j-rar/src/main/java/de/bieniekconsulting/trafficmonitor/connector/snmp/WorkBasedWorkerTask.java | 1949 | package de.bieniekconsulting.trafficmonitor.connector.snmp;
import javax.resource.spi.work.Work;
import javax.resource.spi.work.WorkAdapter;
import javax.resource.spi.work.WorkEvent;
import javax.resource.spi.work.WorkException;
import javax.resource.spi.work.WorkManager;
import org.jboss.logging.Logger;
import org.snmp4j.SNMP4JSettings;
import org.snmp4j.util.WorkerTask;
class WorkBasedWorkerTask implements WorkerTask {
private static Logger logger = Logger.getLogger(WorkBasedWorkerTask.class);
private class StateListener extends WorkAdapter {
private boolean running = false;
@Override
public void workStarted(WorkEvent e) {
synchronized (this) {
running = true;
}
}
@Override
public void workCompleted(WorkEvent e) {
synchronized (this) {
running = false;
notifyAll();
}
}
public boolean isRunning() {
synchronized (this) {
return running;
}
}
}
private Work work;
private WorkManager workManager;
private StateListener stateListener = new StateListener();
public WorkBasedWorkerTask(WorkerTask wrappedTask, WorkManager workManager) {
this.workManager = workManager;
work = new Work() {
@Override
public void run() {
wrappedTask.run();
}
@Override
public void release() {
wrappedTask.terminate();
}
};
}
@Override
public void run() {
try {
this.workManager.scheduleWork(work, SNMP4JSettings.getThreadJoinTimeout(), null, stateListener);
} catch (WorkException e) {
logger.warn("cannot start work entity", e);
throw new RuntimeException(e);
}
}
@Override
public void terminate() {
logger.trace("terminate");
}
@Override
public void join() throws InterruptedException {
if(stateListener.isRunning()) {
synchronized (stateListener) {
stateListener.wait(SNMP4JSettings.getThreadJoinTimeout());
}
}
}
@Override
public void interrupt() {
logger.trace("interrupt");
}
} | apache-2.0 |
skoumalcz/joogar | joogar/src/androidTest/java/net/skoumal/joogar/integration/ByteArrayFieldTests.java | 2511 | package net.skoumal.joogar.integration;
import net.skoumal.joogar.util.model.ByteArrayAnnotatedModel;
import net.skoumal.joogar.util.model.ByteArrayExtendedModel;
import net.skoumal.joogar.shared.JoogarRecord;
import net.skoumal.joogar.util.CrudTestCase;
import java.util.Arrays;
public class ByteArrayFieldTests extends CrudTestCase {
public void testNullByteArrayExtended() {
byte[] array = null;
JoogarRecord.save(new ByteArrayExtendedModel(array));
ByteArrayExtendedModel model = JoogarRecord.findById(ByteArrayExtendedModel.class, 1);
assertTrue(Arrays.equals(array, model.getByteArray()));
}
public void testNullByteArrayAnnotated() {
byte[] array = null;
JoogarRecord.save(new ByteArrayAnnotatedModel(array));
ByteArrayAnnotatedModel model = JoogarRecord.findById(ByteArrayAnnotatedModel.class, 1);
assertTrue(Arrays.equals(array, model.getByteArray()));
}
public void testEmptyByteArrayExtended() {
byte[] array = "".getBytes();
JoogarRecord.save(new ByteArrayExtendedModel(array));
ByteArrayExtendedModel model = JoogarRecord.findById(ByteArrayExtendedModel.class, 1);
assertEquals(new String(array), new String(model.getByteArray()));
assertTrue(Arrays.equals(array, model.getByteArray()));
}
public void testEmptyByteArrayAnnotated() {
byte[] array = "".getBytes();
JoogarRecord.save(new ByteArrayAnnotatedModel(array));
ByteArrayAnnotatedModel model = JoogarRecord.findById(ByteArrayAnnotatedModel.class, 1);
assertEquals(new String(array), new String(model.getByteArray()));
assertTrue(Arrays.equals(array, model.getByteArray()));
}
public void testByteArrayExtended() {
byte[] array = "hello".getBytes();
JoogarRecord.save(new ByteArrayExtendedModel(array));
ByteArrayExtendedModel model = JoogarRecord.findById(ByteArrayExtendedModel.class, 1);
assertEquals(new String(array), new String(model.getByteArray()));
assertTrue(Arrays.equals(array, model.getByteArray()));
}
public void testByteArrayAnnotated() {
byte[] array = "hello".getBytes();
JoogarRecord.save(new ByteArrayAnnotatedModel(array));
ByteArrayAnnotatedModel model = JoogarRecord.findById(ByteArrayAnnotatedModel.class, 1);
assertEquals(new String(array), new String(model.getByteArray()));
assertTrue(Arrays.equals(array, model.getByteArray()));
}
}
| apache-2.0 |
fitramabr/acra | src/main/java/org/acra/collector/LogFileCollector.java | 2294 | /*
* Copyright 2012 Kevin Gaudin
*
* 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.acra.collector;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import org.acra.util.BoundedLinkedList;
import android.app.Application;
import android.content.Context;
/**
* Collects the N last lines of a text stream. Use this collector if your
* application handles its own logging system.
*
* @author Kevin Gaudin
*
*/
class LogFileCollector {
/**
* Private constructor to prevent instantiation.
*/
private LogFileCollector() {
};
/**
* Reads the last lines of a custom log file. The file name is assumed as
* located in the {@link Application#getFilesDir()} directory if it does not
* contain any path separator.
*
* @param context
* @param fileName
* @param numberOfLines
* @return
* @throws IOException
*/
public static String collectLogFile(Context context, String fileName, int numberOfLines) throws IOException {
BoundedLinkedList<String> resultBuffer = new BoundedLinkedList<String>(numberOfLines);
final BufferedReader reader;
if (fileName.contains("/")) {
reader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)), 1024);
} else {
reader = new BufferedReader(new InputStreamReader(context.openFileInput(fileName)), 1024);
}
String line = reader.readLine();
while (line != null) {
resultBuffer.add(line + "\n");
line = reader.readLine();
}
return resultBuffer.toString();
}
}
| apache-2.0 |
uryyyyyyy/bizCalendarUtil | src/test/java/com/github/uryyyyyyy/bizCalendarUtil/BizScheduleClientTest.java | 362 | package com.github.uryyyyyyy.bizCalendarUtil;
import org.junit.Test;
public class BizScheduleClientTest {
@Test
public void testGetBusinessDayUtil() throws Exception {
BizScheduleClient.getBusinessDayUtil();
}
@Test
public void testGetBusinessHourUtil() throws Exception {
BizScheduleClient.getBusinessHourUtil();
}
} | apache-2.0 |
makholm/gerrit-ceremony | gerrit-server/src/main/java/com/google/gerrit/server/workflow/CategoryFunction.java | 3693 | // Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.workflow;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.reviewdb.ApprovalCategory;
import com.google.gerrit.reviewdb.PatchSetApproval;
import com.google.gerrit.reviewdb.RefRight;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.project.RefControl;
import java.util.HashMap;
import java.util.Map;
/** Function to control {@link PatchSetApproval}s in an {@link ApprovalCategory}. */
public abstract class CategoryFunction {
private static Map<String, CategoryFunction> all =
new HashMap<String, CategoryFunction>();
static {
all.put(SubmitFunction.NAME, new SubmitFunction());
all.put(MaxWithBlock.NAME, new MaxWithBlock());
all.put(MaxNoBlock.NAME, new MaxNoBlock());
all.put(NoOpFunction.NAME, new NoOpFunction());
all.put(NoBlock.NAME, new NoBlock());
}
/**
* Locate a function by category.
*
* @param category the category the function is for.
* @return the function implementation; {@link NoOpFunction} if the function
* is not known to Gerrit and thus cannot be executed.
*/
public static CategoryFunction forCategory(final ApprovalCategory category) {
final CategoryFunction r = forName(category.getFunctionName());
return r != null ? r : new NoOpFunction();
}
/**
* Locate a function by name.
*
* @param functionName the function's unique name.
* @return the function implementation; null if the function is not known to
* Gerrit and thus cannot be executed.
*/
public static CategoryFunction forName(final String functionName) {
return all.get(functionName);
}
/**
* Normalize ChangeApprovals and set the valid flag for this category.
* <p>
* Implementors should invoke:
*
* <pre>
* state.valid(at, true);
* </pre>
* <p>
* If the set of approvals from <code>state.getApprovals(at)</code> covers the
* requirements for the function, indicating the category has been completed.
* <p>
* An example implementation which requires at least one positive and no
* negatives might be:
*
* <pre>
* boolean neg = false, pos = false;
* for (final ChangeApproval ca : state.getApprovals(at)) {
* state.normalize(ca);
* neg |= ca.getValue() < 0;
* pos |= ca.getValue() > 0;
* }
* state.valid(at, !neg && pos);
* </pre>
*
* @param at the cached category description to process.
* @param state state to read approvals and project rights from, and to update
* the valid status into.
*/
public abstract void run(ApprovalType at, FunctionState state);
public boolean isValid(final CurrentUser user, final ApprovalType at,
final FunctionState state) {
RefControl rc = state.controlFor(user);
for (final RefRight pr : rc.getApplicableRights(at.getCategory().getId())) {
if (user.getEffectiveGroups().contains(pr.getAccountGroupId())
&& (pr.getMinValue() < 0 || pr.getMaxValue() > 0)) {
return true;
}
}
return false;
}
}
| apache-2.0 |
uin3566/Dota2Helper | app/src/androidTest/java/com/fangxu/dota2helper/ApplicationTest.java | 353 | package com.fangxu.dota2helper;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | apache-2.0 |
aruanruan/copycat | storage/src/test/java/net/kuujo/copycat/io/storage/LogTest.java | 7280 | /*
* Copyright 2015 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 net.kuujo.copycat.io.storage;
import net.kuujo.copycat.io.serializer.Serializer;
import net.kuujo.copycat.io.serializer.ServiceLoaderTypeResolver;
import org.testng.annotations.Test;
import java.io.File;
import static org.testng.Assert.*;
/**
* Log test.
*
* @author <a href="http://github.com/kuujo">Jordan Halterman</a>
*/
@Test
public class LogTest extends AbstractLogTest {
/**
* Creates a new log.
*/
@Override
protected Log createLog() {
return createLog(String.format("target/test-logs/%s", logId));
}
/**
* Creates a new log.
*/
protected Log createLog(String directory) {
return tempStorageBuilder()
.withDirectory(new File(String.format("target/test-logs/%s", directory)))
.withMaxEntrySize(1024)
.withMaxSegmentSize(1024 * 1024)
.withMaxEntriesPerSegment(1024)
.withSerializer(new Serializer(new ServiceLoaderTypeResolver()))
.build()
.open("copycat");
}
/**
* Tests writing and reading an entry.
*/
public void testCreateReadFirstEntry() {
assertTrue(log.isEmpty());
assertEquals(log.length(), 0);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
assertEquals(log.length(), 1);
assertFalse(log.isEmpty());
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests creating and reading the last entry in the log.
*/
public void testCreateReadLastEntry() {
appendEntries(log, 100);
assertEquals(log.length(), 100);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
assertEquals(log.length(), 101);
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests creating and reading the last entry in the log.
*/
public void testCreateReadMiddleEntry() {
appendEntries(log, 100);
assertEquals(log.length(), 100);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
appendEntries(log, 100);
assertEquals(log.length(), 201);
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests creating and reading entries after a roll over.
*/
public void testCreateReadAfterRollOver() {
appendEntries(log, 1100);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
appendEntries(log, 1050);
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests truncating entries in the log.
*/
public void testTruncate() throws Throwable {
appendEntries(log, 100);
assertEquals(log.lastIndex(), 100);
log.truncate(10);
assertEquals(log.lastIndex(), 10);
appendEntries(log, 10);
assertEquals(log.lastIndex(), 20);
}
/**
* Tests truncating to a skipped index.
*/
public void testTruncateSkipped() throws Throwable {
appendEntries(log, 100);
assertEquals(log.lastIndex(), 100);
log.skip(10);
appendEntries(log, 100);
assertEquals(log.lastIndex(), 210);
log.truncate(105);
assertEquals(log.lastIndex(), 105);
assertNull(log.commit(105).get(105));
}
/**
* Tests emptying the log.
*/
public void testTruncateZero() throws Throwable {
appendEntries(log, 100);
assertEquals(log.lastIndex(), 100);
log.truncate(0);
assertEquals(log.lastIndex(), 0);
appendEntries(log, 10);
assertEquals(log.lastIndex(), 10);
}
/**
* Tests skipping entries in the log.
*/
public void testSkip() throws Throwable {
appendEntries(log, 100);
log.skip(10);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
assertEquals(log.length(), 111);
try (TestEntry entry = log.commit(111).get(101)) {
assertNull(entry);
}
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests skipping entries on a segment rollover.
*/
public void testSkipOnRollOver() {
appendEntries(log, 1020);
log.skip(10);
assertEquals(log.length(), 1030);
long index;
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
index = log.append(entry);
}
assertEquals(log.length(), 1031);
try (TestEntry entry = log.commit(1031).get(1021)) {
assertNull(entry);
}
try (TestEntry entry = log.get(index)) {
assertEquals(entry.getTerm(), 1);
assertTrue(entry.isRemove());
}
}
/**
* Tests recovering the log.
*/
public void testRecover() {
appendEntries(log, 1024);
assertEquals(log.length(), 1024);
try (Log log = createLog()) {
assertEquals(log.length(), 1024);
for (long i = log.firstIndex(); i <= log.lastIndex(); i++) {
try (Entry entry = log.get(i)) {
assertNotNull(entry);
}
}
}
}
/**
* Tests recovering the log after compaction.
*/
public void testRecoverAfterCompact() {
appendEntries(log, 2048);
for (long i = 1; i <= 2048; i++) {
if (i % 3 == 0 || i % 3 == 1) {
log.clean(i);
}
}
for (long i = 1; i <= 2048; i++) {
if (i % 3 == 0 || i % 3 == 1) {
assertTrue(log.lastIndex() >= i);
assertFalse(log.contains(i));
}
}
log.commit(2049).cleaner().clean().join();
try (Log log = createLog()) {
assertEquals(log.length(), 2048);
for (long i = 1; i <= 2048; i++) {
if (i % 3 == 0 || i % 3 == 1) {
assertTrue(log.lastIndex() >= i);
assertFalse(log.contains(i));
assertNull(log.get(i));
}
}
}
}
/**
* Appends a set of entries to the log.
*/
private void appendEntries(Log log, int entries) {
for (int i = 0; i < entries; i++) {
try (TestEntry entry = log.create(TestEntry.class)) {
entry.setTerm(1);
entry.setRemove(true);
log.append(entry);
}
}
}
}
| apache-2.0 |
palantir/atlasdb | atlasdb-config/src/test/java/com/palantir/atlasdb/factory/AutoServiceAnnotatedAtlasDbFactory.java | 3099 | /*
* (c) Copyright 2018 Palantir Technologies 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.palantir.atlasdb.factory;
import com.google.auto.service.AutoService;
import com.google.common.collect.Lists;
import com.palantir.atlasdb.config.LeaderConfig;
import com.palantir.atlasdb.keyvalue.api.KeyValueService;
import com.palantir.atlasdb.keyvalue.api.TableReference;
import com.palantir.atlasdb.spi.AtlasDbFactory;
import com.palantir.atlasdb.spi.KeyValueServiceConfig;
import com.palantir.atlasdb.spi.KeyValueServiceRuntimeConfig;
import com.palantir.atlasdb.util.MetricsManager;
import com.palantir.logsafe.logger.SafeLogger;
import com.palantir.logsafe.logger.SafeLoggerFactory;
import com.palantir.refreshable.Refreshable;
import com.palantir.timestamp.ManagedTimestampService;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.LongSupplier;
import org.jmock.Mockery;
@AutoService(AtlasDbFactory.class)
public class AutoServiceAnnotatedAtlasDbFactory implements AtlasDbFactory<KeyValueServiceConfig> {
public static final String TYPE = "not-a-real-db";
private static final Mockery context = new Mockery();
private static final KeyValueService keyValueService = context.mock(KeyValueService.class);
private static List<ManagedTimestampService> nextTimestampServices = new ArrayList<>();
private static final SafeLogger log = SafeLoggerFactory.get(AutoServiceAnnotatedAtlasDbFactory.class);
@Override
public String getType() {
return TYPE;
}
@Override
public KeyValueService createRawKeyValueService(
MetricsManager metricsManager,
KeyValueServiceConfig config,
Refreshable<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig,
Optional<LeaderConfig> leaderConfig,
Optional<String> unused,
LongSupplier unusedLongSupplier,
boolean initializeAsync) {
if (initializeAsync) {
log.warn("Asynchronous initialization not implemented, will initialize synchronously.");
}
return keyValueService;
}
@Override
public ManagedTimestampService createManagedTimestampService(
KeyValueService rawKvs, Optional<TableReference> timestampTable, boolean initializeAsync) {
return nextTimestampServices.remove(0);
}
public static void nextTimestampServiceToReturn(ManagedTimestampService... timestampServices) {
nextTimestampServices = Lists.newArrayList(timestampServices);
}
}
| apache-2.0 |
dbiir/rainbow | rainbow-workload/src/main/java/cn/edu/ruc/iir/rainbow/workload/util/FileUtil.java | 6793 | package cn.edu.ruc.iir.rainbow.workload.util;
import java.io.*;
import java.util.Date;
public class FileUtil
{
/**
* @param file
* @return String
* @Title: readFile
* @Description: 文件的读和写
*/
public static String readFile(File file)
{
if (!file.exists())
{
return "";
}
FileInputStream fileInputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader bufferedReader = null;
try
{
// 获取磁盘的文件
// File file = new File(fileName);
// 开始读取磁盘的文件
fileInputStream = new FileInputStream(file);
// 创建一个字节流
inputStreamReader = new InputStreamReader(fileInputStream);
// 创建一个字节的缓冲流
bufferedReader = new BufferedReader(inputStreamReader);
StringBuffer buffer = new StringBuffer();
String string = null;
while ((string = bufferedReader.readLine()) != null)
{
buffer.append(string + "\n");
}
return buffer.toString();
} catch (IOException e)
{
e.printStackTrace();
return null;
} finally
{
try
{
bufferedReader.close();
inputStreamReader.close();
fileInputStream.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
}
/**
* @param fileName
* @return String
* @Title: readFile
* @Description:方法的重载
*/
public static String readFile(String fileName)
{
return readFile(new File(fileName));
}
public static void writeFile(String content, String filename)
throws IOException
{
// 要写入的文件
File file = new File(filename);
// 写入流对象
PrintWriter printWriter = null;
try
{
printWriter = new PrintWriter(file);
printWriter.print(content);
printWriter.flush();
} catch (Exception e)
{
e.printStackTrace();
} finally
{
if (printWriter != null)
{
try
{
printWriter.close();
} catch (Exception e2)
{
e2.printStackTrace();
}
}
}
}
public static void writeFile(String content, String filename, boolean flag)
throws IOException
{
File file = new File(filename);
FileWriter fw = new FileWriter(file, flag);
// 写入流对象
PrintWriter printWriter = null;
try
{
printWriter = new PrintWriter(fw);
printWriter.print(content);
printWriter.flush();
} catch (Exception e)
{
e.printStackTrace();
} finally
{
if (printWriter != null)
{
try
{
printWriter.close();
} catch (Exception e2)
{
e2.printStackTrace();
}
}
}
}
public static void appendFile(String content, String filename)
throws IOException
{
boolean flag = false;
// 要写入的文件
File file = new File(filename);
if (file.exists())
{
flag = true;
}
FileWriter fw = new FileWriter(file, true);
// 写入流对象
PrintWriter printWriter = null;
try
{
printWriter = new PrintWriter(fw);
if (flag)
{
printWriter.print("\r\n");
}
printWriter.print(content);
printWriter.flush();
} catch (Exception e)
{
e.printStackTrace();
} finally
{
if (printWriter != null)
{
try
{
printWriter.close();
} catch (Exception e2)
{
e2.printStackTrace();
}
}
}
}
/**
* @param args void
* @throws IOException
* @Title: main
* @Description: 入口函数
*/
public static void main(String[] args) throws IOException
{
String aCashe = new Date().toString();
FileUtil fileUtil = new FileUtil();
fileUtil.write(aCashe);
}
private void write(String aCashe) throws IOException
{
File file = new File(this.getClass().getClassLoader()
.getResource(("cashe/cashe.txt")).getFile());
String filename = file.getAbsolutePath();
filename = filename.replace("cashe.txt", "20170518205458.txt");
// filename = filename.replace("cashe.txt", DateUtil.mkTime(new Date())
// + ".txt");
System.out.println(filename);
FileUtil.appendFile(aCashe, filename);
}
private static void FileFunc() throws IOException
{
// 公式:内容+模板=文件
String pack = "com.hh.server";
String model = "server";
String rootPath = "E:/JSP Project/minjieshi/";
String srcPath = rootPath + "src/template/entity.txt";
System.out.println("1. " + srcPath);
// 获取模板的内容
String templateContent = readFile(srcPath);
templateContent = templateContent.replaceAll("\\[package\\]", pack)
.replaceAll("\\[model\\]", model);
// 将替换的内容写入到工程的目录下面
String path = pack.replaceAll("\\.", "/");
System.out.println("2. " + path);
String filePath = rootPath + "src/" + path;
System.out.println("3. " + filePath);
File rootFile = new File(filePath);
if (!rootFile.exists())
{
rootFile.mkdirs();
}
String fileName = filePath + "/" + model + ".java";
System.out.println("4. " + fileName);
writeFile(templateContent, fileName);
}
public static void delDirectory(String path)
{
File f = new File(path);
delDirectory(f);
}
public static void delDirectory(File path)
{
if (!path.exists())
return;
if (path.isFile())
{
path.delete();
return;
}
File[] files = path.listFiles();
for (int i = 0; i < files.length; i++)
{
delDirectory(files[i]);
}
path.delete();
}
}
| apache-2.0 |
JonathanWalsh/Granule-Closure-Compiler | src/com/google/javascript/jscomp/SimpleDefinitionFinder.java | 16133 | /*
* Copyright 2009 The Closure Compiler 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.google.javascript.jscomp;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.javascript.jscomp.DefinitionsRemover.Definition;
import com.google.javascript.jscomp.DefinitionsRemover.ExternalNameOnlyDefinition;
import com.google.javascript.jscomp.DefinitionsRemover.UnknownDefinition;
import com.google.javascript.jscomp.NodeTraversal.AbstractPostOrderCallback;
import com.google.javascript.rhino.JSDocInfo;
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.Token;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* Simple name-based definition gatherer that implements
* {@link DefinitionProvider}.
*
* It treats all variable writes as happening in the global scope and
* treats all objects as capable of having the same set of properties.
* The current implementation only handles definitions whose right
* hand side is an immutable value or function expression. All
* complex definitions are treated as unknowns.
*
*/
class SimpleDefinitionFinder implements CompilerPass, DefinitionProvider {
private final AbstractCompiler compiler;
private final Map<Node, DefinitionSite> definitionSiteMap;
private final Multimap<String, Definition> nameDefinitionMultimap;
private final Multimap<String, UseSite> nameUseSiteMultimap;
public SimpleDefinitionFinder(AbstractCompiler compiler) {
this.compiler = compiler;
this.definitionSiteMap = Maps.newLinkedHashMap();
this.nameDefinitionMultimap = HashMultimap.create();
this.nameUseSiteMultimap = HashMultimap.create();
}
/**
* Returns the collection of definition sites found during traversal.
*
* @return definition site collection.
*/
public Collection<DefinitionSite> getDefinitionSites() {
return definitionSiteMap.values();
}
private DefinitionSite getDefinitionAt(Node node) {
return definitionSiteMap.get(node);
}
DefinitionSite getDefinitionForFunction(Node function) {
Preconditions.checkState(NodeUtil.isFunction(function));
return getDefinitionAt(getNameNodeFromFunctionNode(function));
}
public Collection<Definition> getDefinitionsReferencedAt(Node useSite) {
if (definitionSiteMap.containsKey(useSite)) {
return null;
}
if (NodeUtil.isGetProp(useSite)) {
String propName = useSite.getLastChild().getString();
if (propName.equals("apply") || propName.equals("call")) {
useSite = useSite.getFirstChild();
}
}
String name = getSimplifiedName(useSite);
if (name != null) {
Collection<Definition> defs = nameDefinitionMultimap.get(name);
if (!defs.isEmpty()) {
return defs;
} else {
return null;
}
} else {
return null;
}
}
public void process(Node externs, Node source) {
NodeTraversal.traverse(
compiler, externs, new DefinitionGatheringCallback(true));
NodeTraversal.traverse(
compiler, source, new DefinitionGatheringCallback(false));
NodeTraversal.traverse(
compiler, source, new UseSiteGatheringCallback());
}
/**
* Returns a collection of use sites that may refer to provided
* definition. Returns an empty collection if the definition is not
* used anywhere.
*
* @param definition Definition of interest.
* @return use site collection.
*/
Collection<UseSite> getUseSites(Definition definition) {
String name = getSimplifiedName(definition.getLValue());
return nameUseSiteMultimap.get(name);
}
/**
* Extract a name from a node. In the case of GETPROP nodes,
* replace the namespace or object expression with "this" for
* simplicity and correctness at the expense of inefficiencies due
* to higher chances of name collisions.
*
* TODO(user) revisit. it would be helpful to at least use fully
* qualified names in the case of namespaces. Might not matter as
* much if this pass runs after "collapsing properties".
*/
private static String getSimplifiedName(Node node) {
if (NodeUtil.isName(node)) {
String name = node.getString();
if (name != null && name.length()!=0) {
return name;
} else {
return null;
}
} else if (NodeUtil.isGetProp(node)) {
return "this." + node.getLastChild().getString();
}
return null;
}
private class DefinitionGatheringCallback extends AbstractPostOrderCallback {
private boolean inExterns;
DefinitionGatheringCallback(boolean inExterns) {
this.inExterns = inExterns;
}
public void visit(NodeTraversal traversal, Node node, Node parent) {
// Arguments of external functions should not count as name
// definitions. They are placeholder names for documentation
// purposes only which are not reachable from anywhere.
if (inExterns && NodeUtil.isName(node) && parent.getType() == Token.LP) {
return;
}
Definition def =
DefinitionsRemover.getDefinition(node, inExterns);
if (def != null) {
String name = getSimplifiedName(def.getLValue());
if (name != null) {
Node rValue = def.getRValue();
if ((rValue != null) &&
!NodeUtil.isImmutableValue(rValue) &&
!NodeUtil.isFunction(rValue)) {
// Unhandled complex expression
Definition unknownDef =
new UnknownDefinition(def.getLValue(), inExterns);
def = unknownDef;
}
// TODO(johnlenz) : remove this stub dropping code if it becomes
// illegal to have untyped stubs in the externs definitions.
if (inExterns) {
// We need special handling of untyped externs stubs here:
// the stub should be dropped if the name is provided elsewhere.
List<Definition> stubsToRemove = Lists.newArrayList();
String qualifiedName = node.getQualifiedName();
// If there is no qualified name for this, then there will be
// no stubs to remove. This will happen if node is an object
// literal key.
if (qualifiedName != null) {
for (Definition prevDef : nameDefinitionMultimap.get(name)) {
if (prevDef instanceof ExternalNameOnlyDefinition
&& !jsdocContainsDeclarations(node)) {
String prevName = prevDef.getLValue().getQualifiedName();
if (qualifiedName.equals(prevName)) {
// Drop this stub, there is a real definition.
stubsToRemove.add(prevDef);
}
}
}
for (Definition prevDef : stubsToRemove) {
nameDefinitionMultimap.remove(name, prevDef);
}
}
}
nameDefinitionMultimap.put(name, def);
definitionSiteMap.put(node,
new DefinitionSite(node,
def,
traversal.getModule(),
traversal.inGlobalScope(),
inExterns));
}
}
if (inExterns && (parent != null) && NodeUtil.isExpressionNode(parent)) {
String name = getSimplifiedName(node);
if (name != null) {
// TODO(johnlenz) : remove this code if it becomes illegal to have
// stubs in the externs definitions.
// We need special handling of untyped externs stubs here:
// the stub should be dropped if the name is provided elsewhere.
// We can't just drop the stub now as it needs to be used as the
// externs definition if no other definition is provided.
boolean dropStub = false;
if (!jsdocContainsDeclarations(node)) {
String qualifiedName = node.getQualifiedName();
if (qualifiedName != null) {
for (Definition prevDef : nameDefinitionMultimap.get(name)) {
String prevName = prevDef.getLValue().getQualifiedName();
if (qualifiedName.equals(prevName)) {
dropStub = true;
break;
}
}
}
}
if (!dropStub) {
// Incomplete definition
Definition definition = new ExternalNameOnlyDefinition(node);
nameDefinitionMultimap.put(name, definition);
definitionSiteMap.put(node,
new DefinitionSite(node,
definition,
traversal.getModule(),
traversal.inGlobalScope(),
inExterns));
}
}
}
}
/**
* @return Whether the node has a JSDoc that actually declares something.
*/
private boolean jsdocContainsDeclarations(Node node) {
JSDocInfo info = node.getJSDocInfo();
return (info != null && info.containsDeclaration());
}
}
private class UseSiteGatheringCallback extends AbstractPostOrderCallback {
public void visit(NodeTraversal traversal, Node node, Node parent) {
Collection<Definition> defs = getDefinitionsReferencedAt(node);
if (defs == null) {
return;
}
Definition first = defs.iterator().next();
String name = getSimplifiedName(first.getLValue());
Preconditions.checkNotNull(name);
nameUseSiteMultimap.put(
name,
new UseSite(node, traversal.getScope(), traversal.getModule()));
}
}
/**
* @param use A use site to check.
* @return Whether the use is a call or new.
*/
static boolean isCallOrNewSite(UseSite use) {
Node call = use.node.getParent();
if (call == null) {
// The node has been removed from the AST.
return false;
}
// We need to make sure we're dealing with a call to the function we're
// optimizing. If the the first child of the parent is not the site, this
// is a nested call and it's a call to another function.
return NodeUtil.isCallOrNew(call) && call.getFirstChild() == use.node;
}
boolean canModifyDefinition(Definition definition) {
if (isExported(definition)) {
return false;
}
// Don't modify unused definitions for two reasons:
// 1) It causes unnecessary churn
// 2) Other definitions might be used to reflect on this one using
// goog.reflect.object (the check for definitions with uses is below).
Collection<UseSite> useSites = getUseSites(definition);
if (useSites.isEmpty()) {
return false;
}
for (UseSite site : useSites) {
// This catches the case where an object literal in goog.reflect.object
// and a prototype method have the same property name.
// NOTE(nicksantos): Maps and trogedit both do this by different
// mechanisms.
Node nameNode = site.node;
Collection<Definition> singleSiteDefinitions =
getDefinitionsReferencedAt(nameNode);
if (singleSiteDefinitions.size() > 1) {
return false;
}
Preconditions.checkState(!singleSiteDefinitions.isEmpty());
Preconditions.checkState(singleSiteDefinitions.contains(definition));
}
return true;
}
/**
* @return Whether the definition is directly exported.
*/
private boolean isExported(Definition definition) {
// Assume an exported method result is used.
Node lValue = definition.getLValue();
if (lValue == null) {
return true;
}
String partialName;
if (NodeUtil.isGetProp(lValue)) {
partialName = lValue.getLastChild().getString();
} else if (NodeUtil.isName(lValue)) {
partialName = lValue.getString();
} else {
// GETELEM is assumed to be an export or other expression are unknown
// uses.
return true;
}
CodingConvention codingConvention = compiler.getCodingConvention();
if (codingConvention.isExported(partialName)) {
return true;
}
return false;
}
/**
* @return Whether the function is defined in a non-aliasing expression.
*/
static boolean isSimpleFunctionDeclaration(Node fn) {
Node parent = fn.getParent();
Node gramps = parent.getParent();
// Simple definition finder doesn't provide useful results in some
// cases, specifically:
// - functions with recursive definitions
// - functions defined in object literals
// - functions defined in array litersals
// Here we defined a set of known function declaration that are 'ok'.
// Some projects seem to actually define "JSCompiler_renameProperty"
// rather than simply having an extern definition. Don't mess with it.
Node nameNode = SimpleDefinitionFinder.getNameNodeFromFunctionNode(fn);
if (nameNode != null
&& NodeUtil.isName(nameNode)) {
String name = nameNode.getString();
if (name.equals(NodeUtil.JSC_PROPERTY_NAME_FN) ||
name.equals(
ObjectPropertyStringPreprocess.EXTERN_OBJECT_PROPERTY_STRING)) {
return false;
}
}
// example: function a(){};
if (NodeUtil.isFunctionDeclaration(fn)) {
return true;
}
// example: a = function(){};
// example: var a = function(){};
if (fn.getFirstChild().getString().length()==0
&& (NodeUtil.isExprAssign(gramps) || NodeUtil.isName(parent))) {
return true;
}
return false;
}
/**
* @return the node defining the name for this function (if any).
*/
static Node getNameNodeFromFunctionNode(Node function) {
Preconditions.checkState(NodeUtil.isFunction(function));
if (NodeUtil.isFunctionDeclaration(function)) {
return function.getFirstChild();
} else {
Node parent = function.getParent();
if (NodeUtil.isVarDeclaration(parent)) {
return parent;
} else if (NodeUtil.isAssign(parent)) {
return parent.getFirstChild();
} else if (NodeUtil.isObjectLitKey(parent, parent.getParent())) {
return parent;
}
}
return null;
}
/**
* Traverse a node and its children and remove any references to from
* the structures.
*/
void removeReferences(Node node) {
if (DefinitionsRemover.isDefinitionNode(node)) {
DefinitionSite defSite = definitionSiteMap.get(node);
if (defSite != null) {
Definition def = defSite.definition;
String name = getSimplifiedName(def.getLValue());
if (name != null) {
this.definitionSiteMap.remove(node);
this.nameDefinitionMultimap.remove(name, node);
}
}
} else {
Node useSite = node;
if (NodeUtil.isGetProp(useSite)) {
String propName = useSite.getLastChild().getString();
if (propName.equals("apply") || propName.equals("call")) {
useSite = useSite.getFirstChild();
}
}
String name = getSimplifiedName(useSite);
if (name != null) {
this.nameUseSiteMultimap.remove(name, new UseSite(useSite, null, null));
}
}
for (Node child : node.children()) {
removeReferences(child);
}
}
}
| apache-2.0 |
fivesmallq/web-data-extractor | src/main/java/im/nll/data/extractor/utils/StringUtils.java | 76953 | package im.nll.data.extractor.utils;
import org.slf4j.Logger;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.MessageFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtils {
private static final Logger logger = Logs.get();
/**
* The empty String <code>""</code>.
*
* @since 2.0
*/
public static final String EMPTY = "";
/**
* An empty immutable {@code String} array.
*/
public static final String[] EMPTY_STRING_ARRAY = new String[0];
// 日期正则
private final static String strictDatePattern = "\\d{2,4}[-年/\\s]*\\d{1,2}[-月/\\s]*\\d{1,2}[\\s日/]*(\\d{1,2}:\\d{1,2}(:\\d{1,2})?)?";
private static final int INDEX_NOT_FOUND = -1;
private static Pattern strictDateRegexPattern = Pattern.compile(
strictDatePattern, Pattern.CANON_EQ | Pattern.DOTALL
| Pattern.CASE_INSENSITIVE);
private static final Set<String> IRRELEVANT_PARAMETERS = new HashSet<String>(
3);
static {
IRRELEVANT_PARAMETERS.add("jsessionid");
IRRELEVANT_PARAMETERS.add("phpsessid");
IRRELEVANT_PARAMETERS.add("aspsessionid");
}
public static boolean isUrl(String url) {
if (url == null || url.length() == 0) {
return false;
}
// NOTE:为了支持参数化的url,故暂时不用正则的方式来严格的校验
return url.startsWith("http://") || url.startsWith("https://");
}
public static boolean isNullOrEmpty(String content) {
return content == null || content.length() == 0
|| "null".equals(content);
}
public static boolean isNotNullOrEmpty(String content) {
return (content != null) && (content.length() > 0);
}
public static String defaultIfNullOrEmpty(String str, String defaultStr) {
return StringUtils.isNullOrEmpty(str) ? defaultStr : str;
}
/**
* 获取数字字符.
*
* @param str
* @return
*/
public static String getNumStr(String str) {
if (isNullOrEmpty(str)) {
return "";
}
Pattern numPattern = Pattern.compile("\\d");
Matcher matcher = numPattern.matcher(str);
StringBuilder builder = new StringBuilder();
while (matcher.find()) {
builder.append(matcher.group());
}
return builder.toString();
}
/**
* 获取最后一个字符,如果为空返回"";
*
* @param str
* @return
*/
public static String last(String str) {
if (StringUtils.isNotNullOrEmpty(str)) {
return str.substring(str.length() - 1, str.length());
} else {
return "";
}
}
// Empty checks
// -----------------------------------------------------------------------
/**
* <p>
* Checks if a CharSequence is empty ("") or null.
* </p>
* <p>
* <pre>
* StringUtils.isEmpty(null) = true
* StringUtils.isEmpty("") = true
* StringUtils.isEmpty(" ") = false
* StringUtils.isEmpty("bob") = false
* StringUtils.isEmpty(" bob ") = false
* </pre>
* <p>
* <p>
* NOTE: This method changed in Lang version 2.0. It no longer trims the
* CharSequence. That functionality is available in isBlank().
* </p>
*
* @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is empty or null
* @since 3.0 Changed signature from isEmpty(String) to
* isEmpty(CharSequence)
*/
public static boolean isEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
/**
* <p>
* Checks if a String is whitespace, empty ("") or null.
* </p>
* <p>
* <pre>
* StringUtils.isBlank(null) = true
* StringUtils.isBlank("") = true
* StringUtils.isBlank(" ") = true
* StringUtils.isBlank("bob") = false
* StringUtils.isBlank(" bob ") = false
* </pre>
*
* @param str the String to check, may be null
* @return <code>true</code> if the String is null, empty or whitespace
* @since 2.0
*/
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if ((Character.isWhitespace(str.charAt(i)) == false)) {
return false;
}
}
return true;
}
/**
* <p>
* Capitalizes a String changing the first letter to title case as per
* {@link Character#toTitleCase(char)}. No other letters are changed.
* </p>
* <p>
* <p>
* <code>null</code> input String returns <code>null</code>.
* </p>
* <p>
* <pre>
* StringUtils.capitalize(null) = null
* StringUtils.capitalize("") = ""
* StringUtils.capitalize("cat") = "Cat"
* StringUtils.capitalize("cAt") = "CAt"
* </pre>
*
* @param str the String to capitalize, may be null
* @return the capitalized String, <code>null</code> if null String input
* @since 2.0
*/
public static String capitalize(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return str;
}
return new StringBuffer(strLen)
.append(Character.toTitleCase(str.charAt(0)))
.append(str.substring(1)).toString();
}
// SubStringAfter/SubStringBefore
// -----------------------------------------------------------------------
/**
* <p>
* Gets the substring before the first occurrence of a separator. The
* separator is not returned.
* </p>
* <p>
* <p>
* A {@code null} string input will return {@code null}. An empty ("")
* string input will return the empty string. A {@code null} separator will
* return the input string.
* </p>
* <p>
* <p>
* If nothing is found, the string input is returned.
* </p>
* <p>
* <pre>
* StringUtils.substringBefore(null, *) = null
* StringUtils.substringBefore("", *) = ""
* StringUtils.substringBefore("abc", "a") = ""
* StringUtils.substringBefore("abcba", "b") = "a"
* StringUtils.substringBefore("abc", "c") = "ab"
* StringUtils.substringBefore("abc", "d") = "abc"
* StringUtils.substringBefore("abc", "") = ""
* StringUtils.substringBefore("abc", null) = "abc"
* </pre>
*
* @param str the String to get a substring from, may be null
* @param separator the String to search for, may be null
* @return the substring before the first occurrence of the separator,
* {@code null} if null String input
* @since 2.0
*/
public static String substringBefore(String str, String separator) {
if (isEmpty(str) || separator == null) {
return str;
}
if (separator.length() == 0) {
return EMPTY;
}
int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
return str.substring(0, pos);
}
/**
* 截取指定字符的前一个字符.
*
* @param str
* @param separator
* @return
*/
public static String substringBeforeLastChar(String str, String separator) {
if (isEmpty(str) || isEmpty(separator)) {
return str;
}
int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
if (pos == 0) {
return "";
}
return str.substring(pos - 1, pos);
}
/**
* <p>
* Gets the substring after the first occurrence of a separator. The
* separator is not returned.
* </p>
* <p>
* <p>
* A {@code null} string input will return {@code null}. An empty ("")
* string input will return the empty string. A {@code null} separator will
* return the empty string if the input string is not {@code null}.
* </p>
* <p>
* <p>
* If nothing is found, the empty string is returned.
* </p>
* <p>
* <pre>
* StringUtils.substringAfter(null, *) = null
* StringUtils.substringAfter("", *) = ""
* StringUtils.substringAfter(*, null) = ""
* StringUtils.substringAfter("abc", "a") = "bc"
* StringUtils.substringAfter("abcba", "b") = "cba"
* StringUtils.substringAfter("abc", "c") = ""
* StringUtils.substringAfter("abc", "d") = ""
* StringUtils.substringAfter("abc", "") = "abc"
* </pre>
*
* @param str the String to get a substring from, may be null
* @param separator the String to search for, may be null
* @return the substring after the first occurrence of the separator,
* {@code null} if null String input
* @since 2.0
*/
public static String substringAfter(String str, String separator) {
if (isEmpty(str)) {
return str;
}
if (separator == null) {
return EMPTY;
}
int pos = str.indexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return EMPTY;
}
return str.substring(pos + separator.length());
}
/**
* <p>
* Gets the substring before the last occurrence of a separator. The
* separator is not returned.
* </p>
* <p>
* <p>
* A {@code null} string input will return {@code null}. An empty ("")
* string input will return the empty string. An empty or {@code null}
* separator will return the input string.
* </p>
* <p>
* <p>
* If nothing is found, the string input is returned.
* </p>
* <p>
* <pre>
* StringUtils.substringBeforeLast(null, *) = null
* StringUtils.substringBeforeLast("", *) = ""
* StringUtils.substringBeforeLast("abcba", "b") = "abc"
* StringUtils.substringBeforeLast("abc", "c") = "ab"
* StringUtils.substringBeforeLast("a", "a") = ""
* StringUtils.substringBeforeLast("a", "z") = "a"
* StringUtils.substringBeforeLast("a", null) = "a"
* StringUtils.substringBeforeLast("a", "") = "a"
* </pre>
*
* @param str the String to get a substring from, may be null
* @param separator the String to search for, may be null
* @return the substring before the last occurrence of the separator,
* {@code null} if null String input
* @since 2.0
*/
public static String substringBeforeLast(String str, String separator) {
if (isEmpty(str) || isEmpty(separator)) {
return str;
}
int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND) {
return str;
}
return str.substring(0, pos);
}
/**
* <p>
* Gets the substring after the last occurrence of a separator. The
* separator is not returned.
* </p>
* <p>
* <p>
* A {@code null} string input will return {@code null}. An empty ("")
* string input will return the empty string. An empty or {@code null}
* separator will return the empty string if the input string is not
* {@code null}.
* </p>
* <p>
* <p>
* If nothing is found, the empty string is returned.
* </p>
* <p>
* <pre>
* StringUtils.substringAfterLast(null, *) = null
* StringUtils.substringAfterLast("", *) = ""
* StringUtils.substringAfterLast(*, "") = ""
* StringUtils.substringAfterLast(*, null) = ""
* StringUtils.substringAfterLast("abc", "a") = "bc"
* StringUtils.substringAfterLast("abcba", "b") = "a"
* StringUtils.substringAfterLast("abc", "c") = ""
* StringUtils.substringAfterLast("a", "a") = ""
* StringUtils.substringAfterLast("a", "z") = ""
* </pre>
*
* @param str the String to get a substring from, may be null
* @param separator the String to search for, may be null
* @return the substring after the last occurrence of the separator,
* {@code null} if null String input
* @since 2.0
*/
public static String substringAfterLast(String str, String separator) {
if (isEmpty(str)) {
return str;
}
if (isEmpty(separator)) {
return EMPTY;
}
int pos = str.lastIndexOf(separator);
if (pos == INDEX_NOT_FOUND || pos == str.length() - separator.length()) {
return EMPTY;
}
return str.substring(pos + separator.length());
}
/**
* <p>
* Gets the String that is nested in between two Strings. Only the first
* match is returned.
* </p>
* <p>
* <p>
* A <code>null</code> input String returns <code>null</code>. A
* <code>null</code> open/close returns <code>null</code> (no match). An
* empty ("") open and close returns an empty string.
* </p>
* <p>
* <pre>
* StringUtils.substringBetween("wx[b]yz", "[", "]") = "b"
* StringUtils.substringBetween(null, *, *) = null
* StringUtils.substringBetween(*, null, *) = null
* StringUtils.substringBetween(*, *, null) = null
* StringUtils.substringBetween("", "", "") = ""
* StringUtils.substringBetween("", "", "]") = null
* StringUtils.substringBetween("", "[", "]") = null
* StringUtils.substringBetween("yabcz", "", "") = ""
* StringUtils.substringBetween("yabcz", "y", "z") = "abc"
* StringUtils.substringBetween("yabczyabcz", "y", "z") = "abc"
* </pre>
*
* @param str the String containing the substring, may be null
* @param open the String before the substring, may be null
* @param close the String after the substring, may be null
* @return the substring, <code>null</code> if no match
* @since 2.0
*/
public static String substringBetween(String str, String open, String close) {
if (str == null || open == null || close == null) {
return null;
}
int start = str.indexOf(open);
if (start != INDEX_NOT_FOUND) {
int end = str.indexOf(close, start + open.length());
if (end != INDEX_NOT_FOUND) {
return str.substring(start + open.length(), end);
}
}
return null;
}
/**
* 置空字符串
*
* @param content 判断的字符串
* @return 如果字符串为空,返回"",否则返回原文
*/
public static String empty(String content) {
return StringUtils.isNullOrEmpty(content) ? "" : content;
}
/**
* 支持的格式串:yyyy,yy,MM,M,dd,d ,其中:
* yyyy(四位年),yy(两位年),MM(两位月,如果不足两位,前导0补齐),M(月,不补齐),dd(两位日,如果不足两位,前导0补齐),d(日,
* 不补齐)
*
* @param oldUrl
* @return
*/
public static String preProcessUrl(String oldUrl) {
//
if (oldUrl.indexOf('{') >= 0) {
String tempUrl = oldUrl.replace("{", "{0,date,");
return MessageFormat.format(tempUrl, new Date());
}
return oldUrl;
}
public static Date normalizeStr2Date(String before) throws ParseException
{
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String afterDateString = normalizeDate(before);
return formatter.parse(afterDateString);
}
/**
* normalization date string,<br>
* not support two-digit year,not support time-only string
*
* @return normalized date string,format is:yyyy-MM-dd HH:mm:ss
*/
public static String normalizeDate(String before) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (StringUtils.isNullOrEmpty(before)) {
return formatter.format(new java.util.Date());
}
int[] calendarField = new int[]{Calendar.YEAR, Calendar.MONTH,
Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY, Calendar.MINUTE,
Calendar.SECOND};
Calendar calendar = Calendar.getInstance();
try {
Matcher matcher = strictDateRegexPattern.matcher(before);
if (matcher.find()) {
before = matcher.group();
}
String[] tmp = before.replaceAll("\\D", " ").split("\\s+");
int i = 0, j = 0;
if (tmp != null && tmp.length > 0 && "".equals(tmp[0])) {
i = 1;
}
if (Integer.parseInt(tmp[i]) < 13) {
j = 1;
}
for (; i < tmp.length; i++, j++) {
if (j == 1) {
calendar.set(calendarField[j], Integer.parseInt(tmp[i]) - 1);
} else {
calendar.set(calendarField[j], Integer.parseInt(tmp[i]));
}
}
for (; j < calendarField.length; j++) {
calendar.set(calendarField[j], 0);
}
return formatter.format(calendar.getTime());
} catch (Exception e) {
logger.error("日期转换错误,内容:(" + before.length() + ")" + before);
return formatter.format(new Date());
}
}
/**
* 转换为int型,如果不能转换,则返回-1
*
* @param value
* @return
*/
public static int tryParseInt(String value) {
try {
return Integer.parseInt(value);
} catch (Exception e) {
return -1;
}
}
/**
* 转换为int型,如果不能转换,则返回defaultValue
*
* @param value
* @param defaultValue
* @return
*/
public static int tryParseInt(String value, int defaultValue) {
try {
return Integer.parseInt(value);
} catch (Exception e) {
return defaultValue;
}
}
/**
* 转换为Date型,如果不能转换,则返回now
*
* @param value
* @return
*/
@SuppressWarnings("deprecation")
public static Date tryParseDate(String value) {
try {
return new Date(Date.parse(value));
} catch (Exception e) {
return new Date();
}
}
/**
* 转换为Date型,如果不能转换,则返回defaultValue
*
* @param value
* @param defaultValue
* @return
*/
@SuppressWarnings("deprecation")
public static Date tryParseDate(String value, Date defaultValue) {
try {
return new Date(Date.parse(value));
} catch (Exception e) {
return defaultValue;
}
}
/**
* 解析http头中包含的日期
*
* @param value
* @return
*/
public static Date parseHttpDate(String value) {
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
"EEE, dd MMM yyyy HH:mm:ss", Locale.US);
Date expires = simpleDateFormat.parse(value);
return expires;
} catch (Exception e) {
return tryParseDate(value);
}
}
/**
* 批量格式化url,通过相对url获取绝对url
*
* @param baseUrl
* @param urlList
* @return
*/
public static List<String> normalizeUrl(String baseUrl, List<String> urlList) {
List<String> newUrlList = new ArrayList<>();
for (String url : urlList) {
newUrlList.add(normalizeUrl(baseUrl, url));
}
return newUrlList;
}
/**
* 批量格式化url,通过相对url获取绝对url
*
* @param baseUrl
* @param urlList
* @param urlSuffix url后缀
* @return
*/
public static List<String> normalizeUrl(String baseUrl,
List<String> urlList, String urlSuffix) {
List<String> newUrlList = new ArrayList<>();
for (String url : urlList) {
newUrlList.add(normalizeUrl(baseUrl, url) + urlSuffix);
}
return newUrlList;
}
/**
* 格式化url,通过相对url获取绝对url
*
* @param baseUrl 相对地址所在地址
* @param urlString 相对地址
* @return
*/
public static String normalizeUrl(String baseUrl, String urlString) {
URL base;
try {
try {
base = new URL(baseUrl);
} catch (MalformedURLException e) {
// the base is unsuitable, but the attribute may be abs on its
// own, so try that
URL abs = new URL(urlString);
return abs.toExternalForm();
}
// workaround: java resolves '//path/file + ?foo' to '//path/?foo',
// not '//path/file?foo' as desired
if (urlString.startsWith("?"))
urlString = base.getPath() + urlString;
URL abs = new URL(base, urlString);
return abs.toExternalForm();
} catch (MalformedURLException e) {
return "";
}
}
/**
* Takes a query string, separates the constituent name-value pairs, and
* stores them in a SortedMap ordered by lexicographical order.
*
* @param queryString the query string
* @return Null if there is no query string.
*/
private static SortedMap<String, String> createParameterMap(
final String queryString) {
if (queryString == null || queryString.isEmpty()) {
return null;
}
final String[] pairs = queryString.split("&");
final SortedMap<String, String> params = new TreeMap<String, String>();
for (final String pair : pairs) {
if (pair.length() == 0) {
continue;
}
String[] tokens = pair.split("=", 2);
switch (tokens.length) {
case 1:
if (pair.charAt(0) == '=') {
params.put("", tokens[0]);
} else {
params.put(tokens[0], "");
}
break;
case 2:
params.put(tokens[0], tokens[1]);
break;
}
}
return params;
}
/**
* Canonicalize the query string.
*
* @param sortedParamMap Parameter name-value pairs in lexicographical order.
* @return Canonical form of query string.
*/
private static String canonicalize(
final SortedMap<String, String> sortedParamMap) {
if (sortedParamMap == null || sortedParamMap.isEmpty()) {
return "";
}
final StringBuilder sb = new StringBuilder(100);
for (Map.Entry<String, String> pair : sortedParamMap.entrySet()) {
final String key = pair.getKey().toLowerCase();
// Ignore irrelevant parameters
if (IRRELEVANT_PARAMETERS.contains(key) || key.startsWith("utm_")) {
continue;
}
if (sb.length() > 0) {
sb.append('&');
}
sb.append(percentEncodeRfc3986(pair.getKey()));
if (!pair.getValue().isEmpty()) {
sb.append('=');
sb.append(percentEncodeRfc3986(pair.getValue()));
}
}
return sb.toString();
}
/**
* Percent-encode values according the RFC 3986. The built-in Java
* URLEncoder does not encode according to the RFC, so we make the extra
* replacements.
*
* @param string Decoded string.
* @return Encoded string per RFC 3986.
*/
private static String percentEncodeRfc3986(String string) {
try {
string = string.replace("+", "%2B");
string = URLDecoder.decode(string, "UTF-8");
string = URLEncoder.encode(string, "UTF-8");
return string.replace("+", "%20").replace("*", "%2A")
.replace("%7E", "~");
} catch (Exception e) {
return string;
}
}
/**
* Normalize path.
*
* @param path the path
* @return the string
*/
private static String normalizePath(final String path) {
return path.replace("%7E", "~").replace(" ", "%20");
}
/**
* <p>
* Joins the elements of the provided {@code Iterable} into a single String
* containing the provided elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. Null objects or empty
* strings within the iteration are represented by empty strings.
* </p>
* <p>
* <p>
* See the examples here: {@link #join(Object[], char)}.
* </p>
*
* @param iterable the {@code Iterable} providing the values to join together,
* may be null
* @param separator the separator character to use
* @return the joined String, {@code null} if null iterator input
* @since 2.3
*/
public static String join(Iterable<?> iterable, char separator) {
if (iterable == null) {
return null;
}
return join(iterable.iterator(), separator);
}
/**
* <p>
* Joins the elements of the provided {@code Iterable} into a single String
* containing the provided elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. A {@code null} separator
* is the same as an empty String ("").
* </p>
* <p>
* <p>
* See the examples here: {@link #join(Object[], String)}.
* </p>
*
* @param iterable the {@code Iterable} providing the values to join together,
* may be null
* @param separator the separator character to use, null treated as ""
* @return the joined String, {@code null} if null iterator input
* @since 2.3
*/
public static String join(Iterable<?> iterable, String separator) {
if (iterable == null) {
return null;
}
return join(iterable.iterator(), separator);
}
/**
* <p>
* Joins the elements of the provided array into a single String containing
* the provided list of elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. Null objects or empty
* strings within the array are represented by empty strings.
* </p>
* <p>
* <pre>
* StringUtils.join(null, *) = null
* StringUtils.join([], *) = ""
* StringUtils.join([null], *) = ""
* StringUtils.join(["a", "b", "c"], ';') = "a;b;c"
* StringUtils.join(["a", "b", "c"], null) = "abc"
* StringUtils.join([null, "", "a"], ';') = ";;a"
* </pre>
*
* @param array the array of values to join together, may be null
* @param separator the separator character to use
* @return the joined String, {@code null} if null array input
* @since 2.0
*/
public static String join(Object[] array, char separator) {
if (array == null) {
return null;
}
return join(array, separator, 0, array.length);
}
/**
* <p>
* Joins the elements of the provided array into a single String containing
* the provided list of elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. Null objects or empty
* strings within the array are represented by empty strings.
* </p>
* <p>
* <pre>
* StringUtils.join(null, *) = null
* StringUtils.join([], *) = ""
* StringUtils.join([null], *) = ""
* StringUtils.join(["a", "b", "c"], ';') = "a;b;c"
* StringUtils.join(["a", "b", "c"], null) = "abc"
* StringUtils.join([null, "", "a"], ';') = ";;a"
* </pre>
*
* @param array the array of values to join together, may be null
* @param separator the separator character to use
* @param startIndex the first index to start joining from. It is an error to pass
* in an end index past the end of the array
* @param endIndex the index to stop joining from (exclusive). It is an error to
* pass in an end index past the end of the array
* @return the joined String, {@code null} if null array input
* @since 2.0
*/
public static String join(Object[] array, char separator, int startIndex,
int endIndex) {
if (array == null) {
return null;
}
int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
}
if (array[i] != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
/**
* <p>
* Joins the elements of the provided array into a single String containing
* the provided list of elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. A {@code null} separator
* is the same as an empty String (""). Null objects or empty strings within
* the array are represented by empty strings.
* </p>
* <p>
* <pre>
* StringUtils.join(null, *) = null
* StringUtils.join([], *) = ""
* StringUtils.join([null], *) = ""
* StringUtils.join(["a", "b", "c"], "--") = "a--b--c"
* StringUtils.join(["a", "b", "c"], null) = "abc"
* StringUtils.join(["a", "b", "c"], "") = "abc"
* StringUtils.join([null, "", "a"], ',') = ",,a"
* </pre>
*
* @param array the array of values to join together, may be null
* @param separator the separator character to use, null treated as ""
* @return the joined String, {@code null} if null array input
*/
public static String join(Object[] array, String separator) {
if (array == null) {
return null;
}
return join(array, separator, 0, array.length);
}
/**
* <p>
* Joins the elements of the provided array into a single String containing
* the provided list of elements.
* </p>
* <p>
* <p>
* No delimiter is added before or after the list. A {@code null} separator
* is the same as an empty String (""). Null objects or empty strings within
* the array are represented by empty strings.
* </p>
* <p>
* <pre>
* StringUtils.join(null, *) = null
* StringUtils.join([], *) = ""
* StringUtils.join([null], *) = ""
* StringUtils.join(["a", "b", "c"], "--") = "a--b--c"
* StringUtils.join(["a", "b", "c"], null) = "abc"
* StringUtils.join(["a", "b", "c"], "") = "abc"
* StringUtils.join([null, "", "a"], ',') = ",,a"
* </pre>
*
* @param array the array of values to join together, may be null
* @param separator the separator character to use, null treated as ""
* @param startIndex the first index to start joining from. It is an error to pass
* in an end index past the end of the array
* @param endIndex the index to stop joining from (exclusive). It is an error to
* pass in an end index past the end of the array
* @return the joined String, {@code null} if null array input
*/
public static String join(Object[] array, String separator, int startIndex,
int endIndex) {
if (array == null) {
return null;
}
if (separator == null) {
separator = EMPTY;
}
// endIndex - startIndex > 0: Len = NofStrings *(len(firstString) +
// len(separator))
// (Assuming that all Strings are roughly equally long)
int noOfItems = endIndex - startIndex;
if (noOfItems <= 0) {
return EMPTY;
}
StringBuilder buf = new StringBuilder(noOfItems * 16);
for (int i = startIndex; i < endIndex; i++) {
if (i > startIndex) {
buf.append(separator);
}
if (array[i] != null) {
buf.append(array[i]);
}
}
return buf.toString();
}
// Joining
// -----------------------------------------------------------------------
/**
* <p>
* Joins the elements of the provided array into a single String containing
* the provided list of elements.
* </p>
* <p>
* <p>
* No separator is added to the joined String. Null objects or empty strings
* within the array are represented by empty strings.
* </p>
* <p>
* <pre>
* StringUtils.join(null) = null
* StringUtils.join([]) = ""
* StringUtils.join([null]) = ""
* StringUtils.join(["a", "b", "c"]) = "abc"
* StringUtils.join([null, "", "a"]) = "a"
* </pre>
*
* @param <T> the specific type of values to join together
* @param elements the values to join together, may be null
* @return the joined String, {@code null} if null array input
* @since 3.0 Changed signature to use varargs
*/
@SuppressWarnings("unchecked")
public static <T> String join(T... elements) {
return join(elements, null);
}
// Nested extraction
// -----------------------------------------------------------------------
// Splitting
// -----------------------------------------------------------------------
/**
* <p>
* Splits the provided text into an array, using whitespace as the
* separator. Whitespace is defined by {@link Character#isWhitespace(char)}.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as one separator. For more control over the split
* use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}.
* </p>
* <p>
* <pre>
* StringUtils.split(null) = null
* StringUtils.split("") = []
* StringUtils.split("abc def") = ["abc", "def"]
* StringUtils.split("abc def") = ["abc", "def"]
* StringUtils.split(" abc ") = ["abc"]
* </pre>
*
* @param str the String to parse, may be null
* @return an array of parsed Strings, {@code null} if null String input
*/
public static String[] split(final String str) {
return split(str, null, -1);
}
/**
* <p>
* Splits the provided text into an array, separator specified. This is an
* alternative to using StringTokenizer.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as one separator. For more control over the split
* use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}.
* </p>
* <p>
* <pre>
* StringUtils.split(null, *) = null
* StringUtils.split("", *) = []
* StringUtils.split("a.b.c", '.') = ["a", "b", "c"]
* StringUtils.split("a..b.c", '.') = ["a", "b", "c"]
* StringUtils.split("a:b:c", '.') = ["a:b:c"]
* StringUtils.split("a b c", ' ') = ["a", "b", "c"]
* </pre>
*
* @param str the String to parse, may be null
* @param separatorChar the character used as the delimiter
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.0
*/
public static String[] split(final String str, final char separatorChar) {
return splitWorker(str, separatorChar, false);
}
/**
* <p>
* Splits the provided text into an array, separators specified. This is an
* alternative to using StringTokenizer.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as one separator. For more control over the split
* use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separatorChars splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.split(null, *) = null
* StringUtils.split("", *) = []
* StringUtils.split("abc def", null) = ["abc", "def"]
* StringUtils.split("abc def", " ") = ["abc", "def"]
* StringUtils.split("abc def", " ") = ["abc", "def"]
* StringUtils.split("ab:cd:ef", ":") = ["ab", "cd", "ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separatorChars the characters used as the delimiters, {@code null} splits on
* whitespace
* @return an array of parsed Strings, {@code null} if null String input
*/
public static String[] split(final String str, final String separatorChars) {
return splitWorker(str, separatorChars, -1, false);
}
/**
* <p>
* Splits the provided text into an array with a maximum length, separators
* specified.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as one separator.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separatorChars splits on whitespace.
* </p>
* <p>
* <p>
* If more than {@code max} delimited substrings are found, the last
* returned string includes all characters after the first {@code max - 1}
* returned strings (including separator characters).
* </p>
* <p>
* <pre>
* StringUtils.split(null, *, *) = null
* StringUtils.split("", *, *) = []
* StringUtils.split("ab cd ef", null, 0) = ["ab", "cd", "ef"]
* StringUtils.split("ab cd ef", null, 0) = ["ab", "cd", "ef"]
* StringUtils.split("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"]
* StringUtils.split("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separatorChars the characters used as the delimiters, {@code null} splits on
* whitespace
* @param max the maximum number of elements to include in the array. A zero
* or negative value implies no limit
* @return an array of parsed Strings, {@code null} if null String input
*/
public static String[] split(final String str, final String separatorChars,
final int max) {
return splitWorker(str, separatorChars, max, false);
}
/**
* <p>
* Splits the provided text into an array, separator string specified.
* </p>
* <p>
* <p>
* The separator(s) will not be included in the returned String array.
* Adjacent separators are treated as one separator.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separator splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.splitByWholeSeparator(null, *) = null
* StringUtils.splitByWholeSeparator("", *) = []
* StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"]
* StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separator String containing the String to be used as a delimiter,
* {@code null} splits on whitespace
* @return an array of parsed Strings, {@code null} if null String was input
*/
public static String[] splitByWholeSeparator(final String str,
final String separator) {
return splitByWholeSeparatorWorker(str, separator, -1, false);
}
/**
* <p>
* Splits the provided text into an array, separator string specified.
* Returns a maximum of {@code max} substrings.
* </p>
* <p>
* <p>
* The separator(s) will not be included in the returned String array.
* Adjacent separators are treated as one separator.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separator splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.splitByWholeSeparator(null, *, *) = null
* StringUtils.splitByWholeSeparator("", *, *) = []
* StringUtils.splitByWholeSeparator("ab de fg", null, 0) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparator("ab de fg", null, 0) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparator("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]
* StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-", 5) = ["ab", "cd", "ef"]
* StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-", 2) = ["ab", "cd-!-ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separator String containing the String to be used as a delimiter,
* {@code null} splits on whitespace
* @param max the maximum number of elements to include in the returned
* array. A zero or negative value implies no limit.
* @return an array of parsed Strings, {@code null} if null String was input
*/
public static String[] splitByWholeSeparator(final String str,
final String separator, final int max) {
return splitByWholeSeparatorWorker(str, separator, max, false);
}
/**
* <p>
* Splits the provided text into an array, separator string specified.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. For more control
* over the split use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separator splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.splitByWholeSeparatorPreserveAllTokens(null, *) = null
* StringUtils.splitByWholeSeparatorPreserveAllTokens("", *) = []
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null) = ["ab", "", "", "de", "fg"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separator String containing the String to be used as a delimiter,
* {@code null} splits on whitespace
* @return an array of parsed Strings, {@code null} if null String was input
* @since 2.4
*/
public static String[] splitByWholeSeparatorPreserveAllTokens(
final String str, final String separator) {
return splitByWholeSeparatorWorker(str, separator, -1, true);
}
/**
* <p>
* Splits the provided text into an array, separator string specified.
* Returns a maximum of {@code max} substrings.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. For more control
* over the split use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separator splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.splitByWholeSeparatorPreserveAllTokens(null, *, *) = null
* StringUtils.splitByWholeSeparatorPreserveAllTokens("", *, *) = []
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null, 0) = ["ab", "de", "fg"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab de fg", null, 0) = ["ab", "", "", "de", "fg"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-", 5) = ["ab", "cd", "ef"]
* StringUtils.splitByWholeSeparatorPreserveAllTokens("ab-!-cd-!-ef", "-!-", 2) = ["ab", "cd-!-ef"]
* </pre>
*
* @param str the String to parse, may be null
* @param separator String containing the String to be used as a delimiter,
* {@code null} splits on whitespace
* @param max the maximum number of elements to include in the returned
* array. A zero or negative value implies no limit.
* @return an array of parsed Strings, {@code null} if null String was input
* @since 2.4
*/
public static String[] splitByWholeSeparatorPreserveAllTokens(
final String str, final String separator, final int max) {
return splitByWholeSeparatorWorker(str, separator, max, true);
}
/**
* Performs the logic for the {@code splitByWholeSeparatorPreserveAllTokens}
* methods.
*
* @param str the String to parse, may be {@code null}
* @param separator String containing the String to be used as a delimiter,
* {@code null} splits on whitespace
* @param max the maximum number of elements to include in the returned
* array. A zero or negative value implies no limit.
* @param preserveAllTokens if {@code true}, adjacent separators are treated as empty
* token separators; if {@code false}, adjacent separators are
* treated as one separator.
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.4
*/
private static String[] splitByWholeSeparatorWorker(final String str,
final String separator, final int max,
final boolean preserveAllTokens) {
if (str == null) {
return null;
}
final int len = str.length();
if (len == 0) {
return EMPTY_STRING_ARRAY;
}
if (separator == null || EMPTY.equals(separator)) {
// Split on whitespace.
return splitWorker(str, null, max, preserveAllTokens);
}
final int separatorLength = separator.length();
final ArrayList<String> substrings = new ArrayList<String>();
int numberOfSubstrings = 0;
int beg = 0;
int end = 0;
while (end < len) {
end = str.indexOf(separator, beg);
if (end > -1) {
if (end > beg) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
// The following is OK, because String.substring( beg,
// end ) excludes
// the character at the position 'end'.
substrings.add(str.substring(beg, end));
// Set the starting point for the next search.
// The following is equivalent to beg = end +
// (separatorLength - 1) + 1,
// which is the right calculation:
beg = end + separatorLength;
}
} else {
// We found a consecutive occurrence of the separator, so
// skip it.
if (preserveAllTokens) {
numberOfSubstrings += 1;
if (numberOfSubstrings == max) {
end = len;
substrings.add(str.substring(beg));
} else {
substrings.add(EMPTY);
}
}
beg = end + separatorLength;
}
} else {
// String.substring( beg ) goes from 'beg' to the end of the
// String.
substrings.add(str.substring(beg));
end = len;
}
}
return substrings.toArray(new String[substrings.size()]);
}
// -----------------------------------------------------------------------
/**
* <p>
* Splits the provided text into an array, using whitespace as the
* separator, preserving all tokens, including empty tokens created by
* adjacent separators. This is an alternative to using StringTokenizer.
* Whitespace is defined by {@link Character#isWhitespace(char)}.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. For more control
* over the split use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}.
* </p>
* <p>
* <pre>
* StringUtils.splitPreserveAllTokens(null) = null
* StringUtils.splitPreserveAllTokens("") = []
* StringUtils.splitPreserveAllTokens("abc def") = ["abc", "def"]
* StringUtils.splitPreserveAllTokens("abc def") = ["abc", "", "def"]
* StringUtils.splitPreserveAllTokens(" abc ") = ["", "abc", ""]
* </pre>
*
* @param str the String to parse, may be {@code null}
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.1
*/
public static String[] splitPreserveAllTokens(final String str) {
return splitWorker(str, null, -1, true);
}
/**
* <p>
* Splits the provided text into an array, separator specified, preserving
* all tokens, including empty tokens created by adjacent separators. This
* is an alternative to using StringTokenizer.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. For more control
* over the split use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}.
* </p>
* <p>
* <pre>
* StringUtils.splitPreserveAllTokens(null, *) = null
* StringUtils.splitPreserveAllTokens("", *) = []
* StringUtils.splitPreserveAllTokens("a.b.c", '.') = ["a", "b", "c"]
* StringUtils.splitPreserveAllTokens("a..b.c", '.') = ["a", "", "b", "c"]
* StringUtils.splitPreserveAllTokens("a:b:c", '.') = ["a:b:c"]
* StringUtils.splitPreserveAllTokens("a\tb\nc", null) = ["a", "b", "c"]
* StringUtils.splitPreserveAllTokens("a b c", ' ') = ["a", "b", "c"]
* StringUtils.splitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", ""]
* StringUtils.splitPreserveAllTokens("a b c ", ' ') = ["a", "b", "c", "", ""]
* StringUtils.splitPreserveAllTokens(" a b c", ' ') = ["", a", "b", "c"]
* StringUtils.splitPreserveAllTokens(" a b c", ' ') = ["", "", a", "b", "c"]
* StringUtils.splitPreserveAllTokens(" a b c ", ' ') = ["", a", "b", "c", ""]
* </pre>
*
* @param str the String to parse, may be {@code null}
* @param separatorChar the character used as the delimiter, {@code null} splits on
* whitespace
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.1
*/
public static String[] splitPreserveAllTokens(final String str,
final char separatorChar) {
return splitWorker(str, separatorChar, true);
}
/**
* Performs the logic for the {@code split} and
* {@code splitPreserveAllTokens} methods that do not return a maximum array
* length.
*
* @param str the String to parse, may be {@code null}
* @param separatorChar the separate character
* @param preserveAllTokens if {@code true}, adjacent separators are treated as empty
* token separators; if {@code false}, adjacent separators are
* treated as one separator.
* @return an array of parsed Strings, {@code null} if null String input
*/
private static String[] splitWorker(final String str,
final char separatorChar, final boolean preserveAllTokens) {
// Performance tuned for 2.0 (JDK1.4)
if (str == null) {
return null;
}
final int len = str.length();
if (len == 0) {
return EMPTY_STRING_ARRAY;
}
final List<String> list = new ArrayList<String>();
int i = 0, start = 0;
boolean match = false;
boolean lastMatch = false;
while (i < len) {
if (str.charAt(i) == separatorChar) {
if (match || preserveAllTokens) {
list.add(str.substring(start, i));
match = false;
lastMatch = true;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
if (match || preserveAllTokens && lastMatch) {
list.add(str.substring(start, i));
}
return list.toArray(new String[list.size()]);
}
/**
* <p>
* Splits the provided text into an array, separators specified, preserving
* all tokens, including empty tokens created by adjacent separators. This
* is an alternative to using StringTokenizer.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. For more control
* over the split use the StrTokenizer class.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separatorChars splits on whitespace.
* </p>
* <p>
* <pre>
* StringUtils.splitPreserveAllTokens(null, *) = null
* StringUtils.splitPreserveAllTokens("", *) = []
* StringUtils.splitPreserveAllTokens("abc def", null) = ["abc", "def"]
* StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "def"]
* StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "", def"]
* StringUtils.splitPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"]
* StringUtils.splitPreserveAllTokens("ab:cd:ef:", ":") = ["ab", "cd", "ef", ""]
* StringUtils.splitPreserveAllTokens("ab:cd:ef::", ":") = ["ab", "cd", "ef", "", ""]
* StringUtils.splitPreserveAllTokens("ab::cd:ef", ":") = ["ab", "", cd", "ef"]
* StringUtils.splitPreserveAllTokens(":cd:ef", ":") = ["", cd", "ef"]
* StringUtils.splitPreserveAllTokens("::cd:ef", ":") = ["", "", cd", "ef"]
* StringUtils.splitPreserveAllTokens(":cd:ef:", ":") = ["", cd", "ef", ""]
* </pre>
*
* @param str the String to parse, may be {@code null}
* @param separatorChars the characters used as the delimiters, {@code null} splits on
* whitespace
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.1
*/
public static String[] splitPreserveAllTokens(final String str,
final String separatorChars) {
return splitWorker(str, separatorChars, -1, true);
}
/**
* <p>
* Splits the provided text into an array with a maximum length, separators
* specified, preserving all tokens, including empty tokens created by
* adjacent separators.
* </p>
* <p>
* <p>
* The separator is not included in the returned String array. Adjacent
* separators are treated as separators for empty tokens. Adjacent
* separators are treated as one separator.
* </p>
* <p>
* <p>
* A {@code null} input String returns {@code null}. A {@code null}
* separatorChars splits on whitespace.
* </p>
* <p>
* <p>
* If more than {@code max} delimited substrings are found, the last
* returned string includes all characters after the first {@code max - 1}
* returned strings (including separator characters).
* </p>
* <p>
* <pre>
* StringUtils.splitPreserveAllTokens(null, *, *) = null
* StringUtils.splitPreserveAllTokens("", *, *) = []
* StringUtils.splitPreserveAllTokens("ab de fg", null, 0) = ["ab", "cd", "ef"]
* StringUtils.splitPreserveAllTokens("ab de fg", null, 0) = ["ab", "cd", "ef"]
* StringUtils.splitPreserveAllTokens("ab:cd:ef", ":", 0) = ["ab", "cd", "ef"]
* StringUtils.splitPreserveAllTokens("ab:cd:ef", ":", 2) = ["ab", "cd:ef"]
* StringUtils.splitPreserveAllTokens("ab de fg", null, 2) = ["ab", " de fg"]
* StringUtils.splitPreserveAllTokens("ab de fg", null, 3) = ["ab", "", " de fg"]
* StringUtils.splitPreserveAllTokens("ab de fg", null, 4) = ["ab", "", "", "de fg"]
* </pre>
*
* @param str the String to parse, may be {@code null}
* @param separatorChars the characters used as the delimiters, {@code null} splits on
* whitespace
* @param max the maximum number of elements to include in the array. A zero
* or negative value implies no limit
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.1
*/
public static String[] splitPreserveAllTokens(final String str,
final String separatorChars, final int max) {
return splitWorker(str, separatorChars, max, true);
}
/**
* Performs the logic for the {@code split} and
* {@code splitPreserveAllTokens} methods that return a maximum array
* length.
*
* @param str the String to parse, may be {@code null}
* @param separatorChars the separate character
* @param max the maximum number of elements to include in the array. A zero
* or negative value implies no limit.
* @param preserveAllTokens if {@code true}, adjacent separators are treated as empty
* token separators; if {@code false}, adjacent separators are
* treated as one separator.
* @return an array of parsed Strings, {@code null} if null String input
*/
private static String[] splitWorker(final String str,
final String separatorChars, final int max,
final boolean preserveAllTokens) {
// Performance tuned for 2.0 (JDK1.4)
// Direct code is quicker than StringTokenizer.
// Also, StringTokenizer uses isSpace() not isWhitespace()
if (str == null) {
return null;
}
final int len = str.length();
if (len == 0) {
return EMPTY_STRING_ARRAY;
}
final List<String> list = new ArrayList<String>();
int sizePlus1 = 1;
int i = 0, start = 0;
boolean match = false;
boolean lastMatch = false;
if (separatorChars == null) {
// Null separator means use whitespace
while (i < len) {
if (Character.isWhitespace(str.charAt(i))) {
if (match || preserveAllTokens) {
lastMatch = true;
if (sizePlus1++ == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else if (separatorChars.length() == 1) {
// Optimise 1 character case
final char sep = separatorChars.charAt(0);
while (i < len) {
if (str.charAt(i) == sep) {
if (match || preserveAllTokens) {
lastMatch = true;
if (sizePlus1++ == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
} else {
// standard case
while (i < len) {
if (separatorChars.indexOf(str.charAt(i)) >= 0) {
if (match || preserveAllTokens) {
lastMatch = true;
if (sizePlus1++ == max) {
i = len;
lastMatch = false;
}
list.add(str.substring(start, i));
match = false;
}
start = ++i;
continue;
}
lastMatch = false;
match = true;
i++;
}
}
if (match || preserveAllTokens && lastMatch) {
list.add(str.substring(start, i));
}
return list.toArray(new String[list.size()]);
}
/**
* <p>
* Splits a String by Character type as returned by
* {@code java.lang.Character.getType(char)}. Groups of contiguous
* characters of the same type are returned as complete tokens.
* <p>
* <pre>
* StringUtils.splitByCharacterType(null) = null
* StringUtils.splitByCharacterType("") = []
* StringUtils.splitByCharacterType("ab de fg") = ["ab", " ", "de", " ", "fg"]
* StringUtils.splitByCharacterType("ab de fg") = ["ab", " ", "de", " ", "fg"]
* StringUtils.splitByCharacterType("ab:cd:ef") = ["ab", ":", "cd", ":", "ef"]
* StringUtils.splitByCharacterType("number5") = ["number", "5"]
* StringUtils.splitByCharacterType("fooBar") = ["foo", "B", "ar"]
* StringUtils.splitByCharacterType("foo200Bar") = ["foo", "200", "B", "ar"]
* StringUtils.splitByCharacterType("ASFRules") = ["ASFR", "ules"]
* </pre>
*
* @param str the String to split, may be {@code null}
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.4
*/
public static String[] splitByCharacterType(final String str) {
return splitByCharacterType(str, false);
}
/**
* <p>
* Splits a String by Character type as returned by
* {@code java.lang.Character.getType(char)}. Groups of contiguous
* characters of the same type are returned as complete tokens, with the
* following exception: the character of type
* {@code Character.UPPERCASE_LETTER}, if any, immediately preceding a token
* of type {@code Character.LOWERCASE_LETTER} will belong to the following
* token rather than to the preceding, if any,
* {@code Character.UPPERCASE_LETTER} token.
* <p>
* <pre>
* StringUtils.splitByCharacterTypeCamelCase(null) = null
* StringUtils.splitByCharacterTypeCamelCase("") = []
* StringUtils.splitByCharacterTypeCamelCase("ab de fg") = ["ab", " ", "de", " ", "fg"]
* StringUtils.splitByCharacterTypeCamelCase("ab de fg") = ["ab", " ", "de", " ", "fg"]
* StringUtils.splitByCharacterTypeCamelCase("ab:cd:ef") = ["ab", ":", "cd", ":", "ef"]
* StringUtils.splitByCharacterTypeCamelCase("number5") = ["number", "5"]
* StringUtils.splitByCharacterTypeCamelCase("fooBar") = ["foo", "Bar"]
* StringUtils.splitByCharacterTypeCamelCase("foo200Bar") = ["foo", "200", "Bar"]
* StringUtils.splitByCharacterTypeCamelCase("ASFRules") = ["ASF", "Rules"]
* </pre>
*
* @param str the String to split, may be {@code null}
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.4
*/
public static String[] splitByCharacterTypeCamelCase(final String str) {
return splitByCharacterType(str, true);
}
/**
* <p>
* Splits a String by Character type as returned by
* {@code java.lang.Character.getType(char)}. Groups of contiguous
* characters of the same type are returned as complete tokens, with the
* following exception: if {@code camelCase} is {@code true}, the character
* of type {@code Character.UPPERCASE_LETTER}, if any, immediately preceding
* a token of type {@code Character.LOWERCASE_LETTER} will belong to the
* following token rather than to the preceding, if any,
* {@code Character.UPPERCASE_LETTER} token.
*
* @param str the String to split, may be {@code null}
* @param camelCase whether to use so-called "camel-case" for letter types
* @return an array of parsed Strings, {@code null} if null String input
* @since 2.4
*/
private static String[] splitByCharacterType(final String str,
final boolean camelCase) {
if (str == null) {
return null;
}
if (str.isEmpty()) {
return EMPTY_STRING_ARRAY;
}
final char[] c = str.toCharArray();
final List<String> list = new ArrayList<String>();
int tokenStart = 0;
int currentType = Character.getType(c[tokenStart]);
for (int pos = tokenStart + 1; pos < c.length; pos++) {
final int type = Character.getType(c[pos]);
if (type == currentType) {
continue;
}
if (camelCase && type == Character.LOWERCASE_LETTER
&& currentType == Character.UPPERCASE_LETTER) {
final int newTokenStart = pos - 1;
if (newTokenStart != tokenStart) {
list.add(new String(c, tokenStart, newTokenStart
- tokenStart));
tokenStart = newTokenStart;
}
} else {
list.add(new String(c, tokenStart, pos - tokenStart));
tokenStart = pos;
}
currentType = type;
}
list.add(new String(c, tokenStart, c.length - tokenStart));
return list.toArray(new String[list.size()]);
}
/**
* 获取html源代码中的body部分.
* <p>
* 如果没有body标签,那么返回全部
*
* @param html
* @return
*/
public static String body(String html) {
int start_index = html.toLowerCase().indexOf("<body");
int end_index = html.toLowerCase().lastIndexOf("</body>");
if (start_index < 0) {
start_index = 0;
}
if (end_index < 0) {
end_index = html.length();
}
return html.substring(start_index, end_index);
}
/**
* <p>
* Find the Levenshtein distance between two Strings.
* </p>
* <p>
* <p>
* This is the number of changes needed to change one String into another,
* where each change is a single character modification (deletion, insertion
* or substitution).
* </p>
* <p>
* <p>
* The previous implementation of the Levenshtein distance algorithm was
* from <a
* href="http://www.merriampark.com/ld.htm">http://www.merriampark.com
* /ld.htm</a>
* </p>
* <p>
* <p>
* Chas Emerick has written an implementation in Java, which avoids an
* OutOfMemoryError which can occur when my Java implementation is used with
* very large strings.<br>
* This implementation of the Levenshtein distance algorithm is from <a
* href="http://www.merriampark.com/ldjava.htm">http://www.merriampark.com/
* ldjava.htm</a>
* </p>
* <p>
* <pre>
* StringUtils.getLevenshteinDistance(null, *) = IllegalArgumentException
* StringUtils.getLevenshteinDistance(*, null) = IllegalArgumentException
* StringUtils.getLevenshteinDistance("","") = 0
* StringUtils.getLevenshteinDistance("","a") = 1
* StringUtils.getLevenshteinDistance("aaapppp", "") = 7
* StringUtils.getLevenshteinDistance("frog", "fog") = 1
* StringUtils.getLevenshteinDistance("fly", "ant") = 3
* StringUtils.getLevenshteinDistance("elephant", "hippo") = 7
* StringUtils.getLevenshteinDistance("hippo", "elephant") = 7
* StringUtils.getLevenshteinDistance("hippo", "zzzzzzzz") = 8
* StringUtils.getLevenshteinDistance("hello", "hallo") = 1
* </pre>
*
* @param s the first String, must not be null
* @param t the second String, must not be null
* @return result distance
* @throws IllegalArgumentException if either String input {@code null}
* @since 3.0 Changed signature from getLevenshteinDistance(String, String)
* to getLevenshteinDistance(CharSequence, CharSequence)
*/
public static int getLevenshteinDistance(CharSequence s, CharSequence t) {
if (s == null || t == null) {
throw new IllegalArgumentException("Strings must not be null");
}
/*
* The difference between this impl. and the previous is that, rather
* than creating and retaining a matrix of size s.length() + 1 by
* t.length() + 1, we maintain two single-dimensional arrays of length
* s.length() + 1. The first, d, is the 'current working' distance array
* that maintains the newest distance cost counts as we iterate through
* the characters of String s. Each time we increment the index of
* String t we are comparing, d is copied to p, the second int[]. Doing
* so allows us to retain the previous cost counts as required by the
* algorithm (taking the minimum of the cost count to the left, up one,
* and diagonally up and to the left of the current cost count being
* calculated). (Note that the arrays aren't really copied anymore, just
* switched...this is clearly much better than cloning an array or doing
* a System.arraycopy() each time through the outer loop.)
*
* Effectively, the difference between the two implementations is this
* one does not cause an out of memory condition when calculating the LD
* over two very large strings.
*/
int n = s.length(); // length of s
int m = t.length(); // length of t
if (n == 0) {
return m;
} else if (m == 0) {
return n;
}
if (n > m) {
// swap the input strings to consume less memory
CharSequence tmp = s;
s = t;
t = tmp;
n = m;
m = t.length();
}
int p[] = new int[n + 1]; // 'previous' cost array, horizontally
int d[] = new int[n + 1]; // cost array, horizontally
int _d[]; // placeholder to assist in swapping p and d
// indexes into strings s and t
int i; // iterates through s
int j; // iterates through t
char t_j; // jth character of t
int cost; // cost
for (i = 0; i <= n; i++) {
p[i] = i;
}
for (j = 1; j <= m; j++) {
t_j = t.charAt(j - 1);
d[0] = j;
for (i = 1; i <= n; i++) {
cost = s.charAt(i - 1) == t_j ? 0 : 1;
// minimum of cell to the left+1, to the top+1, diagonally left
// and up +cost
d[i] = Math.min(Math.min(d[i - 1] + 1, p[i] + 1), p[i - 1]
+ cost);
}
// copy current distance counts to 'previous row' distance counts
_d = p;
p = d;
d = _d;
}
// our last action in the above loop was to switch d and p, so p now
// actually has the most recent cost counts
return p[n];
}
/**
* 转换为String数组
*
* @param array
* @return
*/
public static String[] toArray(List<String> array) {
return array.toArray(new String[]{});
}
public static String[] toStringArray(Object... objects) {
String[] stringArray = Arrays.asList(objects).toArray(new String[objects.length]);
return stringArray;
}
/**
* <p>Searches a String for substrings delimited by a start and end tag,
* returning all matching substrings in an array.</p>
* <p>
* <p>A {@code null} input String returns {@code null}.
* A {@code null} open/close returns {@code null} (no match).
* An empty ("") open/close returns {@code null} (no match).</p>
* <p>
* <pre>
* StringUtils.substringsBetween("[a][b][c]", "[", "]") = ["a","b","c"]
* StringUtils.substringsBetween(null, *, *) = null
* StringUtils.substringsBetween(*, null, *) = null
* StringUtils.substringsBetween(*, *, null) = null
* StringUtils.substringsBetween("", "[", "]") = []
* </pre>
*
* @param str the String containing the substrings, null returns null, empty returns empty
* @param open the String identifying the start of the substring, empty returns null
* @param close the String identifying the end of the substring, empty returns null
* @return a String Array of substrings, or {@code null} if no match
* @since 2.3
*/
public static List<String> substringsBetween(final String str, final String open, final String close, boolean tokenReservedFlag) {
if (str == null || isEmpty(open) || isEmpty(close)) {
return null;
}
final int strLen = str.length();
if (strLen == 0) {
return new ArrayList<>();
}
final int closeLen = close.length();
final int openLen = open.length();
final List<String> list = new ArrayList<String>();
int pos = 0;
while (pos < strLen - closeLen) {
int start = str.indexOf(open, pos);
if (start < 0) {
break;
}
start += openLen;
final int end = str.indexOf(close, start);
if (end < 0) {
break;
}
if (tokenReservedFlag) {
list.add(str.substring(start - openLen, end + closeLen));
} else {
list.add(str.substring(start, end));
}
pos = end + closeLen;
}
if (list.isEmpty()) {
return null;
}
return list;
}
}
| apache-2.0 |
romankagan/DDBWorkbench | platform/lang-impl/src/com/intellij/execution/ExecutionHelper.java | 21786 | /*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.execution;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessOutput;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.PopupChooserBuilder;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.pom.Navigatable;
import com.intellij.ui.ListCellRendererWrapper;
import com.intellij.ui.components.JBList;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentFactory;
import com.intellij.ui.content.ContentManager;
import com.intellij.ui.content.MessageView;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.Function;
import com.intellij.util.NotNullFunction;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ErrorTreeView;
import com.intellij.util.ui.MessageCategory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Created by IntelliJ IDEA.
*
* @author: Roman Chernyatchik
* @date: Oct 4, 2007
*/
public class ExecutionHelper {
private static final Logger LOG = Logger.getInstance(ExecutionHelper.class.getName());
private ExecutionHelper() {
}
public static void showErrors(
@NotNull final Project myProject,
@NotNull final List<? extends Exception> errors,
@NotNull final String tabDisplayName,
@Nullable final VirtualFile file)
{
showExceptions(myProject, errors, Collections.<Exception>emptyList(), tabDisplayName, file);
}
public static void showExceptions(
@NotNull final Project myProject,
@NotNull final List<? extends Exception> errors,
@NotNull final List<? extends Exception> warnings,
@NotNull final String tabDisplayName,
@Nullable final VirtualFile file)
{
if (ApplicationManager.getApplication().isUnitTestMode() && !errors.isEmpty()) {
throw new RuntimeException(errors.get(0));
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
if (errors.isEmpty() && warnings.isEmpty()) {
removeContents(null, myProject, tabDisplayName);
return;
}
final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject);
try {
openMessagesView(errorTreeView, myProject, tabDisplayName);
}
catch (NullPointerException e) {
final StringBuilder builder = new StringBuilder();
builder.append("Exceptions occurred:");
for (final Exception exception : errors) {
builder.append("\n");
builder.append(exception.getMessage());
}
builder.append("Warnings occurred:");
for (final Exception exception : warnings) {
builder.append("\n");
builder.append(exception.getMessage());
}
Messages.showErrorDialog(builder.toString(), "Execution Error");
return;
}
addMessages(MessageCategory.ERROR, errors, errorTreeView, file, "Unknown Error");
addMessages(MessageCategory.WARNING, warnings, errorTreeView, file, "Unknown Warning");
ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
}
});
}
private static void addMessages(
final int messageCategory,
@NotNull final List<? extends Exception> exceptions,
@NotNull ErrorViewPanel errorTreeView,
@Nullable final VirtualFile file,
@NotNull final String defaultMessage)
{
for (final Exception exception : exceptions) {
String[] messages = StringUtil.splitByLines(exception.getMessage());
if (messages.length == 0) {
messages = new String[] { defaultMessage };
}
errorTreeView.addMessage(messageCategory, messages, file, -1, -1, null);
}
}
public static void showOutput(@NotNull final Project myProject,
@NotNull final ProcessOutput output,
@NotNull final String tabDisplayName,
@Nullable final VirtualFile file,
final boolean activateWindow) {
final String stdout = output.getStdout();
final String stderr = output.getStderr();
if (ApplicationManager.getApplication().isUnitTestMode() && !(stdout.isEmpty() || stderr.isEmpty())) {
throw new RuntimeException("STDOUT:\n" + stdout + "\nSTDERR:\n" + stderr);
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (myProject.isDisposed()) return;
final String stdOutTitle = "[Stdout]:";
final String stderrTitle = "[Stderr]:";
final ErrorViewPanel errorTreeView = new ErrorViewPanel(myProject);
try {
openMessagesView(errorTreeView, myProject, tabDisplayName);
}
catch (NullPointerException e) {
final StringBuilder builder = new StringBuilder();
builder.append(stdOutTitle).append("\n").append(stdout != null ? stdout : "<empty>").append("\n");
builder.append(stderrTitle).append("\n").append(stderr != null ? stderr : "<empty>");
Messages.showErrorDialog(builder.toString(), "Process Output");
return;
}
if (!StringUtil.isEmpty(stdout)) {
final String[] stdoutLines = StringUtil.splitByLines(stdout);
if (stdoutLines.length > 0) {
if (StringUtil.isEmpty(stderr)) {
// Only stdout available
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null);
}
else {
// both stdout and stderr available, show as groups
if (file == null) {
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, stdOutTitle, new FakeNavigatable(), null, null, null);
}
else {
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stdOutTitle}, file, -1, -1, null);
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{""}, file, -1, -1, null);
errorTreeView.addMessage(MessageCategory.SIMPLE, stdoutLines, file, -1, -1, null);
}
}
}
}
if (!StringUtil.isEmpty(stderr)) {
final String[] stderrLines = StringUtil.splitByLines(stderr);
if (stderrLines.length > 0) {
if (file == null) {
errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, stderrTitle, new FakeNavigatable(), null, null, null);
}
else {
errorTreeView.addMessage(MessageCategory.SIMPLE, new String[]{stderrTitle}, file, -1, -1, null);
errorTreeView.addMessage(MessageCategory.SIMPLE, ArrayUtil.EMPTY_STRING_ARRAY, file, -1, -1, null);
errorTreeView.addMessage(MessageCategory.SIMPLE, stderrLines, file, -1, -1, null);
}
}
}
errorTreeView
.addMessage(MessageCategory.SIMPLE, new String[]{"Process finished with exit code " + output.getExitCode()}, null, -1, -1, null);
if (activateWindow) {
ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
}
}
});
}
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
@NotNull final Project myProject,
@NotNull final String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
@Override
public void run() {
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);
messageView.getContentManager().setSelectedContent(content);
removeContents(content, myProject, tabDisplayName);
}
}, "Open message view", null);
}
private static void removeContents(@Nullable final Content notToRemove,
@NotNull final Project myProject,
@NotNull final String tabDisplayName) {
MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
Content[] contents = messageView.getContentManager().getContents();
for (Content content : contents) {
LOG.assertTrue(content != null);
if (content.isPinned()) continue;
if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
ErrorTreeView listErrorView = (ErrorTreeView)content.getComponent();
if (listErrorView != null) {
if (messageView.getContentManager().removeContent(content, true)) {
content.release();
}
}
}
}
}
public static Collection<RunContentDescriptor> findRunningConsoleByTitle(final Project project,
@NotNull final NotNullFunction<String, Boolean> titleMatcher) {
return findRunningConsole(project, new NotNullFunction<RunContentDescriptor, Boolean>() {
@NotNull
@Override
public Boolean fun(RunContentDescriptor selectedContent) {
return titleMatcher.fun(selectedContent.getDisplayName());
}
});
}
public static Collection<RunContentDescriptor> findRunningConsole(final Project project,
@NotNull final NotNullFunction<RunContentDescriptor, Boolean> descriptorMatcher) {
final ExecutionManager executionManager = ExecutionManager.getInstance(project);
final RunContentDescriptor selectedContent = executionManager.getContentManager().getSelectedContent();
if (selectedContent != null) {
final ToolWindow toolWindow = ExecutionManager.getInstance(project).getContentManager().getToolWindowByDescriptor(selectedContent);
if (toolWindow != null && toolWindow.isVisible()) {
if (descriptorMatcher.fun(selectedContent)) {
return Collections.singletonList(selectedContent);
}
}
}
final ArrayList<RunContentDescriptor> result = ContainerUtil.newArrayList();
for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
if (descriptorMatcher.fun(runContentDescriptor)) {
result.add(runContentDescriptor);
}
}
return result;
}
public static List<RunContentDescriptor> collectConsolesByDisplayName(final Project project,
@NotNull NotNullFunction<String, Boolean> titleMatcher) {
List<RunContentDescriptor> result = ContainerUtil.newArrayList();
final ExecutionManager executionManager = ExecutionManager.getInstance(project);
for (RunContentDescriptor runContentDescriptor : executionManager.getContentManager().getAllDescriptors()) {
if (titleMatcher.fun(runContentDescriptor.getDisplayName())) {
result.add(runContentDescriptor);
}
}
return result;
}
public static void selectContentDescriptor(final @NotNull DataContext dataContext,
final @NotNull Project project,
@NotNull Collection<RunContentDescriptor> consoles,
String selectDialogTitle, final Consumer<RunContentDescriptor> descriptorConsumer) {
if (consoles.size() == 1) {
RunContentDescriptor descriptor = consoles.iterator().next();
descriptorConsumer.consume(descriptor);
descriptorToFront(project, descriptor);
}
else if (consoles.size() > 1) {
final JList list = new JBList(consoles);
final Icon icon = DefaultRunExecutor.getRunExecutorInstance().getIcon();
list.setCellRenderer(new ListCellRendererWrapper<RunContentDescriptor>() {
@Override
public void customize(final JList list,
final RunContentDescriptor value,
final int index,
final boolean selected,
final boolean hasFocus) {
setText(value.getDisplayName());
setIcon(icon);
}
});
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
builder.setTitle(selectDialogTitle);
builder.setItemChoosenCallback(new Runnable() {
@Override
public void run() {
final Object selectedValue = list.getSelectedValue();
if (selectedValue instanceof RunContentDescriptor) {
RunContentDescriptor descriptor = (RunContentDescriptor)selectedValue;
descriptorConsumer.consume(descriptor);
descriptorToFront(project, descriptor);
}
}
}).createPopup().showInBestPositionFor(dataContext);
}
}
private static void descriptorToFront(final Project project, final RunContentDescriptor descriptor) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
final ToolWindow toolWindow = ExecutionManager.getInstance(project).getContentManager().getToolWindowByDescriptor(descriptor);
if (toolWindow != null) {
toolWindow.show(null);
final ContentManager contentManager = toolWindow.getContentManager();
contentManager.setSelectedContent(descriptor.getAttachedContent());
}
}
});
}
public static class ErrorViewPanel extends NewErrorTreeViewPanel {
public ErrorViewPanel(final Project project) {
super(project, "reference.toolWindows.messages");
}
@Override
protected boolean canHideWarnings() {
return false;
}
}
public static void executeExternalProcess(@Nullable final Project myProject,
@NotNull final ProcessHandler processHandler,
@NotNull final ExecutionMode mode,
@NotNull final GeneralCommandLine cmdline) {
executeExternalProcess(myProject, processHandler, mode, cmdline.getCommandLineString());
}
public static void executeExternalProcess(@Nullable final Project myProject,
@NotNull final ProcessHandler processHandler,
@NotNull final ExecutionMode mode,
@NotNull final String presentableCmdline) {
final String title = mode.getTitle() != null ? mode.getTitle() : "Please wait...";
assert title != null;
final Runnable process;
if (mode.cancelable()) {
process = createCancelableExecutionProcess(processHandler, mode.shouldCancelFun());
}
else {
if (mode.getTimeout() <= 0) {
process = new Runnable() {
@Override
public void run() {
processHandler.waitFor();
}
};
}
else {
process = createTimelimitedExecutionProcess(processHandler, mode.getTimeout(), presentableCmdline);
}
}
if (mode.withModalProgress()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(process, title, mode.cancelable(), myProject,
mode.getProgressParentComponent());
}
else if (mode.inBackGround()) {
final Task task = new Task.Backgroundable(myProject, title, mode.cancelable()) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
process.run();
}
};
ProgressManager.getInstance().run(task);
}
else {
final String title2 = mode.getTitle2();
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null && title2 != null) {
indicator.setText2(title2);
}
process.run();
}
}
private static Runnable createCancelableExecutionProcess(final ProcessHandler processHandler,
final Function<Object, Boolean> cancelableFun) {
return new Runnable() {
private ProgressIndicator myProgressIndicator;
private final Semaphore mySemaphore = new Semaphore();
private final Runnable myWaitThread = new Runnable() {
@Override
public void run() {
try {
processHandler.waitFor();
}
finally {
mySemaphore.up();
}
}
};
private final Runnable myCancelListener = new Runnable() {
@Override
public void run() {
for (; ; ) {
if ((myProgressIndicator != null && (myProgressIndicator.isCanceled()
|| !myProgressIndicator.isRunning()))
|| (cancelableFun != null && cancelableFun.fun(null).booleanValue())
|| processHandler.isProcessTerminated()) {
if (!processHandler.isProcessTerminated()) {
try {
processHandler.destroyProcess();
}
finally {
mySemaphore.up();
}
}
break;
}
try {
synchronized (this) {
wait(1000);
}
}
catch (InterruptedException e) {
//Do nothing
}
}
}
};
@Override
public void run() {
myProgressIndicator = ProgressManager.getInstance().getProgressIndicator();
if (myProgressIndicator != null && StringUtil.isEmpty(myProgressIndicator.getText())) {
myProgressIndicator.setText("Please wait...");
}
LOG.assertTrue(myProgressIndicator != null || cancelableFun != null,
"Cancelable process must have an opportunity to be canceled!");
mySemaphore.down();
ApplicationManager.getApplication().executeOnPooledThread(myWaitThread);
ApplicationManager.getApplication().executeOnPooledThread(myCancelListener);
mySemaphore.waitFor();
}
};
}
private static Runnable createTimelimitedExecutionProcess(final ProcessHandler processHandler,
final int timeout,
@NotNull final String presentableCmdline) {
return new Runnable() {
private final Semaphore mySemaphore = new Semaphore();
private final Runnable myProcessThread = new Runnable() {
@Override
public void run() {
try {
final boolean finished = processHandler.waitFor(1000 * timeout);
if (!finished) {
final String msg = "Timeout (" + timeout + " sec) on executing: " + presentableCmdline;
LOG.error(msg);
processHandler.destroyProcess();
}
}
finally {
mySemaphore.up();
}
}
};
@Override
public void run() {
mySemaphore.down();
ApplicationManager.getApplication().executeOnPooledThread(myProcessThread);
mySemaphore.waitFor();
}
};
}
public static class FakeNavigatable implements Navigatable {
@Override
public void navigate(boolean requestFocus) {
// Do nothing
}
@Override
public boolean canNavigate() {
return false;
}
@Override
public boolean canNavigateToSource() {
return false;
}
}
}
| apache-2.0 |
ebayopensource/turmeric-runtime | binding-framework/src/main/java/org/ebayopensource/turmeric/runtime/binding/schema/package-info.java | 818 | /*******************************************************************************
* Copyright (c) 2006-2010 eBay 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
*******************************************************************************/
/**
* Package for binding framework's DataElementSchema interface.
* DataElementSchema is a runtime data structure to capture schema information defined in
* schema sections of a wsdl file. The structure provide necessary information
* for XMLStreamWriters to produce the right payload.
*
*/
package org.ebayopensource.turmeric.runtime.binding.schema;
| apache-2.0 |
kyle-liu/netty4study | transport/src/test/java/io/netty/channel/ChannelOutboundBufferTest.java | 7237 | /*
* Copyright 2012 The Netty Project
*
* The Netty Project 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 io.netty.channel;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.CompositeByteBuf;
import io.netty.util.CharsetUtil;
import org.junit.Test;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import static io.netty.buffer.Unpooled.*;
import static org.junit.Assert.*;
public class ChannelOutboundBufferTest {
@Test
public void testEmptyNioBuffers() {
TestChannel channel = new TestChannel();
ChannelOutboundBuffer buffer = ChannelOutboundBuffer.newInstance(channel);
assertEquals(0, buffer.nioBufferCount());
ByteBuffer[] buffers = buffer.nioBuffers();
assertEquals(32, buffers.length);
for (ByteBuffer b: buffers) {
assertNull(b);
}
assertEquals(0, buffer.nioBufferCount());
release(buffer);
}
@Test
public void testNioBuffersSingleBacked() {
TestChannel channel = new TestChannel();
ChannelOutboundBuffer buffer = ChannelOutboundBuffer.newInstance(channel);
assertEquals(0, buffer.nioBufferCount());
ByteBuffer[] buffers = buffer.nioBuffers();
assertEquals(32, buffers.length);
for (ByteBuffer b: buffers) {
assertNull(b);
}
assertEquals(0, buffer.nioBufferCount());
ByteBuf buf = copiedBuffer("buf1", CharsetUtil.US_ASCII);
ByteBuffer nioBuf = buf.internalNioBuffer(0, buf.readableBytes());
buffer.addMessage(buf, channel.voidPromise());
buffers = buffer.nioBuffers();
assertEquals("Should still be 0 as not flushed yet", 0, buffer.nioBufferCount());
for (ByteBuffer b: buffers) {
assertNull(b);
}
buffer.addFlush();
buffers = buffer.nioBuffers();
assertEquals(32, buffers.length);
assertEquals("Should still be 0 as not flushed yet", 1, buffer.nioBufferCount());
for (int i = 0; i < buffers.length; i++) {
if (i == 0) {
assertEquals(buffers[i], nioBuf);
} else {
assertNull(buffers[i]);
}
}
release(buffer);
}
@Test
public void testNioBuffersExpand() {
TestChannel channel = new TestChannel();
ChannelOutboundBuffer buffer = ChannelOutboundBuffer.newInstance(channel);
ByteBuf buf = directBuffer().writeBytes("buf1".getBytes(CharsetUtil.US_ASCII));
for (int i = 0; i < 64; i++) {
buffer.addMessage(buf.copy(), channel.voidPromise());
}
ByteBuffer[] buffers = buffer.nioBuffers();
assertEquals("Should still be 0 as not flushed yet", 0, buffer.nioBufferCount());
for (ByteBuffer b: buffers) {
assertNull(b);
}
buffer.addFlush();
buffers = buffer.nioBuffers();
assertEquals(64, buffers.length);
assertEquals(64, buffer.nioBufferCount());
for (int i = 0; i < buffers.length; i++) {
assertEquals(buffers[i], buf.internalNioBuffer(0, buf.readableBytes()));
}
release(buffer);
buf.release();
}
@Test
public void testNioBuffersExpand2() {
TestChannel channel = new TestChannel();
ChannelOutboundBuffer buffer = ChannelOutboundBuffer.newInstance(channel);
CompositeByteBuf comp = compositeBuffer(256);
ByteBuf buf = directBuffer().writeBytes("buf1".getBytes(CharsetUtil.US_ASCII));
for (int i = 0; i < 65; i++) {
comp.addComponent(buf.copy()).writerIndex(comp.writerIndex() + buf.readableBytes());
}
buffer.addMessage(comp, channel.voidPromise());
ByteBuffer[] buffers = buffer.nioBuffers();
assertEquals("Should still be 0 as not flushed yet", 0, buffer.nioBufferCount());
for (ByteBuffer b: buffers) {
assertNull(b);
}
buffer.addFlush();
buffers = buffer.nioBuffers();
assertEquals(128, buffers.length);
assertEquals(65, buffer.nioBufferCount());
for (int i = 0; i < buffers.length; i++) {
if (i < 65) {
assertEquals(buffers[i], buf.internalNioBuffer(0, buf.readableBytes()));
} else {
assertNull(buffers[i]);
}
}
release(buffer);
buf.release();
}
private static void release(ChannelOutboundBuffer buffer) {
for (;;) {
if (!buffer.remove()) {
break;
}
}
}
private static final class TestChannel extends AbstractChannel {
private final ChannelConfig config = new DefaultChannelConfig(this);
TestChannel() {
super(null);
}
@Override
protected AbstractUnsafe newUnsafe() {
return new TestUnsafe();
}
@Override
protected boolean isCompatible(EventLoop loop) {
return false;
}
@Override
protected SocketAddress localAddress0() {
throw new UnsupportedOperationException();
}
@Override
protected SocketAddress remoteAddress0() {
throw new UnsupportedOperationException();
}
@Override
protected void doBind(SocketAddress localAddress) throws Exception {
throw new UnsupportedOperationException();
}
@Override
protected void doDisconnect() throws Exception {
throw new UnsupportedOperationException();
}
@Override
protected void doClose() throws Exception {
throw new UnsupportedOperationException();
}
@Override
protected void doBeginRead() throws Exception {
throw new UnsupportedOperationException();
}
@Override
protected void doWrite(ChannelOutboundBuffer in) throws Exception {
throw new UnsupportedOperationException();
}
@Override
public ChannelConfig config() {
return config;
}
@Override
public boolean isOpen() {
return true;
}
@Override
public boolean isActive() {
return true;
}
@Override
public ChannelMetadata metadata() {
throw new UnsupportedOperationException();
}
final class TestUnsafe extends AbstractUnsafe {
@Override
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, ChannelPromise promise) {
throw new UnsupportedOperationException();
}
}
}
}
| apache-2.0 |
ribbon-xx/VTVPro-Plus | VtvPro/src/mdn/vtvsport/object/LoginInfo.java | 1093 | package mdn.vtvsport.object;
import mdn.vtvsport.parsexml.LoginInfoHandler;
import mdn.vtvsport.util.HLog;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.StringReader;
/**
* Created by hieuxit on 8/25/14.
*/
public class LoginInfo {
public String mPhoneNumber;
public String mAccountName;
public String mAccountPassword;
public static LoginInfo fromResponse(String response) {
try {
SAXParserFactory saxPF = SAXParserFactory.newInstance();
SAXParser saxP = saxPF.newSAXParser();
XMLReader xmlR = saxP.getXMLReader();
LoginInfoHandler myXMLHandler = new LoginInfoHandler();
xmlR.setContentHandler(myXMLHandler);
xmlR.parse(new InputSource(new StringReader(response)));
return myXMLHandler.getData();
} catch (Exception e) {
e.printStackTrace();
HLog.e("Parse xml error: " + e.toString());
}
return new LoginInfo();
}
@Override
public String toString() {
return "[username:" + mAccountName + ", pass: " + mAccountPassword + "]";
}
}
| apache-2.0 |
britter/bean-validators | src/main/java/com/github/britter/beanvalidators/file/internal/ExecutableFileConstraintValidator.java | 1140 | /*
* Copyright 2015 Benedikt Ritter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.britter.beanvalidators.file.internal;
import com.github.britter.beanvalidators.file.Executable;
import com.github.britter.beanvalidators.internal.NullAcceptingConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import java.io.File;
public final class ExecutableFileConstraintValidator implements NullAcceptingConstraintValidator<Executable, File> {
@Override
public boolean isValidNonNullValue(File value, ConstraintValidatorContext context) {
return value.canExecute();
}
}
| apache-2.0 |
csunbird/dailyshoppingmanager | dsm-mobile/app/src/main/java/com/sunbird/dsm_mobile/services/ProductService.java | 1818 | package com.sunbird.dsm_mobile.services;
import com.sunbird.dsm_mobile.model.ProductModel;
import com.sunbird.dsm_mobile.model.Request.AddProductRequest;
import com.sunbird.dsm_mobile.model.Request.ReportPriceRequest;
import com.sunbird.dsm_mobile.tasks.AddProductTask;
import com.sunbird.dsm_mobile.tasks.GetProductsTask;
import com.sunbird.dsm_mobile.tasks.ReportPriceTask;
import com.sunbird.dsm_mobile.utils.CacheManager;
import com.sunbird.dsm_mobile.utils.Constants;
import java.util.List;
/**
* Created by Umut Deveci on 17.12.2016.
*/
public class ProductService {
public static List<ProductModel> getAllProducts() {
try {
List<ProductModel> products = CacheManager.getCachedValue(Constants.productCacheKey);
if(products==null){
return refreshProductsCache();
}
return products;
} catch (Exception e) {
return null;
}
}
public static List<ProductModel> refreshProductsCache() {
try {
List<ProductModel> productModelList = new GetProductsTask().execute().get();
CacheManager.putObject(Constants.productCacheKey,productModelList);
return productModelList;
} catch (Exception e) {
return null;
}
}
public static boolean addProduct(AddProductRequest request) {
try {
Boolean result = new AddProductTask(request).execute().get();
return result;
}catch (Exception e) {
return false;
}
}
public static boolean reportPrice(ReportPriceRequest request) {
try {
Boolean result = new ReportPriceTask(request).execute().get();
return result;
} catch (Exception e) {
return false;
}
}
}
| apache-2.0 |
andy-goryachev/PasswordSafe | src/goryachev/swing/options/FileOption.java | 1077 | // Copyright © 2008-2022 Andy Goryachev <andy@goryachev.com>
package goryachev.swing.options;
import goryachev.common.util.CSettings;
import java.io.File;
import java.util.Collection;
public class FileOption
extends COption<File>
{
private File defaultValue;
public FileOption(String propertyName)
{
super(propertyName);
}
public FileOption(String propertyName, File defaultValue)
{
this(propertyName);
this.defaultValue = defaultValue;
}
public FileOption(String propertyName, CSettings s, Collection<COption<?>> list)
{
super(propertyName, s, list);
}
public File defaultValue()
{
return defaultValue;
}
public String toProperty(File f)
{
if(f == null)
{
return null;
}
try
{
return f.getCanonicalPath();
}
catch(Exception e)
{
return f.getAbsolutePath();
}
}
public File parseProperty(String s)
{
return new File(s);
}
public String getFileName()
{
File f = get();
return (f == null ? null : f.getAbsolutePath());
}
}
| apache-2.0 |
linqs/psl | psl-core/src/main/java/org/linqs/psl/application/learning/weight/search/grid/InitialWeightRankSearch.java | 3237 | /*
* This file is part of the PSL software.
* Copyright 2011-2015 University of Maryland
* Copyright 2013-2019 The Regents of the University of California
*
* 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.linqs.psl.application.learning.weight.search.grid;
import org.linqs.psl.application.learning.weight.WeightLearningApplication;
import org.linqs.psl.application.learning.weight.maxlikelihood.MaxLikelihoodMPE;
import org.linqs.psl.database.Database;
import org.linqs.psl.model.Model;
import org.linqs.psl.model.rule.Rule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
/**
* RankSearch over the initial weights and then run weight learning like normal.
*
* TODO(eriq): It would be great if we could construct the internal WLA on our side instead
* of relying on it to be passed in (we have to ensure that the caller uses the same rules and DBs).
*/
public class InitialWeightRankSearch extends RankSearch {
private static final Logger log = LoggerFactory.getLogger(InitialWeightRankSearch.class);
/**
* The weight lerning application that we will invoke at each location.
*/
private WeightLearningApplication internalWLA;
public InitialWeightRankSearch(Model model, WeightLearningApplication internalWLA, Database rvDB, Database observedDB) {
this(model.getRules(), internalWLA, rvDB, observedDB);
}
public InitialWeightRankSearch(List<Rule> rules, Database rvDB, Database observedDB) {
this(rules, new MaxLikelihoodMPE(rules, rvDB, observedDB), rvDB, observedDB);
}
/**
* The WeightLearningApplication should not have had initGroundModel() called yet.
*/
public InitialWeightRankSearch(List<Rule> rules, WeightLearningApplication internalWLA, Database rvDB, Database observedDB) {
super(rules, rvDB, observedDB);
this.internalWLA = internalWLA;
}
@Override
protected void postInitGroundModel() {
// Init the internal WLA.
internalWLA.initGroundModel(
this.reasoner,
this.groundRuleStore,
this.termStore,
this.termGenerator,
this.atomManager,
this.trainingMap
);
}
@Override
protected double inspectLocation(double[] weights) {
// Just have the internal WLA learn and then get the loss as the score.
internalWLA.learn();
// Save the learned weights.
for (int i = 0; i < mutableRules.size(); i++) {
weights[i] = mutableRules.get(i).getWeight();
}
return super.inspectLocation(weights);
}
@Override
public void close() {
super.close();
internalWLA.close();
}
}
| apache-2.0 |
leafclick/intellij-community | platform/util/src/com/intellij/util/text/StringSearcher.java | 8367 | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.text;
import com.intellij.openapi.util.text.StringUtil;
import gnu.trove.TIntArrayList;
import gnu.trove.TIntProcedure;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
public class StringSearcher {
private final String myPattern;
private final char[] myPatternArray;
private final int myPatternLength;
private final int[] mySearchTable = new int[128];
private final boolean myCaseSensitive;
private final boolean myLowercaseTransform;
private final boolean myForwardDirection;
private final boolean myJavaIdentifier;
private final boolean myHandleEscapeSequences;
public int getPatternLength() {
return myPatternLength;
}
public StringSearcher(@NotNull String pattern, boolean caseSensitive, boolean forwardDirection) {
this(pattern, caseSensitive, forwardDirection, false);
}
public StringSearcher(@NotNull String pattern, boolean caseSensitive, boolean forwardDirection, boolean handleEscapeSequences) {
this(pattern, caseSensitive, forwardDirection, handleEscapeSequences, true);
}
public StringSearcher(@NotNull String pattern,
boolean caseSensitive,
boolean forwardDirection,
boolean handleEscapeSequences,
boolean lookForJavaIdentifiersOnlyIfPossible) {
myHandleEscapeSequences = handleEscapeSequences;
if (pattern.isEmpty()) throw new IllegalArgumentException("pattern is empty");
myPattern = pattern;
myCaseSensitive = caseSensitive;
myForwardDirection = forwardDirection;
char[] chars = myCaseSensitive ? myPattern.toCharArray() : StringUtil.toLowerCase(myPattern).toCharArray();
if (chars.length != myPattern.length()) {
myLowercaseTransform = false;
chars = StringUtil.toUpperCase(myPattern).toCharArray();
} else {
myLowercaseTransform = true;
}
myPatternArray = chars;
myPatternLength = myPatternArray.length;
Arrays.fill(mySearchTable, -1);
myJavaIdentifier = lookForJavaIdentifiersOnlyIfPossible &&
Character.isJavaIdentifierPart(pattern.charAt(0)) &&
Character.isJavaIdentifierPart(pattern.charAt(pattern.length() - 1));
}
@NotNull
public String getPattern(){
return myPattern;
}
public boolean isCaseSensitive() {
return myCaseSensitive;
}
public boolean isJavaIdentifier() {
return myJavaIdentifier;
}
public boolean isHandleEscapeSequences() {
return myHandleEscapeSequences;
}
public int scan(@NotNull CharSequence text) {
return scan(text,0,text.length());
}
public int scan(@NotNull CharSequence text, int _start, int _end) {
return scan(text, null, _start, _end);
}
public int @NotNull [] findAllOccurrences(@NotNull CharSequence text) {
int end = text.length();
TIntArrayList result = new TIntArrayList();
for (int index = 0; index < end; index++) {
//noinspection AssignmentToForLoopParameter
index = scan(text, index, end);
if (index < 0) break;
result.add(index);
}
return result.toNativeArray();
}
public boolean processOccurrences(@NotNull CharSequence text, @NotNull TIntProcedure consumer) {
int end = text.length();
for (int index = 0; index < end; index++) {
//noinspection AssignmentToForLoopParameter
index = scan(text, index, end);
if (index < 0) break;
if (!consumer.execute(index)) return false;
}
return true;
}
public int scan(@NotNull CharSequence text, char @Nullable [] textArray, int _start, int _end) {
if (_start > _end) {
throw new AssertionError("start > end, " + _start + ">" + _end);
}
final int textLength = text.length();
if (_end > textLength) {
throw new AssertionError("end > length, " + _end + ">" + textLength);
}
if (myForwardDirection) {
if (myPatternLength == 1) {
// optimization
return StringUtil.indexOf(text, myPatternArray[0], _start, _end, myCaseSensitive);
}
int start = _start;
int end = _end - myPatternLength;
while (start <= end) {
int i = myPatternLength - 1;
char lastChar = normalizedCharAt(text, textArray, start + i);
if (isSameChar(myPatternArray[i], lastChar)) {
i--;
while (i >= 0) {
char c = textArray != null ? textArray[start + i] : text.charAt(start + i);
if (!isSameChar(myPatternArray[i], c)) break;
i--;
}
if (i < 0) {
return start;
}
}
int step = lastChar < 128 ? mySearchTable[lastChar] : 1;
if (step <= 0) {
int index;
for (index = myPatternLength - 2; index >= 0; index--) {
if (myPatternArray[index] == lastChar) break;
}
step = myPatternLength - index - 1;
mySearchTable[lastChar] = step;
}
start += step;
}
}
else {
int start = 1;
while (start <= _end - myPatternLength + 1) {
int i = myPatternLength - 1;
char lastChar = normalizedCharAt(text, textArray, _end - (start + i));
if (isSameChar(myPatternArray[myPatternLength - 1 - i], lastChar)) {
i--;
while (i >= 0) {
char c = textArray != null ? textArray[_end - (start + i)] : text.charAt(_end - (start + i));
if (!isSameChar(myPatternArray[myPatternLength - 1 - i], c)) break;
i--;
}
if (i < 0) return _end - start - myPatternLength + 1;
}
int step = lastChar < 128 ? mySearchTable[lastChar] : 1;
if (step <= 0) {
int index;
for (index = myPatternLength - 2; index >= 0; index--) {
if (myPatternArray[myPatternLength - 1 - index] == lastChar) break;
}
step = myPatternLength - index - 1;
mySearchTable[lastChar] = step;
}
start += step;
}
}
return -1;
}
private char normalizedCharAt(@NotNull CharSequence text, char @Nullable [] textArray, int index) {
char lastChar = textArray != null ? textArray[index] : text.charAt(index);
if (myCaseSensitive) {
return lastChar;
}
return myLowercaseTransform ? StringUtil.toLowerCase(lastChar) : StringUtil.toUpperCase(lastChar);
}
private boolean isSameChar(char charInPattern, char charInText) {
boolean sameChar = charInPattern == charInText;
if (!sameChar && !myCaseSensitive) {
return StringUtil.charsEqualIgnoreCase(charInPattern, charInText);
}
return sameChar;
}
@Override
public String toString() {
return "pattern " + myPattern;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StringSearcher searcher = (StringSearcher)o;
if (myCaseSensitive != searcher.myCaseSensitive) return false;
if (myLowercaseTransform != searcher.myLowercaseTransform) return false;
if (myForwardDirection != searcher.myForwardDirection) return false;
if (myJavaIdentifier != searcher.myJavaIdentifier) return false;
if (myHandleEscapeSequences != searcher.myHandleEscapeSequences) return false;
return myPattern.equals(searcher.myPattern);
}
@Override
public int hashCode() {
int result = myPattern.hashCode();
result = 31 * result + (myCaseSensitive ? 1 : 0);
result = 31 * result + (myLowercaseTransform ? 1 : 0);
result = 31 * result + (myForwardDirection ? 1 : 0);
result = 31 * result + (myJavaIdentifier ? 1 : 0);
result = 31 * result + (myHandleEscapeSequences ? 1 : 0);
return result;
}
}
| apache-2.0 |
RJMillerLab/ibench | src/tresc/benchmark/data/ToXgeneTypes/UnionToxGeneType.java | 1176 | /**
*
*/
package tresc.benchmark.data.ToXgeneTypes;
import java.util.List;
import java.util.Random;
import toxgene.interfaces.ToXgeneCdataGenerator;
/**
* @author lord_pretzel
*
*/
public class UnionToxGeneType implements ToXgeneCdataGenerator {
private ToXgeneCdataGenerator[] types;
private Random rand;
private int numDts;
public UnionToxGeneType (List<ToXgeneCdataGenerator> l) {
types = new ToXgeneCdataGenerator[l.size()];
for(int i = 0; i < types.length; i++) {
types[i] = l.get(i);
}
init();
}
public UnionToxGeneType (ToXgeneCdataGenerator[] types) {
this.types = types;
init();
}
private void init() {
numDts = types.length;
rand = new Random(0);
}
/* (non-Javadoc)
* @see toxgene.interfaces.ToXgeneCdataGenerator#setRandomSeed(int)
*/
@Override
public void setRandomSeed(int seed) {
rand.setSeed(seed);
for(int i = 0; i < types.length; i++) {
types[i].setRandomSeed(seed);
}
}
/* (non-Javadoc)
* @see toxgene.interfaces.ToXgeneCdataGenerator#getCdata(int)
*/
@Override
public String getCdata(int length) {
int pos;
pos = rand.nextInt(numDts);
return types[pos].getCdata(length);
}
}
| apache-2.0 |
sdgdsffdsfff/bi-platform | queryrouter/src/main/java/com/baidu/rigel/biplatform/queryrouter/query/vo/sql/MeasureParseResult.java | 2985 | /**
* Copyright (c) 2014 Baidu, 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.baidu.rigel.biplatform.queryrouter.query.vo.sql;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 对每个指标进行解析
*
* @author xiaoming.chen
*
*/
public class MeasureParseResult implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -8776815596786643840L;
/**
* calateExpression 计算公式,类型还未确定 TODO 后续需要修改Object为公式对应的类型
*/
private Object caculateExpression;
/**
* baseMeasureCondition 基础指标对应的偏移条件,如果没有偏移,不用设置就是查询基础指标
*/
private List<MeasureCondition> baseMeasureCondition;
/**
* get baseMeasureCondition
*
* @return the baseMeasureCondition
*/
public List<MeasureCondition> getBaseMeasureCondition() {
if (this.baseMeasureCondition == null) {
this.baseMeasureCondition = new ArrayList<MeasureCondition>(1);
}
return baseMeasureCondition;
}
/**
* set baseMeasureCondition with baseMeasureCondition
*
* @param baseMeasureCondition the baseMeasureCondition to set
*/
public void setBaseMeasureCondition(List<MeasureCondition> baseMeasureCondition) {
this.baseMeasureCondition = baseMeasureCondition;
}
/**
* 创建一个简单指标的指标解析结果,只包含本身的基础指标
*
* @param measureName 指标名称
* @return 解析结果
*/
public static MeasureParseResult createBaseMeasure(String measureName) {
MeasureParseResult result = new MeasureParseResult();
result.getBaseMeasureCondition().add(new MeasureCondition(measureName));
return result;
}
/**
* get caculateExpression
*
* @return the caculateExpression
*/
public Object getCaculateExpression() {
return caculateExpression;
}
/**
* set caculateExpression with caculateExpression
*
* @param caculateExpression the caculateExpression to set
*/
public void setCaculateExpression(Object caculateExpression) {
this.caculateExpression = caculateExpression;
}
}
| apache-2.0 |
sajhak/container-support | src/main/java/org/ballerinalang/containers/docker/exception/BallerinaDockerClientException.java | 1025 | /*
* Copyright (c) 2017, WSO2 Inc. (http://wso2.com) 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 org.ballerinalang.containers.docker.exception;
/**
* Generic exception in Ballerina Container Support.
*/
public class BallerinaDockerClientException extends Exception {
public BallerinaDockerClientException(String message) {
super(message);
}
public BallerinaDockerClientException(String message, Throwable cause) {
super(message, cause);
}
}
| apache-2.0 |
erensezener/inverse-reinforcement-learning-java-toolbox | src/datastructure/Action.java | 432 | package datastructure;
public abstract class Action {
protected State currentState;
protected State nextState;
public State getCurrentState() {
return currentState;
}
public void setCurrentState(State currentState) {
this.currentState = currentState;
}
public abstract State getNextState();
public void setNextState(State nextState) {
this.nextState = nextState;
}
}
| apache-2.0 |
JetBrains/xodus | query/src/main/java/jetbrains/exodus/query/metadata/SimplePropertyMetaDataImpl.java | 1277 | /**
* Copyright 2010 - 2022 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package jetbrains.exodus.query.metadata;
import org.jetbrains.annotations.Nullable;
/**
*/
public class SimplePropertyMetaDataImpl extends PropertyMetaDataImpl {
private String primitiveTypeName;
public SimplePropertyMetaDataImpl() {
}
public SimplePropertyMetaDataImpl(final String name, final String primitiveTypeName) {
super(name, PropertyType.PRIMITIVE);
this.primitiveTypeName = primitiveTypeName;
}
@Nullable
public String getPrimitiveTypeName() {
return primitiveTypeName;
}
public void setPrimitiveTypeName(String primitiveTypeName) {
this.primitiveTypeName = primitiveTypeName;
}
}
| apache-2.0 |
LonelyMushroom/Architecture | RxArchitecture/model_zhihu/src/main/java/com/lmroom/zhihu/bean/WelcomeBean.java | 528 | package com.lmroom.zhihu.bean;
/**
* Created by codeest on 16/8/15.
*/
public class WelcomeBean {
/**
* text : © Fido Dido
* img : http://p2.zhimg.com/10/7b/107bb4894b46d75a892da6fa80ef504a.jpg
*/
private String text;
private String img;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
}
| apache-2.0 |
swjjxyxty/Study | studyspring/restdoc/src/main/java/com/bestxty/sutdy/restdoc/Application.java | 397 | package com.bestxty.sutdy.restdoc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author jiangtaiyang
* Created by jiangtaiyang on 2017/6/26.
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
} | apache-2.0 |
logginghub/core | logginghub-utils/src/main/java/com/logginghub/utils/sof/Profiler.java | 3276 | package com.logginghub.utils.sof;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import com.logginghub.utils.FactoryMap;
import com.logginghub.utils.Out;
import com.logginghub.utils.StringUtils;
import com.logginghub.utils.TimeUtils;
public class Profiler {
// private static long current;
public final static class Entry {
long start;
String key;
int depth;
public Entry(long start, String key, int depth) {
super();
this.start = start;
this.key = key;
this.depth = depth;
}
}
public final static class Result {
public Result(String key) {
this.key = key;
}
String key;
double total;
long count;
int depth;
public void update(long elapsed, int depth) {
this.depth = depth;
count++;
total += elapsed;
}
public double calculateMeanNanos() {
return total / count;
}
}
public static void dump() {
NumberFormat nf = NumberFormat.getInstance();
for (String string : outputOrder) {
Result entry = entries.get(string);
Out.out("{} | {} | {} | {}",
StringUtils.padRight(StringUtils.repeat(" ", entry.depth) + entry.key, 60),
StringUtils.padLeft(nf.format(entry.count), 20),
StringUtils.padLeft(nf.format(entry.total), 20),
StringUtils.padLeft(TimeUtils.formatIntervalNanoseconds(entry.calculateMeanNanos()), 20));
}
}
private static FactoryMap<String, Result> entries = new FactoryMap<String, Result>() {
@Override protected Result createEmptyValue(String key) {
return new Result(key);
}
};
private static Stack<Entry> entryStack = new Stack<Entry>();
// private static String name;
public static void end() {
long endTime = System.nanoTime();
StringBuilder keyBuilder = new StringBuilder();
String div = "";
for (Entry entry : entryStack) {
keyBuilder.append(div).append(entry.key);
div ="::";
}
Entry pop = entryStack.pop();
String key = keyBuilder.toString();
long elapsed = endTime - pop.start;
entries.get(key).update(elapsed, pop.depth);
}
private static List<String> outputOrder = new ArrayList<String>();
public static void start(String name) {
StringBuilder keyBuilder = new StringBuilder();
String div = "";
for (Entry entry : entryStack) {
keyBuilder.append(div).append(entry.key);
div ="::";
}
keyBuilder.append(div).append(name);
String key = keyBuilder.toString();
if (!outputOrder.contains(key)) {
outputOrder.add(key);
}
Entry entry = new Entry(0, name, entryStack.size());
entryStack.push(entry);
entry.start = System.nanoTime();
}
}
| apache-2.0 |
darciopacifico/omr | branchs/msaf_validador/JazzFramework/src/main/java/br/com/dlp/framework/servicelocator/RelatorioServiceLocator.java | 1619 | package br.com.dlp.framework.servicelocator;
import javax.jms.QueueSession;
import org.hibernate.Session;
public class RelatorioServiceLocator extends AbstractJ2EEServiceLocatorImpl {
/**
*
*/
private static final long serialVersionUID = 8264244757027885399L;
public RelatorioServiceLocator() throws ServiceLocatorException {
super();
}
public void closeHibernateSession(Session session)
throws ServiceLocatorException {
throw new ServiceLocatorException(
"Esta implementação de IServiceLocator "
+ "serve apenas para o componente de Relatorios, não"
+ "sendo possível invocar este servico de fechar sessao do hibernate");
}
public synchronized Session getHibernateSession()
throws ServiceLocatorException {
throw new ServiceLocatorException(
"Esta implementação de IServiceLocator "
+ "serve apenas para o componente de Relatorios, não"
+ "sendo possível invocar este servico de criar sessao do hibernate");
}
public QueueSession getQueueSessionPool() throws ServiceLocatorException {
throw new ServiceLocatorException(
"Esta implementação de IServiceLocator "
+ "serve apenas para o componente de Relatorios, não"
+ "sendo possível invocar este servico de criar sessao de filas");
}
public QueueSession getQueueSessionBatch() throws ServiceLocatorException {
throw new ServiceLocatorException(
"Esta implementação de IServiceLocator "
+ "serve apenas para o componente de Relatorios, não"
+ "sendo possível invocar este servico de criar sessao de filas");
}
}
| apache-2.0 |
oehme/analysing-gradle-performance | my-app/src/main/java/org/gradle/test/performance/mediummonolithicjavaproject/p147/Production2949.java | 1891 | package org.gradle.test.performance.mediummonolithicjavaproject.p147;
public class Production2949 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | apache-2.0 |
arafalov/Solr-Components | DirectoryLayout/src/main/java/com/solrstart/components/layout/MatchPatterns.java | 8194 | package com.solrstart.components.layout;
import java.nio.file.Path;
import java.util.ArrayList;
/**
* Created by arafalov on 12/24/14.
*/
public class MatchPatterns {
private static ArrayList<GroupPattern> GROUP_PATTERNS = new ArrayList<>();
private static GroupPattern addPattern(String pattern, String description) {
GroupPattern gp = new GroupPattern(pattern, description);
GROUP_PATTERNS.add(gp);
return gp;
}
static {
addPattern("docs/solr-[^.]+$", "Javadoc directories.");
addPattern("licenses/.*-LICENSE.*\\.txt", "Licenses for various libraries Solr ships with.").setCountOnly();
addPattern("licenses/.*-NOTICE.*\\.txt", "Notices for various libraries Solr ships with.").setCountOnly();
addPattern("licenses/.*\\.sha1", "SHA1 signatures for various libraries Solr ships with.").setCountOnly();
// addPattern("example/solr-webapp/webapp/img/ico/.*", "Various icons used for Admin UI");
// addPattern("example/solr-webapp/webapp/img/filetypes/.*", "PNG image files representing different files (by extension)");
addPattern("example/solr-webapp/webapp", "Unpacked copy of the solr.war");
addPattern("example/exampledocs/.*\\.xml", "XML file with content to populate the example core");
addPattern("example/exampledocs/post.jar", "Simple client to send documents to Solr. Use <em>java -jar post.jar -h</em> for options.");
// Match solr.xml but NOT in example doc (using negative look-behind matching)
addPattern(".*(?<!exampledocs)/solr\\.xml", "File marking top of Solr home. In new style, indicates that directories below should be searched for core.properties file");
addPattern(".*/core\\.properties",
"Marks that this directory represents Solr core/collection. Can be empty for all defaults");
addPattern(".*/stopwords_.*\\.txt",
"Language-specific stopwords used by <a href='/info/analyzers/#StopFilterFactory'>solr.StopFilterFactory</a>");
addPattern(".*/stopwords\\.txt",
"Generic example stopwords (probably empty) used by <a href='/info/analyzers/#StopFilterFactory'>solr.StopFilterFactory</a>");
addPattern(".*/admin-extra(.menu-(top|bottom))?\\.html",
"(Little used) files that will be added by the AdminUI to create <a href='https://cwiki.apache.org/confluence/display/solr/Core-Specific+Tools'>additional menu screens</a> for the core.");
addPattern(".*/solrconfig\\.xml",
"The configuration file with <a href='https://cwiki.apache.org/confluence/display/solr/Configuring+solrconfig.xml'>the most parameters affecting Solr itself</a>"
);
addPattern(".*/schema\\.xml",
"Main <a href='https://cwiki.apache.org/confluence/display/solr/Documents%2C+Fields%2C+and+Schema+Design'>schema definition</a> for the collection. If dynamic schema is enabled, this file will be serve as a seed for REST-controlled schema in (usually called) <em>managed-schema</em>");
addPattern(".*/zoo\\.cfg",
"Zookeper configuration used for <a href='https://cwiki.apache.org/confluence/display/solr/SolrCloud'>SolrCloud</a>");
addPattern(".*/log4j\\.properties",
"Logging configuration using <a href='http://logging.apache.org/log4j/1.2/manual.html'>Log4J</a>");
addPattern(".*/conf/velocity/.*\\.vm", "Various (*.vm) velocity files for /browse handler").setCountOnly();
addPattern(".*/_[0-9]+\\.fd[tx]",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene41/Lucene41StoredFieldsFormat.html'>field data (Stored Fields) and index</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+\\.fnm",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene46/Lucene46FieldInfosFormat.html'>information about the fields</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+\\.nv[dm]",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene49/Lucene49NormsFormat.html'>Norms (Encodes length and boost factors for docs and fields)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+\\.si",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene40/Lucene40SegmentInfoFormat.html'>metadata about a segment</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+\\.tv[dx]",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene42/Lucene42TermVectorsFormat.html'>Term Vector Documents (tvd) and index (tvx)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/segments(\\.gen|_[0-9]+)",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/index/SegmentInfos.html'>information about a commit point</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/write\\.lock",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#Lock_File'>Write lock (prevents multiple IndexWriters from writing to the same file)</a>");
addPattern(".*/_[0-9]+_Lucene[0-9_]+\\.doc",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene41/Lucene41PostingsFormat.html'>Frequences (list of docs which contain each term along with frequency)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+_Lucene[0-9_]+\\.pay",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene41/Lucene41PostingsFormat.html'>Payloads (additional per-position metadata information such as character offsets and user payloads)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+_Lucene[0-9_]+\\.pos",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene41/Lucene41PostingsFormat.html'>Positions (information about where a term occurs in the index)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/_[0-9]+_Lucene[0-9_]+\\.ti[mp]",
"Lucene <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene41/Lucene41PostingsFormat.html'>Term Dictionary(tim) and index(tip)</a> (See also <a href='http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/codecs/lucene410/package-summary.html#package_description'>Overview</a>)");
addPattern(".*/tlog\\.[0-9]+",
"Transaction log file required for <a href='https://cwiki.apache.org/confluence/display/solr/RealTime+Get'>Realtime Get</a> and Solr Cloud");
}
public static GroupPattern findPattern(Path filePath) {
for (GroupPattern groupPattern : GROUP_PATTERNS) {
if (groupPattern.getPattern().matcher(filePath.toString()).matches()) { return groupPattern; }
}
//matched nothing
return null;
}
}
| apache-2.0 |
jentfoo/aws-sdk-java | aws-java-sdk-batch/src/main/java/com/amazonaws/services/batch/model/transform/DescribeJobQueuesRequestProtocolMarshaller.java | 2665 | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.batch.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.batch.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* DescribeJobQueuesRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DescribeJobQueuesRequestProtocolMarshaller implements Marshaller<Request<DescribeJobQueuesRequest>, DescribeJobQueuesRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/v1/describejobqueues")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).serviceName("AWSBatch").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public DescribeJobQueuesRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<DescribeJobQueuesRequest> marshall(DescribeJobQueuesRequest describeJobQueuesRequest) {
if (describeJobQueuesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<DescribeJobQueuesRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
describeJobQueuesRequest);
protocolMarshaller.startMarshalling();
DescribeJobQueuesRequestMarshaller.getInstance().marshall(describeJobQueuesRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| apache-2.0 |
remibergsma/cosmic | cosmic-core/server/src/test/java/com/cloud/network/lb/UpdateLoadBalancerTest.java | 5091 | package com.cloud.network.lb;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
import com.cloud.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
import com.cloud.context.CallContext;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.NetworkModel;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.as.dao.AutoScaleVmGroupDao;
import com.cloud.network.dao.LBHealthCheckPolicyDao;
import com.cloud.network.dao.LBStickinessPolicyDao;
import com.cloud.network.dao.LoadBalancerCertMapDao;
import com.cloud.network.dao.LoadBalancerDao;
import com.cloud.network.dao.LoadBalancerVMMapDao;
import com.cloud.network.dao.LoadBalancerVO;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.element.LoadBalancingServiceProvider;
import com.cloud.user.Account;
import com.cloud.user.AccountVO;
import com.cloud.user.MockAccountManagerImpl;
import com.cloud.user.User;
import com.cloud.user.UserVO;
import com.cloud.utils.exception.InvalidParameterValueException;
import java.util.ArrayList;
import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InOrder;
import org.mockito.Mockito;
public class UpdateLoadBalancerTest {
private static final long domainId = 5L;
private static final String accountName = "admin";
LoadBalancingRulesManagerImpl _lbMgr = new LoadBalancingRulesManagerImpl();
private UpdateLoadBalancerRuleCmd updateLbRuleCmd;
private final LoadBalancerDao lbDao = Mockito.mock(LoadBalancerDao.class);
private final NetworkDao netDao = Mockito.mock(NetworkDao.class);
private final NetworkModel netModel = Mockito.mock(NetworkModel.class);
private final LoadBalancingServiceProvider lbServiceProvider = Mockito.mock(LoadBalancingServiceProvider.class);
@Before
public void setUp() {
_lbMgr._accountMgr = new MockAccountManagerImpl();
_lbMgr._autoScaleVmGroupDao = Mockito.mock(AutoScaleVmGroupDao.class);
_lbMgr._networkDao = netDao;
_lbMgr._networkModel = netModel;
_lbMgr._lb2healthcheckDao = Mockito.mock(LBHealthCheckPolicyDao.class);
_lbMgr._lb2stickinesspoliciesDao = Mockito.mock(LBStickinessPolicyDao.class);
_lbMgr._lb2VmMapDao = Mockito.mock(LoadBalancerVMMapDao.class);
_lbMgr._lbCertMapDao = Mockito.mock(LoadBalancerCertMapDao.class);
_lbMgr._lbDao = lbDao;
_lbMgr._lbProviders = new ArrayList<LoadBalancingServiceProvider>();
_lbMgr._lbProviders.add(lbServiceProvider);
updateLbRuleCmd = new UpdateLoadBalancerRuleCmd();
final AccountVO account = new AccountVO(accountName, domainId, "networkDomain", Account.ACCOUNT_TYPE_NORMAL, "uuid");
final UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user, account);
}
@Test
public void testValidateRuleBeforeUpdateLB() throws ResourceAllocationException, ResourceUnavailableException, InsufficientCapacityException {
final LoadBalancerVO lb = new LoadBalancerVO(null, null, null, 0L, 0, 0, null, 0L, 0L, domainId, null, 60000, 60000);
when(lbDao.findById(anyLong())).thenReturn(lb);
when(netModel.getPublicIpAddress(anyLong())).thenReturn(Mockito.mock(PublicIpAddress.class));
when(netDao.findById(anyLong())).thenReturn(Mockito.mock(NetworkVO.class));
when(lbServiceProvider.validateLBRule(any(Network.class), any(LoadBalancingRule.class))).thenReturn(true);
when(lbDao.update(anyLong(), eq(lb))).thenReturn(true);
_lbMgr.updateLoadBalancerRule(updateLbRuleCmd);
final InOrder inOrder = Mockito.inOrder(lbServiceProvider, lbDao);
inOrder.verify(lbServiceProvider).validateLBRule(any(Network.class), any(LoadBalancingRule.class));
inOrder.verify(lbDao).update(anyLong(), eq(lb));
}
@Test(expected = InvalidParameterValueException.class)
public void testRuleNotValidated() throws ResourceAllocationException, ResourceUnavailableException, InsufficientCapacityException {
final LoadBalancerVO lb = new LoadBalancerVO(null, null, null, 0L, 0, 0, null, 0L, 0L, domainId, null, 60000, 60000);
when(lbDao.findById(anyLong())).thenReturn(lb);
when(netModel.getPublicIpAddress(anyLong())).thenReturn(Mockito.mock(PublicIpAddress.class));
when(netDao.findById(anyLong())).thenReturn(Mockito.mock(NetworkVO.class));
when(lbServiceProvider.validateLBRule(any(Network.class), any(LoadBalancingRule.class))).thenReturn(false);
_lbMgr.updateLoadBalancerRule(updateLbRuleCmd);
}
@After
public void tearDown() {
CallContext.unregister();
}
}
| apache-2.0 |
eHarmony/seeking | seeking-mongo/src/test/java/com/eharmony/matching/seeking/translator/mongodb/MorphiaPropertyResolverTest.java | 2243 | package com.eharmony.matching.seeking.translator.mongodb;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import com.eharmony.matching.seeking.test.TestClass;
import com.google.code.morphia.annotations.Embedded;
import com.google.code.morphia.annotations.Id;
import com.google.code.morphia.annotations.Property;
import com.google.code.morphia.mapping.Mapper;
public class MorphiaPropertyResolverTest {
@SuppressWarnings("unused")
public static class TestMappedEmbeddedClass {
private int a;
@Property("bee")
private int b;
}
@SuppressWarnings("unused")
public static class TestMappedClass {
@Id
private int id;
private String name;
@Property("thatProperty")
private String thisProperty;
@Embedded
private TestMappedEmbeddedClass t;
@Embedded("teatwo")
private TestMappedEmbeddedClass t2;
}
@Before
public void before() {
mapper.addMappedClass(TestClass.class);
}
private final Mapper mapper = new Mapper();
private final MorphiaPropertyResolver resolver = new MorphiaPropertyResolver(
mapper);
@Test
public void resolve_id() {
assertEquals("_id", resolver.resolve("id", TestMappedClass.class));
}
@Test
public void resolve_name() {
assertEquals("name", resolver.resolve("name", TestMappedClass.class));
}
@Test
public void resolve_thisProperty() {
assertEquals("thatProperty",
resolver.resolve("thisProperty", TestMappedClass.class));
}
@Test
public void resolve_t() {
assertEquals("t", resolver.resolve("t", TestMappedClass.class));
assertEquals("t.a", resolver.resolve("t.a", TestMappedClass.class));
assertEquals("t.bee", resolver.resolve("t.b", TestMappedClass.class));
}
@Test
public void resolve_t2() {
assertEquals("teatwo", resolver.resolve("t2", TestMappedClass.class));
assertEquals("teatwo.a", resolver.resolve("t2.a", TestMappedClass.class));
assertEquals("teatwo.bee", resolver.resolve("t2.b", TestMappedClass.class));
}
}
| apache-2.0 |
nomoa/elasticsearch | core/src/main/java/org/elasticsearch/index/mapper/core/LegacyShortFieldMapper.java | 14135 | /*
* 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.mapper.core;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Terms;
import org.apache.lucene.search.LegacyNumericRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefBuilder;
import org.apache.lucene.util.LegacyNumericUtils;
import org.elasticsearch.Version;
import org.elasticsearch.action.fieldstats.FieldStats;
import org.elasticsearch.common.Explicit;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.Fuzziness;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.fielddata.IndexFieldData;
import org.elasticsearch.index.fielddata.IndexNumericFieldData.NumericType;
import org.elasticsearch.index.fielddata.plain.DocValuesIndexFieldData;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperParsingException;
import org.elasticsearch.index.mapper.ParseContext;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeShortValue;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseNumberField;
/**
*
*/
public class LegacyShortFieldMapper extends LegacyNumberFieldMapper {
public static final String CONTENT_TYPE = "short";
public static final int DEFAULT_PRECISION_STEP = 8;
public static class Defaults extends LegacyNumberFieldMapper.Defaults {
public static final MappedFieldType FIELD_TYPE = new ShortFieldType();
static {
FIELD_TYPE.freeze();
}
}
public static class Builder extends LegacyNumberFieldMapper.Builder<Builder, LegacyShortFieldMapper> {
public Builder(String name) {
super(name, Defaults.FIELD_TYPE, DEFAULT_PRECISION_STEP);
builder = this;
}
@Override
public LegacyShortFieldMapper build(BuilderContext context) {
if (context.indexCreatedVersion().onOrAfter(Version.V_5_0_0_alpha2)) {
throw new IllegalStateException("Cannot use legacy numeric types after 5.0");
}
setupFieldType(context);
LegacyShortFieldMapper fieldMapper = new LegacyShortFieldMapper(name, fieldType, defaultFieldType,
ignoreMalformed(context), coerce(context),
context.indexSettings(), multiFieldsBuilder.build(this, context), copyTo);
return (LegacyShortFieldMapper) fieldMapper.includeInAll(includeInAll);
}
@Override
protected int maxPrecisionStep() {
return 32;
}
}
public static class TypeParser implements Mapper.TypeParser {
@Override
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException {
LegacyShortFieldMapper.Builder builder = new LegacyShortFieldMapper.Builder(name);
parseNumberField(builder, name, node, parserContext);
for (Iterator<Map.Entry<String, Object>> iterator = node.entrySet().iterator(); iterator.hasNext();) {
Map.Entry<String, Object> entry = iterator.next();
String propName = entry.getKey();
Object propNode = entry.getValue();
if (propName.equals("null_value")) {
if (propNode == null) {
throw new MapperParsingException("Property [null_value] cannot be null.");
}
builder.nullValue(nodeShortValue(propNode));
iterator.remove();
}
}
return builder;
}
}
static final class ShortFieldType extends NumberFieldType {
public ShortFieldType() {
super(LegacyNumericType.INT);
}
protected ShortFieldType(ShortFieldType ref) {
super(ref);
}
@Override
public NumberFieldType clone() {
return new ShortFieldType(this);
}
@Override
public String typeName() {
return CONTENT_TYPE;
}
@Override
public Short nullValue() {
return (Short)super.nullValue();
}
@Override
public Short valueForSearch(Object value) {
if (value == null) {
return null;
}
return ((Number) value).shortValue();
}
@Override
public BytesRef indexedValueForSearch(Object value) {
BytesRefBuilder bytesRef = new BytesRefBuilder();
LegacyNumericUtils.intToPrefixCoded(parseValue(value), 0, bytesRef); // 0 because of exact match
return bytesRef.get();
}
@Override
public Query rangeQuery(Object lowerTerm, Object upperTerm, boolean includeLower, boolean includeUpper) {
return LegacyNumericRangeQuery.newIntRange(name(), numericPrecisionStep(),
lowerTerm == null ? null : (int)parseValue(lowerTerm),
upperTerm == null ? null : (int)parseValue(upperTerm),
includeLower, includeUpper);
}
@Override
public Query fuzzyQuery(Object value, Fuzziness fuzziness, int prefixLength, int maxExpansions, boolean transpositions) {
short iValue = parseValue(value);
short iSim = fuzziness.asShort();
return LegacyNumericRangeQuery.newIntRange(name(), numericPrecisionStep(),
iValue - iSim,
iValue + iSim,
true, true);
}
@Override
public FieldStats.Long stats(IndexReader reader) throws IOException {
int maxDoc = reader.maxDoc();
Terms terms = org.apache.lucene.index.MultiFields.getTerms(reader, name());
if (terms == null) {
return null;
}
long minValue = LegacyNumericUtils.getMinInt(terms);
long maxValue = LegacyNumericUtils.getMaxInt(terms);
return new FieldStats.Long(
maxDoc, terms.getDocCount(), terms.getSumDocFreq(), terms.getSumTotalTermFreq(),
isSearchable(), isAggregatable(), minValue, maxValue);
}
@Override
public IndexFieldData.Builder fielddataBuilder() {
failIfNoDocValues();
return new DocValuesIndexFieldData.Builder().numericType(NumericType.SHORT);
}
}
protected LegacyShortFieldMapper(String simpleName, MappedFieldType fieldType, MappedFieldType defaultFieldType,
Explicit<Boolean> ignoreMalformed, Explicit<Boolean> coerce,
Settings indexSettings, MultiFields multiFields, CopyTo copyTo) {
super(simpleName, fieldType, defaultFieldType, ignoreMalformed, coerce, indexSettings, multiFields, copyTo);
}
@Override
public ShortFieldType fieldType() {
return (ShortFieldType) super.fieldType();
}
private static short parseValue(Object value) {
if (value instanceof Number) {
return ((Number) value).shortValue();
}
if (value instanceof BytesRef) {
return Short.parseShort(((BytesRef) value).utf8ToString());
}
return Short.parseShort(value.toString());
}
@Override
protected boolean customBoost() {
return true;
}
@Override
protected void innerParseCreateField(ParseContext context, List<Field> fields) throws IOException {
short value;
float boost = fieldType().boost();
if (context.externalValueSet()) {
Object externalValue = context.externalValue();
if (externalValue == null) {
if (fieldType().nullValue() == null) {
return;
}
value = fieldType().nullValue();
} else if (externalValue instanceof String) {
String sExternalValue = (String) externalValue;
if (sExternalValue.length() == 0) {
if (fieldType().nullValue() == null) {
return;
}
value = fieldType().nullValue();
} else {
value = Short.parseShort(sExternalValue);
}
} else {
value = ((Number) externalValue).shortValue();
}
if (context.includeInAll(includeInAll, this)) {
context.allEntries().addText(fieldType().name(), Short.toString(value), boost);
}
} else {
XContentParser parser = context.parser();
if (parser.currentToken() == XContentParser.Token.VALUE_NULL ||
(parser.currentToken() == XContentParser.Token.VALUE_STRING && parser.textLength() == 0)) {
if (fieldType().nullValue() == null) {
return;
}
value = fieldType().nullValue();
if (fieldType().nullValueAsString() != null && (context.includeInAll(includeInAll, this))) {
context.allEntries().addText(fieldType().name(), fieldType().nullValueAsString(), boost);
}
} else if (parser.currentToken() == XContentParser.Token.START_OBJECT
&& Version.indexCreated(context.indexSettings()).before(Version.V_5_0_0_alpha1)) {
XContentParser.Token token;
String currentFieldName = null;
Short objValue = fieldType().nullValue();
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else {
if ("value".equals(currentFieldName) || "_value".equals(currentFieldName)) {
if (parser.currentToken() != XContentParser.Token.VALUE_NULL) {
objValue = parser.shortValue(coerce.value());
}
} else if ("boost".equals(currentFieldName) || "_boost".equals(currentFieldName)) {
boost = parser.floatValue();
} else {
throw new IllegalArgumentException("unknown property [" + currentFieldName + "]");
}
}
}
if (objValue == null) {
// no value
return;
}
value = objValue;
} else {
value = parser.shortValue(coerce.value());
if (context.includeInAll(includeInAll, this)) {
context.allEntries().addText(fieldType().name(), parser.text(), boost);
}
}
}
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
CustomShortNumericField field = new CustomShortNumericField(value, fieldType());
if (boost != 1f && Version.indexCreated(context.indexSettings()).before(Version.V_5_0_0_alpha1)) {
field.setBoost(boost);
}
fields.add(field);
}
if (fieldType().hasDocValues()) {
addDocValue(context, fields, value);
}
}
@Override
protected String contentType() {
return CONTENT_TYPE;
}
@Override
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
super.doXContentBody(builder, includeDefaults, params);
if (includeDefaults || fieldType().numericPrecisionStep() != DEFAULT_PRECISION_STEP) {
builder.field("precision_step", fieldType().numericPrecisionStep());
}
if (includeDefaults || fieldType().nullValue() != null) {
builder.field("null_value", fieldType().nullValue());
}
if (includeInAll != null) {
builder.field("include_in_all", includeInAll);
} else if (includeDefaults) {
builder.field("include_in_all", false);
}
}
public static class CustomShortNumericField extends CustomNumericField {
private final short number;
public CustomShortNumericField(short number, NumberFieldType fieldType) {
super(number, fieldType);
this.number = number;
}
@Override
public TokenStream tokenStream(Analyzer analyzer, TokenStream previous) {
if (fieldType().indexOptions() != IndexOptions.NONE) {
return getCachedStream().setIntValue(number);
}
return null;
}
@Override
public String numericAsString() {
return Short.toString(number);
}
}
}
| apache-2.0 |
kohii/smoothcsv | smoothcsv-app-modules/smoothcsv-core/src/main/java/com/smoothcsv/core/filter/FilterOperationPanel.java | 2228 | /*
* Copyright 2016 kohii
*
* 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.smoothcsv.core.filter;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import com.smoothcsv.framework.util.SCBundle;
import com.smoothcsv.swing.components.ExButtonGroup;
import com.smoothcsv.swing.components.ExRadioButton;
/**
* @author kohii
*/
@SuppressWarnings("serial")
public class FilterOperationPanel extends JPanel {
private ExButtonGroup<Integer> buttonGroup;
@SuppressWarnings("unchecked")
public FilterOperationPanel() {
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
setBorder(BorderFactory.createTitledBorder(""));
ExRadioButton<Integer> deleteUnmatchRadio =
new ExRadioButton<>(FilterConditions.FILTER_OPERATION_DELETE_UNMATCH,
SCBundle.get("key.filterOpe.deleteUnmatch"));
add(deleteUnmatchRadio);
ExRadioButton<Integer> deleteMatchRadio = new ExRadioButton<>(
FilterConditions.FILTER_OPERATION_DELETE_MATCH, SCBundle.get("key.filterOpe.deleteMatch"));
add(deleteMatchRadio);
ExRadioButton<Integer> newTabUnmatchRadio =
new ExRadioButton<>(FilterConditions.FILTER_OPERATION_NEW_TAB_UNMATCH,
SCBundle.get("key.filterOpe.newTabUnmatch"));
add(newTabUnmatchRadio);
ExRadioButton<Integer> newTabMatchRadio = new ExRadioButton<>(
FilterConditions.FILTER_OPERATION_NEW_TAB_MATCH, SCBundle.get("key.filterOpe.newTabMatch"));
add(newTabMatchRadio);
buttonGroup = new ExButtonGroup<Integer>(deleteUnmatchRadio, deleteMatchRadio,
newTabUnmatchRadio, newTabMatchRadio);
}
public int getSeletedOperation() {
return buttonGroup.getSelectedValue();
}
}
| apache-2.0 |
frank29259/java | Object/Objext/src/com/lab/text/Year.java | 123 |
package com.lab.text;
public class Year {
public int Change(int age){
return 2558-age;
}
} | apache-2.0 |
nobodyiam/apollo | apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java | 4306 | /*
* Copyright 2022 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.internals;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
import com.ctrip.framework.apollo.spi.ApolloInjectorCustomizer;
import com.ctrip.framework.apollo.spi.ConfigFactory;
import com.ctrip.framework.apollo.spi.ConfigFactoryManager;
import com.ctrip.framework.apollo.spi.ConfigRegistry;
import com.ctrip.framework.apollo.spi.DefaultConfigFactory;
import com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager;
import com.ctrip.framework.apollo.spi.DefaultConfigRegistry;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory;
import com.ctrip.framework.apollo.util.factory.PropertiesFactory;
import com.ctrip.framework.apollo.util.http.DefaultHttpClient;
import com.ctrip.framework.apollo.util.http.HttpClient;
import com.ctrip.framework.apollo.util.yaml.YamlParser;
import com.ctrip.framework.foundation.internals.ServiceBootstrap;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Singleton;
import java.util.List;
/**
* Guice injector
* @author Jason Song(song_s@ctrip.com)
*/
public class DefaultInjector implements Injector {
private final com.google.inject.Injector m_injector;
private final List<ApolloInjectorCustomizer> m_customizers;
public DefaultInjector() {
try {
m_injector = Guice.createInjector(new ApolloModule());
m_customizers = ServiceBootstrap.loadAllOrdered(ApolloInjectorCustomizer.class);
} catch (Throwable ex) {
ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex);
Tracer.logError(exception);
throw exception;
}
}
@Override
public <T> T getInstance(Class<T> clazz) {
try {
for (ApolloInjectorCustomizer customizer : m_customizers) {
T instance = customizer.getInstance(clazz);
if (instance != null) {
return instance;
}
}
return m_injector.getInstance(clazz);
} catch (Throwable ex) {
Tracer.logError(ex);
throw new ApolloConfigException(
String.format("Unable to load instance for %s!", clazz.getName()), ex);
}
}
@Override
public <T> T getInstance(Class<T> clazz, String name) {
try {
for (ApolloInjectorCustomizer customizer : m_customizers) {
T instance = customizer.getInstance(clazz, name);
if (instance != null) {
return instance;
}
}
//Guice does not support get instance by type and name
return null;
} catch (Throwable ex) {
Tracer.logError(ex);
throw new ApolloConfigException(
String.format("Unable to load instance for %s with name %s!", clazz.getName(), name), ex);
}
}
private static class ApolloModule extends AbstractModule {
@Override
protected void configure() {
bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class);
bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class);
bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class);
bind(ConfigFactory.class).to(DefaultConfigFactory.class).in(Singleton.class);
bind(ConfigUtil.class).in(Singleton.class);
bind(HttpClient.class).to(DefaultHttpClient.class).in(Singleton.class);
bind(ConfigServiceLocator.class).in(Singleton.class);
bind(RemoteConfigLongPollService.class).in(Singleton.class);
bind(YamlParser.class).in(Singleton.class);
bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class);
}
}
}
| apache-2.0 |
EdwardLee03/tomcat-sr | src/main/java/org/apache/tomcat/util/threads/TaskQueue.java | 5789 | /*
* 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.tomcat.util.threads;
import java.util.Collection;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
/**
* 专门设计的运行在线程池执行器的任务队列。
* <p>
* As task queue specifically designed to run with a thread pool executor.
* The task queue is optimised to properly utilize threads within
* a thread pool executor. If you use a normal queue, the executor will spawn threads
* when there are idle threads and you wont be able to force items unto the queue itself
* @author fhanik
*
*/
public class TaskQueue extends LinkedBlockingQueue<Runnable> {
private static final long serialVersionUID = 1L;
/** 该任务队列所在的线程池执行器 */
private ThreadPoolExecutor parent = null;
// no need to be volatile, the one times when we change and read it occur in
// a single thread (the one that did stop a context and fired listeners)
private Integer forcedRemainingCapacity = null;
public TaskQueue() {
super();
}
public TaskQueue(int capacity) {
super(capacity);
}
public TaskQueue(Collection<? extends Runnable> c) {
super(c);
}
public void setParent(ThreadPoolExecutor tp) {
parent = tp;
}
public boolean force(Runnable o) {
if (parent.isShutdown()) {
// 执行器已被关闭
throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
}
return super.offer(o); // forces the item onto the queue, to be used if the task is rejected
}
/**
* 强制将任务插入到队列尾部。
*
* @param o 可运行的任务
* @param timeout
* @param unit
* @return
* @throws InterruptedException
*/
public boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException {
if (parent.isShutdown()) {
// 执行器已被关闭
throw new RejectedExecutionException("Executor not running, can't force a command into the queue");
}
return super.offer(o, timeout, unit); // forces the item onto the queue, to be used if the task is rejected
}
/*
* 插入指定元素到队列尾部。
*/
@Override
public boolean offer(Runnable o) {
//we can't do any checks
if (parent==null) return super.offer(o);
//we are maxed out on threads, simply queue the object (达到"最大线程数")
if (parent.getPoolSize() == parent.getMaximumPoolSize()) return super.offer(o);
//we have idle threads, just add it to the queue (核心池有空闲线程)
if (parent.getSubmittedCount() < parent.getPoolSize()) return super.offer(o);
//if we have less threads than maximum force creation of a new thread (需要创建一个新的线程)
if (parent.getPoolSize() < parent.getMaximumPoolSize()) return false;
//if we reached here, we need to add it to the queue (插入到队列)
return super.offer(o);
}
/*
* 检索并移除队列头部任务。(非阻塞操作)
*/
@Override
public Runnable poll(long timeout, TimeUnit unit)
throws InterruptedException {
Runnable runnable = super.poll(timeout, unit);
if (runnable == null && parent != null) {
// the poll timed out, it gives an opportunity to stop the current
// thread if needed to avoid memory leaks. (关闭当前的线程,以避免内存泄露)
parent.stopCurrentThreadIfNeeded();
}
return runnable;
}
/*
* 检索并移除队列头部任务。(阻塞操作)
*/
@Override
public Runnable take() throws InterruptedException {
if (parent != null && parent.currentThreadShouldBeStopped()) {
// 先尝试着在给定的时间里去检索任务
return poll(parent.getKeepAliveTime(TimeUnit.MILLISECONDS),
TimeUnit.MILLISECONDS);
// yes, this may return null (in case of timeout) which normally
// does not occur with take()
// but the ThreadPoolExecutor implementation allows this
}
// 一直阻塞
return super.take();
}
/*
* 任务队列的剩余容量。
*/
@Override
public int remainingCapacity() {
if (forcedRemainingCapacity != null) {
// ThreadPoolExecutor.setCorePoolSize checks that
// remainingCapacity==0 to allow to interrupt idle threads
// I don't see why, but this hack allows to conform to this
// "requirement"
return forcedRemainingCapacity.intValue();
}
return super.remainingCapacity();
}
public void setForcedRemainingCapacity(Integer forcedRemainingCapacity) {
this.forcedRemainingCapacity = forcedRemainingCapacity;
}
}
| apache-2.0 |
kevprakash/GenerationAndSimulationPlatform | generation/Generation.java | 530 | package generation;
import math.function.Function;
public class Generation {
public static double[][] fillArray2D(int x, int y, Function fillFunction, String[] variableNames){
double[][] output = new double[y][x];
for(int i = 0; i < y; i++){
for(int j = 0; j < x; j++){
output[i][j] = fillFunction.f(new double[]{i, j}, variableNames);
}
}
return output;
}
public static double[][] fillArray2D(int x, int y, Function fillFunction){
return fillArray2D(x, y, fillFunction, new String[]{"x", "y"});
}
}
| apache-2.0 |
ShansOwn/android-architecture | app/src/main/java/com/shansown/androidarchitecture/data/api/SearchQuery.java | 1066 | package com.shansown.androidarchitecture.data.api;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import static com.shansown.androidarchitecture.util.Preconditions.checkNotNull;
public final class SearchQuery {
private static final DateTimeFormatter ISO_8601_DATE = DateTimeFormat.forPattern("yyyy-MM-dd");
private final DateTime createdSince;
private SearchQuery(Builder builder) {
this.createdSince = checkNotNull(builder.createdSince, "createdSince == null");
}
@Override public String toString() {
// Returning null here is not ideal, but it lets retrofit drop the query param altogether.
return createdSince == null ? null : "created:>=" + ISO_8601_DATE.print(createdSince);
}
public static final class Builder {
private DateTime createdSince;
public Builder createdSince(DateTime createdSince) {
this.createdSince = createdSince;
return this;
}
public SearchQuery build() {
return new SearchQuery(this);
}
}
}
| apache-2.0 |
dgomezferro/omid | src/main/java/com/yahoo/omid/tso/persistence/LoggerProtocol.java | 4377 | /**
* Copyright (c) 2011 Yahoo! 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. See accompanying LICENSE file.
*/
package com.yahoo.omid.tso.persistence;
import java.nio.ByteBuffer;
import com.yahoo.omid.tso.TSOState;
import com.yahoo.omid.tso.TimestampOracle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class LoggerProtocol extends TSOState{
private static final Log LOG = LogFactory.getLog(LoggerProtocol.class);
/*
* Protocol flags. Used to identify fields of the logger records.
*/
public final static byte TIMESTAMPORACLE = (byte) -1;
public final static byte COMMIT = (byte) -2;
public final static byte LARGESTDELETEDTIMESTAMP = (byte) -3;
public final static byte ABORT = (byte) -4;
public final static byte FULLABORT = (byte) -5;
public final static byte LOGSTART = (byte) -6;
public final static byte SNAPSHOT = (byte) -7;
/**
* Logger protocol constructor. Currently it only constructs the
* super class, TSOState.
*
* @param logger
* @param largestDeletedTimestamp
*/
LoggerProtocol(TimestampOracle timestampOracle){
super(timestampOracle);
}
private boolean commits;
private boolean oracle;
private boolean aborts;
private boolean consumed;
private boolean hasSnapshot;
private int snapshot = -1;
/**
* Execute a logged entry (several logged ops)
* @param bb Serialized operations
*/
void execute(ByteBuffer bb){
boolean done = !bb.hasRemaining();
while(!done){
byte op = bb.get();
long timestamp, startTimestamp, commitTimestamp;
if(LOG.isTraceEnabled()){
LOG.trace("Operation: " + op);
}
switch(op){
case TIMESTAMPORACLE:
timestamp = bb.getLong();
this.getSO().initialize(timestamp);
this.initialize();
oracle = true;
break;
case COMMIT:
startTimestamp = bb.getLong();
commitTimestamp = bb.getLong();
processCommit(startTimestamp, commitTimestamp);
if (commitTimestamp < largestDeletedTimestamp) {
commits = true;
}
break;
case LARGESTDELETEDTIMESTAMP:
timestamp = bb.getLong();
processLargestDeletedTimestamp(timestamp);
break;
case ABORT:
timestamp = bb.getLong();
processAbort(timestamp);
break;
case FULLABORT:
timestamp = bb.getLong();
processFullAbort(timestamp);
break;
case LOGSTART:
consumed = true;
break;
case SNAPSHOT:
int snapshot = (int) bb.getLong();
if (snapshot > this.snapshot) {
this.snapshot = snapshot;
this.hasSnapshot = true;
}
if (hasSnapshot && snapshot < this.snapshot) {
this.aborts = true;
}
break;
}
if(bb.remaining() == 0) done = true;
}
}
/**
* Checks whether all the required information has been recovered
* from the log.
*
* @return true if the recovery has finished
*/
boolean finishedRecovery() {
return (oracle && commits && aborts) || consumed;
}
/**
* Returns a TSOState object based on this object.
*
* @return
*/
TSOState getState(){
return ((TSOState) this);
}
}
| apache-2.0 |
Blankj/AndroidUtilCode | lib/utilcode/src/main/java/com/blankj/utilcode/util/IntentUtils.java | 19141 | package com.blankj.utilcode.util;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.provider.Settings;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresPermission;
import androidx.core.content.FileProvider;
import static android.Manifest.permission.CALL_PHONE;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/09/23
* desc : utils about intent
* </pre>
*/
public final class IntentUtils {
private IntentUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* Return whether the intent is available.
*
* @param intent The intent.
* @return {@code true}: yes<br>{@code false}: no
*/
public static boolean isIntentAvailable(final Intent intent) {
return Utils.getApp()
.getPackageManager()
.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
.size() > 0;
}
/**
* Return the intent of install app.
* <p>Target APIs greater than 25 must hold
* {@code <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />}</p>
*
* @param filePath The path of file.
* @return the intent of install app
*/
public static Intent getInstallAppIntent(final String filePath) {
return getInstallAppIntent(UtilsBridge.getFileByPath(filePath));
}
/**
* Return the intent of install app.
* <p>Target APIs greater than 25 must hold
* {@code <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />}</p>
*
* @param file The file.
* @return the intent of install app
*/
public static Intent getInstallAppIntent(final File file) {
if (!UtilsBridge.isFileExists(file)) return null;
Uri uri;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
uri = Uri.fromFile(file);
} else {
String authority = Utils.getApp().getPackageName() + ".utilcode.fileprovider";
uri = FileProvider.getUriForFile(Utils.getApp(), authority, file);
}
return getInstallAppIntent(uri);
}
/**
* Return the intent of install app.
* <p>Target APIs greater than 25 must hold
* {@code <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />}</p>
*
* @param uri The uri.
* @return the intent of install app
*/
public static Intent getInstallAppIntent(final Uri uri) {
if (uri == null) return null;
Intent intent = new Intent(Intent.ACTION_VIEW);
String type = "application/vnd.android.package-archive";
intent.setDataAndType(uri, type);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
/**
* Return the intent of uninstall app.
* <p>Target APIs greater than 25 must hold
* Must hold {@code <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />}</p>
*
* @param pkgName The name of the package.
* @return the intent of uninstall app
*/
public static Intent getUninstallAppIntent(final String pkgName) {
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:" + pkgName));
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
/**
* Return the intent of launch app.
*
* @param pkgName The name of the package.
* @return the intent of launch app
*/
public static Intent getLaunchAppIntent(final String pkgName) {
String launcherActivity = UtilsBridge.getLauncherActivity(pkgName);
if (UtilsBridge.isSpace(launcherActivity)) return null;
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClassName(pkgName, launcherActivity);
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
/**
* Return the intent of launch app details settings.
*
* @param pkgName The name of the package.
* @return the intent of launch app details settings
*/
public static Intent getLaunchAppDetailsSettingsIntent(final String pkgName) {
return getLaunchAppDetailsSettingsIntent(pkgName, false);
}
/**
* Return the intent of launch app details settings.
*
* @param pkgName The name of the package.
* @return the intent of launch app details settings
*/
public static Intent getLaunchAppDetailsSettingsIntent(final String pkgName, final boolean isNewTask) {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + pkgName));
return getIntent(intent, isNewTask);
}
/**
* Return the intent of share text.
*
* @param content The content.
* @return the intent of share text
*/
public static Intent getShareTextIntent(final String content) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, content);
intent = Intent.createChooser(intent, "");
return getIntent(intent, true);
}
/**
* Return the intent of share image.
*
* @param imagePath The path of image.
* @return the intent of share image
*/
public static Intent getShareImageIntent(final String imagePath) {
return getShareTextImageIntent("", imagePath);
}
/**
* Return the intent of share image.
*
* @param imageFile The file of image.
* @return the intent of share image
*/
public static Intent getShareImageIntent(final File imageFile) {
return getShareTextImageIntent("", imageFile);
}
/**
* Return the intent of share image.
*
* @param imageUri The uri of image.
* @return the intent of share image
*/
public static Intent getShareImageIntent(final Uri imageUri) {
return getShareTextImageIntent("", imageUri);
}
/**
* Return the intent of share image.
*
* @param content The content.
* @param imagePath The path of image.
* @return the intent of share image
*/
public static Intent getShareTextImageIntent(@Nullable final String content, final String imagePath) {
return getShareTextImageIntent(content, UtilsBridge.getFileByPath(imagePath));
}
/**
* Return the intent of share image.
*
* @param content The content.
* @param imageFile The file of image.
* @return the intent of share image
*/
public static Intent getShareTextImageIntent(@Nullable final String content, final File imageFile) {
return getShareTextImageIntent(content, UtilsBridge.file2Uri(imageFile));
}
/**
* Return the intent of share image.
*
* @param content The content.
* @param imageUri The uri of image.
* @return the intent of share image
*/
public static Intent getShareTextImageIntent(@Nullable final String content, final Uri imageUri) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, content);
intent.putExtra(Intent.EXTRA_STREAM, imageUri);
intent.setType("image/*");
intent = Intent.createChooser(intent, "");
return getIntent(intent, true);
}
/**
* Return the intent of share images.
*
* @param imagePaths The paths of images.
* @return the intent of share images
*/
public static Intent getShareImageIntent(final LinkedList<String> imagePaths) {
return getShareTextImageIntent("", imagePaths);
}
/**
* Return the intent of share images.
*
* @param images The files of images.
* @return the intent of share images
*/
public static Intent getShareImageIntent(final List<File> images) {
return getShareTextImageIntent("", images);
}
/**
* Return the intent of share images.
*
* @param uris The uris of image.
* @return the intent of share image
*/
public static Intent getShareImageIntent(final ArrayList<Uri> uris) {
return getShareTextImageIntent("", uris);
}
/**
* Return the intent of share images.
*
* @param content The content.
* @param imagePaths The paths of images.
* @return the intent of share images
*/
public static Intent getShareTextImageIntent(@Nullable final String content,
final LinkedList<String> imagePaths) {
List<File> files = new ArrayList<>();
if (imagePaths != null) {
for (String imagePath : imagePaths) {
File file = UtilsBridge.getFileByPath(imagePath);
if (file != null) {
files.add(file);
}
}
}
return getShareTextImageIntent(content, files);
}
/**
* Return the intent of share images.
*
* @param content The content.
* @param images The files of images.
* @return the intent of share images
*/
public static Intent getShareTextImageIntent(@Nullable final String content, final List<File> images) {
ArrayList<Uri> uris = new ArrayList<>();
if (images != null) {
for (File image : images) {
Uri uri = UtilsBridge.file2Uri(image);
if (uri != null) {
uris.add(uri);
}
}
}
return getShareTextImageIntent(content, uris);
}
/**
* Return the intent of share images.
*
* @param content The content.
* @param uris The uris of image.
* @return the intent of share image
*/
public static Intent getShareTextImageIntent(@Nullable final String content, final ArrayList<Uri> uris) {
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.putExtra(Intent.EXTRA_TEXT, content);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
intent.setType("image/*");
intent = Intent.createChooser(intent, "");
return getIntent(intent, true);
}
/**
* Return the intent of component.
*
* @param pkgName The name of the package.
* @param className The name of class.
* @return the intent of component
*/
public static Intent getComponentIntent(final String pkgName, final String className) {
return getComponentIntent(pkgName, className, null, false);
}
/**
* Return the intent of component.
*
* @param pkgName The name of the package.
* @param className The name of class.
* @param isNewTask True to add flag of new task, false otherwise.
* @return the intent of component
*/
public static Intent getComponentIntent(final String pkgName,
final String className,
final boolean isNewTask) {
return getComponentIntent(pkgName, className, null, isNewTask);
}
/**
* Return the intent of component.
*
* @param pkgName The name of the package.
* @param className The name of class.
* @param bundle The Bundle of extras to add to this intent.
* @return the intent of component
*/
public static Intent getComponentIntent(final String pkgName,
final String className,
final Bundle bundle) {
return getComponentIntent(pkgName, className, bundle, false);
}
/**
* Return the intent of component.
*
* @param pkgName The name of the package.
* @param className The name of class.
* @param bundle The Bundle of extras to add to this intent.
* @param isNewTask True to add flag of new task, false otherwise.
* @return the intent of component
*/
public static Intent getComponentIntent(final String pkgName,
final String className,
final Bundle bundle,
final boolean isNewTask) {
Intent intent = new Intent();
if (bundle != null) intent.putExtras(bundle);
ComponentName cn = new ComponentName(pkgName, className);
intent.setComponent(cn);
return getIntent(intent, isNewTask);
}
/**
* Return the intent of shutdown.
* <p>Requires root permission
* or hold {@code android:sharedUserId="android.uid.system"},
* {@code <uses-permission android:name="android.permission.SHUTDOWN" />}
* in manifest.</p>
*
* @return the intent of shutdown
*/
public static Intent getShutdownIntent() {
Intent intent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
intent = new Intent("com.android.internal.intent.action.REQUEST_SHUTDOWN");
} else {
intent = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
}
intent.putExtra("android.intent.extra.KEY_CONFIRM", false);
return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
/**
* Return the intent of dial.
*
* @param phoneNumber The phone number.
* @return the intent of dial
*/
public static Intent getDialIntent(@NonNull final String phoneNumber) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + Uri.encode(phoneNumber)));
return getIntent(intent, true);
}
/**
* Return the intent of call.
* <p>Must hold {@code <uses-permission android:name="android.permission.CALL_PHONE" />}</p>
*
* @param phoneNumber The phone number.
* @return the intent of call
*/
@RequiresPermission(CALL_PHONE)
public static Intent getCallIntent(@NonNull final String phoneNumber) {
Intent intent = new Intent("android.intent.action.CALL", Uri.parse("tel:" + Uri.encode(phoneNumber)));
return getIntent(intent, true);
}
/**
* Return the intent of send SMS.
*
* @param phoneNumber The phone number.
* @param content The content of SMS.
* @return the intent of send SMS
*/
public static Intent getSendSmsIntent(@NonNull final String phoneNumber, final String content) {
Uri uri = Uri.parse("smsto:" + Uri.encode(phoneNumber));
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.putExtra("sms_body", content);
return getIntent(intent, true);
}
/**
* Return the intent of capture.
*
* @param outUri The uri of output.
* @return the intent of capture
*/
public static Intent getCaptureIntent(final Uri outUri) {
return getCaptureIntent(outUri, false);
}
/**
* Return the intent of capture.
*
* @param outUri The uri of output.
* @param isNewTask True to add flag of new task, false otherwise.
* @return the intent of capture
*/
public static Intent getCaptureIntent(final Uri outUri, final boolean isNewTask) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outUri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
return getIntent(intent, isNewTask);
}
private static Intent getIntent(final Intent intent, final boolean isNewTask) {
return isNewTask ? intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) : intent;
}
// /**
// * 获取选择照片的 Intent
// *
// * @return
// */
// public static Intent getPickIntentWithGallery() {
// Intent intent = new Intent(Intent.ACTION_PICK);
// return intent.setType("image*//*");
// }
//
// /**
// * 获取从文件中选择照片的 Intent
// *
// * @return
// */
// public static Intent getPickIntentWithDocuments() {
// Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// return intent.setType("image*//*");
// }
//
//
// public static Intent buildImageGetIntent(final Uri saveTo, final int outputX, final int outputY, final boolean returnData) {
// return buildImageGetIntent(saveTo, 1, 1, outputX, outputY, returnData);
// }
//
// public static Intent buildImageGetIntent(Uri saveTo, int aspectX, int aspectY,
// int outputX, int outputY, boolean returnData) {
// Intent intent = new Intent();
// if (Build.VERSION.SDK_INT < 19) {
// intent.setAction(Intent.ACTION_GET_CONTENT);
// } else {
// intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
// intent.addCategory(Intent.CATEGORY_OPENABLE);
// }
// intent.setType("image*//*");
// intent.putExtra("output", saveTo);
// intent.putExtra("aspectX", aspectX);
// intent.putExtra("aspectY", aspectY);
// intent.putExtra("outputX", outputX);
// intent.putExtra("outputY", outputY);
// intent.putExtra("scale", true);
// intent.putExtra("return-data", returnData);
// intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
// return intent;
// }
//
// public static Intent buildImageCropIntent(final Uri uriFrom, final Uri uriTo, final int outputX, final int outputY, final boolean returnData) {
// return buildImageCropIntent(uriFrom, uriTo, 1, 1, outputX, outputY, returnData);
// }
//
// public static Intent buildImageCropIntent(Uri uriFrom, Uri uriTo, int aspectX, int aspectY,
// int outputX, int outputY, boolean returnData) {
// Intent intent = new Intent("com.android.camera.action.CROP");
// intent.setDataAndType(uriFrom, "image*//*");
// intent.putExtra("crop", "true");
// intent.putExtra("output", uriTo);
// intent.putExtra("aspectX", aspectX);
// intent.putExtra("aspectY", aspectY);
// intent.putExtra("outputX", outputX);
// intent.putExtra("outputY", outputY);
// intent.putExtra("scale", true);
// intent.putExtra("return-data", returnData);
// intent.putExtra("outputFormat", Bitmap.CompressFormat.PNG.toString());
// return intent;
// }
//
// public static Intent buildImageCaptureIntent(final Uri uri) {
// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
// return intent;
// }
}
| apache-2.0 |
opentracing/opentracing-java | opentracing-api/src/test/java/io/opentracing/propagation/BinaryAdaptersTest.java | 1983 | /*
* Copyright 2016-2020 The OpenTracing 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 io.opentracing.propagation;
import java.nio.ByteBuffer;
import org.junit.Test;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class BinaryAdaptersTest {
@Test
public void testExtractBinary() {
ByteBuffer buff = ByteBuffer.wrap(new byte[0]);
BinaryExtract binary = BinaryAdapters.extractionCarrier(buff);
assertEquals(buff, binary.extractionBuffer());
}
@Test(expected = NullPointerException.class)
public void testExtractBinaryNull() {
BinaryAdapters.extractionCarrier(null);
}
@Test
public void testInjectBinary() {
ByteBuffer buffer = ByteBuffer.allocate(1);
BinaryInject binary = BinaryAdapters.injectionCarrier(buffer);
assertEquals(buffer, binary.injectionBuffer(1));
assertEquals(0, buffer.position());
}
@Test(expected = IllegalArgumentException.class)
public void testInjectBinaryInvalidLength() {
BinaryInject binary = BinaryAdapters.injectionCarrier(ByteBuffer.allocate(1));
binary.injectionBuffer(0);
}
@Test(expected = AssertionError.class)
public void testInjectBinaryLargerLength() {
BinaryInject binary = BinaryAdapters.injectionCarrier(ByteBuffer.allocate(1));
binary.injectionBuffer(2);
}
}
| apache-2.0 |
subzerosu/rpc-console | russian-post/src/main/java/cane/brothers/russianpost/config/Config.java | 4150 | package cane.brothers.russianpost.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Date;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cane.brothers.russianpost.utils.DateUtils;
public class Config {
private static final Logger log = LoggerFactory.getLogger(Config.class);
private static String propFileName = "resources/config.properties";
private static String clientSecrets = "resources/client_secrets.json";
private static String dataStoreDir = ".store/rpc16";
private static String postLogin;
private static String postPassword;
private static int postDelay;
private static int deliveryDelay;
private static int operationDelay;
private static String charset;
private static boolean cleanUp;
private static String mailUser;
private static String mailFrom;
private static String mailPassword;
private static String mailHostName;
private static int mailPort;
private static String mailTo;
private static String mailSubjecy;
/** google */
private static String googleAppName;
private static String googleSpreadSheetName;
//
private static Date time;
static {
try {
String properiesPath = new File(propFileName).getAbsolutePath();
if(log.isDebugEnabled()) {
log.debug("конфигурационный файл: " + properiesPath);
}
Properties prop = new Properties();
prop.load(new FileInputStream(properiesPath));
time = new Date(System.currentTimeMillis());
log.info(DateUtils.getDateTime(time));
// get the property value and print it out
postLogin = prop.getProperty("login");
postPassword = prop.getProperty("password");
postDelay = Integer.valueOf(prop.getProperty("delay", "5"));
deliveryDelay = Integer.valueOf(prop.getProperty("deliveryDelay",
"35"));
operationDelay = Integer.valueOf(prop.getProperty("operationDelay",
"10"));
charset = prop.getProperty("charset", "utf-8");
cleanUp = Boolean.parseBoolean(prop.getProperty("cleanup", "true"));
mailUser = prop.getProperty("sender_user");
mailFrom = prop.getProperty("sender_email");
mailPassword = prop.getProperty("sender_password");
mailHostName = prop.getProperty("smtp_host_name");
mailPort = Integer.valueOf(prop.getProperty("smtp_port", "465"));
mailTo = prop.getProperty("mail_to");
mailSubjecy = prop.getProperty("mail_subject");
googleAppName = prop.getProperty("google_app_name", "CaneBrothers-RPC/1.7");
googleSpreadSheetName = prop.getProperty("google_spreadsheet_name", "barcodes-sample");
dataStoreDir = prop.getProperty("google_datastore_dir");
log.info("настройки считаны");
} catch (IOException ex) {
log.error("Не могу прочитать файл с настройками...", ex);
}
}
public static String getPostLogin() {
return postLogin;
}
public static String getPostPassword() {
return postPassword;
}
public static int getPostDelay() {
return postDelay;
}
public static int getDeliveryDelay() {
return deliveryDelay;
}
public static int getOperationDelay() {
return operationDelay;
}
public static Date getDate() {
return time;
}
public static String getMailUser() {
return mailUser;
}
public static String getMailFrom() {
return mailFrom;
}
public static String getMailPassword() {
return mailPassword;
}
public static String getMailHostName() {
return mailHostName;
}
public static int getMailPort() {
return mailPort;
}
public static String getMailTo() {
return mailTo;
}
public static String getMailSubjecy() {
return mailSubjecy;
}
public static Charset getCharset() {
return Charset.forName(charset);
}
public static boolean doCleanUp() {
return cleanUp;
}
public static String getGoogleAppName() {
return googleAppName;
}
public static String getGoogleSpreadSheetName() {
return googleSpreadSheetName;
}
public static String getDataStoreDir() {
return dataStoreDir;
}
public static String getClientSecrets() {
return clientSecrets;
}
}
| apache-2.0 |
iisi-nj/GemFireLite | Gemlite-sample/order/orderDomain/src/main/java/shell/TestCustomer.java | 3024 | /*
* Copyright 2010-2013 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 shell;
import gemlite.core.api.SimpleClient;
import gemlite.core.api.logic.LogicServices;
import gemlite.core.api.logic.RemoteResult;
import gemlite.sample.order.domain.Customer;
import gemlite.sample.order.domain.CustomerDBKey;
import java.util.List;
import junit.framework.Assert;
import org.junit.Test;
@SuppressWarnings("deprecation")
public class TestCustomer
{
@Test
public void testCase() throws Exception
{
SimpleClient.connect();
TestCustomer dc = new TestCustomer();
String name = "jcaoooo";
dc.testAdd(name);
Thread.sleep(500);
dc.testUpdate(name);
Thread.sleep(500);
dc.testDelete(name);
SimpleClient.disconnect();
}
@SuppressWarnings("unchecked")
private void testAdd(String name)
{
RemoteResult rr = LogicServices.createRequestWithFilter("customer", "TestCustomerAdd", name, name);
List<CustomerDBKey> list = rr.getResult(List.class);
for(CustomerDBKey dbkey : list)
{
System.out.println(dbkey);
}
Assert.assertEquals(list.size(), 2);
}
@SuppressWarnings("unchecked")
private void testUpdate(String name)
{
RemoteResult rr = LogicServices.createRequestWithFilter("customer", "TestCustomerUpdate", name, name);
List<Customer> valueList = rr.getResult(List.class);
Assert.assertEquals(valueList.size(), 2);
for(Customer cus : valueList)
{
Assert.assertEquals(cus.getTelephone(), "123456");
}
}
@SuppressWarnings("unchecked")
private void testDelete(String name)
{
RemoteResult rr = LogicServices.createRequestWithFilter("customer", "TestCustomerDelete", name, name);
List<CustomerDBKey> list = rr.getResult(List.class);
for(CustomerDBKey dbkey : list)
{
System.out.println(dbkey);
}
Assert.assertEquals(list.size(), 0);
}
}
| apache-2.0 |
ASCorpDevelopment/EclipseProject | revista/src/main/java/com/bsangola/controladores/CadastroUsuarioBean.java | 1335 | package com.bsangola.controladores;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import com.bsangola.enums.Sexo;
import com.bsangola.modelos.Permissao;
import com.bsangola.modelos.Usuario;
import com.bsangola.servico.Permissoes;
import com.bsangola.servico.Usuarios;
@SuppressWarnings("serial")
@ManagedBean
@ViewScoped
public class CadastroUsuarioBean implements Serializable {
private Usuario usuario;
private List<Permissao> permissaos;
public CadastroUsuarioBean() {
this.usuario = new Usuario();
init();
}
public Sexo[] getSexo() {
return Sexo.values();
}
private void init() {
this.permissaos = new Permissoes().buscarTodos();
}
public boolean isEditando() {
return this.usuario.getCodigo() != null;
}
public void salvar() {
new Usuarios().criar(this.usuario);
this.setUsuario(new Usuario());
}
public Usuario getUsuario() {
return usuario;
}
public void setUsuario(Usuario usuario) {
this.usuario = usuario;
if (this.usuario == null) {
this.usuario = new Usuario();
}
}
public List<Permissao> getPermissaos() {
return permissaos;
}
public void setPermissaos(List<Permissao> permissaos) {
this.permissaos = permissaos;
}
}
| apache-2.0 |
wanliwang/cayman | cm-javaweb/src/main/java/com/bjorktech/cayman/javaweb/pojo/AddressVO.java | 313 | package com.bjorktech.cayman.javaweb.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* User: sheshan
* Date: 23/03/2018
* content:
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AddressVO {
private String city;
private String Street;
}
| apache-2.0 |
OpenSageTV/sagetv | test/java/sage/epg/sd/SDImagesTest.java | 5432 | /*
* Copyright 2015 The SageTV Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sage.epg.sd;
import org.testng.annotations.Test;
import sage.Show;
import sage.epg.sd.json.images.SDImage;
import sage.epg.sd.json.images.SDProgramImages;
import sage.epg.sd.json.map.SDLineupMap;
import sage.epg.sd.json.map.station.SDLogo;
import sage.epg.sd.json.map.station.SDStation;
import sage.epg.sd.json.programs.SDProgram;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
public class SDImagesTest extends DeserializeTest
{
private void verifyImages(SDImage[] images, byte[][] packedImages, int showcardID, int expected)
{
assert packedImages.length == expected : "Expected " + expected + " indexes, got " + packedImages.length;
Set<SDImage> foundImages = new HashSet<>();
for (int i = 1; i < packedImages.length; i++)
{
assert packedImages[i] != null : "Index " + i + " was null!";
boolean exists = false;
String decoded = SDImages.decodeImageUrl(showcardID, packedImages[i]);
for (SDImage image : images)
{
if (image.getUri().equals(decoded))
{
// Duplicate URLs are also not acceptable.
if (!foundImages.add(image))
continue;
exists = true;
break;
}
}
assert exists : "The decoded URL '" + decoded + "' did not exist in the original image collection.";
}
for (int i = 0; i < packedImages[0].length; i++)
{
if (packedImages[0][i] == 0)
{
int count = SDImages.getImageCount(i, packedImages);
assert count == 0 : "Expected count to be == 0, got " + count;
continue;
}
int count = SDImages.getImageCount(i, packedImages);
assert count > 0 : "Expected count to be > 0, got " + count;
for (int j = 0; j < count; j++)
{
// Verify that every image type in the array is returnable.
String url = SDImages.getImageUrl(showcardID, packedImages, j, i);
assert url != null : "Expected a URL for index=" + j + " imageTypeIndex=" + i + ", got null.";
}
// Verify that if we request an invalid index for this type, it doesn't return anything.
String url = SDImages.getImageUrl(showcardID, packedImages, count, i);
assert url == null : "Expected null for index=" + count + " imageTypeIndex=" + i + ", got " + url;
}
}
@Test(groups = {"gson", "schedulesDirect", "images", "series" })
public void seriesEncodingTest() throws IOException
{
String programImages = "epg/sd/json/images/programImagesShow.json";
SDProgramImages images[] = deserialize(programImages, SDProgramImages[].class);
int[] showcardID = new int[1];
byte[][] packedImages = SDImages.encodeImages(images[0].getImages(), showcardID, SDImages.ENCODE_SERIES_ONLY);
verifyImages(images[0].getImages(), packedImages, showcardID[0], 5);
showcardID[0] = 0;
packedImages = SDImages.encodeImages(images[0].getImages(), showcardID, SDImages.ENCODE_ALL);
assert packedImages.length == 0;
}
@Test(groups = {"gson", "schedulesDirect", "images", "movie" })
public void movieEncodingTest() throws IOException
{
String programImages = "epg/sd/json/images/programImagesMovie.json";
SDProgramImages images[] = deserialize(programImages, SDProgramImages[].class);
int[] showcardID = new int[1];
byte[][] packedImages = SDImages.encodeImages(images[0].getImages(), showcardID, SDImages.ENCODE_ALL);
verifyImages(images[0].getImages(), packedImages, showcardID[0], 22);
}
@Test(groups = {"gson", "schedulesDirect", "images", "episode" })
public void episodeEncodingTest() throws IOException
{
String episode = "epg/sd/json/programs/programEpisode.json";
SDProgram program = deserialize(episode, SDProgram.class);
int[] showcardID = new int[1];
byte[][] packedImages = SDImages.encodeEpisodeImage(program.getEpisodeImage(), showcardID);
assert packedImages.length == 2;
assert SDImages.getImageCount(SDImages.getSDIndexForShowType(Show.IMAGE_PHOTO_THUMB_TALL), packedImages) == 1;
}
@Test(groups = {"gson", "schedulesDirect", "images", "channelLogo" })
public void channelLogoEncodingTest() throws IOException
{
// Source: https://json.schedulesdirect.org/20141201/lineups/USA-PA67431-X
String cable = "epg/sd/json/map/mapCable.json";
SDLineupMap lineupMap = deserialize(cable, SDLineupMap.class);
lineupMap.getStations()[0].getLogo().getURL();
for (SDStation station : lineupMap.getStations())
{
SDLogo logo = station.getLogo();
if (logo != null)
{
int logoID[] = new int[1];
byte[] encodedLogo = SDImages.encodeLogoURL(logo.getURL(), logoID);
String decodedLogo = SDImages.decodeLogoURL(encodedLogo, logoID[0]);
assert logo.getURL().equals(decodedLogo);
}
}
}
}
| apache-2.0 |
GIP-RECIA/cas | support/cas-server-support-electrofence/src/main/java/org/apereo/cas/impl/calcs/BaseAuthenticationRequestRiskCalculator.java | 4595 | package org.apereo.cas.impl.calcs;
import org.apereo.cas.api.AuthenticationRequestRiskCalculator;
import org.apereo.cas.api.AuthenticationRiskScore;
import org.apereo.cas.authentication.Authentication;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.services.RegisteredService;
import org.apereo.cas.support.events.CasEventRepository;
import org.apereo.cas.support.events.dao.CasEvent;
import org.apereo.cas.support.events.ticket.CasTicketGrantingTicketCreatedEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.ZonedDateTime;
import java.util.Collection;
/**
* This is {@link BaseAuthenticationRequestRiskCalculator}.
*
* @author Misagh Moayyed
* @since 5.1.0
*/
@Slf4j
@RequiredArgsConstructor
public abstract class BaseAuthenticationRequestRiskCalculator implements AuthenticationRequestRiskCalculator {
/**
* CAS event repository instance.
*/
protected final CasEventRepository casEventRepository;
/**
* CAS settings.
*/
protected final CasConfigurationProperties casProperties;
@Override
public final AuthenticationRiskScore calculate(final Authentication authentication,
final RegisteredService service,
final HttpServletRequest request) {
val principal = authentication.getPrincipal();
val events = getCasTicketGrantingTicketCreatedEventsFor(principal.getId());
if (events.isEmpty()) {
return new AuthenticationRiskScore(HIGHEST_RISK_SCORE);
}
val score = new AuthenticationRiskScore(calculateScore(request, authentication, service, events));
LOGGER.debug("Calculated authentication risk score by [{}] is [{}]", getClass().getSimpleName(), score);
return score;
}
/**
* Calculate score authentication risk score.
*
* @param request the request
* @param authentication the authentication
* @param service the service
* @param events the events
* @return the authentication risk score
*/
protected BigDecimal calculateScore(final HttpServletRequest request,
final Authentication authentication,
final RegisteredService service,
final Collection<? extends CasEvent> events) {
return HIGHEST_RISK_SCORE;
}
/**
* Gets cas ticket granting ticket created events.
*
* @param principal the principal
* @return the cas ticket granting ticket created events for
*/
protected Collection<? extends CasEvent> getCasTicketGrantingTicketCreatedEventsFor(final String principal) {
val type = CasTicketGrantingTicketCreatedEvent.class.getName();
LOGGER.debug("Retrieving events of type [{}] for [{}]", type, principal);
val date = ZonedDateTime.now()
.minusDays(casProperties.getAuthn().getAdaptive().getRisk().getDaysInRecentHistory());
return casEventRepository.getEventsOfTypeForPrincipal(type, principal, date);
}
/**
* Calculate score based on events count big decimal.
*
* @param authentication the authentication
* @param events the events
* @param count the count
* @return the big decimal
*/
protected BigDecimal calculateScoreBasedOnEventsCount(final Authentication authentication,
final Collection<? extends CasEvent> events,
final long count) {
if (count == events.size()) {
LOGGER.debug("Principal [{}] is assigned to the lowest risk score with attempted count of [{}]", authentication.getPrincipal(), count);
return LOWEST_RISK_SCORE;
}
return getFinalAveragedScore(count, events.size());
}
/**
* Gets final averaged score.
*
* @param eventCount the event count
* @param total the total
* @return the final averaged score
*/
protected BigDecimal getFinalAveragedScore(final long eventCount, final long total) {
val score = BigDecimal.valueOf(eventCount)
.divide(BigDecimal.valueOf(total), 2, RoundingMode.HALF_UP);
return HIGHEST_RISK_SCORE.subtract(score);
}
}
| apache-2.0 |
harrywu304/ipaas | com.github.ipaas.ideploy.agent/com.github.ipaas.ideploy.agent.executor/src/main/java/com/github/ipaas/ideploy/agent/handler/RollbackCodeHandler.java | 2940 | /**
* 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.ipaas.ideploy.agent.handler;
import java.io.File;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tmatesoft.svn.core.wc.SVNRevision;
import com.github.ipaas.ideploy.agent.CrsCmdHandlerWithFeed;
import com.github.ipaas.ideploy.agent.util.SVNUtil;
import com.github.ipaas.ideploy.agent.util.UpdateCodeUtil;
import com.github.ipaas.ifw.util.JsonUtil;
import com.github.ipaas.ifw.util.StringUtil;
/**
* 回滚至旧代码
*
* @author wudg
*/
public class RollbackCodeHandler extends CrsCmdHandlerWithFeed {
private static Logger logger = LoggerFactory.getLogger(RollbackCodeHandler.class);
@Override
public void execute(String flowId, String cmd, Map<String, Object> params, BundleContext bundleContext)
throws Exception {
String doingCodeVerPath = (String) params.get("doingCodeVerPath");
String usingCodeVerPath = (String) params.get("usingCodeVerPath");
String deployPath = (String) params.get("deployPath");
logger.debug(" params:" + JsonUtil.toJson(params));
if (StringUtil.isNullOrBlank(usingCodeVerPath)) {// 机器是首次安装,代码服务器上没有备份代码,回退本地备份的代码
File localBkFile = new File(String.valueOf(params.get("localBkPath")));
File appRootFile = new File(deployPath);
if (appRootFile.exists()) {
FileUtils.cleanDirectory(appRootFile);// 清理部署目录
}
if (!localBkFile.exists()) {
logger.error("没有找到本地备份代码:" + localBkFile.getAbsolutePath());
throw new Exception("没有本地备份代码,不能回退!");
}
FileUtils.copyDirectory(localBkFile, appRootFile);
logger.debug("回退本地代码完成");
return;
}
String savePath = String.valueOf(params.get("savePath"));
long headRev = SVNRevision.HEAD.getNumber();
Integer hostStatus = Integer.valueOf("" + params.get("hostStatus"));
if (hostStatus == 1) {// 新加入的机器,全量复制SVN上的代码
SVNUtil.getDeta4UpdateAll(usingCodeVerPath, headRev, savePath);
} else {
// 获取代码 获取正在更新版本回退到正在使用版本的差异
SVNUtil.getDelta(doingCodeVerPath, headRev, usingCodeVerPath, headRev, savePath);
}
// 更新代码
UpdateCodeUtil.updateCode(savePath, deployPath);
}
}
| apache-2.0 |
ilya-klyuchnikov/buck | src/com/facebook/buck/rules/CachingBuildRuleBuilder.java | 59235 | /*
* Copyright 2017-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.facebook.buck.rules;
import com.facebook.buck.artifact_cache.ArtifactCache;
import com.facebook.buck.artifact_cache.CacheResult;
import com.facebook.buck.artifact_cache.CacheResultType;
import com.facebook.buck.artifact_cache.RuleKeyCacheResult;
import com.facebook.buck.artifact_cache.RuleKeyCacheResultEvent;
import com.facebook.buck.event.BuckEventBus;
import com.facebook.buck.event.ConsoleEvent;
import com.facebook.buck.event.LeafEvents;
import com.facebook.buck.event.ThrowableConsoleEvent;
import com.facebook.buck.log.Logger;
import com.facebook.buck.model.BuildId;
import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.rules.BuildInfo.MetadataKey;
import com.facebook.buck.rules.keys.DependencyFileEntry;
import com.facebook.buck.rules.keys.RuleKeyAndInputs;
import com.facebook.buck.rules.keys.RuleKeyDiagnostics;
import com.facebook.buck.rules.keys.RuleKeyFactories;
import com.facebook.buck.rules.keys.RuleKeyFactoryWithDiagnostics;
import com.facebook.buck.rules.keys.RuleKeyType;
import com.facebook.buck.rules.keys.SupportsDependencyFileRuleKey;
import com.facebook.buck.rules.keys.SupportsInputBasedRuleKey;
import com.facebook.buck.step.ExecutionContext;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.StepFailedException;
import com.facebook.buck.step.StepRunner;
import com.facebook.buck.util.ContextualProcessExecutor;
import com.facebook.buck.util.Discardable;
import com.facebook.buck.util.HumanReadableException;
import com.facebook.buck.util.MoreSuppliers;
import com.facebook.buck.util.ObjectMappers;
import com.facebook.buck.util.Scope;
import com.facebook.buck.util.Threads;
import com.facebook.buck.util.cache.FileHashCache;
import com.facebook.buck.util.concurrent.MoreFutures;
import com.facebook.buck.util.concurrent.ResourceAmounts;
import com.facebook.buck.util.concurrent.WeightedListeningExecutorService;
import com.facebook.buck.util.exceptions.BuckUncheckedExecutionException;
import com.google.common.base.Preconditions;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.hash.HashCode;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Atomics;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
class CachingBuildRuleBuilder {
private static final Logger LOG = Logger.get(CachingBuildRuleBuilder.class);
private final BuildRuleBuilderDelegate buildRuleBuilderDelegate;
private final CachingBuildEngine.BuildMode buildMode;
private final BuildRuleDurationTracker buildRuleDurationTracker;
private final boolean consoleLogBuildFailuresInline;
private final RuleKeyDiagnostics<RuleKey, String> defaultRuleKeyDiagnostics;
private final FileHashCache fileHashCache;
private final SourcePathResolver pathResolver;
private final ResourceAwareSchedulingInfo resourceAwareSchedulingInfo;
private final RuleKeyFactories ruleKeyFactories;
private final WeightedListeningExecutorService service;
private final StepRunner stepRunner;
private final RuleDepsCache ruleDeps;
private final BuildRule rule;
private final ExecutionContext executionContext;
private final OnDiskBuildInfo onDiskBuildInfo;
private final Discardable<BuildInfoRecorder> buildInfoRecorder;
private final BuildableContext buildableContext;
private final BuildRulePipelinesRunner pipelinesRunner;
private final BuckEventBus eventBus;
private final BuildContext buildRuleBuildContext;
private final ArtifactCache artifactCache;
private final BuildId buildId;
private final RemoteBuildRuleCompletionWaiter remoteBuildRuleCompletionWaiter;
private final Set<String> depsWithCacheMiss = Collections.synchronizedSet(new HashSet<>());
private final BuildRuleScopeManager buildRuleScopeManager;
private final RuleKey defaultKey;
private final Supplier<Optional<RuleKey>> inputBasedKey;
private final DependencyFileRuleKeyManager dependencyFileRuleKeyManager;
private final BuildCacheArtifactFetcher buildCacheArtifactFetcher;
private final InputBasedRuleKeyManager inputBasedRuleKeyManager;
private final ManifestRuleKeyManager manifestRuleKeyManager;
private final BuildCacheArtifactUploader buildCacheArtifactUploader;
/**
* This is used to weakly cache the manifest RuleKeyAndInputs. I
*
* <p>This is necessary because RuleKeyAndInputs may be very large, and due to the async nature of
* CachingBuildRuleBuilder, there may be many BuildRules that are in-between two stages that both
* need the manifest's RuleKeyAndInputs. If we just stored the RuleKeyAndInputs directly, we could
* use too much memory.
*/
private final Supplier<Optional<RuleKeyAndInputs>> manifestBasedKeySupplier;
// These fields contain data that may be computed during a build.
private volatile ListenableFuture<Void> uploadCompleteFuture = Futures.immediateFuture(null);
private volatile boolean depsAreAvailable;
@Nullable private volatile ManifestFetchResult manifestFetchResult = null;
@Nullable private volatile ManifestStoreResult manifestStoreResult = null;
public CachingBuildRuleBuilder(
BuildRuleBuilderDelegate buildRuleBuilderDelegate,
Optional<Long> artifactCacheSizeLimit,
BuildInfoStoreManager buildInfoStoreManager,
CachingBuildEngine.BuildMode buildMode,
final BuildRuleDurationTracker buildRuleDurationTracker,
final boolean consoleLogBuildFailuresInline,
RuleKeyDiagnostics<RuleKey, String> defaultRuleKeyDiagnostics,
CachingBuildEngine.DepFiles depFiles,
final FileHashCache fileHashCache,
long maxDepFileCacheEntries,
CachingBuildEngine.MetadataStorage metadataStorage,
SourcePathResolver pathResolver,
ResourceAwareSchedulingInfo resourceAwareSchedulingInfo,
final RuleKeyFactories ruleKeyFactories,
WeightedListeningExecutorService service,
StepRunner stepRunner,
RuleDepsCache ruleDeps,
BuildRule rule,
BuildEngineBuildContext buildContext,
ExecutionContext executionContext,
OnDiskBuildInfo onDiskBuildInfo,
BuildInfoRecorder buildInfoRecorder,
BuildableContext buildableContext,
BuildRulePipelinesRunner pipelinesRunner,
RemoteBuildRuleCompletionWaiter remoteBuildRuleCompletionWaiter) {
this.buildRuleBuilderDelegate = buildRuleBuilderDelegate;
this.buildMode = buildMode;
this.buildRuleDurationTracker = buildRuleDurationTracker;
this.consoleLogBuildFailuresInline = consoleLogBuildFailuresInline;
this.defaultRuleKeyDiagnostics = defaultRuleKeyDiagnostics;
this.fileHashCache = fileHashCache;
this.pathResolver = pathResolver;
this.resourceAwareSchedulingInfo = resourceAwareSchedulingInfo;
this.ruleKeyFactories = ruleKeyFactories;
this.service = service;
this.stepRunner = stepRunner;
this.ruleDeps = ruleDeps;
this.rule = rule;
this.executionContext = executionContext;
this.onDiskBuildInfo = onDiskBuildInfo;
this.buildInfoRecorder = new Discardable<>(buildInfoRecorder);
this.buildableContext = buildableContext;
this.pipelinesRunner = pipelinesRunner;
this.eventBus = buildContext.getEventBus();
this.buildRuleBuildContext = buildContext.getBuildContext();
this.artifactCache = buildContext.getArtifactCache();
this.buildId = buildContext.getBuildId();
this.remoteBuildRuleCompletionWaiter = remoteBuildRuleCompletionWaiter;
this.buildRuleScopeManager = new BuildRuleScopeManager();
this.defaultKey = ruleKeyFactories.getDefaultRuleKeyFactory().build(rule);
this.inputBasedKey = MoreSuppliers.memoize(this::calculateInputBasedRuleKey);
this.manifestBasedKeySupplier =
MoreSuppliers.weakMemoize(
() -> {
try (Scope ignored = buildRuleScope()) {
return calculateManifestKey(eventBus);
} catch (IOException e) {
throw new RuntimeException(e);
}
});
this.dependencyFileRuleKeyManager =
new DependencyFileRuleKeyManager(
depFiles, rule, this.buildInfoRecorder, onDiskBuildInfo, ruleKeyFactories, eventBus);
this.buildCacheArtifactFetcher =
new BuildCacheArtifactFetcher(
rule,
buildRuleScopeManager,
serviceByAdjustingDefaultWeightsTo(CachingBuildEngine.CACHE_CHECK_RESOURCE_AMOUNTS),
this::onOutputsWillChange,
eventBus,
buildInfoStoreManager,
metadataStorage,
onDiskBuildInfo);
inputBasedRuleKeyManager =
new InputBasedRuleKeyManager(
eventBus,
ruleKeyFactories,
this.buildInfoRecorder,
buildCacheArtifactFetcher,
artifactCache,
onDiskBuildInfo,
rule,
buildRuleScopeManager,
inputBasedKey);
manifestRuleKeyManager =
new ManifestRuleKeyManager(
depFiles,
rule,
fileHashCache,
maxDepFileCacheEntries,
pathResolver,
ruleKeyFactories,
buildCacheArtifactFetcher,
artifactCache,
manifestBasedKeySupplier);
buildCacheArtifactUploader =
new BuildCacheArtifactUploader(
defaultKey,
inputBasedKey,
onDiskBuildInfo,
rule,
manifestRuleKeyManager,
eventBus,
artifactCache,
artifactCacheSizeLimit);
}
// Return a `BuildResult.Builder` with rule-specific state pre-filled.
private BuildResult.Builder buildResultBuilder() {
return BuildResult.builder().setRule(rule).setDepsWithCacheMisses(depsWithCacheMiss);
}
private BuildResult success(BuildRuleSuccessType successType, CacheResult cacheResult) {
return buildResultBuilder()
.setStatus(BuildRuleStatus.SUCCESS)
.setSuccessOptional(successType)
.setCacheResult(cacheResult)
.setUploadCompleteFuture(uploadCompleteFuture)
.build();
}
private BuildResult failure(Throwable thrown) {
return buildResultBuilder().setStatus(BuildRuleStatus.FAIL).setFailureOptional(thrown).build();
}
private BuildResult canceled(Throwable thrown) {
return buildResultBuilder()
.setStatus(BuildRuleStatus.CANCELED)
.setFailureOptional(thrown)
.build();
}
/**
* We have a lot of places where tasks are submitted into a service implicitly. There is no way to
* assign custom weights to such tasks. By creating a temporary service with adjusted weights it
* is possible to trick the system and tweak the weights.
*/
private WeightedListeningExecutorService serviceByAdjustingDefaultWeightsTo(
ResourceAmounts defaultAmounts) {
return resourceAwareSchedulingInfo.adjustServiceDefaultWeightsTo(defaultAmounts, service);
}
ListenableFuture<BuildResult> build() {
final AtomicReference<Long> outputSize = Atomics.newReference();
ListenableFuture<List<BuildResult>> depResults =
Futures.immediateFuture(Collections.emptyList());
// If we're performing a deep build, guarantee that all dependencies will *always* get
// materialized locally
if (buildMode == CachingBuildEngine.BuildMode.DEEP
|| buildMode == CachingBuildEngine.BuildMode.POPULATE_FROM_REMOTE_CACHE) {
depResults = buildRuleBuilderDelegate.getDepResults(rule, executionContext);
}
ListenableFuture<BuildResult> buildResult =
Futures.transformAsync(
depResults,
input -> buildOrFetchFromCache(),
serviceByAdjustingDefaultWeightsTo(
CachingBuildEngine.SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS));
// Check immediately (without posting a new task) for a failure so that we can short-circuit
// pending work. Use .catchingAsync() instead of .catching() so that we can propagate unchecked
// exceptions.
buildResult =
Futures.catchingAsync(
buildResult,
Throwable.class,
throwable -> {
Preconditions.checkNotNull(throwable);
buildRuleBuilderDelegate.setFirstFailure(throwable);
Throwables.throwIfInstanceOf(throwable, Exception.class);
throw new RuntimeException(throwable);
});
buildResult =
Futures.transform(
buildResult,
(result) -> {
buildRuleBuilderDelegate.markRuleAsUsed(rule, eventBus);
return result;
},
MoreExecutors.directExecutor());
buildResult =
Futures.transformAsync(
buildResult,
ruleAsyncFunction(result -> finalizeBuildRule(result, outputSize)),
serviceByAdjustingDefaultWeightsTo(
CachingBuildEngine.RULE_KEY_COMPUTATION_RESOURCE_AMOUNTS));
buildResult =
Futures.catchingAsync(
buildResult,
Throwable.class,
thrown -> {
LOG.debug(thrown, "Building rule [%s] failed.", rule.getBuildTarget());
if (consoleLogBuildFailuresInline) {
eventBus.post(ConsoleEvent.severe(getErrorMessageIncludingBuildRule()));
}
thrown = addBuildRuleContextToException(thrown);
recordFailureAndCleanUp(thrown);
return Futures.immediateFuture(failure(thrown));
});
// Do things that need to happen after either success or failure, but don't block the dependents
// while doing so:
buildRuleBuilderDelegate.addAsyncCallback(
MoreFutures.addListenableCallback(
buildResult,
new FutureCallback<BuildResult>() {
@Override
public void onSuccess(BuildResult input) {
handleResult(input);
// Reset interrupted flag once failure has been recorded.
if (!input.isSuccess() && input.getFailure() instanceof InterruptedException) {
Threads.interruptCurrentThread();
}
}
@Override
public void onFailure(@Nonnull Throwable thrown) {
throw new AssertionError("Dead code", thrown);
}
},
serviceByAdjustingDefaultWeightsTo(
CachingBuildEngine.RULE_KEY_COMPUTATION_RESOURCE_AMOUNTS)));
return buildResult;
}
private void finalizeMatchingKey(BuildRuleSuccessType success)
throws IOException, StepFailedException, InterruptedException {
switch (success) {
case MATCHING_RULE_KEY:
// No need to record anything for matching rule key.
return;
case MATCHING_DEP_FILE_RULE_KEY:
if (SupportsInputBasedRuleKey.isSupported(rule)) {
// The input-based key should already be computed.
inputBasedKey
.get()
.ifPresent(
key ->
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY, key.toString()));
}
// $FALL-THROUGH$
case MATCHING_INPUT_BASED_RULE_KEY:
getBuildInfoRecorder()
.addBuildMetadata(BuildInfo.MetadataKey.RULE_KEY, defaultKey.toString());
break;
case BUILT_LOCALLY:
case FETCHED_FROM_CACHE:
case FETCHED_FROM_CACHE_INPUT_BASED:
case FETCHED_FROM_CACHE_MANIFEST_BASED:
throw new RuntimeException(String.format("Unexpected success type %s.", success));
}
// TODO(cjhopman): input-based/depfile each rewrite the matching key, that's unnecessary.
// TODO(cjhopman): this writes the current build-id/timestamp/extra-data, that's probably
// unnecessary.
getBuildInfoRecorder()
.assertOnlyHasKeys(
BuildInfo.MetadataKey.RULE_KEY,
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY,
BuildInfo.MetadataKey.DEP_FILE_RULE_KEY,
BuildInfo.MetadataKey.BUILD_ID);
try {
getBuildInfoRecorder().updateBuildMetadata();
} catch (IOException e) {
throw new IOException(String.format("Failed to write metadata to disk for %s.", rule), e);
}
}
private ListenableFuture<BuildResult> finalizeBuildRule(
BuildResult input, AtomicReference<Long> outputSize)
throws StepFailedException, InterruptedException, IOException {
try {
// If we weren't successful, exit now.
if (input.getStatus() != BuildRuleStatus.SUCCESS) {
return Futures.immediateFuture(input);
}
try (Scope ignored = LeafEvents.scope(eventBus, "finalizing_build_rule")) {
// We shouldn't see any build fail result at this point.
BuildRuleSuccessType success = input.getSuccess();
switch (success) {
case BUILT_LOCALLY:
finalizeBuiltLocally(outputSize);
break;
case FETCHED_FROM_CACHE:
case FETCHED_FROM_CACHE_INPUT_BASED:
case FETCHED_FROM_CACHE_MANIFEST_BASED:
finalizeFetchedFromCache(success);
break;
case MATCHING_RULE_KEY:
case MATCHING_INPUT_BASED_RULE_KEY:
case MATCHING_DEP_FILE_RULE_KEY:
finalizeMatchingKey(success);
break;
}
} catch (Exception e) {
throw new BuckUncheckedExecutionException(e, "When finalizing rule.");
}
// Give the rule a chance to populate its internal data structures now that all of
// the files should be in a valid state.
try {
if (rule instanceof InitializableFromDisk) {
doInitializeFromDisk((InitializableFromDisk<?>) rule);
}
} catch (IOException e) {
throw new IOException(
String.format("Error initializing %s from disk: %s.", rule, e.getMessage()), e);
}
return Futures.immediateFuture(input);
} finally {
// The BuildInfoRecorder should not be accessed after this point. It does not accurately
// reflect the state of the buildrule.
buildInfoRecorder.discard();
}
}
private void finalizeFetchedFromCache(BuildRuleSuccessType success)
throws StepFailedException, InterruptedException, IOException {
// For rules fetched from cache, we want to overwrite just the minimum set of things from the
// cache result. Ensure that nobody has accidentally added unnecessary information to the
// recorder.
getBuildInfoRecorder()
.assertOnlyHasKeys(
BuildInfo.MetadataKey.BUILD_ID,
BuildInfo.MetadataKey.RULE_KEY,
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY,
BuildInfo.MetadataKey.DEP_FILE_RULE_KEY,
BuildInfo.MetadataKey.MANIFEST_KEY);
// The build has succeeded, whether we've fetched from cache, or built locally.
// So run the post-build steps.
if (rule instanceof HasPostBuildSteps) {
executePostBuildSteps(((HasPostBuildSteps) rule).getPostBuildSteps(buildRuleBuildContext));
}
// Invalidate any cached hashes for the output paths, since we've updated them.
for (Path path : onDiskBuildInfo.getOutputPaths()) {
fileHashCache.invalidate(rule.getProjectFilesystem().resolve(path));
}
// If this rule was fetched from cache, seed the file hash cache with the recorded
// output hashes from the build metadata. Skip this if the output size is too big for
// input-based rule keys.
long outputSize =
Long.parseLong(onDiskBuildInfo.getValue(BuildInfo.MetadataKey.OUTPUT_SIZE).get());
if (shouldWriteOutputHashes(outputSize)) {
Optional<ImmutableMap<String, String>> hashes =
onDiskBuildInfo.getMap(BuildInfo.MetadataKey.RECORDED_PATH_HASHES);
Preconditions.checkState(hashes.isPresent());
// Seed the cache with the hashes.
for (Map.Entry<String, String> ent : hashes.get().entrySet()) {
Path path = rule.getProjectFilesystem().getPath(ent.getKey());
HashCode hashCode = HashCode.fromString(ent.getValue());
fileHashCache.set(rule.getProjectFilesystem().resolve(path), hashCode);
}
}
switch (success) {
case FETCHED_FROM_CACHE:
break;
case FETCHED_FROM_CACHE_MANIFEST_BASED:
if (SupportsInputBasedRuleKey.isSupported(rule)) {
// The input-based key should already be computed.
inputBasedKey
.get()
.ifPresent(
key ->
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY, key.toString()));
}
// $FALL-THROUGH$
case FETCHED_FROM_CACHE_INPUT_BASED:
getBuildInfoRecorder()
.addBuildMetadata(BuildInfo.MetadataKey.RULE_KEY, defaultKey.toString());
break;
case BUILT_LOCALLY:
case MATCHING_RULE_KEY:
case MATCHING_INPUT_BASED_RULE_KEY:
case MATCHING_DEP_FILE_RULE_KEY:
throw new RuntimeException(String.format("Unexpected success type %s.", success));
}
// TODO(cjhopman): input-based/depfile each rewrite the matching key, that's unnecessary.
// TODO(cjhopman): this writes the current build-id/timestamp/extra-data, that's probably
// unnecessary.
getBuildInfoRecorder()
.assertOnlyHasKeys(
BuildInfo.MetadataKey.RULE_KEY,
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY,
BuildInfo.MetadataKey.DEP_FILE_RULE_KEY,
BuildInfo.MetadataKey.MANIFEST_KEY,
BuildInfo.MetadataKey.BUILD_ID);
try {
getBuildInfoRecorder().updateBuildMetadata();
} catch (IOException e) {
throw new IOException(String.format("Failed to write metadata to disk for %s.", rule), e);
}
}
private void finalizeBuiltLocally(AtomicReference<Long> outputSize)
throws IOException, StepFailedException, InterruptedException {
BuildRuleSuccessType success = BuildRuleSuccessType.BUILT_LOCALLY;
// Try get the output size now that all outputs have been recorded.
outputSize.set(getBuildInfoRecorder().getOutputSize());
getBuildInfoRecorder()
.addMetadata(BuildInfo.MetadataKey.OUTPUT_SIZE, outputSize.get().toString());
if (rule instanceof HasPostBuildSteps) {
executePostBuildSteps(((HasPostBuildSteps) rule).getPostBuildSteps(buildRuleBuildContext));
}
// Invalidate any cached hashes for the output paths, since we've updated them.
for (Path path : getBuildInfoRecorder().getRecordedPaths()) {
fileHashCache.invalidate(rule.getProjectFilesystem().resolve(path));
}
// Doing this here is probably not strictly necessary, however in the case of
// pipelined rules built locally we will never do an input-based cache check.
// That check would have written the key to metadata, and there are some asserts
// during cache upload that try to ensure they are present.
if (SupportsInputBasedRuleKey.isSupported(rule)
&& !getBuildInfoRecorder()
.getBuildMetadataFor(BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY)
.isPresent()
&& inputBasedKey.get().isPresent()) {
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY, inputBasedKey.get().get().toString());
}
// If this rule uses dep files, make sure we store the new dep file
// list and re-calculate the dep file rule key.
if (dependencyFileRuleKeyManager.useDependencyFileRuleKey()) {
// Query the rule for the actual inputs it used.
ImmutableList<SourcePath> inputs =
((SupportsDependencyFileRuleKey) rule)
.getInputsAfterBuildingLocally(
buildRuleBuildContext, executionContext.getCellPathResolver());
// Record the inputs into our metadata for next time.
// TODO(#9117006): We don't support a way to serlialize `SourcePath`s to the cache,
// so need to use DependencyFileEntry's instead and recover them on deserialization.
ImmutableList<String> inputStrings =
inputs
.stream()
.map(inputString -> DependencyFileEntry.fromSourcePath(inputString, pathResolver))
.map(ObjectMappers.toJsonFunction())
.collect(ImmutableList.toImmutableList());
getBuildInfoRecorder().addMetadata(BuildInfo.MetadataKey.DEP_FILE, inputStrings);
// Re-calculate and store the depfile rule key for next time.
Optional<RuleKeyAndInputs> depFileRuleKeyAndInputs =
dependencyFileRuleKeyManager.calculateDepFileRuleKey(
Optional.of(inputStrings), /* allowMissingInputs */ false);
if (depFileRuleKeyAndInputs.isPresent()) {
RuleKey depFileRuleKey = depFileRuleKeyAndInputs.get().getRuleKey();
getBuildInfoRecorder()
.addBuildMetadata(BuildInfo.MetadataKey.DEP_FILE_RULE_KEY, depFileRuleKey.toString());
// Push an updated manifest to the cache.
if (manifestRuleKeyManager.useManifestCaching()) {
// TODO(cjhopman): This should be able to use manifestKeySupplier.
Optional<RuleKeyAndInputs> manifestKey = calculateManifestKey(eventBus);
if (manifestKey.isPresent()) {
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.MANIFEST_KEY, manifestKey.get().getRuleKey().toString());
ManifestStoreResult manifestStoreResult =
manifestRuleKeyManager.updateAndStoreManifest(
depFileRuleKeyAndInputs.get().getRuleKey(),
depFileRuleKeyAndInputs.get().getInputs(),
manifestKey.get(),
artifactCache);
this.manifestStoreResult = manifestStoreResult;
if (manifestStoreResult.getStoreFuture().isPresent()) {
uploadCompleteFuture = manifestStoreResult.getStoreFuture().get();
}
}
}
}
}
// Make sure the origin field is filled in.
getBuildInfoRecorder()
.addBuildMetadata(BuildInfo.MetadataKey.ORIGIN_BUILD_ID, buildId.toString());
// Make sure that all of the local files have the same values they would as if the
// rule had been built locally.
getBuildInfoRecorder()
.addBuildMetadata(BuildInfo.MetadataKey.TARGET, rule.getBuildTarget().toString());
getBuildInfoRecorder()
.addMetadata(
BuildInfo.MetadataKey.RECORDED_PATHS,
getBuildInfoRecorder()
.getRecordedPaths()
.stream()
.map(Object::toString)
.collect(ImmutableList.toImmutableList()));
if (success.shouldWriteRecordedMetadataToDiskAfterBuilding()) {
try {
boolean clearExistingMetadata = success.shouldClearAndOverwriteMetadataOnDisk();
getBuildInfoRecorder().writeMetadataToDisk(clearExistingMetadata);
} catch (IOException e) {
throw new IOException(String.format("Failed to write metadata to disk for %s.", rule), e);
}
}
if (shouldWriteOutputHashes(outputSize.get())) {
onDiskBuildInfo.writeOutputHashes(fileHashCache);
}
}
private boolean shouldWriteOutputHashes(long outputSize) {
Optional<Long> sizeLimit = ruleKeyFactories.getInputBasedRuleKeyFactory().getInputSizeLimit();
return !sizeLimit.isPresent() || (outputSize <= sizeLimit.get());
}
private BuildInfoRecorder getBuildInfoRecorder() {
return buildInfoRecorder.get();
}
private void uploadToCache(BuildRuleSuccessType success) {
try {
// Push to cache.
uploadCompleteFuture = buildCacheArtifactUploader.uploadToCache(success);
} catch (Throwable t) {
eventBus.post(ThrowableConsoleEvent.create(t, "Error uploading to cache for %s.", rule));
}
}
private void handleResult(BuildResult input) {
Optional<Long> outputSize = Optional.empty();
Optional<HashCode> outputHash = Optional.empty();
Optional<BuildRuleSuccessType> successType = Optional.empty();
boolean shouldUploadToCache = false;
try (Scope ignored = buildRuleScope()) {
if (input.getStatus() == BuildRuleStatus.SUCCESS) {
BuildRuleSuccessType success = input.getSuccess();
successType = Optional.of(success);
// Try get the output size.
Optional<String> outputSizeString = onDiskBuildInfo.getValue(MetadataKey.OUTPUT_SIZE);
if (outputSizeString.isPresent()) {
outputSize = Optional.of(Long.parseLong(outputSizeString.get()));
}
// All rules should have output_size/output_hash in their artifact metadata.
if (success.shouldUploadResultingArtifact()
&& outputSize.isPresent()
&& shouldWriteOutputHashes(outputSize.get())) {
String hashString = onDiskBuildInfo.getValue(BuildInfo.MetadataKey.OUTPUT_HASH).get();
outputHash = Optional.of(HashCode.fromString(hashString));
}
// Determine if this is rule is cacheable.
shouldUploadToCache =
outputSize.isPresent()
&& buildCacheArtifactUploader.shouldUploadToCache(success, outputSize.get());
// Upload it to the cache.
if (shouldUploadToCache) {
uploadToCache(success);
}
}
buildRuleScopeManager.finished(
input, outputSize, outputHash, successType, shouldUploadToCache);
}
}
private ListenableFuture<Optional<BuildResult>> buildLocally(
final CacheResult cacheResult, final ListeningExecutorService service) {
if (SupportsPipelining.isSupported(rule)
&& ((SupportsPipelining<?>) rule).useRulePipelining()) {
return pipelinesRunner.runPipelineStartingAt(
buildRuleBuildContext, (SupportsPipelining<?>) rule, service);
} else {
BuildRuleSteps<RulePipelineState> buildRuleSteps = new BuildRuleSteps<>(cacheResult, null);
service.execute(buildRuleSteps);
return buildRuleSteps.getFuture();
}
}
private ListenableFuture<Optional<BuildResult>> checkManifestBasedCaches() throws IOException {
Optional<RuleKeyAndInputs> manifestKeyAndInputs = manifestBasedKeySupplier.get();
if (!manifestKeyAndInputs.isPresent()) {
return Futures.immediateFuture(Optional.empty());
}
getBuildInfoRecorder()
.addBuildMetadata(
BuildInfo.MetadataKey.MANIFEST_KEY, manifestKeyAndInputs.get().getRuleKey().toString());
try (Scope ignored = LeafEvents.scope(eventBus, "checking_cache_depfile_based")) {
return Futures.transform(
manifestRuleKeyManager.performManifestBasedCacheFetch(manifestKeyAndInputs.get()),
(@Nonnull ManifestFetchResult result) -> {
this.manifestFetchResult = result;
if (!result.getRuleCacheResult().isPresent()) {
return Optional.empty();
}
if (!result.getRuleCacheResult().get().getType().isSuccess()) {
return Optional.empty();
}
return Optional.of(
success(
BuildRuleSuccessType.FETCHED_FROM_CACHE_MANIFEST_BASED,
result.getRuleCacheResult().get()));
});
}
}
private Optional<BuildResult> checkMatchingDepfile() throws IOException {
return dependencyFileRuleKeyManager.checkMatchingDepfile()
? Optional.of(
success(
BuildRuleSuccessType.MATCHING_DEP_FILE_RULE_KEY,
CacheResult.localKeyUnchangedHit()))
: Optional.empty();
}
private ListenableFuture<Optional<BuildResult>> checkInputBasedCaches() throws IOException {
return Futures.transform(
inputBasedRuleKeyManager.checkInputBasedCaches(),
optionalResult ->
optionalResult.map(result -> success(result.getFirst(), result.getSecond())));
}
private ListenableFuture<BuildResult> buildOrFetchFromCache() throws IOException {
// If we've already seen a failure, exit early.
if (!buildRuleBuilderDelegate.shouldKeepGoing()) {
return Futures.immediateFuture(canceled(buildRuleBuilderDelegate.getFirstFailure()));
}
// 1. Check if it's already built.
try (Scope ignored = buildRuleScope()) {
Optional<BuildResult> buildResult = checkMatchingLocalKey();
if (buildResult.isPresent()) {
return Futures.immediateFuture(buildResult.get());
}
}
AtomicReference<CacheResult> rulekeyCacheResult = new AtomicReference<>();
ListenableFuture<Optional<BuildResult>> buildResultFuture;
// 2. Rule key cache lookup.
buildResultFuture =
// TODO(cjhopman): This should follow the same, simple pattern as everything else. With a
// large ui.thread_line_limit, SuperConsole tries to redraw more lines than are available.
// These cache threads make it more likely to hit that problem when SuperConsole is aware
// of them.
Futures.transform(
performRuleKeyCacheCheck(),
cacheResult -> {
rulekeyCacheResult.set(cacheResult);
return getBuildResultForRuleKeyCacheResult(cacheResult);
});
// 3. Before unlocking dependencies, ensure build rule hasn't started remotely.
buildResultFuture =
attemptDistributedBuildSynchronization(buildResultFuture, rulekeyCacheResult);
// 4. Build deps.
buildResultFuture =
transformBuildResultAsyncIfNotPresent(
buildResultFuture,
() -> {
if (SupportsPipelining.isSupported(rule)) {
addToPipelinesRunner(
(SupportsPipelining<?>) rule,
Preconditions.checkNotNull(rulekeyCacheResult.get()));
}
return Futures.transformAsync(
buildRuleBuilderDelegate.getDepResults(rule, executionContext),
(depResults) -> handleDepsResults(depResults),
serviceByAdjustingDefaultWeightsTo(
CachingBuildEngine.SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS));
});
// 5. Return to the current rule and check if it was (or is being) built in a pipeline with
// one of its dependencies
if (SupportsPipelining.isSupported(rule)) {
buildResultFuture =
transformBuildResultAsyncIfNotPresent(
buildResultFuture,
() -> {
SupportsPipelining<?> pipelinedRule = (SupportsPipelining<?>) rule;
return pipelinesRunner.runningPipelinesContainRule(pipelinedRule)
? pipelinesRunner.getFuture(pipelinedRule)
: Futures.immediateFuture(Optional.empty());
});
}
// 6. Return to the current rule and check caches to see if we can avoid building
if (SupportsInputBasedRuleKey.isSupported(rule)) {
buildResultFuture =
transformBuildResultAsyncIfNotPresent(buildResultFuture, this::checkInputBasedCaches);
}
// 7. Then check if the depfile matches.
if (dependencyFileRuleKeyManager.useDependencyFileRuleKey()) {
buildResultFuture =
transformBuildResultIfNotPresent(
buildResultFuture,
this::checkMatchingDepfile,
serviceByAdjustingDefaultWeightsTo(CachingBuildEngine.CACHE_CHECK_RESOURCE_AMOUNTS));
}
// 8. Check for a manifest-based cache hit.
if (manifestRuleKeyManager.useManifestCaching()) {
buildResultFuture =
transformBuildResultAsyncIfNotPresent(buildResultFuture, this::checkManifestBasedCaches);
}
// 9. Fail if populating the cache and cache lookups failed.
if (buildMode == CachingBuildEngine.BuildMode.POPULATE_FROM_REMOTE_CACHE) {
buildResultFuture =
transformBuildResultIfNotPresent(
buildResultFuture,
() -> {
LOG.info(
"Cannot populate cache for " + rule.getBuildTarget().getFullyQualifiedName());
return Optional.of(
canceled(
new HumanReadableException(
"Skipping %s: in cache population mode local builds are disabled",
rule)));
},
MoreExecutors.newDirectExecutorService());
}
// 10. Before building locally, do a final check that rule hasn't started building remotely.
// (as time has passed due to building of dependencies)
buildResultFuture =
attemptDistributedBuildSynchronization(buildResultFuture, rulekeyCacheResult);
// 11. Build the current rule locally, if we have to.
buildResultFuture =
transformBuildResultAsyncIfNotPresent(
buildResultFuture,
() ->
buildLocally(
Preconditions.checkNotNull(rulekeyCacheResult.get()),
service
// This needs to adjust the default amounts even in the non-resource-aware
// scheduling case so that RuleScheduleInfo works correctly.
.withDefaultAmounts(getRuleResourceAmounts())));
if (SupportsPipelining.isSupported(rule)) {
buildResultFuture.addListener(
() -> pipelinesRunner.removeRule((SupportsPipelining<?>) rule),
MoreExecutors.directExecutor());
}
// Unwrap the result.
return Futures.transform(buildResultFuture, Optional::get);
}
private ListenableFuture<Optional<BuildResult>> attemptDistributedBuildSynchronization(
ListenableFuture<Optional<BuildResult>> buildResultFuture,
AtomicReference<CacheResult> rulekeyCacheResult) {
// Check if rule has started being built remotely (i.e. by Stampede). If it has, or if we are
// in a 'always wait mode' distributed build, then wait, otherwise proceed immediately.
return transformBuildResultAsyncIfNotPresent(
buildResultFuture,
() -> {
if (!remoteBuildRuleCompletionWaiter.shouldWaitForRemoteCompletionOfBuildRule(
rule.getFullyQualifiedName())) {
// Start building locally right away, as remote build hasn't started yet.
// Note: this code path is also used for regular local Buck builds, these use
// NoOpRemoteBuildRuleCompletionWaiter that always returns false for above call.
return Futures.immediateFuture(Optional.empty());
}
// Once remote build has finished, download artifact from cache using default key
return Futures.transformAsync(
remoteBuildRuleCompletionWaiter.waitForBuildRuleToFinishRemotely(rule),
(Void v) ->
Futures.transform(
performRuleKeyCacheCheck(),
cacheResult -> {
rulekeyCacheResult.set(cacheResult);
return getBuildResultForRuleKeyCacheResult(cacheResult);
}));
});
}
private <T extends RulePipelineState> void addToPipelinesRunner(
SupportsPipelining<T> rule, CacheResult cacheResult) {
pipelinesRunner.addRule(rule, pipeline -> new BuildRuleSteps<T>(cacheResult, pipeline));
}
private Optional<BuildResult> checkMatchingLocalKey() {
Optional<RuleKey> cachedRuleKey = onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.RULE_KEY);
if (defaultKey.equals(cachedRuleKey.orElse(null))) {
return Optional.of(
success(BuildRuleSuccessType.MATCHING_RULE_KEY, CacheResult.localKeyUnchangedHit()));
}
return Optional.empty();
}
private ListenableFuture<CacheResult> performRuleKeyCacheCheck() throws IOException {
long cacheRequestTimestampMillis = System.currentTimeMillis();
return Futures.transform(
buildCacheArtifactFetcher
.tryToFetchArtifactFromBuildCacheAndOverlayOnTopOfProjectFilesystem(
defaultKey,
artifactCache,
// TODO(simons): This should be a shared between all tests, not one per cell
rule.getProjectFilesystem()),
cacheResult -> {
RuleKeyCacheResult ruleKeyCacheResult =
RuleKeyCacheResult.builder()
.setBuildTarget(rule.getFullyQualifiedName())
.setRuleKey(defaultKey.toString())
.setRuleKeyType(RuleKeyType.DEFAULT)
.setCacheResult(cacheResult.getType())
.setRequestTimestampMillis(cacheRequestTimestampMillis)
.setTwoLevelContentHashKey(cacheResult.twoLevelContentHashKey())
.build();
eventBus.post(new RuleKeyCacheResultEvent(ruleKeyCacheResult));
return cacheResult;
});
}
private Optional<BuildResult> getBuildResultForRuleKeyCacheResult(CacheResult cacheResult) {
if (!cacheResult.getType().isSuccess()) {
return Optional.empty();
}
return Optional.of(success(BuildRuleSuccessType.FETCHED_FROM_CACHE, cacheResult));
}
private ListenableFuture<Optional<BuildResult>> handleDepsResults(List<BuildResult> depResults) {
for (BuildResult depResult : depResults) {
if (buildMode != CachingBuildEngine.BuildMode.POPULATE_FROM_REMOTE_CACHE
&& !depResult.isSuccess()) {
return Futures.immediateFuture(Optional.of(canceled(depResult.getFailure())));
}
if (depResult
.getCacheResult()
.orElse(CacheResult.skipped())
.getType()
.equals(CacheResultType.MISS)) {
depsWithCacheMiss.add(depResult.getRule().getFullyQualifiedName());
}
}
depsAreAvailable = true;
return Futures.immediateFuture(Optional.empty());
}
private void recordFailureAndCleanUp(Throwable failure) {
// Make this failure visible for other rules, so that they can stop early.
buildRuleBuilderDelegate.setFirstFailure(Preconditions.checkNotNull(failure));
// If we failed, cleanup the state of this rule.
// TODO(mbolin): Delete all files produced by the rule, as they are not guaranteed
// to be valid at this point?
try {
onDiskBuildInfo.deleteExistingMetadata();
} catch (Throwable t) {
eventBus.post(ThrowableConsoleEvent.create(t, "Error when deleting metadata for %s.", rule));
}
}
private BuildRuleKeys getBuildRuleKeys() {
Optional<RuleKey> inputKey =
onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY);
Optional<RuleKey> depFileKey =
onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.DEP_FILE_RULE_KEY);
Optional<RuleKey> manifestKey = onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.MANIFEST_KEY);
return BuildRuleKeys.builder()
.setRuleKey(defaultKey)
.setInputRuleKey(inputKey)
.setDepFileRuleKey(depFileKey)
.setManifestRuleKey(manifestKey)
.build();
}
private Optional<BuildRuleDiagnosticData> getBuildRuleDiagnosticData(
boolean failureOrBuiltLocally) {
RuleKeyDiagnosticsMode mode = executionContext.getRuleKeyDiagnosticsMode();
if (mode == RuleKeyDiagnosticsMode.NEVER
|| (mode == RuleKeyDiagnosticsMode.BUILT_LOCALLY && !failureOrBuiltLocally)) {
return Optional.empty();
}
ImmutableList.Builder<RuleKeyDiagnostics.Result<?, ?>> diagnosticKeysBuilder =
ImmutableList.builder();
defaultRuleKeyDiagnostics.processRule(rule, diagnosticKeysBuilder::add);
return Optional.of(
new BuildRuleDiagnosticData(ruleDeps.get(rule), diagnosticKeysBuilder.build()));
}
private Throwable addBuildRuleContextToException(@Nonnull Throwable thrown) {
return new BuckUncheckedExecutionException("", thrown, getErrorMessageIncludingBuildRule());
}
private String getErrorMessageIncludingBuildRule() {
return String.format("When building rule %s.", rule.getBuildTarget());
}
/**
* onOutputsWillChange() should be called once we've determined that the outputs are going to
* change from their previous state (e.g. because we're about to build locally or unzip an
* artifact from the cache).
*/
private void onOutputsWillChange() throws IOException {
if (rule instanceof InitializableFromDisk) {
((InitializableFromDisk<?>) rule).getBuildOutputInitializer().invalidate();
}
onDiskBuildInfo.deleteExistingMetadata();
// TODO(cjhopman): Delete old outputs.
}
private void executePostBuildSteps(Iterable<Step> postBuildSteps)
throws InterruptedException, StepFailedException {
LOG.debug("Running post-build steps for %s", rule);
Optional<BuildTarget> optionalTarget = Optional.of(rule.getBuildTarget());
for (Step step : postBuildSteps) {
stepRunner.runStepForBuildTarget(
executionContext.withProcessExecutor(
new ContextualProcessExecutor(
executionContext.getProcessExecutor(),
ImmutableMap.of(
CachingBuildEngine.BUILD_RULE_TYPE_CONTEXT_KEY,
rule.getType(),
CachingBuildEngine.STEP_TYPE_CONTEXT_KEY,
CachingBuildEngine.StepType.POST_BUILD_STEP.toString()))),
step,
optionalTarget);
// Check for interruptions that may have been ignored by step.
if (Thread.interrupted()) {
Threads.interruptCurrentThread();
throw new InterruptedException();
}
}
LOG.debug("Finished running post-build steps for %s", rule);
}
private <T> void doInitializeFromDisk(InitializableFromDisk<T> initializable) throws IOException {
try (Scope ignored = LeafEvents.scope(eventBus, "initialize_from_disk")) {
BuildOutputInitializer<T> buildOutputInitializer = initializable.getBuildOutputInitializer();
buildOutputInitializer.initializeFromDisk();
}
}
private Optional<RuleKeyAndInputs> calculateManifestKey(BuckEventBus eventBus)
throws IOException {
Preconditions.checkState(depsAreAvailable);
return manifestRuleKeyManager.calculateManifestKey(eventBus);
}
private Optional<RuleKey> calculateInputBasedRuleKey() {
Preconditions.checkState(depsAreAvailable);
return inputBasedRuleKeyManager.calculateInputBasedRuleKey();
}
private ResourceAmounts getRuleResourceAmounts() {
if (resourceAwareSchedulingInfo.isResourceAwareSchedulingEnabled()) {
return resourceAwareSchedulingInfo.getResourceAmountsForRule(rule);
} else {
return getResourceAmountsForRuleWithCustomScheduleInfo();
}
}
private ResourceAmounts getResourceAmountsForRuleWithCustomScheduleInfo() {
Preconditions.checkArgument(!resourceAwareSchedulingInfo.isResourceAwareSchedulingEnabled());
RuleScheduleInfo ruleScheduleInfo;
if (rule instanceof OverrideScheduleRule) {
ruleScheduleInfo = ((OverrideScheduleRule) rule).getRuleScheduleInfo();
} else {
ruleScheduleInfo = RuleScheduleInfo.DEFAULT;
}
return ResourceAmounts.of(ruleScheduleInfo.getJobsMultiplier(), 0, 0, 0);
}
private Scope buildRuleScope() {
return buildRuleScopeManager.scope();
}
// Wrap an async function in rule resume/suspend events.
private <F, T> AsyncFunction<F, T> ruleAsyncFunction(final AsyncFunction<F, T> delegate) {
return input -> {
try (Scope ignored = buildRuleScope()) {
return delegate.apply(input);
}
};
}
private ListenableFuture<Optional<BuildResult>> transformBuildResultIfNotPresent(
ListenableFuture<Optional<BuildResult>> future,
Callable<Optional<BuildResult>> function,
ListeningExecutorService executor) {
return transformBuildResultAsyncIfNotPresent(
future,
() ->
executor.submit(
() -> {
if (!buildRuleBuilderDelegate.shouldKeepGoing()) {
Preconditions.checkNotNull(buildRuleBuilderDelegate.getFirstFailure());
return Optional.of(canceled(buildRuleBuilderDelegate.getFirstFailure()));
}
try (Scope ignored = buildRuleScope()) {
return function.call();
}
}));
}
private ListenableFuture<Optional<BuildResult>> transformBuildResultAsyncIfNotPresent(
ListenableFuture<Optional<BuildResult>> future,
Callable<ListenableFuture<Optional<BuildResult>>> function) {
// Immediately (i.e. without posting a task), returns the current result if it's already present
// or a cancelled result if we've already seen a failure.
return Futures.transformAsync(
future,
(result) -> {
if (result.isPresent()) {
return Futures.immediateFuture(result);
}
if (!buildRuleBuilderDelegate.shouldKeepGoing()) {
Preconditions.checkNotNull(buildRuleBuilderDelegate.getFirstFailure());
return Futures.immediateFuture(
Optional.of(canceled(buildRuleBuilderDelegate.getFirstFailure())));
}
return function.call();
},
MoreExecutors.directExecutor());
}
/** Encapsulates the steps involved in building a single {@link BuildRule} locally. */
private class BuildRuleSteps<T extends RulePipelineState>
implements RunnableWithFuture<Optional<BuildResult>> {
private final CacheResult cacheResult;
private final SettableFuture<Optional<BuildResult>> future = SettableFuture.create();
@Nullable private final T pipelineState;
public BuildRuleSteps(CacheResult cacheResult, @Nullable T pipelineState) {
this.cacheResult = cacheResult;
this.pipelineState = pipelineState;
}
@Override
public SettableFuture<Optional<BuildResult>> getFuture() {
return future;
}
@Override
public void run() {
try {
if (!buildRuleBuilderDelegate.shouldKeepGoing()) {
Preconditions.checkNotNull(buildRuleBuilderDelegate.getFirstFailure());
future.set(Optional.of(canceled(buildRuleBuilderDelegate.getFirstFailure())));
return;
}
try (Scope ignored = buildRuleScope()) {
executeCommandsNowThatDepsAreBuilt();
}
// Set the future outside of the scope, to match the behavior of other steps that use
// futures provided by the ExecutorService.
future.set(Optional.of(success(BuildRuleSuccessType.BUILT_LOCALLY, cacheResult)));
} catch (Throwable t) {
future.setException(t);
}
}
/**
* Execute the commands for this build rule. Requires all dependent rules are already built
* successfully.
*/
private void executeCommandsNowThatDepsAreBuilt()
throws InterruptedException, StepFailedException {
try {
onOutputsWillChange();
} catch (IOException e) {
throw new BuckUncheckedExecutionException(e);
}
LOG.debug("Building locally: %s", rule);
// Attempt to get an approximation of how long it takes to actually run the command.
@SuppressWarnings("PMD.PrematureDeclaration")
long start = System.nanoTime();
eventBus.post(BuildRuleEvent.willBuildLocally(rule));
buildRuleBuilderDelegate.onRuleAboutToBeBuilt(rule);
// Get and run all of the commands.
List<? extends Step> steps;
try (Scope ignored = LeafEvents.scope(eventBus, "get_build_steps")) {
if (pipelineState == null) {
steps = rule.getBuildSteps(buildRuleBuildContext, buildableContext);
} else {
@SuppressWarnings("unchecked")
SupportsPipelining<T> pipelinedRule = (SupportsPipelining<T>) rule;
steps =
pipelinedRule.getPipelinedBuildSteps(
buildRuleBuildContext, buildableContext, pipelineState);
}
}
Optional<BuildTarget> optionalTarget = Optional.of(rule.getBuildTarget());
for (Step step : steps) {
stepRunner.runStepForBuildTarget(
executionContext.withProcessExecutor(
new ContextualProcessExecutor(
executionContext.getProcessExecutor(),
ImmutableMap.of(
CachingBuildEngine.BUILD_RULE_TYPE_CONTEXT_KEY,
rule.getType(),
CachingBuildEngine.STEP_TYPE_CONTEXT_KEY,
CachingBuildEngine.StepType.BUILD_STEP.toString()))),
step,
optionalTarget);
// Check for interruptions that may have been ignored by step.
if (Thread.interrupted()) {
Thread.currentThread().interrupt();
throw new InterruptedException();
}
}
long end = System.nanoTime();
LOG.debug(
"Build completed: %s %s (%dns)",
rule.getType(), rule.getFullyQualifiedName(), end - start);
}
}
public interface BuildRuleBuilderDelegate {
void markRuleAsUsed(BuildRule rule, BuckEventBus eventBus);
boolean shouldKeepGoing();
void setFirstFailure(Throwable throwable);
ListenableFuture<List<BuildResult>> getDepResults(
BuildRule rule, ExecutionContext executionContext);
void addAsyncCallback(ListenableFuture<Void> callback);
@Nullable
Throwable getFirstFailure();
void onRuleAboutToBeBuilt(BuildRule rule);
}
/**
* Handles BuildRule resumed/suspended/finished scopes. Only one scope can be active at a time.
* Scopes nested on the same thread are allowed.
*
* <p>Once the rule has been marked as finished, any further scope() calls will fail.
*/
class BuildRuleScopeManager {
private final RuleKeyFactoryWithDiagnostics<RuleKey> ruleKeyFactory;
private volatile @Nullable Thread currentBuildRuleScopeThread = null;
private @Nullable FinishedData finishedData = null;
public BuildRuleScopeManager() {
ruleKeyFactory = ruleKeyFactories.getDefaultRuleKeyFactory();
}
Scope scope() {
synchronized (this) {
Preconditions.checkState(
finishedData == null, "RuleScope started after rule marked as finished.");
if (currentBuildRuleScopeThread != null) {
Preconditions.checkState(Thread.currentThread() == currentBuildRuleScopeThread);
return () -> {};
}
BuildRuleEvent.Resumed resumed = postResumed();
currentBuildRuleScopeThread = Thread.currentThread();
return () -> {
synchronized (this) {
currentBuildRuleScopeThread = null;
if (finishedData != null) {
postFinished(resumed);
} else {
postSuspended(resumed);
}
}
};
}
}
public synchronized void finished(
BuildResult input,
Optional<Long> outputSize,
Optional<HashCode> outputHash,
Optional<BuildRuleSuccessType> successType,
boolean shouldUploadToCache) {
Preconditions.checkState(finishedData == null, "Build rule already marked finished.");
Preconditions.checkState(
currentBuildRuleScopeThread != null,
"finished() can only be called within a buildrule scope.");
Preconditions.checkState(
currentBuildRuleScopeThread == Thread.currentThread(),
"finished() should be called from the same thread as the current buildrule scope.");
finishedData =
new FinishedData(input, outputSize, outputHash, successType, shouldUploadToCache);
}
private void post(BuildRuleEvent event) {
LOG.verbose(event.toString());
eventBus.post(event);
}
private BuildRuleEvent.Resumed postResumed() {
BuildRuleEvent.Resumed resumedEvent =
BuildRuleEvent.resumed(rule, buildRuleDurationTracker, ruleKeyFactory);
post(resumedEvent);
return resumedEvent;
}
private void postSuspended(BuildRuleEvent.Resumed resumed) {
post(BuildRuleEvent.suspended(resumed, ruleKeyFactories.getDefaultRuleKeyFactory()));
}
private void postFinished(BuildRuleEvent.Resumed resumed) {
Preconditions.checkNotNull(finishedData);
post(finishedData.getEvent(resumed));
}
}
private class FinishedData {
private final BuildResult input;
private final Optional<Long> outputSize;
private final Optional<HashCode> outputHash;
private final Optional<BuildRuleSuccessType> successType;
private final boolean shouldUploadToCache;
public FinishedData(
BuildResult input,
Optional<Long> outputSize,
Optional<HashCode> outputHash,
Optional<BuildRuleSuccessType> successType,
boolean shouldUploadToCache) {
this.input = input;
this.outputSize = outputSize;
this.outputHash = outputHash;
this.successType = successType;
this.shouldUploadToCache = shouldUploadToCache;
}
private BuildRuleEvent.Finished getEvent(BuildRuleEvent.Resumed resumedEvent) {
boolean failureOrBuiltLocally =
input.getStatus() == BuildRuleStatus.FAIL
|| (input.isSuccess() && input.getSuccess() == BuildRuleSuccessType.BUILT_LOCALLY);
// Log the result to the event bus.
BuildRuleEvent.Finished finished =
BuildRuleEvent.finished(
resumedEvent,
getBuildRuleKeys(),
input.getStatus(),
input.getCacheResult().orElse(CacheResult.miss()),
onDiskBuildInfo
.getBuildValue(BuildInfo.MetadataKey.ORIGIN_BUILD_ID)
.map(BuildId::new),
successType,
shouldUploadToCache,
outputHash,
outputSize,
getBuildRuleDiagnosticData(failureOrBuiltLocally),
Optional.ofNullable(manifestFetchResult),
Optional.ofNullable(manifestStoreResult));
return finished;
}
}
}
| apache-2.0 |
jenniferzheng/gobblin | gobblin-api/src/test/java/org/apache/gobblin/ack/HierarchicalAckableTest.java | 4183 | /*
* 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.gobblin.ack;
import org.testng.Assert;
import org.testng.TestException;
import org.testng.annotations.Test;
import com.google.common.collect.Lists;
public class HierarchicalAckableTest {
@Test
public void testCloseBeforeAck() throws Exception {
BasicAckableForTesting ackable = new BasicAckableForTesting();
HierarchicalAckable hierarchicalAckable = new HierarchicalAckable(Lists.newArrayList(ackable));
Ackable child1 = hierarchicalAckable.newChildAckable();
Ackable child2 = hierarchicalAckable.newChildAckable();
hierarchicalAckable.close();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
child2.ack();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
// acking same child twice does not ack parent
child2.ack();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
child1.ack();
Assert.assertEquals(ackable.acked, 1);
Assert.assertEquals(ackable.nacked, 0);
// Acking again changes nothing
child1.ack();
Assert.assertEquals(ackable.acked, 1);
Assert.assertEquals(ackable.nacked, 0);
}
@Test
public void testAckBeforeClose() throws Exception {
BasicAckableForTesting ackable = new BasicAckableForTesting();
HierarchicalAckable hierarchicalAckable = new HierarchicalAckable(Lists.newArrayList(ackable));
Ackable child1 = hierarchicalAckable.newChildAckable();
Ackable child2 = hierarchicalAckable.newChildAckable();
child2.ack();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
child1.ack();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
hierarchicalAckable.close();
Assert.assertEquals(ackable.acked, 1);
Assert.assertEquals(ackable.nacked, 0);
}
@Test
public void testChildNacked() throws Exception {
BasicAckableForTesting ackable = new BasicAckableForTesting();
HierarchicalAckable hierarchicalAckable = new HierarchicalAckable(Lists.newArrayList(ackable));
Ackable child1 = hierarchicalAckable.newChildAckable();
Ackable child2 = hierarchicalAckable.newChildAckable();
child2.ack();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
hierarchicalAckable.close();
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 0);
child1.nack(new TestException("test"));
Assert.assertEquals(ackable.acked, 0);
Assert.assertEquals(ackable.nacked, 1);
Assert.assertNotNull(ackable.throwable);
Assert.assertTrue(ackable.throwable instanceof HierarchicalAckable.ChildrenFailedException);
Assert.assertEquals(((HierarchicalAckable.ChildrenFailedException) ackable.throwable).getFailureCauses().size(), 1);
}
@Test
public void testMultipleParents() throws Exception {
BasicAckableForTesting ackable1 = new BasicAckableForTesting();
BasicAckableForTesting ackable2 = new BasicAckableForTesting();
HierarchicalAckable hierarchicalAckable = new HierarchicalAckable(Lists.newArrayList(ackable1, ackable2));
Ackable child1 = hierarchicalAckable.newChildAckable();
hierarchicalAckable.close();
child1.ack();
Assert.assertEquals(ackable1.acked, 1);
Assert.assertEquals(ackable2.acked, 1);
}
}
| apache-2.0 |
Mohitsharma44/Citysynth | Citysynth_v2/Yaml_reader/snakeyaml/src/test/java/org/yaml/snakeyaml/issues/issue154/TestBean.java | 712 | /**
* Copyright (c) 2008-2012, http://www.snakeyaml.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yaml.snakeyaml.issues.issue154;
public class TestBean {
public int hello;
}
| apache-2.0 |
DevCrush/Imitation | app/src/main/java/com/crush/example/knife/AnnotationKnifeActivity.java | 1747 | package com.crush.example.knife;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.crush.annotation.BindView;
import com.crush.annotation.OnClick;
import com.crush.annotationknife.AnnotationKnife;
import com.crush.example.R;
/**
* Created by Crush on 2017/5/21.
*/
public class AnnotationKnifeActivity extends AppCompatActivity {
@BindView(R.id.tv)
TextView mTv;
@BindView(R.id.img)
ImageView mImg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_annotation_knife);
AnnotationKnife.bind(this);
Log.v("", "");
mTv.setText("11111111111111111111");
mImg.setImageResource(R.mipmap.ic_launcher);
mImg.setBackgroundColor(Color.RED);
// mImg.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// startActivity(new Intent(AnnotationKnifeActivity.this, SecondActivity.class));
// }
// });
}
@OnClick(R.id.img)
void click() {
Toast.makeText(this, "无参数", Toast.LENGTH_SHORT).show();
startActivity(new Intent(AnnotationKnifeActivity.this, SecondActivity.class));
}
@OnClick(R.id.tv)
void click(View v) {
Toast.makeText(this, v.getClass().getCanonicalName(), Toast.LENGTH_SHORT).show();
startActivity(new Intent(AnnotationKnifeActivity.this, SecondActivity.class));
}
}
| apache-2.0 |
HuaweiBigData/StreamCQL | streaming/src/main/java/com/huawei/streaming/operator/IStreamOperator.java | 1595 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.huawei.streaming.operator;
import java.io.Serializable;
import com.huawei.streaming.config.StreamingConfig;
import com.huawei.streaming.exception.StreamingException;
/**
* 流算子基本接口
*
*/
public interface IStreamOperator extends Serializable
{
/**
* 设置配置属性
* 编译时接口
* 各种配置属性的缺失,可以在该阶段快速发现
*
*/
void setConfig(StreamingConfig conf) throws StreamingException;
/**
* 获取配置属性
* 编译时接口
*/
StreamingConfig getConfig();
/**
* 运行时的初始化接口
*
*/
void initialize() throws StreamingException;
/**
* 运行时的销毁接口
*
*/
void destroy() throws StreamingException;
}
| apache-2.0 |
sohaniwso2/devstudio-tooling-esb | plugins/org.wso2.developerstudio.eclipse.gmf.esb/src/org/wso2/developerstudio/eclipse/gmf/esb/InboundEndpoint.java | 233456 | /**
* Copyright 2009-2012 WSO2, Inc. (http://wso2.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.developerstudio.eclipse.gmf.esb;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Inbound Endpoint</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSequenceInputConnector <em>Sequence Input Connector</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSequenceOutputConnector <em>Sequence Output Connector</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOnErrorSequenceInputConnector <em>On Error Sequence Input Connector</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOnErrorSequenceOutputConnector <em>On Error Sequence Output Connector</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getContainer <em>Container</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getName <em>Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getType <em>Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getClass_ <em>Class</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getProtocol <em>Protocol</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundEndpointBehaviour <em>Inbound Endpoint Behaviour</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHttpPort <em>Inbound Http Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolSizeCore <em>Inbound Worker Pool Size Core</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolSizeMax <em>Inbound Worker Pool Size Max</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerThreadKeepAliveSec <em>Inbound Worker Thread Keep Alive Sec</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolQueueLength <em>Inbound Worker Pool Queue Length</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundThreadGroupId <em>Inbound Thread Group Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundThreadId <em>Inbound Thread Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getDispatchFilterPattern <em>Dispatch Filter Pattern</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInterval <em>Interval</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isSequential <em>Sequential</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isCoordination <em>Coordination</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileURI <em>Transport VFS File URI</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWso2mbConnectionUrl <em>Wso2mb Connection Url</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSContentType <em>Transport VFS Content Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileNamePattern <em>Transport VFS File Name Pattern</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileProcessInterval <em>Transport VFS File Process Interval</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileProcessCount <em>Transport VFS File Process Count</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSLocking <em>Transport VFS Locking</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMaxRetryCount <em>Transport VFS Max Retry Count</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSReconnectTimeout <em>Transport VFS Reconnect Timeout</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportJMSSharedSubscription <em>Transport JMS Shared Subscription</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSubscriptionName <em>Transport JMS Subscription Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPinnedServers <em>Transport JMS Pinned Servers</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterProcess <em>Transport VFS Action After Process</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterProcess <em>Transport VFS Move After Process</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterErrors <em>Transport VFS Action After Errors</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterErrors <em>Transport VFS Move After Errors</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterFailure <em>Transport VFS Action After Failure</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterFailure <em>Transport VFS Move After Failure</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSAutoLockRelease <em>Transport VFS Auto Lock Release</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSAutoLockReleaseInterval <em>Transport VFS Auto Lock Release Interval</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSLockReleaseSameNode <em>Transport VFS Lock Release Same Node</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSDistributedLock <em>Transport VFS Distributed Lock</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSStreaming <em>Transport VFS Streaming</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSBuild <em>Transport VFS Build</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSDistributedTimeout <em>Transport VFS Distributed Timeout</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getJavaNamingFactoryInitial <em>Java Naming Factory Initial</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getJavaNamingProviderUrl <em>Java Naming Provider Url</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConnectionFactoryJNDIName <em>Transport JMS Connection Factory JNDI Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConnectionFactoryType <em>Transport JMS Connection Factory Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConcurrentConsumers <em>Transport JMS Concurrent Consumers</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDestination <em>Transport JMS Destination</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportJMSSessionTransacted <em>Transport JMS Session Transacted</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSessionAcknowledgement <em>Transport JMS Session Acknowledgement</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSCacheLevel <em>Transport JMS Cache Level</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSUserName <em>Transport JMS User Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPassword <em>Transport JMS Password</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSJMSSpecVersion <em>Transport JMSJMS Spec Version</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSubscriptionDurable <em>Transport JMS Subscription Durable</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDurableSubscriberClientID <em>Transport JMS Durable Subscriber Client ID</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSMessageSelector <em>Transport JMS Message Selector</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSRetryDuration <em>Transport JMS Retry Duration</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveTimestampFormat <em>Transport VFS Move Timestamp Format</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileSortAttribute <em>Transport VFS File Sort Attribute</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSFileSortAscending <em>Transport VFS File Sort Ascending</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSSubFolderTimestampFormat <em>Transport VFS Sub Folder Timestamp Format</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSCreateFolder <em>Transport VFS Create Folder</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSReceiveTimeout <em>Transport JMS Receive Timeout</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSContentType <em>Transport JMS Content Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSContentTypeProperty <em>Transport JMS Content Type Property</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSReplyDestination <em>Transport JMS Reply Destination</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPubSubNoLocal <em>Transport JMS Pub Sub No Local</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDurableSubscriberName <em>Transport JMS Durable Subscriber Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTConnectionFactory <em>Transport MQTT Connection Factory</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTServerHostName <em>Transport MQTT Server Host Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTServerPort <em>Transport MQTT Server Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTTopicName <em>Transport MQTT Topic Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionQOS <em>Transport MQTT Subscription QOS</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportMQTTSessionClean <em>Transport MQTT Session Clean</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSslEnable <em>Transport MQTT Ssl Enable</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTTemporaryStoreDirectory <em>Transport MQTT Temporary Store Directory</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionUsername <em>Transport MQTT Subscription Username</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionPassword <em>Transport MQTT Subscription Password</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTClientId <em>Transport MQTT Client Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTruststore <em>Truststore</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getKeystore <em>Keystore</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSslVerifyClient <em>Ssl Verify Client</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSslProtocol <em>Ssl Protocol</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getHttpsProtocols <em>Https Protocols</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getCertificateRevocationVerifier <em>Certificate Revocation Verifier</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7Port <em>Inbound HL7 Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7AutoAck <em>Inbound HL7 Auto Ack</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7MessagePreProcessor <em>Inbound HL7 Message Pre Processor</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7CharSet <em>Inbound HL7 Char Set</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7TimeOut <em>Inbound HL7 Time Out</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7ValidateMessage <em>Inbound HL7 Validate Message</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7BuildInvalidMessages <em>Inbound HL7 Build Invalid Messages</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7PassThroughInvalidMessages <em>Inbound HL7 Pass Through Invalid Messages</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperConnect <em>Zookeeper Connect</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getGroupId <em>Group Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getContentType <em>Content Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerType <em>Consumer Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicsOrTopicFilter <em>Topics Or Topic Filter</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicsName <em>Topics Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicFilterFrom <em>Topic Filter From</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicFilterName <em>Topic Filter Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerTopic <em>Simple Consumer Topic</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerBrokers <em>Simple Consumer Brokers</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerPort <em>Simple Consumer Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerPartition <em>Simple Consumer Partition</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerMaxMessagesToRead <em>Simple Consumer Max Messages To Read</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getThreadCount <em>Thread Count</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerId <em>Consumer Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSocketTimeoutMs <em>Socket Timeout Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSocketReceiveBufferBytes <em>Socket Receive Buffer Bytes</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchMessageMaxBytes <em>Fetch Message Max Bytes</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getNumConsumerFetches <em>Num Consumer Fetches</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isAutoCommitEnable <em>Auto Commit Enable</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getAutoCommitIntervalMs <em>Auto Commit Interval Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getQueuedMaxMessageChunks <em>Queued Max Message Chunks</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRebalanceMaxRetries <em>Rebalance Max Retries</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchMinBytes <em>Fetch Min Bytes</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchWaitMaxMs <em>Fetch Wait Max Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRebalanceBackoffMs <em>Rebalance Backoff Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRefreshLeaderBackoffMs <em>Refresh Leader Backoff Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getAutoOffsetReset <em>Auto Offset Reset</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerTimeoutMs <em>Consumer Timeout Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isExcludeInternalTopics <em>Exclude Internal Topics</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getPartitionAssignmentStrategy <em>Partition Assignment Strategy</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getClientId <em>Client Id</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperSessionTimeoutMs <em>Zookeeper Session Timeout Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperConnectionTimeoutMs <em>Zookeeper Connection Timeout Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperSyncTimeMs <em>Zookeeper Sync Time Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsStorage <em>Offsets Storage</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsChannelBackoffMs <em>Offsets Channel Backoff Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsChannelSocketTimeoutMs <em>Offsets Channel Socket Timeout Ms</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsCommitMaxRetries <em>Offsets Commit Max Retries</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isDualCommitEnabled <em>Dual Commit Enabled</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmHost <em>Inbound Cxf Rm Host</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmPort <em>Inbound Cxf Rm Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmConfigFile <em>Inbound Cxf Rm Config File</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isEnableSSL <em>Enable SSL</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getServiceParameters <em>Service Parameters</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isSuspend <em>Suspend</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionFactory <em>Transport Rabbit Mq Connection Factory</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerHostName <em>Transport Rabbit Mq Server Host Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerPort <em>Transport Rabbit Mq Server Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerUserName <em>Transport Rabbit Mq Server User Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerPassword <em>Transport Rabbit Mq Server Password</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueName <em>Transport Rabbit Mq Queue Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeName <em>Transport Rabbit Mq Exchange Name</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueDurable <em>Transport Rabbit Mq Queue Durable</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueExclusive <em>Transport Rabbit Mq Queue Exclusive</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueAutoDelete <em>Transport Rabbit Mq Queue Auto Delete</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueAutoAck <em>Transport Rabbit Mq Queue Auto Ack</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueRoutingKey <em>Transport Rabbit Mq Queue Routing Key</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueDeliveryMode <em>Transport Rabbit Mq Queue Delivery Mode</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeType <em>Transport Rabbit Mq Exchange Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeDurable <em>Transport Rabbit Mq Exchange Durable</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeAutoDelete <em>Transport Rabbit Mq Exchange Auto Delete</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerVirtualHost <em>Transport Rabbit Mq Server Virtual Host</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqFactoryHeartbeat <em>Transport Rabbit Mq Factory Heartbeat</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslEnabled <em>Transport Rabbit Mq Connection Ssl Enabled</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystoreLocation <em>Transport Rabbit Mq Connection Ssl Keystore Location</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystoreType <em>Transport Rabbit Mq Connection Ssl Keystore Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystorePassword <em>Transport Rabbit Mq Connection Ssl Keystore Password</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststoreLocation <em>Transport Rabbit Mq Connection Ssl Truststore Location</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststoreType <em>Transport Rabbit Mq Connection Ssl Truststore Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststorePassword <em>Transport Rabbit Mq Connection Ssl Truststore Password</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslVersion <em>Transport Rabbit Mq Connection Ssl Version</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqMessageContentType <em>Transport Rabbit Mq Message Content Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionRetryCount <em>Transport Rabbit Mq Connection Retry Count</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionRetryInterval <em>Transport Rabbit Mq Connection Retry Interval</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerRetryInterval <em>Transport Rabbit Mq Server Retry Interval</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConsumerQos <em>Transport Rabbit Mq Consumer Qos</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsInboundPort <em>Ws Inbound Port</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsClientSideBroadcastLevel <em>Ws Client Side Broadcast Level</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsOutflowDispatchSequence <em>Ws Outflow Dispatch Sequence</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsOutflowDispatchFaultSequence <em>Ws Outflow Dispatch Fault Sequence</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsBossThreadPoolSize <em>Ws Boss Thread Pool Size</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsWorkerThreadPoolSize <em>Ws Worker Thread Pool Size</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsSubprotocolHandlerClass <em>Ws Subprotocol Handler Class</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsPipelineHandlerClass <em>Ws Pipeline Handler Class</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportFeedURL <em>Transport Feed URL</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportFeedType <em>Transport Feed Type</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTraceEnabled <em>Trace Enabled</em>}</li>
* <li>{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isStatisticsEnabled <em>Statistics Enabled</em>}</li>
* </ul>
*
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint()
* @model
* @generated
*/
public interface InboundEndpoint extends EsbElement {
/**
* Returns the value of the '<em><b>Sequence Input Connector</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Sequence Input Connector</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sequence Input Connector</em>' containment reference.
* @see #setSequenceInputConnector(InboundEndpointSequenceInputConnector)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SequenceInputConnector()
* @model containment="true"
* @generated
*/
InboundEndpointSequenceInputConnector getSequenceInputConnector();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSequenceInputConnector <em>Sequence Input Connector</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Sequence Input Connector</em>' containment reference.
* @see #getSequenceInputConnector()
* @generated
*/
void setSequenceInputConnector(InboundEndpointSequenceInputConnector value);
/**
* Returns the value of the '<em><b>Sequence Output Connector</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Sequence Output Connector</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sequence Output Connector</em>' containment reference.
* @see #setSequenceOutputConnector(InboundEndpointSequenceOutputConnector)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SequenceOutputConnector()
* @model containment="true"
* @generated
*/
InboundEndpointSequenceOutputConnector getSequenceOutputConnector();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSequenceOutputConnector <em>Sequence Output Connector</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Sequence Output Connector</em>' containment reference.
* @see #getSequenceOutputConnector()
* @generated
*/
void setSequenceOutputConnector(InboundEndpointSequenceOutputConnector value);
/**
* Returns the value of the '<em><b>On Error Sequence Input Connector</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>On Error Sequence Input Connector</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>On Error Sequence Input Connector</em>' containment reference.
* @see #setOnErrorSequenceInputConnector(InboundEndpointOnErrorSequenceInputConnector)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OnErrorSequenceInputConnector()
* @model containment="true"
* @generated
*/
InboundEndpointOnErrorSequenceInputConnector getOnErrorSequenceInputConnector();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOnErrorSequenceInputConnector <em>On Error Sequence Input Connector</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>On Error Sequence Input Connector</em>' containment reference.
* @see #getOnErrorSequenceInputConnector()
* @generated
*/
void setOnErrorSequenceInputConnector(InboundEndpointOnErrorSequenceInputConnector value);
/**
* Returns the value of the '<em><b>On Error Sequence Output Connector</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>On Error Sequence Output Connector</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>On Error Sequence Output Connector</em>' containment reference.
* @see #setOnErrorSequenceOutputConnector(InboundEndpointOnErrorSequenceOutputConnector)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OnErrorSequenceOutputConnector()
* @model containment="true"
* @generated
*/
InboundEndpointOnErrorSequenceOutputConnector getOnErrorSequenceOutputConnector();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOnErrorSequenceOutputConnector <em>On Error Sequence Output Connector</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>On Error Sequence Output Connector</em>' containment reference.
* @see #getOnErrorSequenceOutputConnector()
* @generated
*/
void setOnErrorSequenceOutputConnector(InboundEndpointOnErrorSequenceOutputConnector value);
/**
* Returns the value of the '<em><b>Container</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Container</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Container</em>' containment reference.
* @see #setContainer(InboundEndpointContainer)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Container()
* @model containment="true"
* @generated
*/
InboundEndpointContainer getContainer();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getContainer <em>Container</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Container</em>' containment reference.
* @see #getContainer()
* @generated
*/
void setContainer(InboundEndpointContainer value);
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Name()
* @model
* @generated
*/
String getName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Type</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointType
* @see #setType(InboundEndpointType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Type()
* @model
* @generated
*/
InboundEndpointType getType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getType <em>Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointType
* @see #getType()
* @generated
*/
void setType(InboundEndpointType value);
/**
* Returns the value of the '<em><b>Inbound HL7 Port</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Port</em>' attribute.
* @see #setInboundHL7Port(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7Port()
* @model default=""
* @generated
*/
String getInboundHL7Port();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7Port <em>Inbound HL7 Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Port</em>' attribute.
* @see #getInboundHL7Port()
* @generated
*/
void setInboundHL7Port(String value);
/**
* Returns the value of the '<em><b>Inbound HL7 Auto Ack</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Auto Ack</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Auto Ack</em>' attribute.
* @see #setInboundHL7AutoAck(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7AutoAck()
* @model default="true"
* @generated
*/
boolean isInboundHL7AutoAck();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7AutoAck <em>Inbound HL7 Auto Ack</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Auto Ack</em>' attribute.
* @see #isInboundHL7AutoAck()
* @generated
*/
void setInboundHL7AutoAck(boolean value);
/**
* Returns the value of the '<em><b>Inbound HL7 Message Pre Processor</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Message Pre Processor</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Message Pre Processor</em>' attribute.
* @see #setInboundHL7MessagePreProcessor(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7MessagePreProcessor()
* @model default=""
* @generated
*/
String getInboundHL7MessagePreProcessor();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7MessagePreProcessor <em>Inbound HL7 Message Pre Processor</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Message Pre Processor</em>' attribute.
* @see #getInboundHL7MessagePreProcessor()
* @generated
*/
void setInboundHL7MessagePreProcessor(String value);
/**
* Returns the value of the '<em><b>Inbound HL7 Char Set</b></em>' attribute.
* The default value is <code>"UTF-8"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Char Set</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Char Set</em>' attribute.
* @see #setInboundHL7CharSet(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7CharSet()
* @model default="UTF-8"
* @generated
*/
String getInboundHL7CharSet();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7CharSet <em>Inbound HL7 Char Set</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Char Set</em>' attribute.
* @see #getInboundHL7CharSet()
* @generated
*/
void setInboundHL7CharSet(String value);
/**
* Returns the value of the '<em><b>Inbound HL7 Time Out</b></em>' attribute.
* The default value is <code>"10000"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Time Out</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Time Out</em>' attribute.
* @see #setInboundHL7TimeOut(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7TimeOut()
* @model default="10000"
* @generated
*/
String getInboundHL7TimeOut();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHL7TimeOut <em>Inbound HL7 Time Out</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Time Out</em>' attribute.
* @see #getInboundHL7TimeOut()
* @generated
*/
void setInboundHL7TimeOut(String value);
/**
* Returns the value of the '<em><b>Inbound HL7 Validate Message</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Validate Message</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Validate Message</em>' attribute.
* @see #setInboundHL7ValidateMessage(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7ValidateMessage()
* @model default="true"
* @generated
*/
boolean isInboundHL7ValidateMessage();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7ValidateMessage <em>Inbound HL7 Validate Message</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Validate Message</em>' attribute.
* @see #isInboundHL7ValidateMessage()
* @generated
*/
void setInboundHL7ValidateMessage(boolean value);
/**
* Returns the value of the '<em><b>Inbound HL7 Build Invalid Messages</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Build Invalid Messages</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Build Invalid Messages</em>' attribute.
* @see #setInboundHL7BuildInvalidMessages(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7BuildInvalidMessages()
* @model default="true"
* @generated
*/
boolean isInboundHL7BuildInvalidMessages();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7BuildInvalidMessages <em>Inbound HL7 Build Invalid Messages</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Build Invalid Messages</em>' attribute.
* @see #isInboundHL7BuildInvalidMessages()
* @generated
*/
void setInboundHL7BuildInvalidMessages(boolean value);
/**
* Returns the value of the '<em><b>Inbound HL7 Pass Through Invalid Messages</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound HL7 Pass Through Invalid Messages</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound HL7 Pass Through Invalid Messages</em>' attribute.
* @see #setInboundHL7PassThroughInvalidMessages(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHL7PassThroughInvalidMessages()
* @model default="true"
* @generated
*/
boolean isInboundHL7PassThroughInvalidMessages();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isInboundHL7PassThroughInvalidMessages <em>Inbound HL7 Pass Through Invalid Messages</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound HL7 Pass Through Invalid Messages</em>' attribute.
* @see #isInboundHL7PassThroughInvalidMessages()
* @generated
*/
void setInboundHL7PassThroughInvalidMessages(boolean value);
/**
* Returns the value of the '<em><b>Zookeeper Connect</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Zookeeper Connect</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Zookeeper Connect</em>' attribute.
* @see #setZookeeperConnect(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ZookeeperConnect()
* @model default=""
* @generated
*/
String getZookeeperConnect();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperConnect <em>Zookeeper Connect</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Zookeeper Connect</em>' attribute.
* @see #getZookeeperConnect()
* @generated
*/
void setZookeeperConnect(String value);
/**
* Returns the value of the '<em><b>Group Id</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Group Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Group Id</em>' attribute.
* @see #setGroupId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_GroupId()
* @model default=""
* @generated
*/
String getGroupId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getGroupId <em>Group Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Group Id</em>' attribute.
* @see #getGroupId()
* @generated
*/
void setGroupId(String value);
/**
* Returns the value of the '<em><b>Consumer Type</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.ConsumerType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Consumer Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Consumer Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.ConsumerType
* @see #setConsumerType(ConsumerType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ConsumerType()
* @model
* @generated
*/
ConsumerType getConsumerType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerType <em>Consumer Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Consumer Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.ConsumerType
* @see #getConsumerType()
* @generated
*/
void setConsumerType(ConsumerType value);
/**
* Returns the value of the '<em><b>Topics Or Topic Filter</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.TopicsType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Topics Or Topic Filter</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Topics Or Topic Filter</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.TopicsType
* @see #setTopicsOrTopicFilter(TopicsType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TopicsOrTopicFilter()
* @model
* @generated
*/
TopicsType getTopicsOrTopicFilter();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicsOrTopicFilter <em>Topics Or Topic Filter</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Topics Or Topic Filter</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.TopicsType
* @see #getTopicsOrTopicFilter()
* @generated
*/
void setTopicsOrTopicFilter(TopicsType value);
/**
* Returns the value of the '<em><b>Topics Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Topics Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Topics Name</em>' attribute.
* @see #setTopicsName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TopicsName()
* @model
* @generated
*/
String getTopicsName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicsName <em>Topics Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Topics Name</em>' attribute.
* @see #getTopicsName()
* @generated
*/
void setTopicsName(String value);
/**
* Returns the value of the '<em><b>Topic Filter From</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.TopicFilterFromType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Topic Filter From</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Topic Filter From</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.TopicFilterFromType
* @see #setTopicFilterFrom(TopicFilterFromType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TopicFilterFrom()
* @model
* @generated
*/
TopicFilterFromType getTopicFilterFrom();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicFilterFrom <em>Topic Filter From</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Topic Filter From</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.TopicFilterFromType
* @see #getTopicFilterFrom()
* @generated
*/
void setTopicFilterFrom(TopicFilterFromType value);
/**
* Returns the value of the '<em><b>Topic Filter Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Topic Filter Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Topic Filter Name</em>' attribute.
* @see #setTopicFilterName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TopicFilterName()
* @model
* @generated
*/
String getTopicFilterName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTopicFilterName <em>Topic Filter Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Topic Filter Name</em>' attribute.
* @see #getTopicFilterName()
* @generated
*/
void setTopicFilterName(String value);
/**
* Returns the value of the '<em><b>Simple Consumer Topic</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Simple Consumer Topic</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Simple Consumer Topic</em>' attribute.
* @see #setSimpleConsumerTopic(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SimpleConsumerTopic()
* @model
* @generated
*/
String getSimpleConsumerTopic();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerTopic <em>Simple Consumer Topic</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Simple Consumer Topic</em>' attribute.
* @see #getSimpleConsumerTopic()
* @generated
*/
void setSimpleConsumerTopic(String value);
/**
* Returns the value of the '<em><b>Simple Consumer Brokers</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Simple Consumer Brokers</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Simple Consumer Brokers</em>' attribute.
* @see #setSimpleConsumerBrokers(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SimpleConsumerBrokers()
* @model
* @generated
*/
String getSimpleConsumerBrokers();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerBrokers <em>Simple Consumer Brokers</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Simple Consumer Brokers</em>' attribute.
* @see #getSimpleConsumerBrokers()
* @generated
*/
void setSimpleConsumerBrokers(String value);
/**
* Returns the value of the '<em><b>Simple Consumer Port</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Simple Consumer Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Simple Consumer Port</em>' attribute.
* @see #setSimpleConsumerPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SimpleConsumerPort()
* @model
* @generated
*/
String getSimpleConsumerPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerPort <em>Simple Consumer Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Simple Consumer Port</em>' attribute.
* @see #getSimpleConsumerPort()
* @generated
*/
void setSimpleConsumerPort(String value);
/**
* Returns the value of the '<em><b>Simple Consumer Partition</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Simple Consumer Partition</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Simple Consumer Partition</em>' attribute.
* @see #setSimpleConsumerPartition(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SimpleConsumerPartition()
* @model
* @generated
*/
String getSimpleConsumerPartition();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerPartition <em>Simple Consumer Partition</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Simple Consumer Partition</em>' attribute.
* @see #getSimpleConsumerPartition()
* @generated
*/
void setSimpleConsumerPartition(String value);
/**
* Returns the value of the '<em><b>Simple Consumer Max Messages To Read</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Simple Consumer Max Messages To Read</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Simple Consumer Max Messages To Read</em>' attribute.
* @see #setSimpleConsumerMaxMessagesToRead(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SimpleConsumerMaxMessagesToRead()
* @model
* @generated
*/
String getSimpleConsumerMaxMessagesToRead();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSimpleConsumerMaxMessagesToRead <em>Simple Consumer Max Messages To Read</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Simple Consumer Max Messages To Read</em>' attribute.
* @see #getSimpleConsumerMaxMessagesToRead()
* @generated
*/
void setSimpleConsumerMaxMessagesToRead(String value);
/**
* Returns the value of the '<em><b>Content Type</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.ContentType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Content Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Content Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.ContentType
* @see #setContentType(ContentType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ContentType()
* @model
* @generated
*/
ContentType getContentType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getContentType <em>Content Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Content Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.ContentType
* @see #getContentType()
* @generated
*/
void setContentType(ContentType value);
/**
* Returns the value of the '<em><b>Thread Count</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Thread Count</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Thread Count</em>' attribute.
* @see #setThreadCount(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ThreadCount()
* @model default=""
* @generated
*/
String getThreadCount();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getThreadCount <em>Thread Count</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Thread Count</em>' attribute.
* @see #getThreadCount()
* @generated
*/
void setThreadCount(String value);
/**
* Returns the value of the '<em><b>Consumer Id</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Consumer Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Consumer Id</em>' attribute.
* @see #setConsumerId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ConsumerId()
* @model
* @generated
*/
String getConsumerId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerId <em>Consumer Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Consumer Id</em>' attribute.
* @see #getConsumerId()
* @generated
*/
void setConsumerId(String value);
/**
* Returns the value of the '<em><b>Socket Timeout Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Socket Timeout Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Socket Timeout Ms</em>' attribute.
* @see #setSocketTimeoutMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SocketTimeoutMs()
* @model default=""
* @generated
*/
String getSocketTimeoutMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSocketTimeoutMs <em>Socket Timeout Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Socket Timeout Ms</em>' attribute.
* @see #getSocketTimeoutMs()
* @generated
*/
void setSocketTimeoutMs(String value);
/**
* Returns the value of the '<em><b>Socket Receive Buffer Bytes</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Socket Receive Buffer Bytes</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Socket Receive Buffer Bytes</em>' attribute.
* @see #setSocketReceiveBufferBytes(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SocketReceiveBufferBytes()
* @model
* @generated
*/
String getSocketReceiveBufferBytes();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSocketReceiveBufferBytes <em>Socket Receive Buffer Bytes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Socket Receive Buffer Bytes</em>' attribute.
* @see #getSocketReceiveBufferBytes()
* @generated
*/
void setSocketReceiveBufferBytes(String value);
/**
* Returns the value of the '<em><b>Fetch Message Max Bytes</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Fetch Message Max Bytes</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Fetch Message Max Bytes</em>' attribute.
* @see #setFetchMessageMaxBytes(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_FetchMessageMaxBytes()
* @model
* @generated
*/
String getFetchMessageMaxBytes();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchMessageMaxBytes <em>Fetch Message Max Bytes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Fetch Message Max Bytes</em>' attribute.
* @see #getFetchMessageMaxBytes()
* @generated
*/
void setFetchMessageMaxBytes(String value);
/**
* Returns the value of the '<em><b>Num Consumer Fetches</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Num Consumer Fetches</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Num Consumer Fetches</em>' attribute.
* @see #setNumConsumerFetches(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_NumConsumerFetches()
* @model
* @generated
*/
String getNumConsumerFetches();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getNumConsumerFetches <em>Num Consumer Fetches</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Num Consumer Fetches</em>' attribute.
* @see #getNumConsumerFetches()
* @generated
*/
void setNumConsumerFetches(String value);
/**
* Returns the value of the '<em><b>Auto Commit Enable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Auto Commit Enable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Auto Commit Enable</em>' attribute.
* @see #setAutoCommitEnable(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_AutoCommitEnable()
* @model
* @generated
*/
boolean isAutoCommitEnable();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isAutoCommitEnable <em>Auto Commit Enable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Auto Commit Enable</em>' attribute.
* @see #isAutoCommitEnable()
* @generated
*/
void setAutoCommitEnable(boolean value);
/**
* Returns the value of the '<em><b>Zookeeper Session Timeout Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Zookeeper Session Timeout Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Zookeeper Session Timeout Ms</em>' attribute.
* @see #setZookeeperSessionTimeoutMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ZookeeperSessionTimeoutMs()
* @model default=""
* @generated
*/
String getZookeeperSessionTimeoutMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperSessionTimeoutMs <em>Zookeeper Session Timeout Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Zookeeper Session Timeout Ms</em>' attribute.
* @see #getZookeeperSessionTimeoutMs()
* @generated
*/
void setZookeeperSessionTimeoutMs(String value);
/**
* Returns the value of the '<em><b>Zookeeper Connection Timeout Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Zookeeper Connection Timeout Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Zookeeper Connection Timeout Ms</em>' attribute.
* @see #setZookeeperConnectionTimeoutMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ZookeeperConnectionTimeoutMs()
* @model default=""
* @generated
*/
String getZookeeperConnectionTimeoutMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperConnectionTimeoutMs <em>Zookeeper Connection Timeout Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Zookeeper Connection Timeout Ms</em>' attribute.
* @see #getZookeeperConnectionTimeoutMs()
* @generated
*/
void setZookeeperConnectionTimeoutMs(String value);
/**
* Returns the value of the '<em><b>Zookeeper Sync Time Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Zookeeper Sync Time Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Zookeeper Sync Time Ms</em>' attribute.
* @see #setZookeeperSyncTimeMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ZookeeperSyncTimeMs()
* @model default=""
* @generated
*/
String getZookeeperSyncTimeMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getZookeeperSyncTimeMs <em>Zookeeper Sync Time Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Zookeeper Sync Time Ms</em>' attribute.
* @see #getZookeeperSyncTimeMs()
* @generated
*/
void setZookeeperSyncTimeMs(String value);
/**
* Returns the value of the '<em><b>Offsets Storage</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.OffsetsStorageType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Offsets Storage</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Offsets Storage</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.OffsetsStorageType
* @see #setOffsetsStorage(OffsetsStorageType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OffsetsStorage()
* @model
* @generated
*/
OffsetsStorageType getOffsetsStorage();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsStorage <em>Offsets Storage</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Offsets Storage</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.OffsetsStorageType
* @see #getOffsetsStorage()
* @generated
*/
void setOffsetsStorage(OffsetsStorageType value);
/**
* Returns the value of the '<em><b>Offsets Channel Backoff Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Offsets Channel Backoff Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Offsets Channel Backoff Ms</em>' attribute.
* @see #setOffsetsChannelBackoffMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OffsetsChannelBackoffMs()
* @model default=""
* @generated
*/
String getOffsetsChannelBackoffMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsChannelBackoffMs <em>Offsets Channel Backoff Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Offsets Channel Backoff Ms</em>' attribute.
* @see #getOffsetsChannelBackoffMs()
* @generated
*/
void setOffsetsChannelBackoffMs(String value);
/**
* Returns the value of the '<em><b>Offsets Channel Socket Timeout Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Offsets Channel Socket Timeout Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Offsets Channel Socket Timeout Ms</em>' attribute.
* @see #setOffsetsChannelSocketTimeoutMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OffsetsChannelSocketTimeoutMs()
* @model default=""
* @generated
*/
String getOffsetsChannelSocketTimeoutMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsChannelSocketTimeoutMs <em>Offsets Channel Socket Timeout Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Offsets Channel Socket Timeout Ms</em>' attribute.
* @see #getOffsetsChannelSocketTimeoutMs()
* @generated
*/
void setOffsetsChannelSocketTimeoutMs(String value);
/**
* Returns the value of the '<em><b>Offsets Commit Max Retries</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Offsets Commit Max Retries</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Offsets Commit Max Retries</em>' attribute.
* @see #setOffsetsCommitMaxRetries(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_OffsetsCommitMaxRetries()
* @model default=""
* @generated
*/
String getOffsetsCommitMaxRetries();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getOffsetsCommitMaxRetries <em>Offsets Commit Max Retries</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Offsets Commit Max Retries</em>' attribute.
* @see #getOffsetsCommitMaxRetries()
* @generated
*/
void setOffsetsCommitMaxRetries(String value);
/**
* Returns the value of the '<em><b>Dual Commit Enabled</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Dual Commit Enabled</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Dual Commit Enabled</em>' attribute.
* @see #setDualCommitEnabled(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_DualCommitEnabled()
* @model
* @generated
*/
boolean isDualCommitEnabled();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isDualCommitEnabled <em>Dual Commit Enabled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Dual Commit Enabled</em>' attribute.
* @see #isDualCommitEnabled()
* @generated
*/
void setDualCommitEnabled(boolean value);
/**
* Returns the value of the '<em><b>Auto Commit Interval Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Auto Commit Interval Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Auto Commit Interval Ms</em>' attribute.
* @see #setAutoCommitIntervalMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_AutoCommitIntervalMs()
* @model default=""
* @generated
*/
String getAutoCommitIntervalMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getAutoCommitIntervalMs <em>Auto Commit Interval Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Auto Commit Interval Ms</em>' attribute.
* @see #getAutoCommitIntervalMs()
* @generated
*/
void setAutoCommitIntervalMs(String value);
/**
* Returns the value of the '<em><b>Queued Max Message Chunks</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Queued Max Message Chunks</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Queued Max Message Chunks</em>' attribute.
* @see #setQueuedMaxMessageChunks(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_QueuedMaxMessageChunks()
* @model
* @generated
*/
String getQueuedMaxMessageChunks();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getQueuedMaxMessageChunks <em>Queued Max Message Chunks</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Queued Max Message Chunks</em>' attribute.
* @see #getQueuedMaxMessageChunks()
* @generated
*/
void setQueuedMaxMessageChunks(String value);
/**
* Returns the value of the '<em><b>Rebalance Max Retries</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Rebalance Max Retries</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Rebalance Max Retries</em>' attribute.
* @see #setRebalanceMaxRetries(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_RebalanceMaxRetries()
* @model default=""
* @generated
*/
String getRebalanceMaxRetries();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRebalanceMaxRetries <em>Rebalance Max Retries</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Rebalance Max Retries</em>' attribute.
* @see #getRebalanceMaxRetries()
* @generated
*/
void setRebalanceMaxRetries(String value);
/**
* Returns the value of the '<em><b>Fetch Min Bytes</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Fetch Min Bytes</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Fetch Min Bytes</em>' attribute.
* @see #setFetchMinBytes(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_FetchMinBytes()
* @model default=""
* @generated
*/
String getFetchMinBytes();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchMinBytes <em>Fetch Min Bytes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Fetch Min Bytes</em>' attribute.
* @see #getFetchMinBytes()
* @generated
*/
void setFetchMinBytes(String value);
/**
* Returns the value of the '<em><b>Fetch Wait Max Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Fetch Wait Max Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Fetch Wait Max Ms</em>' attribute.
* @see #setFetchWaitMaxMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_FetchWaitMaxMs()
* @model default=""
* @generated
*/
String getFetchWaitMaxMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getFetchWaitMaxMs <em>Fetch Wait Max Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Fetch Wait Max Ms</em>' attribute.
* @see #getFetchWaitMaxMs()
* @generated
*/
void setFetchWaitMaxMs(String value);
/**
* Returns the value of the '<em><b>Rebalance Backoff Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Rebalance Backoff Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Rebalance Backoff Ms</em>' attribute.
* @see #setRebalanceBackoffMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_RebalanceBackoffMs()
* @model default=""
* @generated
*/
String getRebalanceBackoffMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRebalanceBackoffMs <em>Rebalance Backoff Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Rebalance Backoff Ms</em>' attribute.
* @see #getRebalanceBackoffMs()
* @generated
*/
void setRebalanceBackoffMs(String value);
/**
* Returns the value of the '<em><b>Refresh Leader Backoff Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Refresh Leader Backoff Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Refresh Leader Backoff Ms</em>' attribute.
* @see #setRefreshLeaderBackoffMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_RefreshLeaderBackoffMs()
* @model default=""
* @generated
*/
String getRefreshLeaderBackoffMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getRefreshLeaderBackoffMs <em>Refresh Leader Backoff Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Refresh Leader Backoff Ms</em>' attribute.
* @see #getRefreshLeaderBackoffMs()
* @generated
*/
void setRefreshLeaderBackoffMs(String value);
/**
* Returns the value of the '<em><b>Auto Offset Reset</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.AutoOffsetResetType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Auto Offset Reset</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Auto Offset Reset</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.AutoOffsetResetType
* @see #setAutoOffsetReset(AutoOffsetResetType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_AutoOffsetReset()
* @model
* @generated
*/
AutoOffsetResetType getAutoOffsetReset();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getAutoOffsetReset <em>Auto Offset Reset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Auto Offset Reset</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.AutoOffsetResetType
* @see #getAutoOffsetReset()
* @generated
*/
void setAutoOffsetReset(AutoOffsetResetType value);
/**
* Returns the value of the '<em><b>Consumer Timeout Ms</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Consumer Timeout Ms</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Consumer Timeout Ms</em>' attribute.
* @see #setConsumerTimeoutMs(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ConsumerTimeoutMs()
* @model default=""
* @generated
*/
String getConsumerTimeoutMs();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getConsumerTimeoutMs <em>Consumer Timeout Ms</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Consumer Timeout Ms</em>' attribute.
* @see #getConsumerTimeoutMs()
* @generated
*/
void setConsumerTimeoutMs(String value);
/**
* Returns the value of the '<em><b>Exclude Internal Topics</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Exclude Internal Topics</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Exclude Internal Topics</em>' attribute.
* @see #setExcludeInternalTopics(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ExcludeInternalTopics()
* @model
* @generated
*/
boolean isExcludeInternalTopics();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isExcludeInternalTopics <em>Exclude Internal Topics</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Exclude Internal Topics</em>' attribute.
* @see #isExcludeInternalTopics()
* @generated
*/
void setExcludeInternalTopics(boolean value);
/**
* Returns the value of the '<em><b>Partition Assignment Strategy</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.PartitionAssignmentStrategyType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Partition Assignment Strategy</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Partition Assignment Strategy</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.PartitionAssignmentStrategyType
* @see #setPartitionAssignmentStrategy(PartitionAssignmentStrategyType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_PartitionAssignmentStrategy()
* @model
* @generated
*/
PartitionAssignmentStrategyType getPartitionAssignmentStrategy();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getPartitionAssignmentStrategy <em>Partition Assignment Strategy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Partition Assignment Strategy</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.PartitionAssignmentStrategyType
* @see #getPartitionAssignmentStrategy()
* @generated
*/
void setPartitionAssignmentStrategy(PartitionAssignmentStrategyType value);
/**
* Returns the value of the '<em><b>Client Id</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Client Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Client Id</em>' attribute.
* @see #setClientId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ClientId()
* @model default=""
* @generated
*/
String getClientId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getClientId <em>Client Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Client Id</em>' attribute.
* @see #getClientId()
* @generated
*/
void setClientId(String value);
/**
* Returns the value of the '<em><b>Inbound Cxf Rm Host</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Cxf Rm Host</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Cxf Rm Host</em>' attribute.
* @see #setInboundCxfRmHost(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundCxfRmHost()
* @model default=""
* @generated
*/
String getInboundCxfRmHost();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmHost <em>Inbound Cxf Rm Host</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Cxf Rm Host</em>' attribute.
* @see #getInboundCxfRmHost()
* @generated
*/
void setInboundCxfRmHost(String value);
/**
* Returns the value of the '<em><b>Inbound Cxf Rm Port</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Cxf Rm Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Cxf Rm Port</em>' attribute.
* @see #setInboundCxfRmPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundCxfRmPort()
* @model default=""
* @generated
*/
String getInboundCxfRmPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmPort <em>Inbound Cxf Rm Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Cxf Rm Port</em>' attribute.
* @see #getInboundCxfRmPort()
* @generated
*/
void setInboundCxfRmPort(String value);
/**
* Returns the value of the '<em><b>Inbound Cxf Rm Config File</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Cxf Rm Config File</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Cxf Rm Config File</em>' attribute.
* @see #setInboundCxfRmConfigFile(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundCxfRmConfigFile()
* @model default=""
* @generated
*/
String getInboundCxfRmConfigFile();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundCxfRmConfigFile <em>Inbound Cxf Rm Config File</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Cxf Rm Config File</em>' attribute.
* @see #getInboundCxfRmConfigFile()
* @generated
*/
void setInboundCxfRmConfigFile(String value);
/**
* Returns the value of the '<em><b>Enable SSL</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Enable SSL</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Enable SSL</em>' attribute.
* @see #setEnableSSL(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_EnableSSL()
* @model
* @generated
*/
boolean isEnableSSL();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isEnableSSL <em>Enable SSL</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Enable SSL</em>' attribute.
* @see #isEnableSSL()
* @generated
*/
void setEnableSSL(boolean value);
/**
* Returns the value of the '<em><b>Service Parameters</b></em>' containment reference list.
* The list contents are of type {@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointParameter}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Service Parameters</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Service Parameters</em>' containment reference list.
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_ServiceParameters()
* @model containment="true"
* @generated
*/
EList<InboundEndpointParameter> getServiceParameters();
/**
* Returns the value of the '<em><b>Suspend</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Suspend</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Suspend</em>' attribute.
* @see #setSuspend(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Suspend()
* @model default="false"
* @generated
*/
boolean isSuspend();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isSuspend <em>Suspend</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Suspend</em>' attribute.
* @see #isSuspend()
* @generated
*/
void setSuspend(boolean value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Factory</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Factory</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Factory</em>' attribute.
* @see #setTransportRabbitMqConnectionFactory(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionFactory()
* @model
* @generated
*/
String getTransportRabbitMqConnectionFactory();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionFactory <em>Transport Rabbit Mq Connection Factory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Factory</em>' attribute.
* @see #getTransportRabbitMqConnectionFactory()
* @generated
*/
void setTransportRabbitMqConnectionFactory(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server Host Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server Host Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server Host Name</em>' attribute.
* @see #setTransportRabbitMqServerHostName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerHostName()
* @model
* @generated
*/
String getTransportRabbitMqServerHostName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerHostName <em>Transport Rabbit Mq Server Host Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server Host Name</em>' attribute.
* @see #getTransportRabbitMqServerHostName()
* @generated
*/
void setTransportRabbitMqServerHostName(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server Port</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server Port</em>' attribute.
* @see #setTransportRabbitMqServerPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerPort()
* @model
* @generated
*/
String getTransportRabbitMqServerPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerPort <em>Transport Rabbit Mq Server Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server Port</em>' attribute.
* @see #getTransportRabbitMqServerPort()
* @generated
*/
void setTransportRabbitMqServerPort(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server User Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server User Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server User Name</em>' attribute.
* @see #setTransportRabbitMqServerUserName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerUserName()
* @model
* @generated
*/
String getTransportRabbitMqServerUserName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerUserName <em>Transport Rabbit Mq Server User Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server User Name</em>' attribute.
* @see #getTransportRabbitMqServerUserName()
* @generated
*/
void setTransportRabbitMqServerUserName(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server Password</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server Password</em>' attribute.
* @see #setTransportRabbitMqServerPassword(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerPassword()
* @model
* @generated
*/
String getTransportRabbitMqServerPassword();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerPassword <em>Transport Rabbit Mq Server Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server Password</em>' attribute.
* @see #getTransportRabbitMqServerPassword()
* @generated
*/
void setTransportRabbitMqServerPassword(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Name</em>' attribute.
* @see #setTransportRabbitMqQueueName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueName()
* @model
* @generated
*/
String getTransportRabbitMqQueueName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueName <em>Transport Rabbit Mq Queue Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Name</em>' attribute.
* @see #getTransportRabbitMqQueueName()
* @generated
*/
void setTransportRabbitMqQueueName(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Exchange Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Exchange Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Exchange Name</em>' attribute.
* @see #setTransportRabbitMqExchangeName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqExchangeName()
* @model
* @generated
*/
String getTransportRabbitMqExchangeName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeName <em>Transport Rabbit Mq Exchange Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Exchange Name</em>' attribute.
* @see #getTransportRabbitMqExchangeName()
* @generated
*/
void setTransportRabbitMqExchangeName(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Durable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Durable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Durable</em>' attribute.
* @see #setTransportRabbitMqQueueDurable(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueDurable()
* @model
* @generated
*/
String getTransportRabbitMqQueueDurable();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueDurable <em>Transport Rabbit Mq Queue Durable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Durable</em>' attribute.
* @see #getTransportRabbitMqQueueDurable()
* @generated
*/
void setTransportRabbitMqQueueDurable(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Exclusive</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Exclusive</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Exclusive</em>' attribute.
* @see #setTransportRabbitMqQueueExclusive(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueExclusive()
* @model
* @generated
*/
String getTransportRabbitMqQueueExclusive();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueExclusive <em>Transport Rabbit Mq Queue Exclusive</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Exclusive</em>' attribute.
* @see #getTransportRabbitMqQueueExclusive()
* @generated
*/
void setTransportRabbitMqQueueExclusive(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Auto Delete</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Auto Delete</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Auto Delete</em>' attribute.
* @see #setTransportRabbitMqQueueAutoDelete(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueAutoDelete()
* @model
* @generated
*/
String getTransportRabbitMqQueueAutoDelete();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueAutoDelete <em>Transport Rabbit Mq Queue Auto Delete</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Auto Delete</em>' attribute.
* @see #getTransportRabbitMqQueueAutoDelete()
* @generated
*/
void setTransportRabbitMqQueueAutoDelete(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Auto Ack</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Auto Ack</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Auto Ack</em>' attribute.
* @see #setTransportRabbitMqQueueAutoAck(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueAutoAck()
* @model
* @generated
*/
String getTransportRabbitMqQueueAutoAck();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueAutoAck <em>Transport Rabbit Mq Queue Auto Ack</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Auto Ack</em>' attribute.
* @see #getTransportRabbitMqQueueAutoAck()
* @generated
*/
void setTransportRabbitMqQueueAutoAck(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Routing Key</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Routing Key</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Routing Key</em>' attribute.
* @see #setTransportRabbitMqQueueRoutingKey(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueRoutingKey()
* @model
* @generated
*/
String getTransportRabbitMqQueueRoutingKey();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueRoutingKey <em>Transport Rabbit Mq Queue Routing Key</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Routing Key</em>' attribute.
* @see #getTransportRabbitMqQueueRoutingKey()
* @generated
*/
void setTransportRabbitMqQueueRoutingKey(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Queue Delivery Mode</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Queue Delivery Mode</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Queue Delivery Mode</em>' attribute.
* @see #setTransportRabbitMqQueueDeliveryMode(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqQueueDeliveryMode()
* @model
* @generated
*/
String getTransportRabbitMqQueueDeliveryMode();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqQueueDeliveryMode <em>Transport Rabbit Mq Queue Delivery Mode</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Queue Delivery Mode</em>' attribute.
* @see #getTransportRabbitMqQueueDeliveryMode()
* @generated
*/
void setTransportRabbitMqQueueDeliveryMode(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Exchange Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Exchange Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Exchange Type</em>' attribute.
* @see #setTransportRabbitMqExchangeType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqExchangeType()
* @model
* @generated
*/
String getTransportRabbitMqExchangeType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeType <em>Transport Rabbit Mq Exchange Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Exchange Type</em>' attribute.
* @see #getTransportRabbitMqExchangeType()
* @generated
*/
void setTransportRabbitMqExchangeType(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Exchange Durable</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Exchange Durable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Exchange Durable</em>' attribute.
* @see #setTransportRabbitMqExchangeDurable(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqExchangeDurable()
* @model
* @generated
*/
String getTransportRabbitMqExchangeDurable();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeDurable <em>Transport Rabbit Mq Exchange Durable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Exchange Durable</em>' attribute.
* @see #getTransportRabbitMqExchangeDurable()
* @generated
*/
void setTransportRabbitMqExchangeDurable(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Exchange Auto Delete</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Exchange Auto Delete</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Exchange Auto Delete</em>' attribute.
* @see #setTransportRabbitMqExchangeAutoDelete(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqExchangeAutoDelete()
* @model
* @generated
*/
String getTransportRabbitMqExchangeAutoDelete();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqExchangeAutoDelete <em>Transport Rabbit Mq Exchange Auto Delete</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Exchange Auto Delete</em>' attribute.
* @see #getTransportRabbitMqExchangeAutoDelete()
* @generated
*/
void setTransportRabbitMqExchangeAutoDelete(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server Virtual Host</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server Virtual Host</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server Virtual Host</em>' attribute.
* @see #setTransportRabbitMqServerVirtualHost(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerVirtualHost()
* @model
* @generated
*/
String getTransportRabbitMqServerVirtualHost();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerVirtualHost <em>Transport Rabbit Mq Server Virtual Host</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server Virtual Host</em>' attribute.
* @see #getTransportRabbitMqServerVirtualHost()
* @generated
*/
void setTransportRabbitMqServerVirtualHost(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Factory Heartbeat</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Factory Heartbeat</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Factory Heartbeat</em>' attribute.
* @see #setTransportRabbitMqFactoryHeartbeat(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqFactoryHeartbeat()
* @model
* @generated
*/
String getTransportRabbitMqFactoryHeartbeat();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqFactoryHeartbeat <em>Transport Rabbit Mq Factory Heartbeat</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Factory Heartbeat</em>' attribute.
* @see #getTransportRabbitMqFactoryHeartbeat()
* @generated
*/
void setTransportRabbitMqFactoryHeartbeat(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Enabled</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Enabled</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Enabled</em>' attribute.
* @see #setTransportRabbitMqConnectionSslEnabled(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslEnabled()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslEnabled();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslEnabled <em>Transport Rabbit Mq Connection Ssl Enabled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Enabled</em>' attribute.
* @see #getTransportRabbitMqConnectionSslEnabled()
* @generated
*/
void setTransportRabbitMqConnectionSslEnabled(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Keystore Location</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Keystore Location</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Location</em>' attribute.
* @see #setTransportRabbitMqConnectionSslKeystoreLocation(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslKeystoreLocation()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslKeystoreLocation();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystoreLocation <em>Transport Rabbit Mq Connection Ssl Keystore Location</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Location</em>' attribute.
* @see #getTransportRabbitMqConnectionSslKeystoreLocation()
* @generated
*/
void setTransportRabbitMqConnectionSslKeystoreLocation(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Keystore Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Keystore Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Type</em>' attribute.
* @see #setTransportRabbitMqConnectionSslKeystoreType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslKeystoreType()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslKeystoreType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystoreType <em>Transport Rabbit Mq Connection Ssl Keystore Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Type</em>' attribute.
* @see #getTransportRabbitMqConnectionSslKeystoreType()
* @generated
*/
void setTransportRabbitMqConnectionSslKeystoreType(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Keystore Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Keystore Password</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Password</em>' attribute.
* @see #setTransportRabbitMqConnectionSslKeystorePassword(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslKeystorePassword()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslKeystorePassword();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslKeystorePassword <em>Transport Rabbit Mq Connection Ssl Keystore Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Keystore Password</em>' attribute.
* @see #getTransportRabbitMqConnectionSslKeystorePassword()
* @generated
*/
void setTransportRabbitMqConnectionSslKeystorePassword(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Truststore Location</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Truststore Location</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Location</em>' attribute.
* @see #setTransportRabbitMqConnectionSslTruststoreLocation(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslTruststoreLocation()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslTruststoreLocation();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststoreLocation <em>Transport Rabbit Mq Connection Ssl Truststore Location</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Location</em>' attribute.
* @see #getTransportRabbitMqConnectionSslTruststoreLocation()
* @generated
*/
void setTransportRabbitMqConnectionSslTruststoreLocation(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Truststore Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Truststore Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Type</em>' attribute.
* @see #setTransportRabbitMqConnectionSslTruststoreType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslTruststoreType()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslTruststoreType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststoreType <em>Transport Rabbit Mq Connection Ssl Truststore Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Type</em>' attribute.
* @see #getTransportRabbitMqConnectionSslTruststoreType()
* @generated
*/
void setTransportRabbitMqConnectionSslTruststoreType(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Truststore Password</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Truststore Password</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Password</em>' attribute.
* @see #setTransportRabbitMqConnectionSslTruststorePassword(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslTruststorePassword()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslTruststorePassword();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslTruststorePassword <em>Transport Rabbit Mq Connection Ssl Truststore Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Truststore Password</em>' attribute.
* @see #getTransportRabbitMqConnectionSslTruststorePassword()
* @generated
*/
void setTransportRabbitMqConnectionSslTruststorePassword(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Ssl Version</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Ssl Version</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Ssl Version</em>' attribute.
* @see #setTransportRabbitMqConnectionSslVersion(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionSslVersion()
* @model
* @generated
*/
String getTransportRabbitMqConnectionSslVersion();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionSslVersion <em>Transport Rabbit Mq Connection Ssl Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Ssl Version</em>' attribute.
* @see #getTransportRabbitMqConnectionSslVersion()
* @generated
*/
void setTransportRabbitMqConnectionSslVersion(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Message Content Type</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Message Content Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Message Content Type</em>' attribute.
* @see #setTransportRabbitMqMessageContentType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqMessageContentType()
* @model
* @generated
*/
String getTransportRabbitMqMessageContentType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqMessageContentType <em>Transport Rabbit Mq Message Content Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Message Content Type</em>' attribute.
* @see #getTransportRabbitMqMessageContentType()
* @generated
*/
void setTransportRabbitMqMessageContentType(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Retry Count</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Retry Count</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Retry Count</em>' attribute.
* @see #setTransportRabbitMqConnectionRetryCount(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionRetryCount()
* @model
* @generated
*/
String getTransportRabbitMqConnectionRetryCount();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionRetryCount <em>Transport Rabbit Mq Connection Retry Count</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Retry Count</em>' attribute.
* @see #getTransportRabbitMqConnectionRetryCount()
* @generated
*/
void setTransportRabbitMqConnectionRetryCount(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Connection Retry Interval</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Connection Retry Interval</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Connection Retry Interval</em>' attribute.
* @see #setTransportRabbitMqConnectionRetryInterval(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConnectionRetryInterval()
* @model
* @generated
*/
String getTransportRabbitMqConnectionRetryInterval();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConnectionRetryInterval <em>Transport Rabbit Mq Connection Retry Interval</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Connection Retry Interval</em>' attribute.
* @see #getTransportRabbitMqConnectionRetryInterval()
* @generated
*/
void setTransportRabbitMqConnectionRetryInterval(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Server Retry Interval</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Server Retry Interval</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Server Retry Interval</em>' attribute.
* @see #setTransportRabbitMqServerRetryInterval(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqServerRetryInterval()
* @model
* @generated
*/
String getTransportRabbitMqServerRetryInterval();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqServerRetryInterval <em>Transport Rabbit Mq Server Retry Interval</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Server Retry Interval</em>' attribute.
* @see #getTransportRabbitMqServerRetryInterval()
* @generated
*/
void setTransportRabbitMqServerRetryInterval(String value);
/**
* Returns the value of the '<em><b>Transport Rabbit Mq Consumer Qos</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Rabbit Mq Consumer Qos</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Rabbit Mq Consumer Qos</em>' containment reference.
* @see #setTransportRabbitMqConsumerQos(RegistryKeyProperty)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportRabbitMqConsumerQos()
* @model containment="true"
* @generated
*/
RegistryKeyProperty getTransportRabbitMqConsumerQos();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportRabbitMqConsumerQos <em>Transport Rabbit Mq Consumer Qos</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Rabbit Mq Consumer Qos</em>' containment reference.
* @see #getTransportRabbitMqConsumerQos()
* @generated
*/
void setTransportRabbitMqConsumerQos(RegistryKeyProperty value);
/**
* Returns the value of the '<em><b>Ws Inbound Port</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Inbound Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Inbound Port</em>' attribute.
* @see #setWsInboundPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsInboundPort()
* @model
* @generated
*/
String getWsInboundPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsInboundPort <em>Ws Inbound Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Inbound Port</em>' attribute.
* @see #getWsInboundPort()
* @generated
*/
void setWsInboundPort(String value);
/**
* Returns the value of the '<em><b>Ws Client Side Broadcast Level</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.WSClientSideBroadcastLevel}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Client Side Broadcast Level</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Client Side Broadcast Level</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.WSClientSideBroadcastLevel
* @see #setWsClientSideBroadcastLevel(WSClientSideBroadcastLevel)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsClientSideBroadcastLevel()
* @model
* @generated
*/
WSClientSideBroadcastLevel getWsClientSideBroadcastLevel();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsClientSideBroadcastLevel <em>Ws Client Side Broadcast Level</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Client Side Broadcast Level</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.WSClientSideBroadcastLevel
* @see #getWsClientSideBroadcastLevel()
* @generated
*/
void setWsClientSideBroadcastLevel(WSClientSideBroadcastLevel value);
/**
* Returns the value of the '<em><b>Ws Outflow Dispatch Sequence</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Outflow Dispatch Sequence</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Outflow Dispatch Sequence</em>' attribute.
* @see #setWsOutflowDispatchSequence(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsOutflowDispatchSequence()
* @model
* @generated
*/
String getWsOutflowDispatchSequence();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsOutflowDispatchSequence <em>Ws Outflow Dispatch Sequence</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Outflow Dispatch Sequence</em>' attribute.
* @see #getWsOutflowDispatchSequence()
* @generated
*/
void setWsOutflowDispatchSequence(String value);
/**
* Returns the value of the '<em><b>Ws Outflow Dispatch Fault Sequence</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Outflow Dispatch Fault Sequence</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Outflow Dispatch Fault Sequence</em>' attribute.
* @see #setWsOutflowDispatchFaultSequence(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsOutflowDispatchFaultSequence()
* @model
* @generated
*/
String getWsOutflowDispatchFaultSequence();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsOutflowDispatchFaultSequence <em>Ws Outflow Dispatch Fault Sequence</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Outflow Dispatch Fault Sequence</em>' attribute.
* @see #getWsOutflowDispatchFaultSequence()
* @generated
*/
void setWsOutflowDispatchFaultSequence(String value);
/**
* Returns the value of the '<em><b>Ws Boss Thread Pool Size</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Boss Thread Pool Size</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Boss Thread Pool Size</em>' attribute.
* @see #setWsBossThreadPoolSize(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsBossThreadPoolSize()
* @model
* @generated
*/
String getWsBossThreadPoolSize();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsBossThreadPoolSize <em>Ws Boss Thread Pool Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Boss Thread Pool Size</em>' attribute.
* @see #getWsBossThreadPoolSize()
* @generated
*/
void setWsBossThreadPoolSize(String value);
/**
* Returns the value of the '<em><b>Ws Worker Thread Pool Size</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Worker Thread Pool Size</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Worker Thread Pool Size</em>' attribute.
* @see #setWsWorkerThreadPoolSize(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsWorkerThreadPoolSize()
* @model
* @generated
*/
String getWsWorkerThreadPoolSize();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsWorkerThreadPoolSize <em>Ws Worker Thread Pool Size</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Worker Thread Pool Size</em>' attribute.
* @see #getWsWorkerThreadPoolSize()
* @generated
*/
void setWsWorkerThreadPoolSize(String value);
/**
* Returns the value of the '<em><b>Ws Subprotocol Handler Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Subprotocol Handler Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Subprotocol Handler Class</em>' attribute.
* @see #setWsSubprotocolHandlerClass(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsSubprotocolHandlerClass()
* @model
* @generated
*/
String getWsSubprotocolHandlerClass();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsSubprotocolHandlerClass <em>Ws Subprotocol Handler Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Subprotocol Handler Class</em>' attribute.
* @see #getWsSubprotocolHandlerClass()
* @generated
*/
void setWsSubprotocolHandlerClass(String value);
/**
* Returns the value of the '<em><b>Ws Pipeline Handler Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ws Pipeline Handler Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ws Pipeline Handler Class</em>' attribute.
* @see #setWsPipelineHandlerClass(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_WsPipelineHandlerClass()
* @model
* @generated
*/
String getWsPipelineHandlerClass();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWsPipelineHandlerClass <em>Ws Pipeline Handler Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ws Pipeline Handler Class</em>' attribute.
* @see #getWsPipelineHandlerClass()
* @generated
*/
void setWsPipelineHandlerClass(String value);
/**
* Returns the value of the '<em><b>Transport Feed URL</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Feed URL</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Feed URL</em>' attribute.
* @see #setTransportFeedURL(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportFeedURL()
* @model default=""
* @generated
*/
String getTransportFeedURL();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportFeedURL <em>Transport Feed URL</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Feed URL</em>' attribute.
* @see #getTransportFeedURL()
* @generated
*/
void setTransportFeedURL(String value);
/**
* Returns the value of the '<em><b>Transport Feed Type</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.FeedType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport Feed Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport Feed Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.FeedType
* @see #setTransportFeedType(FeedType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportFeedType()
* @model
* @generated
*/
FeedType getTransportFeedType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportFeedType <em>Transport Feed Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport Feed Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.FeedType
* @see #getTransportFeedType()
* @generated
*/
void setTransportFeedType(FeedType value);
/**
* Returns the value of the '<em><b>Trace Enabled</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Trace Enabled</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Trace Enabled</em>' attribute.
* @see #setTraceEnabled(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TraceEnabled()
* @model
* @generated
*/
boolean isTraceEnabled();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTraceEnabled <em>Trace Enabled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Trace Enabled</em>' attribute.
* @see #isTraceEnabled()
* @generated
*/
void setTraceEnabled(boolean value);
/**
* Returns the value of the '<em><b>Statistics Enabled</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Statistics Enabled</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Statistics Enabled</em>' attribute.
* @see #setStatisticsEnabled(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_StatisticsEnabled()
* @model
* @generated
*/
boolean isStatisticsEnabled();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isStatisticsEnabled <em>Statistics Enabled</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Statistics Enabled</em>' attribute.
* @see #isStatisticsEnabled()
* @generated
*/
void setStatisticsEnabled(boolean value);
/**
* Returns the value of the '<em><b>Class</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Class</em>' attribute.
* @see #setClass(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Class()
* @model default=""
* @generated
*/
String getClass_();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getClass_ <em>Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Class</em>' attribute.
* @see #getClass_()
* @generated
*/
void setClass(String value);
/**
* Returns the value of the '<em><b>Protocol</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Protocol</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Protocol</em>' attribute.
* @see #setProtocol(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Protocol()
* @model default=""
* @generated
*/
String getProtocol();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getProtocol <em>Protocol</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Protocol</em>' attribute.
* @see #getProtocol()
* @generated
*/
void setProtocol(String value);
/**
* Returns the value of the '<em><b>Inbound Endpoint Behaviour</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointBehaviourType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Endpoint Behaviour</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Endpoint Behaviour</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointBehaviourType
* @see #setInboundEndpointBehaviour(InboundEndpointBehaviourType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundEndpointBehaviour()
* @model
* @generated
*/
InboundEndpointBehaviourType getInboundEndpointBehaviour();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundEndpointBehaviour <em>Inbound Endpoint Behaviour</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Endpoint Behaviour</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointBehaviourType
* @see #getInboundEndpointBehaviour()
* @generated
*/
void setInboundEndpointBehaviour(InboundEndpointBehaviourType value);
/**
* Returns the value of the '<em><b>Inbound Http Port</b></em>' attribute.
* The default value is <code>"8000"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Http Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Http Port</em>' attribute.
* @see #setInboundHttpPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundHttpPort()
* @model default="8000"
* @generated
*/
String getInboundHttpPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundHttpPort <em>Inbound Http Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Http Port</em>' attribute.
* @see #getInboundHttpPort()
* @generated
*/
void setInboundHttpPort(String value);
/**
* Returns the value of the '<em><b>Inbound Worker Pool Size Core</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Worker Pool Size Core</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Worker Pool Size Core</em>' attribute.
* @see #setInboundWorkerPoolSizeCore(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundWorkerPoolSizeCore()
* @model default=""
* @generated
*/
String getInboundWorkerPoolSizeCore();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolSizeCore <em>Inbound Worker Pool Size Core</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Worker Pool Size Core</em>' attribute.
* @see #getInboundWorkerPoolSizeCore()
* @generated
*/
void setInboundWorkerPoolSizeCore(String value);
/**
* Returns the value of the '<em><b>Inbound Worker Pool Size Max</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Worker Pool Size Max</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Worker Pool Size Max</em>' attribute.
* @see #setInboundWorkerPoolSizeMax(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundWorkerPoolSizeMax()
* @model default=""
* @generated
*/
String getInboundWorkerPoolSizeMax();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolSizeMax <em>Inbound Worker Pool Size Max</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Worker Pool Size Max</em>' attribute.
* @see #getInboundWorkerPoolSizeMax()
* @generated
*/
void setInboundWorkerPoolSizeMax(String value);
/**
* Returns the value of the '<em><b>Inbound Worker Thread Keep Alive Sec</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Worker Thread Keep Alive Sec</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Worker Thread Keep Alive Sec</em>' attribute.
* @see #setInboundWorkerThreadKeepAliveSec(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundWorkerThreadKeepAliveSec()
* @model default=""
* @generated
*/
String getInboundWorkerThreadKeepAliveSec();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerThreadKeepAliveSec <em>Inbound Worker Thread Keep Alive Sec</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Worker Thread Keep Alive Sec</em>' attribute.
* @see #getInboundWorkerThreadKeepAliveSec()
* @generated
*/
void setInboundWorkerThreadKeepAliveSec(String value);
/**
* Returns the value of the '<em><b>Inbound Worker Pool Queue Length</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Worker Pool Queue Length</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Worker Pool Queue Length</em>' attribute.
* @see #setInboundWorkerPoolQueueLength(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundWorkerPoolQueueLength()
* @model default=""
* @generated
*/
String getInboundWorkerPoolQueueLength();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundWorkerPoolQueueLength <em>Inbound Worker Pool Queue Length</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Worker Pool Queue Length</em>' attribute.
* @see #getInboundWorkerPoolQueueLength()
* @generated
*/
void setInboundWorkerPoolQueueLength(String value);
/**
* Returns the value of the '<em><b>Inbound Thread Group Id</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Thread Group Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Thread Group Id</em>' attribute.
* @see #setInboundThreadGroupId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundThreadGroupId()
* @model default=""
* @generated
*/
String getInboundThreadGroupId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundThreadGroupId <em>Inbound Thread Group Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Thread Group Id</em>' attribute.
* @see #getInboundThreadGroupId()
* @generated
*/
void setInboundThreadGroupId(String value);
/**
* Returns the value of the '<em><b>Inbound Thread Id</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Inbound Thread Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Inbound Thread Id</em>' attribute.
* @see #setInboundThreadId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_InboundThreadId()
* @model default=""
* @generated
*/
String getInboundThreadId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInboundThreadId <em>Inbound Thread Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Inbound Thread Id</em>' attribute.
* @see #getInboundThreadId()
* @generated
*/
void setInboundThreadId(String value);
/**
* Returns the value of the '<em><b>Dispatch Filter Pattern</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Dispatch Filter Pattern</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Dispatch Filter Pattern</em>' attribute.
* @see #setDispatchFilterPattern(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_DispatchFilterPattern()
* @model default=""
* @generated
*/
String getDispatchFilterPattern();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getDispatchFilterPattern <em>Dispatch Filter Pattern</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Dispatch Filter Pattern</em>' attribute.
* @see #getDispatchFilterPattern()
* @generated
*/
void setDispatchFilterPattern(String value);
/**
* Returns the value of the '<em><b>Interval</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Interval</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Interval</em>' attribute.
* @see #setInterval(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Interval()
* @model default=""
* @generated
*/
String getInterval();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getInterval <em>Interval</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Interval</em>' attribute.
* @see #getInterval()
* @generated
*/
void setInterval(String value);
/**
* Returns the value of the '<em><b>Sequential</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Sequential</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sequential</em>' attribute.
* @see #setSequential(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Sequential()
* @model default="true"
* @generated
*/
boolean isSequential();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isSequential <em>Sequential</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Sequential</em>' attribute.
* @see #isSequential()
* @generated
*/
void setSequential(boolean value);
/**
* Returns the value of the '<em><b>Coordination</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Coordination</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Coordination</em>' attribute.
* @see #setCoordination(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Coordination()
* @model default="true"
* @generated
*/
boolean isCoordination();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isCoordination <em>Coordination</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Coordination</em>' attribute.
* @see #isCoordination()
* @generated
*/
void setCoordination(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS File URI</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File URI</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File URI</em>' attribute.
* @see #setTransportVFSFileURI(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileURI()
* @model default=""
* @generated
*/
String getTransportVFSFileURI();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileURI <em>Transport VFS File URI</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File URI</em>' attribute.
* @see #getTransportVFSFileURI()
* @generated
*/
void setTransportVFSFileURI(String value);
/**
* Returns the value of the '<em><b>Wso2mb Connection Url</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Wso2mb Connection Url</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Wso2mb Connection Url</em>' attribute.
* @see #setWso2mbConnectionUrl(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Wso2mbConnectionUrl()
* @model
* @generated
*/
String getWso2mbConnectionUrl();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getWso2mbConnectionUrl <em>Wso2mb Connection Url</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Wso2mb Connection Url</em>' attribute.
* @see #getWso2mbConnectionUrl()
* @generated
*/
void setWso2mbConnectionUrl(String value);
/**
* Returns the value of the '<em><b>Transport VFS Content Type</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Content Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Content Type</em>' attribute.
* @see #setTransportVFSContentType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSContentType()
* @model default=""
* @generated
*/
String getTransportVFSContentType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSContentType <em>Transport VFS Content Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Content Type</em>' attribute.
* @see #getTransportVFSContentType()
* @generated
*/
void setTransportVFSContentType(String value);
/**
* Returns the value of the '<em><b>Transport VFS File Name Pattern</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File Name Pattern</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File Name Pattern</em>' attribute.
* @see #setTransportVFSFileNamePattern(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileNamePattern()
* @model default=""
* @generated
*/
String getTransportVFSFileNamePattern();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileNamePattern <em>Transport VFS File Name Pattern</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File Name Pattern</em>' attribute.
* @see #getTransportVFSFileNamePattern()
* @generated
*/
void setTransportVFSFileNamePattern(String value);
/**
* Returns the value of the '<em><b>Transport VFS File Process Interval</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File Process Interval</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File Process Interval</em>' attribute.
* @see #setTransportVFSFileProcessInterval(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileProcessInterval()
* @model default=""
* @generated
*/
String getTransportVFSFileProcessInterval();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileProcessInterval <em>Transport VFS File Process Interval</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File Process Interval</em>' attribute.
* @see #getTransportVFSFileProcessInterval()
* @generated
*/
void setTransportVFSFileProcessInterval(String value);
/**
* Returns the value of the '<em><b>Transport VFS File Process Count</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File Process Count</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File Process Count</em>' attribute.
* @see #setTransportVFSFileProcessCount(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileProcessCount()
* @model default=""
* @generated
*/
String getTransportVFSFileProcessCount();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileProcessCount <em>Transport VFS File Process Count</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File Process Count</em>' attribute.
* @see #getTransportVFSFileProcessCount()
* @generated
*/
void setTransportVFSFileProcessCount(String value);
/**
* Returns the value of the '<em><b>Transport VFS Locking</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.Enable}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Locking</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Locking</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.Enable
* @see #setTransportVFSLocking(Enable)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSLocking()
* @model
* @generated
*/
Enable getTransportVFSLocking();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSLocking <em>Transport VFS Locking</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Locking</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.Enable
* @see #getTransportVFSLocking()
* @generated
*/
void setTransportVFSLocking(Enable value);
/**
* Returns the value of the '<em><b>Transport VFS Max Retry Count</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Max Retry Count</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Max Retry Count</em>' attribute.
* @see #setTransportVFSMaxRetryCount(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSMaxRetryCount()
* @model default=""
* @generated
*/
String getTransportVFSMaxRetryCount();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMaxRetryCount <em>Transport VFS Max Retry Count</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Max Retry Count</em>' attribute.
* @see #getTransportVFSMaxRetryCount()
* @generated
*/
void setTransportVFSMaxRetryCount(String value);
/**
* Returns the value of the '<em><b>Transport VFS Reconnect Timeout</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Reconnect Timeout</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Reconnect Timeout</em>' attribute.
* @see #setTransportVFSReconnectTimeout(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSReconnectTimeout()
* @model default=""
* @generated
*/
String getTransportVFSReconnectTimeout();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSReconnectTimeout <em>Transport VFS Reconnect Timeout</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Reconnect Timeout</em>' attribute.
* @see #getTransportVFSReconnectTimeout()
* @generated
*/
void setTransportVFSReconnectTimeout(String value);
/**
* Returns the value of the '<em><b>Transport JMS Shared Subscription</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Shared Subscription</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Shared Subscription</em>' attribute.
* @see #setTransportJMSSharedSubscription(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSSharedSubscription()
* @model default="false"
* @generated
*/
boolean isTransportJMSSharedSubscription();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportJMSSharedSubscription <em>Transport JMS Shared Subscription</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Shared Subscription</em>' attribute.
* @see #isTransportJMSSharedSubscription()
* @generated
*/
void setTransportJMSSharedSubscription(boolean value);
/**
* Returns the value of the '<em><b>Transport JMS Subscription Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Subscription Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Subscription Name</em>' attribute.
* @see #setTransportJMSSubscriptionName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSSubscriptionName()
* @model
* @generated
*/
String getTransportJMSSubscriptionName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSubscriptionName <em>Transport JMS Subscription Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Subscription Name</em>' attribute.
* @see #getTransportJMSSubscriptionName()
* @generated
*/
void setTransportJMSSubscriptionName(String value);
/**
* Returns the value of the '<em><b>Transport JMS Pinned Servers</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Pinned Servers</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Pinned Servers</em>' attribute.
* @see #setTransportJMSPinnedServers(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSPinnedServers()
* @model
* @generated
*/
String getTransportJMSPinnedServers();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPinnedServers <em>Transport JMS Pinned Servers</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Pinned Servers</em>' attribute.
* @see #getTransportJMSPinnedServers()
* @generated
*/
void setTransportJMSPinnedServers(String value);
/**
* Returns the value of the '<em><b>Transport VFS Action After Process</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.VFSAction}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Action After Process</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Action After Process</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #setTransportVFSActionAfterProcess(VFSAction)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSActionAfterProcess()
* @model
* @generated
*/
VFSAction getTransportVFSActionAfterProcess();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterProcess <em>Transport VFS Action After Process</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Action After Process</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #getTransportVFSActionAfterProcess()
* @generated
*/
void setTransportVFSActionAfterProcess(VFSAction value);
/**
* Returns the value of the '<em><b>Transport VFS Move After Process</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Move After Process</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Move After Process</em>' attribute.
* @see #setTransportVFSMoveAfterProcess(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSMoveAfterProcess()
* @model default=""
* @generated
*/
String getTransportVFSMoveAfterProcess();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterProcess <em>Transport VFS Move After Process</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Move After Process</em>' attribute.
* @see #getTransportVFSMoveAfterProcess()
* @generated
*/
void setTransportVFSMoveAfterProcess(String value);
/**
* Returns the value of the '<em><b>Transport VFS Action After Errors</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.VFSAction}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Action After Errors</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Action After Errors</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #setTransportVFSActionAfterErrors(VFSAction)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSActionAfterErrors()
* @model
* @generated
*/
VFSAction getTransportVFSActionAfterErrors();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterErrors <em>Transport VFS Action After Errors</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Action After Errors</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #getTransportVFSActionAfterErrors()
* @generated
*/
void setTransportVFSActionAfterErrors(VFSAction value);
/**
* Returns the value of the '<em><b>Transport VFS Move After Errors</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Move After Errors</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Move After Errors</em>' attribute.
* @see #setTransportVFSMoveAfterErrors(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSMoveAfterErrors()
* @model default=""
* @generated
*/
String getTransportVFSMoveAfterErrors();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterErrors <em>Transport VFS Move After Errors</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Move After Errors</em>' attribute.
* @see #getTransportVFSMoveAfterErrors()
* @generated
*/
void setTransportVFSMoveAfterErrors(String value);
/**
* Returns the value of the '<em><b>Transport VFS Action After Failure</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.VFSAction}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Action After Failure</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Action After Failure</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #setTransportVFSActionAfterFailure(VFSAction)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSActionAfterFailure()
* @model
* @generated
*/
VFSAction getTransportVFSActionAfterFailure();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSActionAfterFailure <em>Transport VFS Action After Failure</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Action After Failure</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSAction
* @see #getTransportVFSActionAfterFailure()
* @generated
*/
void setTransportVFSActionAfterFailure(VFSAction value);
/**
* Returns the value of the '<em><b>Transport VFS Move After Failure</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Move After Failure</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Move After Failure</em>' attribute.
* @see #setTransportVFSMoveAfterFailure(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSMoveAfterFailure()
* @model default=""
* @generated
*/
String getTransportVFSMoveAfterFailure();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveAfterFailure <em>Transport VFS Move After Failure</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Move After Failure</em>' attribute.
* @see #getTransportVFSMoveAfterFailure()
* @generated
*/
void setTransportVFSMoveAfterFailure(String value);
/**
* Returns the value of the '<em><b>Transport VFS Auto Lock Release</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Auto Lock Release</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Auto Lock Release</em>' attribute.
* @see #setTransportVFSAutoLockRelease(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSAutoLockRelease()
* @model default="false"
* @generated
*/
boolean isTransportVFSAutoLockRelease();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSAutoLockRelease <em>Transport VFS Auto Lock Release</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Auto Lock Release</em>' attribute.
* @see #isTransportVFSAutoLockRelease()
* @generated
*/
void setTransportVFSAutoLockRelease(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Auto Lock Release Interval</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Auto Lock Release Interval</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Auto Lock Release Interval</em>' attribute.
* @see #setTransportVFSAutoLockReleaseInterval(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSAutoLockReleaseInterval()
* @model default=""
* @generated
*/
String getTransportVFSAutoLockReleaseInterval();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSAutoLockReleaseInterval <em>Transport VFS Auto Lock Release Interval</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Auto Lock Release Interval</em>' attribute.
* @see #getTransportVFSAutoLockReleaseInterval()
* @generated
*/
void setTransportVFSAutoLockReleaseInterval(String value);
/**
* Returns the value of the '<em><b>Transport VFS Lock Release Same Node</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Lock Release Same Node</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Lock Release Same Node</em>' attribute.
* @see #setTransportVFSLockReleaseSameNode(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSLockReleaseSameNode()
* @model default="false"
* @generated
*/
boolean isTransportVFSLockReleaseSameNode();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSLockReleaseSameNode <em>Transport VFS Lock Release Same Node</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Lock Release Same Node</em>' attribute.
* @see #isTransportVFSLockReleaseSameNode()
* @generated
*/
void setTransportVFSLockReleaseSameNode(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Distributed Lock</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Distributed Lock</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Distributed Lock</em>' attribute.
* @see #setTransportVFSDistributedLock(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSDistributedLock()
* @model default="false"
* @generated
*/
boolean isTransportVFSDistributedLock();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSDistributedLock <em>Transport VFS Distributed Lock</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Distributed Lock</em>' attribute.
* @see #isTransportVFSDistributedLock()
* @generated
*/
void setTransportVFSDistributedLock(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Streaming</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Streaming</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Streaming</em>' attribute.
* @see #setTransportVFSStreaming(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSStreaming()
* @model default="false"
* @generated
*/
boolean isTransportVFSStreaming();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSStreaming <em>Transport VFS Streaming</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Streaming</em>' attribute.
* @see #isTransportVFSStreaming()
* @generated
*/
void setTransportVFSStreaming(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Build</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Build</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Build</em>' attribute.
* @see #setTransportVFSBuild(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSBuild()
* @model default="false"
* @generated
*/
boolean isTransportVFSBuild();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSBuild <em>Transport VFS Build</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Build</em>' attribute.
* @see #isTransportVFSBuild()
* @generated
*/
void setTransportVFSBuild(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Distributed Timeout</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Distributed Timeout</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Distributed Timeout</em>' attribute.
* @see #setTransportVFSDistributedTimeout(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSDistributedTimeout()
* @model default=""
* @generated
*/
String getTransportVFSDistributedTimeout();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSDistributedTimeout <em>Transport VFS Distributed Timeout</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Distributed Timeout</em>' attribute.
* @see #getTransportVFSDistributedTimeout()
* @generated
*/
void setTransportVFSDistributedTimeout(String value);
/**
* Returns the value of the '<em><b>Java Naming Factory Initial</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Java Naming Factory Initial</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Java Naming Factory Initial</em>' attribute.
* @see #setJavaNamingFactoryInitial(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_JavaNamingFactoryInitial()
* @model default=""
* @generated
*/
String getJavaNamingFactoryInitial();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getJavaNamingFactoryInitial <em>Java Naming Factory Initial</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Java Naming Factory Initial</em>' attribute.
* @see #getJavaNamingFactoryInitial()
* @generated
*/
void setJavaNamingFactoryInitial(String value);
/**
* Returns the value of the '<em><b>Java Naming Provider Url</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Java Naming Provider Url</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Java Naming Provider Url</em>' attribute.
* @see #setJavaNamingProviderUrl(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_JavaNamingProviderUrl()
* @model default=""
* @generated
*/
String getJavaNamingProviderUrl();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getJavaNamingProviderUrl <em>Java Naming Provider Url</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Java Naming Provider Url</em>' attribute.
* @see #getJavaNamingProviderUrl()
* @generated
*/
void setJavaNamingProviderUrl(String value);
/**
* Returns the value of the '<em><b>Transport JMS Connection Factory JNDI Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Connection Factory JNDI Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Connection Factory JNDI Name</em>' attribute.
* @see #setTransportJMSConnectionFactoryJNDIName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSConnectionFactoryJNDIName()
* @model default=""
* @generated
*/
String getTransportJMSConnectionFactoryJNDIName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConnectionFactoryJNDIName <em>Transport JMS Connection Factory JNDI Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Connection Factory JNDI Name</em>' attribute.
* @see #getTransportJMSConnectionFactoryJNDIName()
* @generated
*/
void setTransportJMSConnectionFactoryJNDIName(String value);
/**
* Returns the value of the '<em><b>Transport JMS Connection Factory Type</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.JMSConnectionFactoryType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Connection Factory Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Connection Factory Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSConnectionFactoryType
* @see #setTransportJMSConnectionFactoryType(JMSConnectionFactoryType)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSConnectionFactoryType()
* @model
* @generated
*/
JMSConnectionFactoryType getTransportJMSConnectionFactoryType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConnectionFactoryType <em>Transport JMS Connection Factory Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Connection Factory Type</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSConnectionFactoryType
* @see #getTransportJMSConnectionFactoryType()
* @generated
*/
void setTransportJMSConnectionFactoryType(JMSConnectionFactoryType value);
/**
* Returns the value of the '<em><b>Transport JMS Concurrent Consumers</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Concurrent Consumers</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Concurrent Consumers</em>' attribute.
* @see #setTransportJMSConcurrentConsumers(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSConcurrentConsumers()
* @model
* @generated
*/
String getTransportJMSConcurrentConsumers();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSConcurrentConsumers <em>Transport JMS Concurrent Consumers</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Concurrent Consumers</em>' attribute.
* @see #getTransportJMSConcurrentConsumers()
* @generated
*/
void setTransportJMSConcurrentConsumers(String value);
/**
* Returns the value of the '<em><b>Transport JMS Destination</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Destination</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Destination</em>' attribute.
* @see #setTransportJMSDestination(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSDestination()
* @model default=""
* @generated
*/
String getTransportJMSDestination();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDestination <em>Transport JMS Destination</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Destination</em>' attribute.
* @see #getTransportJMSDestination()
* @generated
*/
void setTransportJMSDestination(String value);
/**
* Returns the value of the '<em><b>Transport JMS Session Transacted</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Session Transacted</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Session Transacted</em>' attribute.
* @see #setTransportJMSSessionTransacted(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSSessionTransacted()
* @model default="false"
* @generated
*/
boolean isTransportJMSSessionTransacted();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportJMSSessionTransacted <em>Transport JMS Session Transacted</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Session Transacted</em>' attribute.
* @see #isTransportJMSSessionTransacted()
* @generated
*/
void setTransportJMSSessionTransacted(boolean value);
/**
* Returns the value of the '<em><b>Transport JMS Session Acknowledgement</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.JMSSessionAcknowledgement}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Session Acknowledgement</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Session Acknowledgement</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSSessionAcknowledgement
* @see #setTransportJMSSessionAcknowledgement(JMSSessionAcknowledgement)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSSessionAcknowledgement()
* @model
* @generated
*/
JMSSessionAcknowledgement getTransportJMSSessionAcknowledgement();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSessionAcknowledgement <em>Transport JMS Session Acknowledgement</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Session Acknowledgement</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSSessionAcknowledgement
* @see #getTransportJMSSessionAcknowledgement()
* @generated
*/
void setTransportJMSSessionAcknowledgement(JMSSessionAcknowledgement value);
/**
* Returns the value of the '<em><b>Transport JMS Cache Level</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.JMSCacheLevel}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Cache Level</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Cache Level</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSCacheLevel
* @see #setTransportJMSCacheLevel(JMSCacheLevel)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSCacheLevel()
* @model
* @generated
*/
JMSCacheLevel getTransportJMSCacheLevel();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSCacheLevel <em>Transport JMS Cache Level</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Cache Level</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.JMSCacheLevel
* @see #getTransportJMSCacheLevel()
* @generated
*/
void setTransportJMSCacheLevel(JMSCacheLevel value);
/**
* Returns the value of the '<em><b>Transport JMS User Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS User Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS User Name</em>' attribute.
* @see #setTransportJMSUserName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSUserName()
* @model default=""
* @generated
*/
String getTransportJMSUserName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSUserName <em>Transport JMS User Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS User Name</em>' attribute.
* @see #getTransportJMSUserName()
* @generated
*/
void setTransportJMSUserName(String value);
/**
* Returns the value of the '<em><b>Transport JMS Password</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Password</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Password</em>' attribute.
* @see #setTransportJMSPassword(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSPassword()
* @model default=""
* @generated
*/
String getTransportJMSPassword();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPassword <em>Transport JMS Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Password</em>' attribute.
* @see #getTransportJMSPassword()
* @generated
*/
void setTransportJMSPassword(String value);
/**
* Returns the value of the '<em><b>Transport JMSJMS Spec Version</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMSJMS Spec Version</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMSJMS Spec Version</em>' attribute.
* @see #setTransportJMSJMSSpecVersion(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSJMSSpecVersion()
* @model default=""
* @generated
*/
String getTransportJMSJMSSpecVersion();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSJMSSpecVersion <em>Transport JMSJMS Spec Version</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMSJMS Spec Version</em>' attribute.
* @see #getTransportJMSJMSSpecVersion()
* @generated
*/
void setTransportJMSJMSSpecVersion(String value);
/**
* Returns the value of the '<em><b>Transport JMS Subscription Durable</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Subscription Durable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Subscription Durable</em>' attribute.
* @see #setTransportJMSSubscriptionDurable(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSSubscriptionDurable()
* @model default=""
* @generated
*/
String getTransportJMSSubscriptionDurable();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSSubscriptionDurable <em>Transport JMS Subscription Durable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Subscription Durable</em>' attribute.
* @see #getTransportJMSSubscriptionDurable()
* @generated
*/
void setTransportJMSSubscriptionDurable(String value);
/**
* Returns the value of the '<em><b>Transport JMS Durable Subscriber Client ID</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Durable Subscriber Client ID</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Durable Subscriber Client ID</em>' attribute.
* @see #setTransportJMSDurableSubscriberClientID(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSDurableSubscriberClientID()
* @model default=""
* @generated
*/
String getTransportJMSDurableSubscriberClientID();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDurableSubscriberClientID <em>Transport JMS Durable Subscriber Client ID</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Durable Subscriber Client ID</em>' attribute.
* @see #getTransportJMSDurableSubscriberClientID()
* @generated
*/
void setTransportJMSDurableSubscriberClientID(String value);
/**
* Returns the value of the '<em><b>Transport JMS Message Selector</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Message Selector</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Message Selector</em>' attribute.
* @see #setTransportJMSMessageSelector(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSMessageSelector()
* @model default=""
* @generated
*/
String getTransportJMSMessageSelector();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSMessageSelector <em>Transport JMS Message Selector</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Message Selector</em>' attribute.
* @see #getTransportJMSMessageSelector()
* @generated
*/
void setTransportJMSMessageSelector(String value);
/**
* Returns the value of the '<em><b>Transport JMS Retry Duration</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Retry Duration</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Retry Duration</em>' attribute.
* @see #setTransportJMSRetryDuration(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSRetryDuration()
* @model
* @generated
*/
String getTransportJMSRetryDuration();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSRetryDuration <em>Transport JMS Retry Duration</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Retry Duration</em>' attribute.
* @see #getTransportJMSRetryDuration()
* @generated
*/
void setTransportJMSRetryDuration(String value);
/**
* Returns the value of the '<em><b>Transport VFS Move Timestamp Format</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Move Timestamp Format</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Move Timestamp Format</em>' attribute.
* @see #setTransportVFSMoveTimestampFormat(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSMoveTimestampFormat()
* @model default=""
* @generated
*/
String getTransportVFSMoveTimestampFormat();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSMoveTimestampFormat <em>Transport VFS Move Timestamp Format</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Move Timestamp Format</em>' attribute.
* @see #getTransportVFSMoveTimestampFormat()
* @generated
*/
void setTransportVFSMoveTimestampFormat(String value);
/**
* Returns the value of the '<em><b>Transport VFS File Sort Attribute</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.VFSFileSort}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File Sort Attribute</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File Sort Attribute</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSFileSort
* @see #setTransportVFSFileSortAttribute(VFSFileSort)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileSortAttribute()
* @model
* @generated
*/
VFSFileSort getTransportVFSFileSortAttribute();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSFileSortAttribute <em>Transport VFS File Sort Attribute</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File Sort Attribute</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.VFSFileSort
* @see #getTransportVFSFileSortAttribute()
* @generated
*/
void setTransportVFSFileSortAttribute(VFSFileSort value);
/**
* Returns the value of the '<em><b>Transport VFS File Sort Ascending</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS File Sort Ascending</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS File Sort Ascending</em>' attribute.
* @see #setTransportVFSFileSortAscending(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSFileSortAscending()
* @model default="true"
* @generated
*/
boolean isTransportVFSFileSortAscending();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSFileSortAscending <em>Transport VFS File Sort Ascending</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS File Sort Ascending</em>' attribute.
* @see #isTransportVFSFileSortAscending()
* @generated
*/
void setTransportVFSFileSortAscending(boolean value);
/**
* Returns the value of the '<em><b>Transport VFS Sub Folder Timestamp Format</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Sub Folder Timestamp Format</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Sub Folder Timestamp Format</em>' attribute.
* @see #setTransportVFSSubFolderTimestampFormat(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSSubFolderTimestampFormat()
* @model default=""
* @generated
*/
String getTransportVFSSubFolderTimestampFormat();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportVFSSubFolderTimestampFormat <em>Transport VFS Sub Folder Timestamp Format</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Sub Folder Timestamp Format</em>' attribute.
* @see #getTransportVFSSubFolderTimestampFormat()
* @generated
*/
void setTransportVFSSubFolderTimestampFormat(String value);
/**
* Returns the value of the '<em><b>Transport VFS Create Folder</b></em>' attribute.
* The default value is <code>"true"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport VFS Create Folder</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport VFS Create Folder</em>' attribute.
* @see #setTransportVFSCreateFolder(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportVFSCreateFolder()
* @model default="true"
* @generated
*/
boolean isTransportVFSCreateFolder();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportVFSCreateFolder <em>Transport VFS Create Folder</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport VFS Create Folder</em>' attribute.
* @see #isTransportVFSCreateFolder()
* @generated
*/
void setTransportVFSCreateFolder(boolean value);
/**
* Returns the value of the '<em><b>Transport JMS Receive Timeout</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Receive Timeout</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Receive Timeout</em>' attribute.
* @see #setTransportJMSReceiveTimeout(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSReceiveTimeout()
* @model default=""
* @generated
*/
String getTransportJMSReceiveTimeout();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSReceiveTimeout <em>Transport JMS Receive Timeout</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Receive Timeout</em>' attribute.
* @see #getTransportJMSReceiveTimeout()
* @generated
*/
void setTransportJMSReceiveTimeout(String value);
/**
* Returns the value of the '<em><b>Transport JMS Content Type</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Content Type</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Content Type</em>' attribute.
* @see #setTransportJMSContentType(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSContentType()
* @model default=""
* @generated
*/
String getTransportJMSContentType();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSContentType <em>Transport JMS Content Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Content Type</em>' attribute.
* @see #getTransportJMSContentType()
* @generated
*/
void setTransportJMSContentType(String value);
/**
* Returns the value of the '<em><b>Transport JMS Content Type Property</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Content Type Property</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Content Type Property</em>' attribute.
* @see #setTransportJMSContentTypeProperty(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSContentTypeProperty()
* @model default=""
* @generated
*/
String getTransportJMSContentTypeProperty();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSContentTypeProperty <em>Transport JMS Content Type Property</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Content Type Property</em>' attribute.
* @see #getTransportJMSContentTypeProperty()
* @generated
*/
void setTransportJMSContentTypeProperty(String value);
/**
* Returns the value of the '<em><b>Transport JMS Reply Destination</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Reply Destination</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Reply Destination</em>' attribute.
* @see #setTransportJMSReplyDestination(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSReplyDestination()
* @model default=""
* @generated
*/
String getTransportJMSReplyDestination();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSReplyDestination <em>Transport JMS Reply Destination</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Reply Destination</em>' attribute.
* @see #getTransportJMSReplyDestination()
* @generated
*/
void setTransportJMSReplyDestination(String value);
/**
* Returns the value of the '<em><b>Transport JMS Pub Sub No Local</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Pub Sub No Local</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Pub Sub No Local</em>' attribute.
* @see #setTransportJMSPubSubNoLocal(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSPubSubNoLocal()
* @model default=""
* @generated
*/
String getTransportJMSPubSubNoLocal();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSPubSubNoLocal <em>Transport JMS Pub Sub No Local</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Pub Sub No Local</em>' attribute.
* @see #getTransportJMSPubSubNoLocal()
* @generated
*/
void setTransportJMSPubSubNoLocal(String value);
/**
* Returns the value of the '<em><b>Transport JMS Durable Subscriber Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport JMS Durable Subscriber Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport JMS Durable Subscriber Name</em>' attribute.
* @see #setTransportJMSDurableSubscriberName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportJMSDurableSubscriberName()
* @model
* @generated
*/
String getTransportJMSDurableSubscriberName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportJMSDurableSubscriberName <em>Transport JMS Durable Subscriber Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport JMS Durable Subscriber Name</em>' attribute.
* @see #getTransportJMSDurableSubscriberName()
* @generated
*/
void setTransportJMSDurableSubscriberName(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Connection Factory</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Connection Factory</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Connection Factory</em>' attribute.
* @see #setTransportMQTTConnectionFactory(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTConnectionFactory()
* @model default=""
* @generated
*/
String getTransportMQTTConnectionFactory();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTConnectionFactory <em>Transport MQTT Connection Factory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Connection Factory</em>' attribute.
* @see #getTransportMQTTConnectionFactory()
* @generated
*/
void setTransportMQTTConnectionFactory(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Server Host Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Server Host Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Server Host Name</em>' attribute.
* @see #setTransportMQTTServerHostName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTServerHostName()
* @model default=""
* @generated
*/
String getTransportMQTTServerHostName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTServerHostName <em>Transport MQTT Server Host Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Server Host Name</em>' attribute.
* @see #getTransportMQTTServerHostName()
* @generated
*/
void setTransportMQTTServerHostName(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Server Port</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Server Port</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Server Port</em>' attribute.
* @see #setTransportMQTTServerPort(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTServerPort()
* @model default=""
* @generated
*/
String getTransportMQTTServerPort();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTServerPort <em>Transport MQTT Server Port</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Server Port</em>' attribute.
* @see #getTransportMQTTServerPort()
* @generated
*/
void setTransportMQTTServerPort(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Topic Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Topic Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Topic Name</em>' attribute.
* @see #setTransportMQTTTopicName(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTTopicName()
* @model default=""
* @generated
*/
String getTransportMQTTTopicName();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTTopicName <em>Transport MQTT Topic Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Topic Name</em>' attribute.
* @see #getTransportMQTTTopicName()
* @generated
*/
void setTransportMQTTTopicName(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Subscription QOS</b></em>' attribute.
* The literals are from the enumeration {@link org.wso2.developerstudio.eclipse.gmf.esb.MQTTSubscriptionQOS}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Subscription QOS</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Subscription QOS</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.MQTTSubscriptionQOS
* @see #setTransportMQTTSubscriptionQOS(MQTTSubscriptionQOS)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTSubscriptionQOS()
* @model
* @generated
*/
MQTTSubscriptionQOS getTransportMQTTSubscriptionQOS();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionQOS <em>Transport MQTT Subscription QOS</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Subscription QOS</em>' attribute.
* @see org.wso2.developerstudio.eclipse.gmf.esb.MQTTSubscriptionQOS
* @see #getTransportMQTTSubscriptionQOS()
* @generated
*/
void setTransportMQTTSubscriptionQOS(MQTTSubscriptionQOS value);
/**
* Returns the value of the '<em><b>Transport MQTT Session Clean</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Session Clean</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Session Clean</em>' attribute.
* @see #setTransportMQTTSessionClean(boolean)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTSessionClean()
* @model
* @generated
*/
boolean isTransportMQTTSessionClean();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#isTransportMQTTSessionClean <em>Transport MQTT Session Clean</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Session Clean</em>' attribute.
* @see #isTransportMQTTSessionClean()
* @generated
*/
void setTransportMQTTSessionClean(boolean value);
/**
* Returns the value of the '<em><b>Transport MQTT Ssl Enable</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Ssl Enable</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Ssl Enable</em>' attribute.
* @see #setTransportMQTTSslEnable(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTSslEnable()
* @model default=""
* @generated
*/
String getTransportMQTTSslEnable();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSslEnable <em>Transport MQTT Ssl Enable</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Ssl Enable</em>' attribute.
* @see #getTransportMQTTSslEnable()
* @generated
*/
void setTransportMQTTSslEnable(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Temporary Store Directory</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Temporary Store Directory</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Temporary Store Directory</em>' attribute.
* @see #setTransportMQTTTemporaryStoreDirectory(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTTemporaryStoreDirectory()
* @model default=""
* @generated
*/
String getTransportMQTTTemporaryStoreDirectory();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTTemporaryStoreDirectory <em>Transport MQTT Temporary Store Directory</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Temporary Store Directory</em>' attribute.
* @see #getTransportMQTTTemporaryStoreDirectory()
* @generated
*/
void setTransportMQTTTemporaryStoreDirectory(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Subscription Username</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Subscription Username</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Subscription Username</em>' attribute.
* @see #setTransportMQTTSubscriptionUsername(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTSubscriptionUsername()
* @model default=""
* @generated
*/
String getTransportMQTTSubscriptionUsername();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionUsername <em>Transport MQTT Subscription Username</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Subscription Username</em>' attribute.
* @see #getTransportMQTTSubscriptionUsername()
* @generated
*/
void setTransportMQTTSubscriptionUsername(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Subscription Password</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Subscription Password</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Subscription Password</em>' attribute.
* @see #setTransportMQTTSubscriptionPassword(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTSubscriptionPassword()
* @model default=""
* @generated
*/
String getTransportMQTTSubscriptionPassword();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTSubscriptionPassword <em>Transport MQTT Subscription Password</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Subscription Password</em>' attribute.
* @see #getTransportMQTTSubscriptionPassword()
* @generated
*/
void setTransportMQTTSubscriptionPassword(String value);
/**
* Returns the value of the '<em><b>Transport MQTT Client Id</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Transport MQTT Client Id</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Transport MQTT Client Id</em>' attribute.
* @see #setTransportMQTTClientId(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_TransportMQTTClientId()
* @model default=""
* @generated
*/
String getTransportMQTTClientId();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTransportMQTTClientId <em>Transport MQTT Client Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transport MQTT Client Id</em>' attribute.
* @see #getTransportMQTTClientId()
* @generated
*/
void setTransportMQTTClientId(String value);
/**
* Returns the value of the '<em><b>Truststore</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Truststore</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Truststore</em>' attribute.
* @see #setTruststore(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Truststore()
* @model default=""
* @generated
*/
String getTruststore();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getTruststore <em>Truststore</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Truststore</em>' attribute.
* @see #getTruststore()
* @generated
*/
void setTruststore(String value);
/**
* Returns the value of the '<em><b>Keystore</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Keystore</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Keystore</em>' attribute.
* @see #setKeystore(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_Keystore()
* @model default=""
* @generated
*/
String getKeystore();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getKeystore <em>Keystore</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Keystore</em>' attribute.
* @see #getKeystore()
* @generated
*/
void setKeystore(String value);
/**
* Returns the value of the '<em><b>Ssl Verify Client</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ssl Verify Client</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ssl Verify Client</em>' attribute.
* @see #setSslVerifyClient(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SslVerifyClient()
* @model default=""
* @generated
*/
String getSslVerifyClient();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSslVerifyClient <em>Ssl Verify Client</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ssl Verify Client</em>' attribute.
* @see #getSslVerifyClient()
* @generated
*/
void setSslVerifyClient(String value);
/**
* Returns the value of the '<em><b>Ssl Protocol</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Ssl Protocol</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Ssl Protocol</em>' attribute.
* @see #setSslProtocol(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_SslProtocol()
* @model default=""
* @generated
*/
String getSslProtocol();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getSslProtocol <em>Ssl Protocol</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Ssl Protocol</em>' attribute.
* @see #getSslProtocol()
* @generated
*/
void setSslProtocol(String value);
/**
* Returns the value of the '<em><b>Https Protocols</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Https Protocols</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Https Protocols</em>' attribute.
* @see #setHttpsProtocols(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_HttpsProtocols()
* @model default=""
* @generated
*/
String getHttpsProtocols();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getHttpsProtocols <em>Https Protocols</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Https Protocols</em>' attribute.
* @see #getHttpsProtocols()
* @generated
*/
void setHttpsProtocols(String value);
/**
* Returns the value of the '<em><b>Certificate Revocation Verifier</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Certificate Revocation Verifier</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Certificate Revocation Verifier</em>' attribute.
* @see #setCertificateRevocationVerifier(String)
* @see org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage#getInboundEndpoint_CertificateRevocationVerifier()
* @model default=""
* @generated
*/
String getCertificateRevocationVerifier();
/**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpoint#getCertificateRevocationVerifier <em>Certificate Revocation Verifier</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Certificate Revocation Verifier</em>' attribute.
* @see #getCertificateRevocationVerifier()
* @generated
*/
void setCertificateRevocationVerifier(String value);
} // InboundEndpoint
| apache-2.0 |
zonnie/Coins | app/src/main/java/com/moneyifyapp/utils/AnimationUtils.java | 2749 | package com.moneyifyapp.utils;
import android.content.Context;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import com.moneyifyapp.R;
/**
* Created by Zonnie_Work on 17/07/2014.
*/
public class AnimationUtils
{
private static AlphaAnimation sAlphaDown;
private static AlphaAnimation sAlphaUp;
private static Animation mRotateAnimation;
/**
*/
public static AlphaAnimation getAlphaDownAnimation()
{
if(sAlphaDown == null)
{
sAlphaDown = new AlphaAnimation(1.0f, 0.3f);
sAlphaDown.setDuration(500);
sAlphaDown.setFillAfter(true);
}
return sAlphaDown;
}
/**
*/
public static AlphaAnimation getAlphaUpAnimation()
{
if(sAlphaUp == null)
{
sAlphaUp = new AlphaAnimation(0.3f, 1.0f);
sAlphaUp.setFillAfter(true);
sAlphaUp.setDuration(500);
}
return sAlphaUp;
}
/**
*/
public static Animation getBounceAnimtion(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.bounce);
}
public static Animation getZoomInBounceAnimation(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.zoom_in_bounce);
}
public static Animation getZoomInBounceLongAnimation(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.zoom_in_bounce_long);
}
public static Animation getZoomInBounceSmallAnimation(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.zoom_in_bounce_small);
}
public static Animation getFadeInAnimation(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.fade_in);
}
public static Animation getFadeOutAnimation(Context context)
{
return android.view.animation.AnimationUtils.loadAnimation(context, R.anim.fade_out);
}
public static Animation getmRotateAnimation()
{
if(mRotateAnimation == null)
{
mRotateAnimation = new RotateAnimation(0.0f, 360.0f,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
mRotateAnimation.setRepeatCount(Animation.INFINITE);
mRotateAnimation.setDuration(500);
mRotateAnimation.setInterpolator(new LinearInterpolator());
mRotateAnimation.setFillAfter(true);
}
return mRotateAnimation;
}
}
| apache-2.0 |
mesutcelik/hazelcast | hazelcast/src/main/java/com/hazelcast/client/impl/protocol/codec/CountDownLatchGetCountCodec.java | 4859 | /*
* Copyright (c) 2008-2020, 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.
*/
/**
* Returns the current count.
*/
@Generated("c1d791b9df7856ec1f9a3e3b69ba2ed4")
public final class CountDownLatchGetCountCodec {
//hex: 0x0B0400
public static final int REQUEST_MESSAGE_TYPE = 721920;
//hex: 0x0B0401
public static final int RESPONSE_MESSAGE_TYPE = 721921;
private static final int REQUEST_INITIAL_FRAME_SIZE = PARTITION_ID_FIELD_OFFSET + INT_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 + INT_SIZE_IN_BYTES;
private CountDownLatchGetCountCodec() {
}
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
public static class RequestParameters {
/**
* CP group id of this CountDownLatch instance
*/
public com.hazelcast.cp.internal.RaftGroupId groupId;
/**
* Name of the CountDownLatch instance
*/
public java.lang.String name;
}
public static ClientMessage encodeRequest(com.hazelcast.cp.internal.RaftGroupId groupId, java.lang.String name) {
ClientMessage clientMessage = ClientMessage.createForEncode();
clientMessage.setRetryable(true);
clientMessage.setOperationName("CountDownLatch.GetCount");
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);
clientMessage.add(initialFrame);
RaftGroupIdCodec.encode(clientMessage, groupId);
StringCodec.encode(clientMessage, name);
return clientMessage;
}
public static CountDownLatchGetCountCodec.RequestParameters decodeRequest(ClientMessage clientMessage) {
ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
RequestParameters request = new RequestParameters();
//empty initial frame
iterator.next();
request.groupId = RaftGroupIdCodec.decode(iterator);
request.name = StringCodec.decode(iterator);
return request;
}
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
public static class ResponseParameters {
/**
* The current count of this CountDownLatch instance
*/
public int response;
}
public static ClientMessage encodeResponse(int 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);
encodeInt(initialFrame.content, RESPONSE_RESPONSE_FIELD_OFFSET, response);
clientMessage.add(initialFrame);
return clientMessage;
}
public static CountDownLatchGetCountCodec.ResponseParameters decodeResponse(ClientMessage clientMessage) {
ClientMessage.ForwardFrameIterator iterator = clientMessage.frameIterator();
ResponseParameters response = new ResponseParameters();
ClientMessage.Frame initialFrame = iterator.next();
response.response = decodeInt(initialFrame.content, RESPONSE_RESPONSE_FIELD_OFFSET);
return response;
}
}
| apache-2.0 |
gmarchal/easymargining | Server/src/main/java/com/easymargining/replication/eurex/domain/model/EurexProductDefinitionParsedItem.java | 1123 | package com.easymargining.replication.eurex.domain.model;
import com.univocity.parsers.annotations.Parsed;
import lombok.*;
import java.io.Serializable;
/**
* Created by Gilles Marchal on 20/02/2016.
*/
@Getter
@Setter
@EqualsAndHashCode
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class EurexProductDefinitionParsedItem implements Serializable {
private static final long serialVersionUID = 1L;
@Parsed(field = "Eurex Code")
private String eurexCode;
@Parsed(field = "Type")
private String type;
@Parsed(field = "Product Name")
private String productName;
@Parsed(field = "Code & Link")
private String bbgCode;
@Parsed(field = "CUR")
private String currency;
@Parsed(field = "Product ISIN")
private String isinCode;
@Parsed(field = "Tick Size")
private String tickSize;
@Parsed(field = "Trad Unit")
private String tradUnit;
@Parsed(field = "Tick Value")
private String tickValue;
@Parsed(field = "Min Block Size")
private String minBlockSize;
@Parsed(field = "Settlement Type")
private String settlementType;
}
| apache-2.0 |
rssvihla/cassandra-commons | cassandra-commons-core/src/test/java/pro/foundev/cassandra/commons/core/properties/PropertyFinderTest.java | 2266 | /*
* Copyright 2015 Ryan Svihla
*
* 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 pro.foundev.cassandra.commons.core.properties;
import org.junit.Test;
import java.util.function.Function;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
*/
public class PropertyFinderTest {
private void assertPropertyIsReadable(String propertyName, Function<PropertyFinder, String> func){
String original = System.getProperty(propertyName);
try {
String changedValue = "my_changed_value";
System.setProperty(propertyName, changedValue);
PropertyFinder finder = new PropertyFinderImpl();
String property = func.apply(finder);
assertThat(property, is(changedValue));
}finally{
if(original!=null) {
System.setProperty(propertyName, original);
}else{
System.clearProperty(propertyName);
}
}
}
@Test
public void itReadsCassandraYaml(){
assertPropertyIsReadable("cassandraYaml", f->f.getCassandraYaml());
}
@Test
public void itReadsKeySpace(){
assertPropertyIsReadable("cassandra.keyspace",f->f.getKeyspace());
}
@Test
public void itReadsHosts(){
assertPropertyIsReadable("cassandra.hosts", f->f.getHosts());
}
@Test
public void itReadsPort(){
assertPropertyIsReadable("cassandra.port", f->f.getPort());
}
@Test
public void itReadsUsername(){
assertPropertyIsReadable("cassandra.username", f->f.getUsername());
}
@Test
public void itReadsPassword(){
assertPropertyIsReadable("cassandra.password", f->f.getPassword());
}
}
| apache-2.0 |
nafae/developer | modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201311/CreativeTemplateServiceInterfacegetCreativeTemplate.java | 1952 |
package com.google.api.ads.dfp.jaxws.v201311;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Returns the {@link CreativeTemplate} uniquely identified by the given ID.
*
* @param creativeTemplateId the ID of the creative template, which must already exist
* @return the {@code CreativeTemplate} uniquely identified by the given ID
*
*
* <p>Java class for getCreativeTemplate element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="getCreativeTemplate">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="creativeTemplateId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"creativeTemplateId"
})
@XmlRootElement(name = "getCreativeTemplate")
public class CreativeTemplateServiceInterfacegetCreativeTemplate {
protected Long creativeTemplateId;
/**
* Gets the value of the creativeTemplateId property.
*
* @return
* possible object is
* {@link Long }
*
*/
public Long getCreativeTemplateId() {
return creativeTemplateId;
}
/**
* Sets the value of the creativeTemplateId property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setCreativeTemplateId(Long value) {
this.creativeTemplateId = value;
}
}
| apache-2.0 |
anthcp/cdap | cdap-data-fabric/src/test/java/co/cask/cdap/data2/metadata/dataset/BusinessMetadataDatasetTest.java | 22229 | /*
* Copyright 2015 Cask Data, 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 co.cask.cdap.data2.metadata.dataset;
import co.cask.cdap.api.dataset.DatasetProperties;
import co.cask.cdap.data2.datafabric.dataset.DatasetsUtil;
import co.cask.cdap.data2.dataset2.DatasetFrameworkTestUtil;
import co.cask.cdap.proto.Id;
import co.cask.cdap.proto.ProgramType;
import co.cask.cdap.proto.metadata.MetadataRecord;
import co.cask.cdap.proto.metadata.MetadataSearchTargetType;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* Test class for {@link BusinessMetadataDataset} class.
*/
public class BusinessMetadataDatasetTest {
@ClassRule
public static DatasetFrameworkTestUtil dsFrameworkUtil = new DatasetFrameworkTestUtil();
private static final Id.DatasetInstance datasetInstance =
Id.DatasetInstance.from(DatasetFrameworkTestUtil.NAMESPACE_ID, "meta");
private BusinessMetadataDataset dataset;
private final Id.Application app1 = Id.Application.from("ns1", "app1");
// Have to use Id.Program for comparison here because the BusinessMetadataDataset APIs return Id.Program.
private final Id.Program flow1 = Id.Program.from("ns1", "app1", ProgramType.FLOW, "flow1");
private final Id.DatasetInstance dataset1 = Id.DatasetInstance.from("ns1", "ds1");
private final Id.Stream stream1 = Id.Stream.from("ns1", "s1");
@Before
public void before() throws Exception {
dataset = getDataset(datasetInstance);
}
@After
public void after() throws Exception {
dataset = null;
}
@Test
public void testProperties() throws Exception {
Assert.assertEquals(0, dataset.getProperties(app1).size());
Assert.assertEquals(0, dataset.getProperties(flow1).size());
Assert.assertEquals(0, dataset.getProperties(dataset1).size());
Assert.assertEquals(0, dataset.getProperties(stream1).size());
// Set some properties
dataset.setProperty(app1, "akey1", "avalue1");
dataset.setProperty(flow1, "fkey1", "fvalue1");
dataset.setProperty(flow1, "fK", "fV");
dataset.setProperty(dataset1, "dkey1", "dvalue1");
dataset.setProperty(stream1, "skey1", "svalue1");
dataset.setProperty(stream1, "skey2", "svalue2");
// verify
Map<String, String> properties = dataset.getProperties(app1);
Assert.assertEquals(ImmutableMap.of("akey1", "avalue1"), properties);
dataset.removeProperties(app1, "akey1");
Assert.assertNull(dataset.getProperty(app1, "akey1"));
BusinessMetadataRecord result = dataset.getProperty(flow1, "fkey1");
BusinessMetadataRecord expected = new BusinessMetadataRecord(flow1, "fkey1", "fvalue1");
Assert.assertEquals(expected, result);
Assert.assertEquals(ImmutableMap.of("fkey1", "fvalue1", "fK", "fV"), dataset.getProperties(flow1));
dataset.removeProperties(flow1, "fkey1");
properties = dataset.getProperties(flow1);
Assert.assertEquals(1, properties.size());
Assert.assertEquals("fV", properties.get("fK"));
dataset.removeProperties(flow1);
Assert.assertEquals(0, dataset.getProperties(flow1).size());
expected = new BusinessMetadataRecord(dataset1, "dkey1", "dvalue1");
Assert.assertEquals(expected, dataset.getProperty(dataset1, "dkey1"));
Assert.assertEquals(ImmutableMap.of("skey1", "svalue1", "skey2", "svalue2"), dataset.getProperties(stream1));
// reset a property
dataset.setProperty(stream1, "skey1", "sv1");
Assert.assertEquals(ImmutableMap.of("skey1", "sv1", "skey2", "svalue2"), dataset.getProperties(stream1));
// cleanup
dataset.removeProperties(app1);
dataset.removeProperties(flow1);
dataset.removeProperties(dataset1);
dataset.removeProperties(stream1);
Assert.assertEquals(0, dataset.getProperties(app1).size());
Assert.assertEquals(0, dataset.getProperties(flow1).size());
Assert.assertEquals(0, dataset.getProperties(dataset1).size());
Assert.assertEquals(0, dataset.getProperties(stream1).size());
}
@Test
public void testTags() {
Assert.assertEquals(0, dataset.getTags(app1).size());
Assert.assertEquals(0, dataset.getTags(flow1).size());
Assert.assertEquals(0, dataset.getTags(dataset1).size());
Assert.assertEquals(0, dataset.getTags(stream1).size());
dataset.addTags(app1, "tag1", "tag2", "tag3");
dataset.addTags(flow1, "tag1");
dataset.addTags(dataset1, "tag3", "tag2");
dataset.addTags(stream1, "tag2");
Set<String> tags = dataset.getTags(app1);
Assert.assertEquals(3, tags.size());
Assert.assertTrue(tags.contains("tag1"));
Assert.assertTrue(tags.contains("tag2"));
Assert.assertTrue(tags.contains("tag3"));
// add the same tag again
dataset.addTags(app1, "tag1");
Assert.assertEquals(3, dataset.getTags(app1).size());
tags = dataset.getTags(flow1);
Assert.assertEquals(1, tags.size());
Assert.assertTrue(tags.contains("tag1"));
tags = dataset.getTags(dataset1);
Assert.assertEquals(2, tags.size());
Assert.assertTrue(tags.contains("tag3"));
Assert.assertTrue(tags.contains("tag2"));
tags = dataset.getTags(stream1);
Assert.assertEquals(1, tags.size());
Assert.assertTrue(tags.contains("tag2"));
dataset.removeTags(app1, "tag1", "tag2");
tags = dataset.getTags(app1);
Assert.assertEquals(1, tags.size());
Assert.assertTrue(tags.contains("tag3"));
dataset.removeTags(dataset1, "tag3");
tags = dataset.getTags(dataset1);
Assert.assertEquals(1, tags.size());
Assert.assertTrue(tags.contains("tag2"));
// cleanup
dataset.removeTags(app1);
dataset.removeTags(flow1);
dataset.removeTags(dataset1);
dataset.removeTags(stream1);
Assert.assertEquals(0, dataset.getTags(app1).size());
Assert.assertEquals(0, dataset.getTags(flow1).size());
Assert.assertEquals(0, dataset.getTags(dataset1).size());
Assert.assertEquals(0, dataset.getTags(stream1).size());
}
@Test
public void testSearchOnTags() throws Exception {
Assert.assertEquals(0, dataset.getTags(app1).size());
Assert.assertEquals(0, dataset.getTags(flow1).size());
Assert.assertEquals(0, dataset.getTags(dataset1).size());
Assert.assertEquals(0, dataset.getTags(stream1).size());
dataset.addTags(app1, "tag1", "tag2", "tag3");
dataset.addTags(flow1, "tag1");
dataset.addTags(dataset1, "tag3", "tag2", "tag12");
dataset.addTags(stream1, "tag2, tag4");
// Try to search on all tags
List<BusinessMetadataRecord> results =
dataset.findBusinessMetadataOnKeyValue("ns1", "tags:*", MetadataSearchTargetType.ALL);
Assert.assertEquals(4, results.size());
// Try to search for tag1*
results = dataset.findBusinessMetadataOnKeyValue("ns1", "tags:tag1*", MetadataSearchTargetType.ALL);
Assert.assertEquals(3, results.size());
// Try to search for tag1
results = dataset.findBusinessMetadataOnKeyValue("ns1", "tags:tag1", MetadataSearchTargetType.ALL);
Assert.assertEquals(2, results.size());
// Try to search for tag4
results = dataset.findBusinessMetadataOnKeyValue("ns1", "tags:tag4", MetadataSearchTargetType.ALL);
Assert.assertEquals(1, results.size());
// cleanup
dataset.removeTags(app1);
dataset.removeTags(flow1);
dataset.removeTags(dataset1);
dataset.removeTags(stream1);
Assert.assertEquals(0, dataset.getTags(app1).size());
Assert.assertEquals(0, dataset.getTags(flow1).size());
Assert.assertEquals(0, dataset.getTags(dataset1).size());
Assert.assertEquals(0, dataset.getTags(stream1).size());
}
@Test
public void testSearchOnValue() throws Exception {
// Create record
BusinessMetadataRecord record = new BusinessMetadataRecord(flow1, "key1", "value1");
// Save it
dataset.setProperty(flow1, "key1", "value1");
// Save it
dataset.setProperty(flow1, "key2", "value2");
// Search for it based on value
List<BusinessMetadataRecord> results =
dataset.findBusinessMetadataOnValue("ns1", "value1", MetadataSearchTargetType.PROGRAM);
// Assert check
Assert.assertEquals(1, results.size());
BusinessMetadataRecord result = results.get(0);
Assert.assertEquals(record, result);
// Case insensitive
results = dataset.findBusinessMetadataOnValue("ns1", "ValUe1", MetadataSearchTargetType.PROGRAM);
// Assert check
Assert.assertEquals(1, results.size());
result = results.get(0);
Assert.assertEquals(record, result);
// Save it
dataset.setProperty(flow1, "key3", "value1");
// Search for it based on value
List<BusinessMetadataRecord> results2 =
dataset.findBusinessMetadataOnValue("ns1", "value1", MetadataSearchTargetType.PROGRAM);
// Assert check
Assert.assertEquals(2, results2.size());
for (BusinessMetadataRecord result2 : results2) {
Assert.assertEquals("value1", result2.getValue());
}
// Save it
dataset.setProperty(stream1, "key21", "value21");
// Search for it based on value asterix
List<BusinessMetadataRecord> results3 = dataset.findBusinessMetadataOnValue("ns1", "value2*",
MetadataSearchTargetType.ALL);
// Assert check
Assert.assertEquals(2, results3.size());
for (BusinessMetadataRecord result3 : results3) {
Assert.assertTrue(result3.getValue().startsWith("value2"));
}
// Search for it based on value asterix
List<BusinessMetadataRecord> results4 = dataset.findBusinessMetadataOnValue("ns12", "value2*",
MetadataSearchTargetType.ALL);
// Assert check
Assert.assertEquals(0, results4.size());
}
@Test
public void testSearchOnKeyValue() throws Exception {
// Create record
BusinessMetadataRecord record = new BusinessMetadataRecord(flow1, "key1", "value1");
// Save it
dataset.setProperty(flow1, "key1", "value1");
// Save it
dataset.setProperty(flow1, "key2", "value2");
// Search for it based on value
List<BusinessMetadataRecord> results =
dataset.findBusinessMetadataOnKeyValue("ns1", "key1" + BusinessMetadataDataset.KEYVALUE_SEPARATOR + "value1",
MetadataSearchTargetType.PROGRAM);
// Assert check
Assert.assertEquals(1, results.size());
BusinessMetadataRecord result = results.get(0);
Assert.assertEquals(record, result);
// Test wrong ns
List<BusinessMetadataRecord> results2 =
dataset.findBusinessMetadataOnKeyValue("ns12", "key1" + BusinessMetadataDataset.KEYVALUE_SEPARATOR + "value1",
MetadataSearchTargetType.PROGRAM);
// Assert check
Assert.assertEquals(0, results2.size());
}
@Test
public void testHistory() throws Exception {
BusinessMetadataDataset dataset =
getDataset(Id.DatasetInstance.from(DatasetFrameworkTestUtil.NAMESPACE_ID, "testHistory"));
doTestHistory(dataset, flow1, "f_");
doTestHistory(dataset, app1, "a_");
doTestHistory(dataset, dataset1, "d_");
doTestHistory(dataset, stream1, "s_");
}
private void doTestHistory(BusinessMetadataDataset dataset, Id.NamespacedId targetId, String prefix)
throws Exception {
// Metadata change history keyed by time in millis the change was made
Map<Long, MetadataRecord> expected = new HashMap<>();
// No history for targetId at the beginning
MetadataRecord completeRecord = new MetadataRecord(targetId);
expected.put(System.currentTimeMillis(), completeRecord);
// Get history for targetId, should be empty
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis()));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
// Since the key to expected map is time in millis, sleep for a millisecond to make sure the key is distinct
TimeUnit.MILLISECONDS.sleep(1);
// Add first record
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k1", "v1"), toTags(prefix, "t1", "t2"));
addMetadataRecord(dataset, completeRecord);
long time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Since this is the first record, history should be the same as what was added.
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Add a new property and a tag
dataset.setProperty(targetId, prefix + "k2", "v2");
dataset.addTags(targetId, prefix + "t3");
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k1", "v1", "k2", "v2"),
toTags(prefix, "t1", "t2", "t3"));
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Add another property and a tag
dataset.setProperty(targetId, prefix + "k3", "v3");
dataset.addTags(targetId, prefix + "t4");
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k1", "v1", "k2", "v2", "k3", "v3"),
toTags(prefix, "t1", "t2", "t3", "t4"));
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Add the same property and tag as second time
dataset.setProperty(targetId, prefix + "k2", "v2");
dataset.addTags(targetId, prefix + "t3");
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k1", "v1", "k2", "v2", "k3", "v3"),
toTags(prefix, "t1", "t2", "t3", "t4"));
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Remove a property and two tags
dataset.removeProperties(targetId, prefix + "k2");
dataset.removeTags(targetId, prefix + "t4");
dataset.removeTags(targetId, prefix + "t2");
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k1", "v1", "k3", "v3"),
toTags(prefix, "t1", "t3"));
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Remove all properties and all tags
dataset.removeProperties(targetId);
dataset.removeTags(targetId);
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId);
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Add one more property and a tag
dataset.setProperty(targetId, prefix + "k2", "v2");
dataset.addTags(targetId, prefix + "t2");
// Save the complete metadata record at this point
completeRecord = new MetadataRecord(targetId, toProps(prefix, "k2", "v2"),
toTags(prefix, "t2"));
time = System.currentTimeMillis();
expected.put(time, completeRecord);
// Assert the history record with the change
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), time));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
TimeUnit.MILLISECONDS.sleep(1);
// Now assert all history
for (Map.Entry<Long, MetadataRecord> entry : expected.entrySet()) {
Assert.assertEquals(entry.getValue(),
getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), entry.getKey())));
}
// Asserting for current time should give the latest record
Assert.assertEquals(ImmutableSet.of(completeRecord),
dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis()));
// Also, the metadata itself should be equal to the last recorded snapshot
Assert.assertEquals(getFirst(dataset.getSnapshotBeforeTime(ImmutableSet.of(targetId), System.currentTimeMillis())),
new MetadataRecord(targetId, dataset.getProperties(targetId), dataset.getTags(targetId)));
}
private void addMetadataRecord(BusinessMetadataDataset dataset, MetadataRecord record) {
for (Map.Entry<String, String> entry : record.getProperties().entrySet()) {
dataset.setProperty(record.getEntityId(), entry.getKey(), entry.getValue());
}
//noinspection ToArrayCallWithZeroLengthArrayArgument
dataset.addTags(record.getEntityId(), record.getTags().toArray(new String[0]));
}
private Map<String, String> toProps(String prefix, String k1, String v1) {
return ImmutableMap.of(prefix + k1, v1);
}
private Map<String, String> toProps(String prefix, String k1, String v1, String k2, String v2) {
return ImmutableMap.of(prefix + k1, v1, prefix + k2, v2);
}
private Map<String, String> toProps(String prefix, String k1, String v1, String k2, String v2, String k3, String v3) {
return ImmutableMap.of(prefix + k1, v1, prefix + k2, v2, prefix + k3, v3);
}
private Set<String> toTags(String prefix, String... tags) {
ImmutableSet.Builder<String> builder = new ImmutableSet.Builder<>();
for (String tag : tags) {
builder.add(prefix + tag);
}
return builder.build();
}
private <T> T getFirst(Iterable<T> iterable) {
Assert.assertEquals(1, Iterables.size(iterable));
return iterable.iterator().next();
}
private static BusinessMetadataDataset getDataset(Id.DatasetInstance instance) throws Exception {
return DatasetsUtil.getOrCreateDataset(dsFrameworkUtil.getFramework(), instance,
BusinessMetadataDataset.class.getName(),
DatasetProperties.EMPTY, null, null);
}
}
| apache-2.0 |
aleksandr-m/strutsclipse | strutsclipse-test/src/com/amashchenko/eclipse/strutsclipse/taglib/StrutsTaglibParserTest.java | 5075 | /*
* Copyright 2015-2018 Aleksandr Mashchenko.
*
* 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.amashchenko.eclipse.strutsclipse.taglib;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.junit.Assert;
import org.junit.Test;
import com.amashchenko.eclipse.strutsclipse.xmlparser.TagRegion;
public class StrutsTaglibParserTest {
private StrutsTaglibParser strutsTaglibParser = new StrutsTaglibParser();
@Test
public void testGetGetTextRegionSingleQuotes() throws Exception {
final String content = "<s:property value=\"getText('')\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("')"));
Assert.assertNotNull(tagRegion);
Assert.assertNotNull(tagRegion.getCurrentElement());
Assert.assertEquals("", tagRegion.getCurrentElement().getValue());
Assert.assertEquals("", tagRegion.getCurrentElementValuePrefix());
Assert.assertNotNull(tagRegion.getCurrentElement().getValueRegion());
Assert.assertEquals(28, tagRegion.getCurrentElement().getValueRegion()
.getOffset());
Assert.assertEquals(0, tagRegion.getCurrentElement().getValueRegion()
.getLength());
}
@Test
public void testGetGetTextRegionDoubleQuotes() throws Exception {
final String content = "<s:property value='getText(\"\")'/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("\")"));
Assert.assertNotNull(tagRegion);
Assert.assertNotNull(tagRegion.getCurrentElement());
Assert.assertEquals("", tagRegion.getCurrentElement().getValue());
Assert.assertEquals("", tagRegion.getCurrentElementValuePrefix());
Assert.assertNotNull(tagRegion.getCurrentElement().getValueRegion());
Assert.assertEquals(28, tagRegion.getCurrentElement().getValueRegion()
.getOffset());
Assert.assertEquals(0, tagRegion.getCurrentElement().getValueRegion()
.getLength());
}
@Test
public void testGetGetTextRegionEscapedQuotes() throws Exception {
final String content = "<s:property value=\"getText(\\\"\\\")\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("\")"));
Assert.assertNotNull(tagRegion);
Assert.assertNotNull(tagRegion.getCurrentElement());
Assert.assertEquals("", tagRegion.getCurrentElement().getValue());
Assert.assertEquals("", tagRegion.getCurrentElementValuePrefix());
Assert.assertNotNull(tagRegion.getCurrentElement().getValueRegion());
Assert.assertEquals(29, tagRegion.getCurrentElement().getValueRegion()
.getOffset());
Assert.assertEquals(0, tagRegion.getCurrentElement().getValueRegion()
.getLength());
}
@Test
public void testGetGetTextRegionText() throws Exception {
final String text = "test";
final String content = "<s:property value=\"getText('" + text
+ "')\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("st')"));
Assert.assertNotNull(tagRegion);
Assert.assertNotNull(tagRegion.getCurrentElement());
Assert.assertEquals(text, tagRegion.getCurrentElement().getValue());
Assert.assertEquals("te", tagRegion.getCurrentElementValuePrefix());
Assert.assertNotNull(tagRegion.getCurrentElement().getValueRegion());
Assert.assertEquals(28, tagRegion.getCurrentElement().getValueRegion()
.getOffset());
Assert.assertEquals(text.length(), tagRegion.getCurrentElement()
.getValueRegion().getLength());
}
@Test
public void testGetGetTextRegionOutOfRegion() throws Exception {
final String content = "<s:property value=\"getText('')\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("getText"));
Assert.assertNull(tagRegion);
}
@Test
public void testGetGetTextRegionOutOfRegion2() throws Exception {
final String content = "<s:property value=\"getText('')\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("\"/"));
Assert.assertNull(tagRegion);
}
@Test
public void testGetGetTextRegion() throws Exception {
final String content = "<s:property value=\"\"/>";
IDocument document = new Document(content);
TagRegion tagRegion = strutsTaglibParser.getGetTextRegion(document,
content.indexOf("\"") + 1);
Assert.assertNull(tagRegion);
}
}
| apache-2.0 |
EsupPortail/esup-catapp-srv | src/main/java/org/esupportail/catappsrvs/services/ldap/LdapSrv.java | 1487 | package org.esupportail.catappsrvs.services.ldap;
import com.unboundid.ldap.sdk.*;
import fj.data.Either;
import fj.data.List;
import lombok.Value;
import org.esupportail.catappsrvs.model.User;
import static fj.data.Array.array;
import static fj.data.Either.iif;
import static fj.data.Either.left;
import static fj.data.List.iterableList;
import static org.esupportail.catappsrvs.model.CommonTypes.LdapGroup;
@Value(staticConstructor = "of")
public class LdapSrv implements ILdap {
String baseDn;
String searchAttribute;
LDAPInterface ldap;
@Override
public Either<Exception, List<LdapGroup>> getGroups(final User user) {
final Filter uidFilter = Filter.createEqualityFilter("uid", user.uid().value());
try {
final SearchRequest request =
new SearchRequest(baseDn, SearchScope.ONE, uidFilter, searchAttribute);
final java.util.List<SearchResultEntry> results =
ldap.search(request).getSearchEntries();
return iif(!results.isEmpty(),
() -> iterableList(results.get(0).getAttributes())
.bind(attribute -> array(attribute.getValues())
.map(LdapGroup::of)
.toList()),
() -> new Exception("Aucune entrée dans le ldap ne correspond à " + user));
} catch (LDAPException e) {
return left((Exception) e);
}
}
}
| apache-2.0 |
vjanmey/EpicMudfia | com/planet_ink/miniweb/interfaces/SimpleServlet.java | 1150 | package com.planet_ink.miniweb.interfaces;
import com.planet_ink.miniweb.http.HTTPMethod;
/*
Copyright 2012-2014 Bo Zimmerman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
* This is the basic interface that "simple servlets" are provided,
* providing access to the request data and an interface to control
* the server response.
*/
public interface SimpleServlet
{
public void init();
public void doGet(SimpleServletRequest request, SimpleServletResponse response);
public void doPost(SimpleServletRequest request, SimpleServletResponse response);
public void service(HTTPMethod method, SimpleServletRequest request, SimpleServletResponse response);
}
| apache-2.0 |
yesil/jackrabbit-oak | oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/file/FileStore.java | 51876 | /*
* 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.jackrabbit.oak.segment.file;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Lists.newArrayListWithCapacity;
import static com.google.common.collect.Lists.newLinkedList;
import static com.google.common.collect.Maps.newLinkedHashMap;
import static com.google.common.collect.Sets.newHashSet;
import static java.lang.Integer.getInteger;
import static java.lang.String.format;
import static java.lang.System.currentTimeMillis;
import static java.lang.Thread.currentThread;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.MINUTES;
import static java.util.concurrent.TimeUnit.SECONDS;
import static org.apache.jackrabbit.oak.commons.IOUtils.humanReadableByteCount;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
import static org.apache.jackrabbit.oak.segment.SegmentId.isDataSegmentId;
import static org.apache.jackrabbit.oak.segment.SegmentWriterBuilder.segmentWriterBuilder;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.CLEANUP;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.COMPACTION;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.COMPACTION_FORCE_COMPACT;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.COMPACTION_RETRY;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.ESTIMATION;
import static org.apache.jackrabbit.oak.segment.compaction.SegmentGCStatus.IDLE;
import static org.apache.jackrabbit.oak.segment.file.TarRevisions.EXPEDITE_OPTION;
import static org.apache.jackrabbit.oak.segment.file.TarRevisions.timeout;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Closer;
import org.apache.jackrabbit.oak.api.jmx.CacheStatsMBean;
import org.apache.jackrabbit.oak.plugins.blob.ReferenceCollector;
import org.apache.jackrabbit.oak.segment.Compactor;
import org.apache.jackrabbit.oak.segment.RecordId;
import org.apache.jackrabbit.oak.segment.Segment;
import org.apache.jackrabbit.oak.segment.SegmentId;
import org.apache.jackrabbit.oak.segment.SegmentIdTable;
import org.apache.jackrabbit.oak.segment.SegmentNodeState;
import org.apache.jackrabbit.oak.segment.SegmentNotFoundException;
import org.apache.jackrabbit.oak.segment.SegmentNotFoundExceptionListener;
import org.apache.jackrabbit.oak.segment.SegmentWriter;
import org.apache.jackrabbit.oak.segment.WriterCacheManager;
import org.apache.jackrabbit.oak.segment.compaction.SegmentGCOptions;
import org.apache.jackrabbit.oak.segment.file.GCJournal.GCJournalEntry;
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The storage implementation for tar files.
*/
public class FileStore extends AbstractFileStore {
private static final Logger log = LoggerFactory.getLogger(FileStore.class);
/**
* Minimal interval in milli seconds between subsequent garbage collection cycles.
* Garbage collection invoked via {@link #gc()} will be skipped unless at least
* the specified time has passed since its last successful invocation.
*/
private static final long GC_BACKOFF = getInteger("oak.gc.backoff", 10*3600*1000);
private static final int MB = 1024 * 1024;
static final String LOCK_FILE_NAME = "repo.lock";
/**
* GC counter for logging purposes
*/
private static final AtomicLong GC_COUNT = new AtomicLong(0);
@Nonnull
private final SegmentWriter segmentWriter;
private final int maxFileSize;
@Nonnull
private final GarbageCollector garbageCollector;
private volatile List<TarReader> readers;
private volatile TarWriter tarWriter;
private final RandomAccessFile lockFile;
private final FileLock lock;
private TarRevisions revisions;
/**
* Scheduler for running <em>short</em> background operations
*/
private final Scheduler fileStoreScheduler = new Scheduler("FileStore background tasks");
/**
* List of old tar file generations that are waiting to be removed. They can
* not be removed immediately, because they first need to be closed, and the
* JVM needs to release the memory mapped file references.
*/
private final FileReaper fileReaper = new FileReaper();
/**
* This flag is periodically updated by calling the {@code SegmentGCOptions}
* at regular intervals.
*/
private final AtomicBoolean sufficientDiskSpace = new AtomicBoolean(true);
/**
* This flag is raised whenever the available memory falls under a specified
* threshold. See {@link GCMemoryBarrier}
*/
private final AtomicBoolean sufficientMemory = new AtomicBoolean(true);
/**
* Flag signalling shutdown of the file store
*/
private volatile boolean shutdown;
private final ReadWriteLock fileStoreLock = new ReentrantReadWriteLock();
private final FileStoreStats stats;
@Nonnull
private final SegmentNotFoundExceptionListener snfeListener;
FileStore(final FileStoreBuilder builder) throws InvalidFileStoreVersionException, IOException {
super(builder);
lockFile = new RandomAccessFile(new File(directory, LOCK_FILE_NAME), "rw");
try {
lock = lockFile.getChannel().lock();
} catch (OverlappingFileLockException ex) {
throw new IllegalStateException(directory.getAbsolutePath()
+ " is in use by another store.", ex);
}
this.segmentWriter = segmentWriterBuilder("sys")
.withGeneration(new Supplier<Integer>() {
@Override
public Integer get() {
return getGcGeneration();
}
})
.withWriterPool()
.with(builder.getCacheManager())
.build(this);
this.maxFileSize = builder.getMaxFileSize() * MB;
this.garbageCollector = new GarbageCollector(
builder.getGcOptions(), builder.getGcListener(), new GCJournal(directory), builder.getCacheManager());
Map<Integer, Map<Character, File>> map = collectFiles(directory);
Manifest manifest = Manifest.empty();
if (!map.isEmpty()) {
manifest = checkManifest(openManifest());
}
saveManifest(manifest);
this.readers = newArrayListWithCapacity(map.size());
Integer[] indices = map.keySet().toArray(new Integer[map.size()]);
Arrays.sort(indices);
for (int i = indices.length - 1; i >= 0; i--) {
readers.add(TarReader.open(map.get(indices[i]), memoryMapping, recovery));
}
this.stats = new FileStoreStats(builder.getStatsProvider(), this, size());
int writeNumber = 0;
if (indices.length > 0) {
writeNumber = indices[indices.length - 1] + 1;
}
this.tarWriter = new TarWriter(directory, stats, writeNumber);
this.snfeListener = builder.getSnfeListener();
fileStoreScheduler.scheduleAtFixedRate(
format("TarMK flush [%s]", directory), 5, SECONDS,
new Runnable() {
@Override
public void run() {
if (shutdown) {
return;
}
try {
flush();
} catch (IOException e) {
log.warn("Failed to flush the TarMK at {}",
directory, e);
}
}
});
fileStoreScheduler.scheduleAtFixedRate(
format("TarMK filer reaper [%s]", directory), 5, SECONDS,
new Runnable() {
@Override
public void run() {
fileReaper.reap();
}
});
fileStoreScheduler.scheduleAtFixedRate(
format("TarMK disk space check [%s]", directory), 1, MINUTES,
new Runnable() {
final SegmentGCOptions gcOptions = builder.getGcOptions();
@Override
public void run() {
checkDiskSpace(gcOptions);
}
});
log.info("TarMK opened: {} (mmap={})", directory, memoryMapping);
log.debug("TarMK readers {}", this.readers);
}
FileStore bind(TarRevisions revisions) throws IOException {
this.revisions = revisions;
this.revisions.bind(this, initialNode());
return this;
}
private void saveManifest(Manifest manifest) throws IOException {
manifest.setStoreVersion(CURRENT_STORE_VERSION);
manifest.save(getManifestFile());
}
@Nonnull
private Supplier<RecordId> initialNode() {
return new Supplier<RecordId>() {
@Override
public RecordId get() {
try {
SegmentWriter writer = segmentWriterBuilder("init").build(FileStore.this);
NodeBuilder builder = EMPTY_NODE.builder();
builder.setChildNode("root", EMPTY_NODE);
SegmentNodeState node = writer.writeNode(builder.getNodeState());
writer.flush();
return node.getRecordId();
} catch (IOException e) {
String msg = "Failed to write initial node";
log.error(msg, e);
throw new IllegalStateException(msg, e);
}
}
};
}
private int getGcGeneration() {
return revisions.getHead().getSegmentId().getGcGeneration();
}
@CheckForNull
public CacheStatsMBean getStringDeduplicationCacheStats() {
return segmentWriter.getStringCacheStats();
}
@CheckForNull
public CacheStatsMBean getTemplateDeduplicationCacheStats() {
return segmentWriter.getTemplateCacheStats();
}
@CheckForNull
public CacheStatsMBean getNodeDeduplicationCacheStats() {
return segmentWriter.getNodeCacheStats();
}
/**
* @return a runnable for running garbage collection
*/
public Runnable getGCRunner() {
return new SafeRunnable(format("TarMK revision gc [%s]", directory), new Runnable() {
@Override
public void run() {
try {
gc();
} catch (IOException e) {
log.error("Error running revision garbage collection", e);
}
}
});
}
/**
* @return the size of this store. This method shouldn't be called from
* a very tight loop as it contents with the {@link #fileStoreLock}.
*/
private long size() {
List<TarReader> readersSnapshot;
long writeFileSnapshotSize;
fileStoreLock.readLock().lock();
try {
readersSnapshot = ImmutableList.copyOf(readers);
writeFileSnapshotSize = tarWriter != null ? tarWriter.fileLength() : 0;
} finally {
fileStoreLock.readLock().unlock();
}
long size = writeFileSnapshotSize;
for (TarReader reader : readersSnapshot) {
size += reader.size();
}
return size;
}
public int readerCount(){
fileStoreLock.readLock().lock();
try {
return readers.size();
} finally {
fileStoreLock.readLock().unlock();
}
}
public FileStoreStats getStats() {
return stats;
}
public void flush() throws IOException {
if (revisions == null) {
return;
}
revisions.flush(new Callable<Void>() {
@Override
public Void call() throws Exception {
segmentWriter.flush();
tarWriter.flush();
stats.flushed();
return null;
}
});
}
/**
* Run garbage collection: estimation, compaction, cleanup
* @throws IOException
*/
public void gc() throws IOException {
garbageCollector.run();
}
/**
* Run the compaction gain estimation process.
* @return
*/
public GCEstimation estimateCompactionGain() {
return garbageCollector.estimateCompactionGain(Suppliers.ofInstance(false));
}
/**
* Copy every referenced record in data (non-bulk) segments. Bulk segments
* are fully kept (they are only removed in cleanup, if there is no
* reference to them).
* @return {@code true} on success, {@code false} otherwise.
*/
public boolean compact() {
return garbageCollector.compact() > 0;
}
/**
* Run garbage collection on the segment level: reclaim those data segments
* that are from an old segment generation and those bulk segments that are not
* reachable anymore.
* Those tar files that shrink by at least 25% are rewritten to a new tar generation
* skipping the reclaimed segments.
*/
public void cleanup() throws IOException {
garbageCollector.cleanup();
}
/**
* Finds all external blob references that are currently accessible
* in this repository and adds them to the given collector. Useful
* for collecting garbage in an external data store.
* <p>
* Note that this method only collects blob references that are already
* stored in the repository (at the time when this method is called), so
* the garbage collector will need some other mechanism for tracking
* in-memory references and references stored while this method is
* running.
* @param collector reference collector called back for each blob reference found
*/
public void collectBlobReferences(ReferenceCollector collector) throws IOException {
garbageCollector.collectBlobReferences(collector);
}
/**
* Cancel a running revision garbage collection compaction process as soon as possible.
* Does nothing if gc is not running.
*/
public void cancelGC() {
garbageCollector.cancel();
}
@Override
@Nonnull
public SegmentWriter getWriter() {
return segmentWriter;
}
@Override
@Nonnull
public TarRevisions getRevisions() {
return revisions;
}
@Override
public void close() {
// Flag the store as shutting / shut down
shutdown = true;
// avoid deadlocks by closing (and joining) the background
// thread before acquiring the synchronization lock
fileStoreScheduler.close();
try {
flush();
} catch (IOException e) {
log.warn("Unable to flush the store", e);
}
Closer closer = Closer.create();
closer.register(revisions);
fileStoreLock.writeLock().lock();
try {
if (lock != null) {
try {
lock.release();
} catch (IOException e) {
log.warn("Unable to release the file lock", e);
}
}
closer.register(lockFile);
List<TarReader> list = readers;
readers = newArrayList();
for (TarReader reader : list) {
closer.register(reader);
}
closer.register(tarWriter);
} finally {
fileStoreLock.writeLock().unlock();
}
closeAndLogOnFail(closer);
// Try removing pending files in case the scheduler didn't have a chance to run yet
fileReaper.reap();
System.gc(); // for any memory-mappings that are no longer used
log.info("TarMK closed: {}", directory);
}
@Override
public boolean containsSegment(SegmentId id) {
long msb = id.getMostSignificantBits();
long lsb = id.getLeastSignificantBits();
return containsSegment(msb, lsb);
}
private boolean containsSegment(long msb, long lsb) {
for (TarReader reader : readers) {
if (reader.containsEntry(msb, lsb)) {
return true;
}
}
if (tarWriter != null) {
fileStoreLock.readLock().lock();
try {
if (tarWriter.containsEntry(msb, lsb)) {
return true;
}
} finally {
fileStoreLock.readLock().unlock();
}
}
// the writer might have switched to a new file,
// so we need to re-check the readers
for (TarReader reader : readers) {
if (reader.containsEntry(msb, lsb)) {
return true;
}
}
return false;
}
@Override
@Nonnull
public Segment readSegment(final SegmentId id) {
try {
return segmentCache.getSegment(id, new Callable<Segment>() {
@Override
public Segment call() throws Exception {
long msb = id.getMostSignificantBits();
long lsb = id.getLeastSignificantBits();
for (TarReader reader : readers) {
try {
if (reader.isClosed()) {
// Cleanup might already have closed the file.
// The segment should be available from another file.
log.debug("Skipping closed tar file {}", reader);
continue;
}
ByteBuffer buffer = reader.readEntry(msb, lsb);
if (buffer != null) {
return new Segment(FileStore.this, segmentReader, id, buffer);
}
} catch (IOException e) {
log.warn("Failed to read from tar file {}", reader, e);
}
}
if (tarWriter != null) {
fileStoreLock.readLock().lock();
try {
try {
ByteBuffer buffer = tarWriter.readEntry(msb, lsb);
if (buffer != null) {
return new Segment(FileStore.this, segmentReader, id, buffer);
}
} catch (IOException e) {
log.warn("Failed to read from tar file {}", tarWriter, e);
}
} finally {
fileStoreLock.readLock().unlock();
}
}
// the writer might have switched to a new file,
// so we need to re-check the readers
for (TarReader reader : readers) {
try {
if (reader.isClosed()) {
// Cleanup might already have closed the file.
// The segment should be available from another file.
log.info("Skipping closed tar file {}", reader);
continue;
}
ByteBuffer buffer = reader.readEntry(msb, lsb);
if (buffer != null) {
return new Segment(FileStore.this, segmentReader, id, buffer);
}
} catch (IOException e) {
log.warn("Failed to read from tar file {}", reader, e);
}
}
throw new SegmentNotFoundException(id);
}
});
} catch (ExecutionException e) {
SegmentNotFoundException snfe = e.getCause() instanceof SegmentNotFoundException
? (SegmentNotFoundException) e.getCause() : new SegmentNotFoundException(id, e);
snfeListener.notify(id, snfe);
throw snfe;
}
}
@Override
public void writeSegment(SegmentId id, byte[] buffer, int offset, int length) throws IOException {
Segment segment = null;
// If the segment is a data segment, create a new instance of Segment to
// access some internal information stored in the segment and to store
// in an in-memory cache for later use.
int generation = 0;
if (id.isDataSegmentId()) {
ByteBuffer data;
if (offset > 4096) {
data = ByteBuffer.allocate(length);
data.put(buffer, offset, length);
data.rewind();
} else {
data = ByteBuffer.wrap(buffer, offset, length);
}
segment = new Segment(this, segmentReader, id, data);
generation = segment.getGcGeneration();
}
fileStoreLock.writeLock().lock();
try {
// Flush the segment to disk
long size = tarWriter.writeEntry(
id.getMostSignificantBits(),
id.getLeastSignificantBits(),
buffer,
offset,
length,
generation
);
// If the segment is a data segment, update the graph before
// (potentially) flushing the TAR file.
if (segment != null) {
populateTarGraph(segment, tarWriter);
populateTarBinaryReferences(segment, tarWriter);
}
// Close the TAR file if the size exceeds the maximum.
if (size >= maxFileSize) {
newWriter();
}
} finally {
fileStoreLock.writeLock().unlock();
}
// Keep this data segment in memory as it's likely to be accessed soon.
if (segment != null) {
segmentCache.putSegment(segment);
}
}
/**
* Switch to a new tar writer.
* This method may only be called when holding the write lock of {@link #fileStoreLock}
* @throws IOException
*/
private void newWriter() throws IOException {
TarWriter newWriter = tarWriter.createNextGeneration();
if (newWriter != tarWriter) {
File writeFile = tarWriter.getFile();
List<TarReader> list =
newArrayListWithCapacity(1 + readers.size());
list.add(TarReader.open(writeFile, memoryMapping));
list.addAll(readers);
readers = list;
tarWriter = newWriter;
}
}
private void checkDiskSpace(SegmentGCOptions gcOptions) {
long repositoryDiskSpace = size();
long availableDiskSpace = directory.getFreeSpace();
boolean updated = SegmentGCOptions.isDiskSpaceSufficient(repositoryDiskSpace, availableDiskSpace);
boolean previous = sufficientDiskSpace.getAndSet(updated);
if (previous && !updated) {
log.warn("Available disk space ({}) is too low, current repository size is approx. {}",
humanReadableByteCount(availableDiskSpace),
humanReadableByteCount(repositoryDiskSpace));
}
if (updated && !previous) {
log.info("Available disk space ({}) is sufficient again for repository operations, current repository size is approx. {}",
humanReadableByteCount(availableDiskSpace),
humanReadableByteCount(repositoryDiskSpace));
}
}
private class GarbageCollector {
@Nonnull
private final SegmentGCOptions gcOptions;
/**
* {@code GcListener} listening to this instance's gc progress
*/
@Nonnull
private final GCListener gcListener;
@Nonnull
private final GCJournal gcJournal;
@Nonnull
private final WriterCacheManager cacheManager;
@Nonnull
private final GCNodeWriteMonitor compactionMonitor;
private volatile boolean cancelled;
/** Timestamp of the last time {@link #gc()} was successfully invoked. 0 if never. */
private long lastSuccessfullGC;
GarbageCollector(
@Nonnull SegmentGCOptions gcOptions,
@Nonnull GCListener gcListener,
@Nonnull GCJournal gcJournal,
@Nonnull WriterCacheManager cacheManager) {
this.gcOptions = gcOptions;
this.gcListener = gcListener;
this.gcJournal = gcJournal;
this.cacheManager = cacheManager;
this.compactionMonitor = gcOptions.getGCNodeWriteMonitor();
}
synchronized void run() throws IOException {
try {
gcListener.info("TarMK GC #{}: started", GC_COUNT.incrementAndGet());
long dt = System.currentTimeMillis() - lastSuccessfullGC;
if (dt < GC_BACKOFF) {
gcListener.skipped("TarMK GC #{}: skipping garbage collection as it already ran " +
"less than {} hours ago ({} s).", GC_COUNT, GC_BACKOFF/3600000, dt/1000);
return;
}
GCMemoryBarrier gcMemoryBarrier = new GCMemoryBarrier(
sufficientMemory, gcListener, GC_COUNT.get(), gcOptions);
boolean sufficientEstimatedGain = true;
if (gcOptions.isEstimationDisabled()) {
gcListener.info("TarMK GC #{}: estimation skipped because it was explicitly disabled", GC_COUNT);
} else if (gcOptions.isPaused()) {
gcListener.info("TarMK GC #{}: estimation skipped because compaction is paused", GC_COUNT);
} else {
gcListener.info("TarMK GC #{}: estimation started", GC_COUNT);
gcListener.updateStatus(ESTIMATION.message());
Stopwatch watch = Stopwatch.createStarted();
Supplier<Boolean> cancel = new CancelCompactionSupplier(FileStore.this);
GCEstimation estimate = estimateCompactionGain(cancel);
if (cancel.get()) {
gcListener.warn("TarMK GC #{}: estimation interrupted: {}. Skipping garbage collection.", GC_COUNT, cancel);
gcMemoryBarrier.close();
return;
}
sufficientEstimatedGain = estimate.gcNeeded();
String gcLog = estimate.gcLog();
if (sufficientEstimatedGain) {
gcListener.info(
"TarMK GC #{}: estimation completed in {} ({} ms). {}",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), gcLog);
} else {
gcListener.skipped(
"TarMK GC #{}: estimation completed in {} ({} ms). {}",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), gcLog);
}
}
if (sufficientEstimatedGain) {
if (!gcOptions.isPaused()) {
log(segmentWriter.getNodeCacheOccupancyInfo());
int gen = compact();
if (gen > 0) {
fileReaper.add(cleanupOldGenerations(gen));
lastSuccessfullGC = System.currentTimeMillis();
} else if (gen < 0) {
gcListener.info("TarMK GC #{}: cleaning up after failed compaction", GC_COUNT);
fileReaper.add(cleanupGeneration(-gen));
}
log(segmentWriter.getNodeCacheOccupancyInfo());
} else {
gcListener.skipped("TarMK GC #{}: compaction paused", GC_COUNT);
}
}
gcMemoryBarrier.close();
} finally {
compactionMonitor.finished();
gcListener.updateStatus(IDLE.message());
}
}
/**
* Estimated compaction gain. The result will be undefined if stopped through
* the passed {@code stop} signal.
* @param stop signal for stopping the estimation process.
* @return compaction gain estimate
*/
synchronized GCEstimation estimateCompactionGain(Supplier<Boolean> stop) {
return new SizeDeltaGcEstimation(gcOptions, gcJournal,
stats.getApproximateSize());
}
private void log(@CheckForNull String nodeCacheOccupancyInfo) {
if (nodeCacheOccupancyInfo != null) {
log.info("NodeCache occupancy: {}", nodeCacheOccupancyInfo);
}
}
synchronized int compact() {
final int newGeneration = getGcGeneration() + 1;
try {
Stopwatch watch = Stopwatch.createStarted();
gcListener.info("TarMK GC #{}: compaction started, gc options={}", GC_COUNT, gcOptions);
gcListener.updateStatus(COMPACTION.message());
GCJournalEntry gcEntry = gcJournal.read();
long initialSize = size();
compactionMonitor.init(GC_COUNT.get(), gcEntry.getRepoSize(), gcEntry.getNodes(), initialSize);
SegmentNodeState before = getHead();
Supplier<Boolean> cancel = new CancelCompactionSupplier(FileStore.this);
SegmentWriter writer = segmentWriterBuilder("c")
.with(cacheManager)
.withGeneration(newGeneration)
.withoutWriterPool()
.build(FileStore.this);
writer.setCompactionMonitor(compactionMonitor);
SegmentNodeState after = compact(before, writer, cancel);
if (after == null) {
gcListener.warn("TarMK GC #{}: compaction cancelled: {}.", GC_COUNT, cancel);
return -newGeneration;
}
gcListener.info("TarMK GC #{}: compaction cycle 0 completed in {} ({} ms). Compacted {} to {}",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), before.getRecordId(), after.getRecordId());
int cycles = 0;
boolean success = false;
while (cycles < gcOptions.getRetryCount() &&
!(success = revisions.setHead(before.getRecordId(), after.getRecordId(), EXPEDITE_OPTION))) {
// Some other concurrent changes have been made.
// Rebase (and compact) those changes on top of the
// compacted state before retrying to set the head.
cycles++;
gcListener.info("TarMK GC #{}: compaction detected concurrent commits while compacting. " +
"Compacting these commits. Cycle {} of {}",
GC_COUNT, cycles, gcOptions.getRetryCount());
gcListener.updateStatus(COMPACTION_RETRY.message() + cycles);
Stopwatch cycleWatch = Stopwatch.createStarted();
SegmentNodeState head = getHead();
after = compact(head, writer, cancel);
if (after == null) {
gcListener.warn("TarMK GC #{}: compaction cancelled: {}.", GC_COUNT, cancel);
return -newGeneration;
}
gcListener.info("TarMK GC #{}: compaction cycle {} completed in {} ({} ms). Compacted {} against {} to {}",
GC_COUNT, cycles, cycleWatch, cycleWatch.elapsed(MILLISECONDS),
head.getRecordId(), before.getRecordId(), after.getRecordId());
before = head;
}
if (!success) {
gcListener.info("TarMK GC #{}: compaction gave up compacting concurrent commits after {} cycles.",
GC_COUNT, cycles);
int forceTimeout = gcOptions.getForceTimeout();
if (forceTimeout > 0) {
gcListener.info("TarMK GC #{}: trying to force compact remaining commits for {} seconds. " +
"Concurrent commits to the store will be blocked.",
GC_COUNT, forceTimeout);
gcListener.updateStatus(COMPACTION_FORCE_COMPACT.message());
Stopwatch forceWatch = Stopwatch.createStarted();
cycles++;
success = forceCompact(writer, or(cancel, timeOut(forceTimeout, SECONDS)));
if (success) {
gcListener.info("TarMK GC #{}: compaction succeeded to force compact remaining commits " +
"after {} ({} ms).",
GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS));
} else {
if (cancel.get()) {
gcListener.warn("TarMK GC #{}: compaction failed to force compact remaining commits " +
"after {} ({} ms). Compaction was cancelled: {}.",
GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS), cancel);
} else {
gcListener.warn("TarMK GC #{}: compaction failed to force compact remaining commits. " +
"after {} ({} ms). Most likely compaction didn't get exclusive access to the store.",
GC_COUNT, forceWatch, forceWatch.elapsed(MILLISECONDS));
}
}
}
}
if (success) {
writer.flush();
gcListener.compactionSucceeded(newGeneration);
gcListener.info("TarMK GC #{}: compaction succeeded in {} ({} ms), after {} cycles",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), cycles);
return newGeneration;
} else {
gcListener.compactionFailed(newGeneration);
gcListener.info("TarMK GC #{}: compaction failed after {} ({} ms), and {} cycles",
GC_COUNT, watch, watch.elapsed(MILLISECONDS), cycles);
return -newGeneration;
}
} catch (InterruptedException e) {
gcListener.error("TarMK GC #" + GC_COUNT + ": compaction interrupted", e);
currentThread().interrupt();
return -newGeneration;
} catch (Exception e) {
gcListener.error("TarMK GC #" + GC_COUNT + ": compaction encountered an error", e);
return -newGeneration;
}
}
/**
* @param duration
* @param unit
* @return {@code Supplier} instance which returns true once the time specified in
* {@code duration} and {@code unit} has passed.
*/
private Supplier<Boolean> timeOut(final long duration, @Nonnull final TimeUnit unit) {
return new Supplier<Boolean>() {
final long deadline = currentTimeMillis() + MILLISECONDS.convert(duration, unit);
@Override
public Boolean get() {
return currentTimeMillis() > deadline;
}
};
}
/**
* @param supplier1
* @param supplier2
* @return {@code Supplier} instance that returns {@code true} iff {@code supplier1} returns
* {@code true} or otherwise {@code supplier2} returns {@code true}.
*/
private Supplier<Boolean> or(
@Nonnull Supplier<Boolean> supplier1,
@Nonnull Supplier<Boolean> supplier2) {
if (supplier1.get()) {
return Suppliers.ofInstance(true);
} else {
return supplier2;
}
}
private SegmentNodeState compact(NodeState head, SegmentWriter writer, Supplier<Boolean> cancel)
throws IOException {
if (gcOptions.isOffline()) {
return new Compactor(segmentReader, writer, getBlobStore(), cancel, gcOptions)
.compact(EMPTY_NODE, head, EMPTY_NODE);
} else {
return writer.writeNode(head, cancel);
}
}
private boolean forceCompact(@Nonnull final SegmentWriter writer,
@Nonnull final Supplier<Boolean> cancel)
throws InterruptedException {
return revisions.
setHead(new Function<RecordId, RecordId>() {
@Nullable
@Override
public RecordId apply(RecordId base) {
try {
long t0 = currentTimeMillis();
SegmentNodeState after = compact(
segmentReader.readNode(base), writer, cancel);
if (after == null) {
gcListener.info("TarMK GC #{}: compaction cancelled after {} seconds",
GC_COUNT, (currentTimeMillis() - t0) / 1000);
return null;
} else {
return after.getRecordId();
}
} catch (IOException e) {
gcListener.error("TarMK GC #{" + GC_COUNT + "}: Error during forced compaction.", e);
return null;
}
}
},
timeout(gcOptions.getForceTimeout(), SECONDS));
}
synchronized void cleanup() throws IOException {
fileReaper.add(cleanupOldGenerations(getGcGeneration()));
}
/**
* Cleanup segments that are from an old generation. That segments whose generation
* is {@code gcGeneration - SegmentGCOptions.getRetainedGenerations()} or older.
* @param gcGeneration
* @return list of files to be removed
* @throws IOException
*/
private List<File> cleanupOldGenerations(int gcGeneration) throws IOException {
final int reclaimGeneration = gcGeneration - gcOptions.getRetainedGenerations();
Predicate<Integer> reclaimPredicate = new Predicate<Integer>() {
@Override
public boolean apply(Integer generation) {
return generation <= reclaimGeneration;
}
};
return cleanup(reclaimPredicate,
"gc-count=" + GC_COUNT +
",gc-status=success" +
",store-generation=" + gcGeneration +
",reclaim-predicate=(generation<=" + reclaimGeneration + ")");
}
/**
* Cleanup segments whose generation matches the {@code reclaimGeneration} predicate.
* @param reclaimGeneration
* @param gcInfo gc information to be passed to {@link SegmentIdTable#clearSegmentIdTables(Set, String)}
* @return list of files to be removed
* @throws IOException
*/
private List<File> cleanup(
@Nonnull Predicate<Integer> reclaimGeneration,
@Nonnull String gcInfo)
throws IOException {
Stopwatch watch = Stopwatch.createStarted();
Set<UUID> bulkRefs = newHashSet();
Map<TarReader, TarReader> cleaned = newLinkedHashMap();
long initialSize = 0;
fileStoreLock.writeLock().lock();
try {
gcListener.info("TarMK GC #{}: cleanup started.", GC_COUNT);
gcListener.updateStatus(CLEANUP.message());
newWriter();
segmentCache.clear();
// Suggest to the JVM that now would be a good time
// to clear stale weak references in the SegmentTracker
System.gc();
collectBulkReferences(bulkRefs);
for (TarReader reader : readers) {
cleaned.put(reader, reader);
initialSize += reader.size();
}
} finally {
fileStoreLock.writeLock().unlock();
}
gcListener.info("TarMK GC #{}: current repository size is {} ({} bytes)",
GC_COUNT, humanReadableByteCount(initialSize), initialSize);
Set<UUID> reclaim = newHashSet();
for (TarReader reader : cleaned.keySet()) {
reader.mark(bulkRefs, reclaim, reclaimGeneration);
log.info("{}: size of bulk references/reclaim set {}/{}",
reader, bulkRefs.size(), reclaim.size());
if (shutdown) {
gcListener.info("TarMK GC #{}: cleanup interrupted", GC_COUNT);
break;
}
}
Set<UUID> reclaimed = newHashSet();
for (TarReader reader : cleaned.keySet()) {
cleaned.put(reader, reader.sweep(reclaim, reclaimed));
if (shutdown) {
gcListener.info("TarMK GC #{}: cleanup interrupted", GC_COUNT);
break;
}
}
// it doesn't account for concurrent commits that might have happened
long afterCleanupSize = 0;
List<TarReader> oldReaders = newArrayList();
fileStoreLock.writeLock().lock();
try {
// Replace current list of reader with the cleaned readers taking care not to lose
// any new reader that might have come in through concurrent calls to newWriter()
List<TarReader> sweptReaders = newArrayList();
for (TarReader reader : readers) {
if (cleaned.containsKey(reader)) {
TarReader newReader = cleaned.get(reader);
if (newReader != null) {
sweptReaders.add(newReader);
afterCleanupSize += newReader.size();
}
// if these two differ, the former represents the swept version of the latter
if (newReader != reader) {
oldReaders.add(reader);
}
} else {
sweptReaders.add(reader);
}
}
readers = sweptReaders;
} finally {
fileStoreLock.writeLock().unlock();
}
tracker.clearSegmentIdTables(reclaimed, gcInfo);
// Close old readers *after* setting readers to the new readers to avoid accessing
// a closed reader from readSegment()
LinkedList<File> toRemove = newLinkedList();
for (TarReader oldReader : oldReaders) {
closeAndLogOnFail(oldReader);
File file = oldReader.getFile();
toRemove.addLast(file);
}
gcListener.info("TarMK GC #{}: cleanup marking files for deletion: {}", GC_COUNT, toFileNames(toRemove));
long finalSize = size();
long reclaimedSize = initialSize - afterCleanupSize;
stats.reclaimed(reclaimedSize);
gcJournal.persist(reclaimedSize, finalSize, getGcGeneration(), compactionMonitor.getCompactedNodes());
gcListener.cleaned(reclaimedSize, finalSize);
gcListener.info("TarMK GC #{}: cleanup completed in {} ({} ms). Post cleanup size is {} ({} bytes)" +
" and space reclaimed {} ({} bytes).",
GC_COUNT, watch, watch.elapsed(MILLISECONDS),
humanReadableByteCount(finalSize), finalSize,
humanReadableByteCount(reclaimedSize), reclaimedSize);
return toRemove;
}
private String toFileNames(@Nonnull List<File> files) {
if (files.isEmpty()) {
return "none";
} else {
return Joiner.on(",").join(files);
}
}
private void collectBulkReferences(Set<UUID> bulkRefs) {
Set<UUID> refs = newHashSet();
for (SegmentId id : tracker.getReferencedSegmentIds()) {
refs.add(id.asUUID());
}
tarWriter.collectReferences(refs);
for (UUID ref : refs) {
if (!isDataSegmentId(ref.getLeastSignificantBits())) {
bulkRefs.add(ref);
}
}
}
/**
* Cleanup segments of the given generation {@code gcGeneration}.
* @param gcGeneration
* @return list of files to be removed
* @throws IOException
*/
private List<File> cleanupGeneration(final int gcGeneration) throws IOException {
Predicate<Integer> cleanupPredicate = new Predicate<Integer>() {
@Override
public boolean apply(Integer generation) {
return generation == gcGeneration;
}
};
return cleanup(cleanupPredicate,
"gc-count=" + GC_COUNT +
",gc-status=failed" +
",store-generation=" + (gcGeneration - 1) +
",reclaim-predicate=(generation==" + gcGeneration + ")");
}
/**
* Finds all external blob references that are currently accessible
* in this repository and adds them to the given collector. Useful
* for collecting garbage in an external data store.
* <p>
* Note that this method only collects blob references that are already
* stored in the repository (at the time when this method is called), so
* the garbage collector will need some other mechanism for tracking
* in-memory references and references stored while this method is
* running.
* @param collector reference collector called back for each blob reference found
*/
synchronized void collectBlobReferences(ReferenceCollector collector) throws IOException {
segmentWriter.flush();
List<TarReader> tarReaders = newArrayList();
fileStoreLock.writeLock().lock();
try {
newWriter();
tarReaders.addAll(FileStore.this.readers);
} finally {
fileStoreLock.writeLock().unlock();
}
int minGeneration = getGcGeneration() - gcOptions.getRetainedGenerations() + 1;
for (TarReader tarReader : tarReaders) {
tarReader.collectBlobReferences(collector, minGeneration);
}
}
void cancel() {
cancelled = true;
}
/**
* Represents the cancellation policy for the compaction phase. If the disk
* space was considered insufficient at least once during compaction (or if
* the space was never sufficient to begin with), compaction is considered
* canceled. Furthermore when the file store is shutting down, compaction is
* considered canceled.
*/
private class CancelCompactionSupplier implements Supplier<Boolean> {
private final FileStore store;
private String reason;
public CancelCompactionSupplier(@Nonnull FileStore store) {
cancelled = false;
this.store = store;
}
@Override
public Boolean get() {
// The outOfDiskSpace and shutdown flags can only transition from
// false (their initial values), to true. Once true, there should
// be no way to go back.
if (!store.sufficientDiskSpace.get()) {
reason = "Not enough disk space";
return true;
}
if (!store.sufficientMemory.get()) {
reason = "Not enough memory";
return true;
}
if (store.shutdown) {
reason = "The FileStore is shutting down";
return true;
}
if (cancelled) {
reason = "Cancelled by user";
return true;
}
return false;
}
@Override
public String toString() { return reason; }
}
}
}
| apache-2.0 |
nuest/worldviz | src/main/java/org/n52/v3d/worldviz/triangulation/PolygonTriangulator.java | 9294 | package org.n52.v3d.worldviz.triangulation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.n52.v3d.worldviz.extensions.VgLinearRing;
import org.n52.v3d.worldviz.extensions.VgMultiPolygon;
import org.n52.v3d.worldviz.extensions.VgPolygon;
import org.n52.v3d.triturus.gisimplm.GmPoint;
import org.n52.v3d.triturus.gisimplm.GmSimpleTINGeometry;
import org.n52.v3d.triturus.vgis.VgIndexedTIN;
import org.n52.v3d.triturus.vgis.VgPoint;
import org.poly2tri.Poly2Tri;
import org.poly2tri.geometry.polygon.Polygon;
import org.poly2tri.geometry.polygon.PolygonPoint;
import org.poly2tri.triangulation.TriangulationPoint;
import org.poly2tri.triangulation.delaunay.DelaunayTriangle;
public class PolygonTriangulator {
private static String srs;
public static List<VgIndexedTIN> triangulateMultiPolygons(
Collection<VgMultiPolygon> vgMultiPolygons) {
List<VgIndexedTIN> vgTins = new ArrayList<VgIndexedTIN>();
for (VgMultiPolygon vgMultiPolygon : vgMultiPolygons) {
vgTins.addAll(triangulateMultiPolygon(vgMultiPolygon));
}
return vgTins;
}
public static List<VgIndexedTIN> triangulateMultiPolygon(
VgMultiPolygon vgMultiPolygon) {
int numberOfGeometries = vgMultiPolygon.getNumberOfGeometries();
List<VgIndexedTIN> vgTINs = new ArrayList<VgIndexedTIN>(
numberOfGeometries);
for (int i = 0; i < numberOfGeometries; i++) {
VgPolygon vgPolygon = (VgPolygon) vgMultiPolygon.getGeometry(i);
vgTINs.add(triangulatePolygon(vgPolygon));
}
return vgTINs;
}
public static VgIndexedTIN triangulatePolygon(VgPolygon vgPolygon) {
srs = vgPolygon.getSRS();
// transform VgPolygonvertices to
List<PolygonPoint> polygonBorderPoints = transformIntoPolygonPoints(vgPolygon
.getOuterBoundary());
List<PolygonPoint> polygonHolePoints = new ArrayList<PolygonPoint>();
Polygon p2tPolygon = new Polygon(polygonBorderPoints);
// process holes
int numberOfHoles = vgPolygon.getNumberOfHoles();
for (int i = 0; i < numberOfHoles; i++) {
VgLinearRing triturusHole = vgPolygon.getHole(i);
Polygon hole = new Polygon(transformIntoPolygonPoints(triturusHole));
p2tPolygon.addHole(hole);
polygonHolePoints.addAll(transformIntoPolygonPoints(triturusHole));
}
Poly2Tri.triangulate(p2tPolygon);
List<DelaunayTriangle> triangles = p2tPolygon.getTriangles();
// List<PolygonPoint> allPoints = new ArrayList<PolygonPoint>(
// polygonBorderPoints.size() + polygonHolePoints.size());
// allPoints.addAll(polygonBorderPoints);
// allPoints.addAll(polygonHolePoints);
return createTriturusTIN(triangles);
}
/**
* Takes a polygon and a list of additional points that have to be inside of
* the polygon! These inner points will be used as additional nodes for the
* constrained triangulation! The outer boundary of the polygon will still
* be used for guaranteed triangle edges that will not be crossed by any
* edges constructed through the inner points.
*
* @param vgPolygon
* @param additionalInnerPoints
* @return
*/
public static VgIndexedTIN triangulatePolygon(VgPolygon vgPolygon,
List<VgPoint> additionalInnerPoints) {
srs = vgPolygon.getSRS();
// transform VgPolygonvertices to
List<PolygonPoint> polygonBorderPoints = transformIntoPolygonPoints(vgPolygon
.getOuterBoundary());
List<PolygonPoint> polygonHolePoints = new ArrayList<PolygonPoint>();
Polygon p2tPolygon = new Polygon(polygonBorderPoints);
// process holes
int numberOfHoles = vgPolygon.getNumberOfHoles();
for (int i = 0; i < numberOfHoles; i++) {
VgLinearRing vgPolygonHole = vgPolygon.getHole(i);
Polygon triangulationHole = new Polygon(
transformIntoPolygonPoints(vgPolygonHole));
p2tPolygon.addHole(triangulationHole);
// add polygonHolePoints to corresponding list
polygonHolePoints.addAll(transformIntoPolygonPoints(vgPolygonHole));
}
// add Steiner points
List<TriangulationPoint> polygonInnerPoints = transformIntoTriangulationPoints(additionalInnerPoints);
// // a list is needed, in which ALL points that are used to triangulate
// // the polygon are inside. That means all borderPoints and inner
// Steiner
// // points
// List<TriangulationPoint> allPoints = new
// ArrayList<TriangulationPoint>();
// allPoints.addAll(polygonBorderPoints);
// allPoints.addAll(polygonHolePoints);
// allPoints.addAll(polygonInnerPoints);
p2tPolygon.addSteinerPoints(polygonInnerPoints);
Poly2Tri.triangulate(p2tPolygon);
List<DelaunayTriangle> triangles = p2tPolygon.getTriangles();
return createTriturusTIN(triangles);
}
private static List<TriangulationPoint> transformIntoTriangulationPoints(
List<VgPoint> triturusPoints) {
List<TriangulationPoint> points = new ArrayList<TriangulationPoint>(
triturusPoints.size());
for (VgPoint vgPoint : triturusPoints) {
points.add(convert2PolygonPoint(vgPoint));
}
return points;
}
private static List<PolygonPoint> transformIntoPolygonPoints(
VgLinearRing vgLinearRing) {
int numberOfVertices = vgLinearRing.getNumberOfVertices();
List<PolygonPoint> polygonPoints = new ArrayList<PolygonPoint>(
numberOfVertices);
// TODO check!!!
// as the triangulation library expects that no polygon point may be
// insertetd twice
// we check, if the first and last point of the polygon is the same; if
// so, then only insert it once!
for (int i = 0; i < numberOfVertices; i++) {
// if clause only for the last point
if (i == (numberOfVertices - 1)) {
VgPoint firstPolygonPoint = vgLinearRing.getVertex(0);
VgPoint lastPolygonPoint = vgLinearRing.getVertex(i);
if (firstPolygonPoint.equals(lastPolygonPoint)) {
break;
}
}
VgPoint nextVertex = vgLinearRing.getVertex(i);
polygonPoints.add(convert2PolygonPoint(nextVertex));
}
return polygonPoints;
}
/**
* converts a Triturus point into a PolygonPoint (point class of the
* triangulation-lib) that is needed for the triangulation.
*
* @param triturusPoint
* @return
*/
private static PolygonPoint convert2PolygonPoint(VgPoint triturusPoint) {
PolygonPoint nextPoint = new PolygonPoint(triturusPoint.getX(),
triturusPoint.getY(), triturusPoint.getZ());
return nextPoint;
}
private static VgIndexedTIN createTriturusTIN(
List<DelaunayTriangle> triangles) {
Map<TriangulationPoint, Integer> pointIndicesMap = createPointIndicesMap(triangles);
// GmSimpleTINGeometry implements GvIndexedTIN
GmSimpleTINGeometry triturusTIN = new GmSimpleTINGeometry(
pointIndicesMap.size(), triangles.size());
triturusTIN.setSRS(srs);
// Map<TriangulationPoint, Integer> pointIndicesMap =
// createPointIndicesMap(allPoints);
setPointsForTriturusTIN((GmSimpleTINGeometry) triturusTIN,
pointIndicesMap);
int triangleIndex = 0;
for (DelaunayTriangle delaunayTriangle : triangles) {
TriangulationPoint[] trianglePoints = delaunayTriangle.points;
// each Point has to be in the pointsIndicesMap
// thus we can get the corresponding index from the map
triturusTIN.setTriangle(triangleIndex,
pointIndicesMap.get(trianglePoints[0]),
pointIndicesMap.get(trianglePoints[1]),
pointIndicesMap.get(trianglePoints[2]));
triangleIndex++;
}
return triturusTIN;
}
private static Map<TriangulationPoint, Integer> createPointIndicesMap(
List<DelaunayTriangle> triangles) {
Map<TriangulationPoint, Integer> pointIndicesMap = new HashMap<TriangulationPoint, Integer>();
int pointIndex = 0; // first indexPosition that will be incremented for
// each new point
for (DelaunayTriangle delaunayTriangle : triangles) {
TriangulationPoint[] triangulationPoints = delaunayTriangle.points;
for (TriangulationPoint triangulationPoint : triangulationPoints) {
// only if the actual point is NOT already as a key in the map
if (!pointIndicesMap.containsKey(triangulationPoint)) {
pointIndicesMap.put(triangulationPoint, pointIndex);
pointIndex++;
}
}
}
return pointIndicesMap;
}
// private static Map<TriangulationPoint, Integer> createPointIndicesMap(
// List<TriangulationPoint> allPoints) {
//
// Map<TriangulationPoint, Integer> pointIndicesMap = new
// HashMap<TriangulationPoint, Integer>();
// int pointIndex = 0; // first indexPosition that will be incremented for
// // each new point
//
// for (TriangulationPoint polygonPoint : allPoints) {
//
// pointIndicesMap.put(polygonPoint, pointIndex);
// pointIndex++;
//
// }
//
// return pointIndicesMap;
// }
private static void setPointsForTriturusTIN(
GmSimpleTINGeometry triturusTIN,
Map<TriangulationPoint, Integer> pointIndicesMap) {
Set<Entry<TriangulationPoint, Integer>> entrySet = pointIndicesMap
.entrySet();
// each ENtry maps an index to a PolygonPoint
for (Entry<TriangulationPoint, Integer> entry : entrySet) {
TriangulationPoint polygonPoint = entry.getKey();
Integer index = entry.getValue();
VgPoint triturusPoint = new GmPoint(polygonPoint.getX(),
polygonPoint.getY(), polygonPoint.getZ());
triturusPoint.setSRS(srs);
triturusTIN.setPoint(index, triturusPoint);
}
}
}
| apache-2.0 |
rylexr/android-simple-listview-app | app/src/main/java/com/tinbytes/simplelistviewapp/SimpleContentProvider.java | 4620 | /*
* Copyright 2015 Tinbytes 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.tinbytes.simplelistviewapp;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.text.TextUtils;
public class SimpleContentProvider extends ContentProvider {
// Provide a mechanism to identify all the incoming uri patterns.
private static final int ANIMALS = 1;
private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
static {
// /animal
uriMatcher.addURI(DatabaseContract.AUTHORITY, DatabaseContract.AnimalTable.URI_PATH, ANIMALS);
}
private DatabaseHelper dh;
public boolean onCreate() {
dh = new DatabaseHelper(getContext());
return true;
}
public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
Cursor c;
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setDistinct(true);
switch (uriMatcher.match(uri)) {
case ANIMALS:
qb.setTables(DatabaseContract.AnimalTable.TABLE_NAME);
if (sortOrder == null)
sortOrder = DatabaseContract.AnimalColumns.NAME + " ASC";
c = qb.query(dh.getReadableDatabase(), projection, selection, selectionArgs, null, null, sortOrder);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (getContext() != null) {
c.setNotificationUri(getContext().getContentResolver(), uri);
}
return c;
}
public Uri insert(@NonNull Uri uri, ContentValues values) {
if (values != null) {
switch (uriMatcher.match(uri)) {
case ANIMALS:
SQLiteDatabase db = dh.getWritableDatabase();
long rowId = db.insert(DatabaseContract.AnimalTable.TABLE_NAME, null, values);
if (rowId > 0) {
Uri insertedUri = ContentUris.withAppendedId(DatabaseContract.AnimalTable.CONTENT_URI, rowId);
if (getContext() != null) {
getContext().getContentResolver().notifyChange(insertedUri, null);
}
return insertedUri;
}
throw new SQLException("Failed to insert row - " + uri);
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
return null;
}
public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
SQLiteDatabase db = dh.getWritableDatabase();
int count;
switch (uriMatcher.match(uri)) {
case ANIMALS:
count = db.update(DatabaseContract.AnimalTable.TABLE_NAME, values, selection, selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (getContext() != null) {
getContext().getContentResolver().notifyChange(uri, null);
}
return count;
}
public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
SQLiteDatabase db = dh.getWritableDatabase();
int count;
switch (uriMatcher.match(uri)) {
case ANIMALS:
count = db.delete(DatabaseContract.AnimalTable.TABLE_NAME,
DatabaseContract.AnimalTable.ID + "=" + uri.getPathSegments().get(1) +
(!TextUtils.isEmpty(selection) ? " AND (" + selection + ')' : ""), selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
if (getContext() != null) {
getContext().getContentResolver().notifyChange(uri, null);
}
return count;
}
public String getType(@NonNull Uri uri) {
switch (uriMatcher.match(uri)) {
case ANIMALS:
return DatabaseContract.AnimalTable.CONTENT_TYPE;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
}
}
| apache-2.0 |
wrml/wrml | cli/src/main/java/org/wrml/werminal/action/AddAction.java | 2099 | /**
* WRML - Web Resource Modeling Language
* __ __ ______ __ __ __
* /\ \ _ \ \ /\ == \ /\ "-./ \ /\ \
* \ \ \/ ".\ \\ \ __< \ \ \-./\ \\ \ \____
* \ \__/".~\_\\ \_\ \_\\ \_\ \ \_\\ \_____\
* \/_/ \/_/ \/_/ /_/ \/_/ \/_/ \/_____/
*
* http://www.wrml.org
*
* Copyright (C) 2011 - 2013 Mark Masse <mark@wrml.org> (OSS project WRML.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wrml.werminal.action;
import org.wrml.werminal.Werminal;
import org.wrml.werminal.dialog.ListValueDialog;
import java.lang.reflect.Type;
import java.net.URI;
public class AddAction extends WerminalAction {
private ListValueDialog _ListValueDialog;
public AddAction(final Werminal werminal) {
super(werminal, "Add...");
}
@Override
public void doAction() {
final Werminal werminal = getWerminal();
final ListValueDialog listValueDialog = getListValueDialog();
Object initialValue = null;
final Type listElementType = listValueDialog.getListElementType();
if (String.class.equals(listElementType)) {
}
else if (URI.class.equals(listElementType)) {
// TODO: Only do this for base schema uris slot
initialValue = werminal.createSchemaUri("MyBaseModel");
}
listValueDialog.addFormField(initialValue);
}
public ListValueDialog getListValueDialog() {
return _ListValueDialog;
}
public void setListValueDialog(final ListValueDialog listValueDialog) {
_ListValueDialog = listValueDialog;
}
}
| apache-2.0 |
webfirmframework/wff | wffweb/src/main/java/com/webfirmframework/wffweb/tag/html/html5/attribute/AutoComplete.java | 13508 | /*
* Copyright 2014-2022 Web Firm Framework
*
* 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.
* @author WFF
*/
package com.webfirmframework.wffweb.tag.html.html5.attribute;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;
import com.webfirmframework.wffweb.tag.html.attribute.core.AbstractValueSetAttribute;
import com.webfirmframework.wffweb.tag.html.attribute.core.PreIndexedAttributeName;
import com.webfirmframework.wffweb.tag.html.identifier.InputAttributable;
/**
*
* <code>autocomplete</code> attribute for the element.
*
* <pre>
* This attribute indicates whether the value of the control can be automatically completed by the browser.
* Possible values are:
* off: The user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry.
* on: The browser is allowed to automatically complete the value based on values that the user has entered during previous uses, however on does not provide any further information about what kind of data the user might be expected to enter.
* name: Full name
* honorific-prefix: Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "Mlle")
* given-name (first name)
* additional-name
* family-name
* honorific-suffix: Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II")
* nickname
* email
* username
* new-password: A new password (e.g. when creating an account or changing a password)
* current-password
* organization-title: Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy Managing Director")
* organization
* street-address
* address-line1, address-line2, address-line3, address-level4, address-level3, address-level2, address-level1
* country
* country-name
* postal-code
* cc-name: Full name as given on the payment instrument
* cc-given-name
* cc-additional-name
* cc-family-name
* cc-number: Code identifying the payment instrument (e.g. the credit card number)
* cc-exp: Expiration date of the payment instrument
* cc-exp-month
* cc-exp-year
* cc-csc: Security code for the payment instrument
* cc-type: Type of payment instrument (e.g. Visa)
* transaction-currency
* transaction-amount
* language: Preferred language; Valid BCP 47 language tag
* bday
* bday-day
* bday-month
* bday-year
* sex: Gender identity (e.g. Female, Fa'afafine); Free-form text, no newlines
* tel
* url: Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field
* photo: Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field
* </pre>
*
* If the autocomplete attribute is not specified on an input element, then the
* browser uses the autocomplete attribute value of the {@code<input>} element's
* form owner. The form owner is either the form element that this {@code
* <input>} element is a descendant of, or the form element whose id is
* specified by the form attribute of the input element. For more information,
* see the autocomplete attribute in {@code<form>}.
*
* The autocomplete attribute also controls whether Firefox will, unlike other
* browsers, persist the dynamic disabled state and (if applicable) dynamic
* checkedness of an {@code<input>} across page loads. The persistence feature
* is enabled by default. Setting the value of the autocomplete attribute to off
* disables this feature; this works even when the autocomplete attribute would
* normally not apply to the {@code<input>} by virtue of its type. See bug
* 654072.
*
* For most modern browsers (including Firefox 38+, Google Chrome 34+, IE 11+)
* setting the autocomplete attribute will not prevent a browser's password
* manager from asking the user if they want to store login (username and
* password) fields and, if they agree, from autofilling the login the next time
* the user visits the page. See The autocomplete attribute and login fields.
*
* @author WFF
* @since 1.0.0
*/
public class AutoComplete extends AbstractValueSetAttribute implements InputAttributable {
public static final String ON = "on";
public static final String OFF = "off";
/**
* Eg:- Full name
*/
public static final String NAME = "name";
/**
* Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "Mlle").
*/
public static final String HONORIFIC_PREFIX = "honorific-prefix";
/**
* First name
*/
public static final String GIVEN_NAME = "given-name";
/**
* Middle name
*/
public static final String ADDITIONAL_NAME = "additional-name";
/**
* Last name
*/
public static final String FAMILY_NAME = "family-name";
/**
* Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II").
*/
public static final String HONORIFIC_SUFFIX = "honorific-suffix";
public static final String NICKNAME = "nickname";
public static final String EMAIL = "email";
public static final String USERNAME = "username";
/**
* A new password (e.g. when creating an account or changing a password).
*/
public static final String NEW_PASSWORD = "new-password";
public static final String CURRENT_PASSWORD = "current-password";
/**
* Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy
* Managing Director").
*/
public static final String ORGANIZATION_TITLE = "organization-title";
public static final String ORGANIZATION = "organization";
public static final String STREET_ADDRESS = "street-address";
public static final String ADDRESS_LINE1 = "address-line1";
public static final String ADDRESS_LINE2 = "address-line2";
public static final String ADDRESS_LINE3 = "address-line3";
public static final String ADDRESS_LEVEL4 = "address-level4";
public static final String ADDRESS_LEVEL3 = "address-level3";
public static final String ADDRESS_LEVEL2 = "address-level2";
public static final String ADDRESS_LEVEL1 = "address-level1";
public static final String COUNTRY = "country";
public static final String COUNTRY_NAME = "country-name";
public static final String POSTAL_CODE = "postal-code";
/**
* Full name as given on the payment instrument.
*/
public static final String CC_NAME = "cc-name";
public static final String CC_GIVEN_NAME = "cc-given-name";
public static final String CC_ADDITIONAL_NAME = "cc-additional-name";
public static final String CC_FAMILY_NAME = "cc-family-name";
/**
* Code identifying the payment instrument (e.g. the credit card number).
*/
public static final String CC_NUMBER = "cc-number";
/**
* Expiration date of the payment instrument.
*/
public static final String CC_EXP = "cc-exp";
public static final String CC_EXP_MONTH = "cc-exp-month";
public static final String CC_EXP_YEAR = "cc-exp-year";
/**
* Security code for the payment instrument.
*/
public static final String CC_CSC = "cc-csc";
/**
* Type of payment instrument (e.g. Visa).
*/
public static final String CC_TYPE = "cc-type";
public static final String TRANSACTION_CURRENCY = "transaction-currency";
public static final String TRANSACTION_AMOUNT = "transaction-amount";
/**
* Preferred language; a valid BCP 47 language tag.
*/
public static final String LANGUAGE = "language";
/**
* birthday
*/
public static final String BDAY = "bday";
public static final String BDAY_DAY = "bday-day";
public static final String BDAY_MONTH = "bday-month";
public static final String BDAY_YEAR = "bday-year";
/**
* Gender identity (e.g. Female, Fa'afafine), free-form text, no newlines.
*/
public static final String SEX = "sex";
/**
* full telephone number, including country code
*/
public static final String TEL = "tel";
public static final String TEL_COUNTRY_CODE = "tel-country-code";
public static final String TEL_NATIONAL = "tel-national";
public static final String TEL_AREA_CODE = "tel-area-code";
public static final String TEL_LOCAL = "tel-local";
public static final String TEL_LOCAL_PREFIX = "tel-local-prefix";
public static final String TEL_LOCAL_SUFFIX = "tel-local-suffix";
public static final String TEL_EXTENSION = "tel-extension";
/**
* Home page or other Web page corresponding to the company, person, address, or
* contact information in the other fields associated with this field.
*/
public static final String URL = "url";
/**
* Photograph, icon, or other image corresponding to the company, person,
* address, or contact information in the other fields associated with this
* field.
*/
public static final String PHOTO = "photo";
/**
* URL representing an instant messaging protocol endpoint (for example,
* "aim:goim?screenname=example" or "xmpp:fred@example.net")
*/
public static final String IMPP = "impp";
/**
* the field is for contacting someone at their residence
*/
public static final String HOME = "home";
/**
* the field is for contacting someone at their workplace
*/
public static final String WORK = "work";
/**
* the field is for contacting someone regardless of location
*/
public static final String MOBILE = "mobile";
/**
* the field describes a fax machine's contact details
*/
public static final String FAX = "fax";
/**
* the field describes a pager's or beeper's contact details
*/
public static final String PAGER = "pager";
private static final long serialVersionUID = 1_0_0L;
private static final PreIndexedAttributeName PRE_INDEXED_ATTR_NAME;
static {
PRE_INDEXED_ATTR_NAME = (PreIndexedAttributeName.AUTOCOMPLETE);
}
{
super.setPreIndexedAttribute(PRE_INDEXED_ATTR_NAME);
init();
}
/**
*
* @since 2.1.15
* @author WFF
*/
public AutoComplete() {
}
/**
*
* @param value the value for the attribute. The value string can contain values
* separated by space.
* @since 1.0.0
*/
public AutoComplete(final String value) {
super.addAllToAttributeValueSet(value);
}
/**
*
* @param values the value for the attribute. The value string can contain
* values separated by space.
* @since 2.1.15
*/
public AutoComplete(final String... values) {
super.addAllToAttributeValueSet(values);
}
/**
* removes the value
*
* @param value
* @since 2.1.15
* @author WFF
*/
public void removeValue(final String value) {
super.removeFromAttributeValueSet(value);
}
/**
* removes the values
*
* @param values
* @since 2.1.15
* @author WFF
*/
public void removeValues(final Collection<String> values) {
super.removeAllFromAttributeValueSet(values);
}
/**
* adds the values to the last
*
* @param values
* @since 2.1.15
* @author WFF
*/
public void addValues(final Collection<String> values) {
super.addAllToAttributeValueSet(values);
}
/**
* adds the value to the last
*
* @param value
* @since 2.1.15
* @author WFF
*/
public void addValue(final String value) {
super.addToAttributeValueSet(value);
}
/**
* sets the value for this attribute
*
* @param value the value for the attribute.
* @since 1.0.0
*/
public void setValue(final String value) {
super.setAttributeValue(value);
}
/**
* sets the value for this attribute
*
* @param updateClient true to update client browser page if it is available.
* The default value is true but it will be ignored if
* there is no client browser page.
* @param attributeValue the value for the attribute.
* @since 2.1.15
* @author WFF
*/
public void setValue(final boolean updateClient, final String attributeValue) {
super.setAttributeValue(updateClient, attributeValue);
}
/**
* gets the value of this attribute
*
* @return the value of the attribute
* @since 1.0.0
*/
public String getValue() {
return super.getAttributeValue();
}
/**
* @return a new copy of set of values
* @since 2.1.15
* @author WFF
*/
public Set<String> getValueSet() {
return new LinkedHashSet<>(super.getAttributeValueSet());
}
/**
* invokes only once per object
*
* @since 1.0.0
*/
protected void init() {
// to override and use this method
}
}
| apache-2.0 |
rene-anderes/jpa-bidirectional-relations | src/main/java/org/anderes/edu/relations/onetomany/Company.java | 2372 | package org.anderes.edu.relations.onetomany;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.PreRemove;
@Entity
public class Company {
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String name;
@OneToMany(mappedBy="company")
private Collection<Person> employees = new HashSet<>();
Company() {};
public Company(final String name) {
super();
this.name = name;
}
public Collection<Person> getEmployees() {
return Collections.unmodifiableCollection(employees);
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/* ------------- Pattern für JPA bidirektionale Beziehung ------------ */
public void addEmployee(final Person person) {
person.setCompany(this);
}
/*package*/ void internalAddEmployee(Person person) {
employees.add(person);
}
public void removeEmployee(final Person person) {
if (!employees.contains(person)) {
throw new IllegalArgumentException("Die Person ist kein Mitarbeiter dieser Firma.");
}
person.setCompany(null);
}
/*package*/ void internalRemoveEmployee(Person person) {
employees.remove(person);
}
@PreRemove
public void preRemove() {
final Collection<Person> employees = new HashSet<Person>(getEmployees());
for (Person person : employees) {
removeEmployee(person);
}
}
/* /------------ Pattern für JPA bidirektionale Beziehung ------------ */
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Company other = (Company) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
| apache-2.0 |
dpmorocho/obd-api | src/main/java/com/github/dpmorocho/obd/comandos/motor/FuelRateCommand.java | 1878 | package com.github.dpmorocho.obd.comandos.motor;
import com.github.dpmorocho.obd.comandos.ObdCommand;
import com.github.dpmorocho.obd.enums.AvailableCommandNames;
/**
* Fuel systems that use conventional oxygen sensor display the commanded open
* loop equivalence ratio while the system is in open loop. Should report 100%
* when in closed loop fuel.
* <p>
* To obtain the actual air/fuel ratio being commanded, multiply the
* stoichiometric A/F ratio by the equivalence ratio. For example, gasoline,
* stoichiometric is 14.64:1 ratio. If the fuel control system was commanded an
* equivalence ratio of 0.95, the commanded A/F ratio to the engine would be
* 14.64 * 0.95 = 13.9 A/F.
*/
public class FuelRateCommand extends ObdCommand {
// Equivalent ratio (L/h)
private double fuelrate = 0.00;
/**
* Default ctor.
*/
public FuelRateCommand() {
super("01 5E");
}
/**
* Copy ctor.
*
* @param other a {@link FuelRateCommand} object.
*/
public FuelRateCommand(FuelRateCommand other) {
super(other);
}
@Override
protected void performCalculations() {
// ignore first two bytes [hh hh] of the response
int a = buffer.get(2);
int b = buffer.get(3);
fuelrate = ((a * 256) + b) * 0.05;
}
/**
*
*/
@Override
public String getFormattedResult() {
return String.format("%.1f%s", fuelrate, getResultUnit());
}
@Override
public String getCalculatedResult() {
return String.valueOf(fuelrate);
}
@Override
public String getResultUnit() {
return "L/h";
}
/**
* @return a double.
*/
public double getVoltage() {
return fuelrate;
}
@Override
public String getName() {
return AvailableCommandNames.ENGINE_FUEL_RATE.getValue();
}
}
| apache-2.0 |
alim1369/sos | src/sos/base/util/namayangar/sosLayer/search/SearchTarget.java | 1657 | package sos.base.util.namayangar.sosLayer.search;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.util.ArrayList;
import javax.swing.JComponent;
import rescuecore2.misc.Pair;
import sos.base.entities.Road;
import sos.base.util.namayangar.NamayangarUtils;
import sos.base.util.namayangar.misc.gui.ScreenTransform;
import sos.base.util.namayangar.sosLayer.other.SOSAbstractToolsLayer;
import sos.base.util.namayangar.tools.LayerType;
public class SearchTarget extends SOSAbstractToolsLayer<Road>{
public SearchTarget() {
super(Road.class);
setVisible(false);
}
@Override
public int getZIndex() {
return 20;
}
@Override
protected void makeEntities() {
setEntities(model().roads());
}
@Override
protected Shape render(Road entity, Graphics2D g, ScreenTransform transform) {
Shape shape = NamayangarUtils.transformShape(entity, transform);
// SearchRoad sr=mySearch.getWorld().getSearchRoadByRealRoad(entity);
// g.setColor(Color.yellow);
// if(sr.isInEndOfPath()){
// g.fill(shape);
// g.setColor(Color.black);
// g.drawString("val:" + sr.getTargetValue(), transform.xToScreen(entity.getX()), transform.yToScreen(entity.getY()));
// }
return shape;
}
@Override
public JComponent getGUIComponent() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isValid() {
return true;//model().me() instanceof Human;
}
@Override
public ArrayList<Pair<String, String>> sosInspect(Road entity) {
ArrayList<Pair<String, String>> inspect = new ArrayList<Pair<String, String>>();
return inspect;
}
@Override
public LayerType getLayerType() {
return LayerType.Search;
}
} | apache-2.0 |
Evolveum/midpoint-ide-plugins | com.evolveum.midpoint.eclipse.parent/com.evolveum.midpoint.eclipse.ui/src/pcv/PrismItemsParser.java | 20318 | // Generated from C:/midpoint/tgit/general-test/src/pcv\PrismItems.g4 by ANTLR 4.6
package pcv;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class PrismItemsParser extends Parser {
static { RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, PRV=11, PPV=12, NAMESPACE=13, ID=14, WS=15;
public static final int
RULE_start = 0, RULE_item = 1, RULE_prismContainer = 2, RULE_prismReference = 3,
RULE_prismProperty = 4, RULE_pcv = 5, RULE_name = 6;
public static final String[] ruleNames = {
"start", "item", "prismContainer", "prismReference", "prismProperty",
"pcv", "name"
};
private static final String[] _LITERAL_NAMES = {
null, "'PC'", "'('", "')'", "':'", "'['", "','", "']'", "'PrismReference'",
"'PP'", "'PCV'"
};
private static final String[] _SYMBOLIC_NAMES = {
null, null, null, null, null, null, null, null, null, null, null, "PRV",
"PPV", "NAMESPACE", "ID", "WS"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "PrismItems.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public PrismItemsParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class StartContext extends ParserRuleContext {
public ItemContext item() {
return getRuleContext(ItemContext.class,0);
}
public PcvContext pcv() {
return getRuleContext(PcvContext.class,0);
}
public TerminalNode PRV() { return getToken(PrismItemsParser.PRV, 0); }
public TerminalNode PPV() { return getToken(PrismItemsParser.PPV, 0); }
public StartContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_start; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterStart(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitStart(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitStart(this);
else return visitor.visitChildren(this);
}
}
public final StartContext start() throws RecognitionException {
StartContext _localctx = new StartContext(_ctx, getState());
enterRule(_localctx, 0, RULE_start);
try {
setState(18);
_errHandler.sync(this);
switch (_input.LA(1)) {
case T__0:
case T__7:
case T__8:
enterOuterAlt(_localctx, 1);
{
setState(14);
item();
}
break;
case T__9:
enterOuterAlt(_localctx, 2);
{
setState(15);
pcv();
}
break;
case PRV:
enterOuterAlt(_localctx, 3);
{
setState(16);
match(PRV);
}
break;
case PPV:
enterOuterAlt(_localctx, 4);
{
setState(17);
match(PPV);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class ItemContext extends ParserRuleContext {
public PrismContainerContext prismContainer() {
return getRuleContext(PrismContainerContext.class,0);
}
public PrismReferenceContext prismReference() {
return getRuleContext(PrismReferenceContext.class,0);
}
public PrismPropertyContext prismProperty() {
return getRuleContext(PrismPropertyContext.class,0);
}
public ItemContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_item; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterItem(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitItem(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitItem(this);
else return visitor.visitChildren(this);
}
}
public final ItemContext item() throws RecognitionException {
ItemContext _localctx = new ItemContext(_ctx, getState());
enterRule(_localctx, 2, RULE_item);
try {
setState(23);
_errHandler.sync(this);
switch (_input.LA(1)) {
case T__0:
enterOuterAlt(_localctx, 1);
{
setState(20);
prismContainer();
}
break;
case T__7:
enterOuterAlt(_localctx, 2);
{
setState(21);
prismReference();
}
break;
case T__8:
enterOuterAlt(_localctx, 3);
{
setState(22);
prismProperty();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PrismContainerContext extends ParserRuleContext {
public NameContext name() {
return getRuleContext(NameContext.class,0);
}
public List<PcvContext> pcv() {
return getRuleContexts(PcvContext.class);
}
public PcvContext pcv(int i) {
return getRuleContext(PcvContext.class,i);
}
public PrismContainerContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_prismContainer; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterPrismContainer(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitPrismContainer(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitPrismContainer(this);
else return visitor.visitChildren(this);
}
}
public final PrismContainerContext prismContainer() throws RecognitionException {
PrismContainerContext _localctx = new PrismContainerContext(_ctx, getState());
enterRule(_localctx, 4, RULE_prismContainer);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(25);
match(T__0);
setState(26);
match(T__1);
setState(27);
name();
setState(28);
match(T__2);
setState(29);
match(T__3);
setState(30);
match(T__4);
setState(39);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==T__9) {
{
setState(31);
pcv();
setState(36);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
setState(32);
match(T__5);
setState(33);
pcv();
}
}
setState(38);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(41);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PrismReferenceContext extends ParserRuleContext {
public NameContext name() {
return getRuleContext(NameContext.class,0);
}
public List<TerminalNode> PRV() { return getTokens(PrismItemsParser.PRV); }
public TerminalNode PRV(int i) {
return getToken(PrismItemsParser.PRV, i);
}
public PrismReferenceContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_prismReference; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterPrismReference(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitPrismReference(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitPrismReference(this);
else return visitor.visitChildren(this);
}
}
public final PrismReferenceContext prismReference() throws RecognitionException {
PrismReferenceContext _localctx = new PrismReferenceContext(_ctx, getState());
enterRule(_localctx, 6, RULE_prismReference);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(43);
match(T__7);
setState(44);
match(T__1);
setState(45);
name();
setState(46);
match(T__2);
setState(47);
match(T__3);
setState(48);
match(T__4);
setState(57);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==PRV) {
{
setState(49);
match(PRV);
setState(54);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
setState(50);
match(T__5);
setState(51);
match(PRV);
}
}
setState(56);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(59);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PrismPropertyContext extends ParserRuleContext {
public NameContext name() {
return getRuleContext(NameContext.class,0);
}
public List<TerminalNode> PPV() { return getTokens(PrismItemsParser.PPV); }
public TerminalNode PPV(int i) {
return getToken(PrismItemsParser.PPV, i);
}
public PrismPropertyContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_prismProperty; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterPrismProperty(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitPrismProperty(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitPrismProperty(this);
else return visitor.visitChildren(this);
}
}
public final PrismPropertyContext prismProperty() throws RecognitionException {
PrismPropertyContext _localctx = new PrismPropertyContext(_ctx, getState());
enterRule(_localctx, 8, RULE_prismProperty);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(61);
match(T__8);
setState(62);
match(T__1);
setState(63);
name();
setState(64);
match(T__2);
setState(65);
match(T__3);
setState(66);
match(T__4);
setState(75);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==PPV) {
{
setState(67);
match(PPV);
setState(72);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
setState(68);
match(T__5);
setState(69);
match(PPV);
}
}
setState(74);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(77);
match(T__6);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PcvContext extends ParserRuleContext {
public NameContext name() {
return getRuleContext(NameContext.class,0);
}
public TerminalNode ID() { return getToken(PrismItemsParser.ID, 0); }
public List<ItemContext> item() {
return getRuleContexts(ItemContext.class);
}
public ItemContext item(int i) {
return getRuleContext(ItemContext.class,i);
}
public PcvContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_pcv; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterPcv(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitPcv(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitPcv(this);
else return visitor.visitChildren(this);
}
}
public final PcvContext pcv() throws RecognitionException {
PcvContext _localctx = new PcvContext(_ctx, getState());
enterRule(_localctx, 10, RULE_pcv);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(79);
match(T__9);
setState(80);
match(T__1);
{
setState(81);
name();
}
setState(82);
match(T__2);
setState(83);
match(T__3);
setState(97);
_errHandler.sync(this);
switch (_input.LA(1)) {
case T__4:
{
{
setState(84);
match(T__4);
setState(93);
_errHandler.sync(this);
_la = _input.LA(1);
if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << T__0) | (1L << T__7) | (1L << T__8))) != 0)) {
{
setState(85);
item();
setState(90);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==T__5) {
{
{
setState(86);
match(T__5);
setState(87);
item();
}
}
setState(92);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
setState(95);
match(T__6);
}
}
break;
case ID:
{
setState(96);
match(ID);
}
break;
default:
throw new NoViableAltException(this);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class NameContext extends ParserRuleContext {
public TerminalNode ID() { return getToken(PrismItemsParser.ID, 0); }
public TerminalNode NAMESPACE() { return getToken(PrismItemsParser.NAMESPACE, 0); }
public NameContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_name; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).enterName(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof PrismItemsListener ) ((PrismItemsListener)listener).exitName(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof PrismItemsVisitor ) return ((PrismItemsVisitor<? extends T>)visitor).visitName(this);
else return visitor.visitChildren(this);
}
}
public final NameContext name() throws RecognitionException {
NameContext _localctx = new NameContext(_ctx, getState());
enterRule(_localctx, 12, RULE_name);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(100);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==NAMESPACE) {
{
setState(99);
match(NAMESPACE);
}
}
setState(102);
match(ID);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static final String _serializedATN =
"\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\21k\4\2\t\2\4\3\t"+
"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\3\2\5\2\25\n\2"+
"\3\3\3\3\3\3\5\3\32\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\7\4%\n\4\f"+
"\4\16\4(\13\4\5\4*\n\4\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\7\5"+
"\67\n\5\f\5\16\5:\13\5\5\5<\n\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3"+
"\6\3\6\7\6I\n\6\f\6\16\6L\13\6\5\6N\n\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3"+
"\7\3\7\3\7\3\7\7\7[\n\7\f\7\16\7^\13\7\5\7`\n\7\3\7\3\7\5\7d\n\7\3\b\5"+
"\bg\n\b\3\b\3\b\3\b\2\2\t\2\4\6\b\n\f\16\2\2r\2\24\3\2\2\2\4\31\3\2\2"+
"\2\6\33\3\2\2\2\b-\3\2\2\2\n?\3\2\2\2\fQ\3\2\2\2\16f\3\2\2\2\20\25\5\4"+
"\3\2\21\25\5\f\7\2\22\25\7\r\2\2\23\25\7\16\2\2\24\20\3\2\2\2\24\21\3"+
"\2\2\2\24\22\3\2\2\2\24\23\3\2\2\2\25\3\3\2\2\2\26\32\5\6\4\2\27\32\5"+
"\b\5\2\30\32\5\n\6\2\31\26\3\2\2\2\31\27\3\2\2\2\31\30\3\2\2\2\32\5\3"+
"\2\2\2\33\34\7\3\2\2\34\35\7\4\2\2\35\36\5\16\b\2\36\37\7\5\2\2\37 \7"+
"\6\2\2 )\7\7\2\2!&\5\f\7\2\"#\7\b\2\2#%\5\f\7\2$\"\3\2\2\2%(\3\2\2\2&"+
"$\3\2\2\2&\'\3\2\2\2\'*\3\2\2\2(&\3\2\2\2)!\3\2\2\2)*\3\2\2\2*+\3\2\2"+
"\2+,\7\t\2\2,\7\3\2\2\2-.\7\n\2\2./\7\4\2\2/\60\5\16\b\2\60\61\7\5\2\2"+
"\61\62\7\6\2\2\62;\7\7\2\2\638\7\r\2\2\64\65\7\b\2\2\65\67\7\r\2\2\66"+
"\64\3\2\2\2\67:\3\2\2\28\66\3\2\2\289\3\2\2\29<\3\2\2\2:8\3\2\2\2;\63"+
"\3\2\2\2;<\3\2\2\2<=\3\2\2\2=>\7\t\2\2>\t\3\2\2\2?@\7\13\2\2@A\7\4\2\2"+
"AB\5\16\b\2BC\7\5\2\2CD\7\6\2\2DM\7\7\2\2EJ\7\16\2\2FG\7\b\2\2GI\7\16"+
"\2\2HF\3\2\2\2IL\3\2\2\2JH\3\2\2\2JK\3\2\2\2KN\3\2\2\2LJ\3\2\2\2ME\3\2"+
"\2\2MN\3\2\2\2NO\3\2\2\2OP\7\t\2\2P\13\3\2\2\2QR\7\f\2\2RS\7\4\2\2ST\5"+
"\16\b\2TU\7\5\2\2Uc\7\6\2\2V_\7\7\2\2W\\\5\4\3\2XY\7\b\2\2Y[\5\4\3\2Z"+
"X\3\2\2\2[^\3\2\2\2\\Z\3\2\2\2\\]\3\2\2\2]`\3\2\2\2^\\\3\2\2\2_W\3\2\2"+
"\2_`\3\2\2\2`a\3\2\2\2ad\7\t\2\2bd\7\20\2\2cV\3\2\2\2cb\3\2\2\2d\r\3\2"+
"\2\2eg\7\17\2\2fe\3\2\2\2fg\3\2\2\2gh\3\2\2\2hi\7\20\2\2i\17\3\2\2\2\16"+
"\24\31&)8;JM\\_cf";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} | apache-2.0 |
ilyaVishnev/ilyav | chapter_001/src/test/java/ru/job4j/generics/DynamicListTest.java | 1411 | package ru.job4j.generics;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import static org.hamcrest.collection.IsArrayContainingInAnyOrder.arrayContainingInAnyOrder;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
public class DynamicListTest {
@Test
public void whenAddnewElementsThenListgrows() {
DynamicList<Integer> dynamicList = new DynamicList<Integer>();
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
dynamicList.add(new Integer(23));
Iterator<Integer> iterator = dynamicList.iterator();
ArrayList<Integer> list = new ArrayList<>();
while (iterator.hasNext()) {
list.add(iterator.next());
}
ArrayList<Integer> example = new ArrayList<>();
example.addAll(Arrays.asList(23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23));
assertThat(list.toArray(), arrayContainingInAnyOrder(example.toArray()));
}
}
| apache-2.0 |
jalotsav/Sarvam-Sugar | app/src/main/java/com/jalotsav/sarvamsugar/model/MdlOutstanding.java | 1627 | /*
* Copyright 2016 Jalotsav
*
* 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.jalotsav.sarvamsugar.model;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
/**
* Created by JALOTSAV Dev. on 15/9/16.
*/
public class MdlOutstanding {
@SerializedName("method")
String method;
@SerializedName("result")
String result;
@SerializedName("message")
String message;
@SerializedName("data")
ArrayList<MdlOutstandingData> data;
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public ArrayList<MdlOutstandingData> getData() {
return data;
}
public void setData(ArrayList<MdlOutstandingData> data) {
this.data = data;
}
}
| apache-2.0 |
maxirosson/jdroid-incubator | jdroid-incubator-java/src/main/java/com/jdroid/java/mail/MailService.java | 174 | package com.jdroid.java.mail;
public interface MailService {
public void sendMail(String subject, String body, String sender, String recipient) throws MailException;
}
| apache-2.0 |
adarshkhare1/KeyValueStore | src/main/java/com/adarsh/KeyValueStore/Tasks/StorageTaskPool.java | 1650 | package com.adarsh.KeyValueStore.Tasks;
import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class StorageTaskPool {
private static final ExecutorService _DeletePool;
private static final ExecutorService _InsertPool;
private static final ExecutorService _ReadPool;
private static final ExecutorService _UpdatePool;
private static final int _NumberOfThreads = 10;
static {
_DeletePool = Executors.newFixedThreadPool(_NumberOfThreads);
_InsertPool = Executors.newFixedThreadPool(_NumberOfThreads);
_ReadPool = Executors.newFixedThreadPool(_NumberOfThreads);
_UpdatePool = Executors.newFixedThreadPool(_NumberOfThreads);
}
private StorageTaskPool(){
//Making class as singleton.
}
/**
* @param operation
* @return
*/
public static<T> ExecutorCompletionService<T> CreateNewTaskCompletionService(StorageOperation operation){
StorageAction action = operation.getStorageAction();
if(action == StorageAction.Delete) {
return new ExecutorCompletionService<T>(_DeletePool);
}
else if(action == StorageAction.Insert){
return new ExecutorCompletionService<T>(_InsertPool);
}
else if(action == StorageAction.Read){
return new ExecutorCompletionService<T>(_ReadPool);
}
else if(action == StorageAction.Update){
return new ExecutorCompletionService<T>(_UpdatePool);
}
throw new IllegalArgumentException("Unknown Storage Action.");
}
}
| apache-2.0 |
nafae/developer | modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201411/DimensionAttribute.java | 36998 |
package com.google.api.ads.dfp.jaxws.v201411;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DimensionAttribute.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="DimensionAttribute">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="LINE_ITEM_LABELS"/>
* <enumeration value="LINE_ITEM_LABEL_IDS"/>
* <enumeration value="LINE_ITEM_OPTIMIZABLE"/>
* <enumeration value="LINE_ITEM_DELIVERY_PACING"/>
* <enumeration value="LINE_ITEM_FREQUENCY_CAP"/>
* <enumeration value="LINE_ITEM_RECONCILED_RATE"/>
* <enumeration value="ADVERTISER_EXTERNAL_ID"/>
* <enumeration value="ADVERTISER_PRIMARY_CONTACT"/>
* <enumeration value="ORDER_START_DATE_TIME"/>
* <enumeration value="ORDER_END_DATE_TIME"/>
* <enumeration value="ORDER_EXTERNAL_ID"/>
* <enumeration value="ORDER_PO_NUMBER"/>
* <enumeration value="ORDER_IS_PROGRAMMATIC"/>
* <enumeration value="ORDER_AGENCY"/>
* <enumeration value="ORDER_AGENCY_ID"/>
* <enumeration value="ORDER_LABELS"/>
* <enumeration value="ORDER_LABEL_IDS"/>
* <enumeration value="ORDER_TRAFFICKER"/>
* <enumeration value="ORDER_TRAFFICKER_ID"/>
* <enumeration value="ORDER_SECONDARY_TRAFFICKERS"/>
* <enumeration value="ORDER_SALESPERSON"/>
* <enumeration value="ORDER_SECONDARY_SALESPEOPLE"/>
* <enumeration value="ORDER_LIFETIME_IMPRESSIONS"/>
* <enumeration value="ORDER_LIFETIME_CLICKS"/>
* <enumeration value="ORDER_LIFETIME_MERGED_IMPRESSIONS"/>
* <enumeration value="ORDER_LIFETIME_MERGED_CLICKS"/>
* <enumeration value="ORDER_BOOKED_CPM"/>
* <enumeration value="ORDER_BOOKED_CPC"/>
* <enumeration value="LINE_ITEM_START_DATE_TIME"/>
* <enumeration value="LINE_ITEM_END_DATE_TIME"/>
* <enumeration value="LINE_ITEM_EXTERNAL_ID"/>
* <enumeration value="LINE_ITEM_COST_TYPE"/>
* <enumeration value="LINE_ITEM_COST_PER_UNIT"/>
* <enumeration value="LINE_ITEM_CURRENCY_CODE"/>
* <enumeration value="LINE_ITEM_GOAL_QUANTITY"/>
* <enumeration value="LINE_ITEM_SPONSORSHIP_GOAL_PERCENTAGE"/>
* <enumeration value="LINE_ITEM_LIFETIME_IMPRESSIONS"/>
* <enumeration value="LINE_ITEM_LIFETIME_CLICKS"/>
* <enumeration value="LINE_ITEM_LIFETIME_MERGED_IMPRESSIONS"/>
* <enumeration value="LINE_ITEM_LIFETIME_MERGED_CLICKS"/>
* <enumeration value="LINE_ITEM_PRIORITY"/>
* <enumeration value="CREATIVE_OR_CREATIVE_SET"/>
* <enumeration value="MASTER_COMPANION_TYPE"/>
* <enumeration value="LINE_ITEM_CONTRACTED_QUANTITY"/>
* <enumeration value="LINE_ITEM_DISCOUNT"/>
* <enumeration value="LINE_ITEM_NON_CPD_BOOKED_REVENUE"/>
* <enumeration value="ADVERTISER_LABELS"/>
* <enumeration value="ADVERTISER_LABEL_IDS"/>
* <enumeration value="CREATIVE_CLICK_THROUGH_URL"/>
* <enumeration value="CREATIVE_SSL_SCAN_RESULT"/>
* <enumeration value="CREATIVE_SSL_COMPLIANCE_OVERRIDE"/>
* <enumeration value="LINE_ITEM_CREATIVE_START_DATE"/>
* <enumeration value="LINE_ITEM_CREATIVE_END_DATE"/>
* <enumeration value="PROPOSAL_START_DATE_TIME"/>
* <enumeration value="PROPOSAL_END_DATE_TIME"/>
* <enumeration value="PROPOSAL_CREATION_DATE_TIME"/>
* <enumeration value="PROPOSAL_SOLD_DATE_TIME"/>
* <enumeration value="PROPOSAL_IS_SOLD"/>
* <enumeration value="PROPOSAL_PROBABILITY_TO_CLOSE"/>
* <enumeration value="PROPOSAL_STATUS"/>
* <enumeration value="PROPOSAL_ARCHIVAL_STATUS"/>
* <enumeration value="PROPOSAL_CURRENCY"/>
* <enumeration value="PROPOSAL_EXCHANGE_RATE"/>
* <enumeration value="PROPOSAL_AGENCY_COMMISSION_RATE"/>
* <enumeration value="PROPOSAL_VAT_RATE"/>
* <enumeration value="PROPOSAL_DISCOUNT"/>
* <enumeration value="PROPOSAL_ADVERTISER_DISCOUNT"/>
* <enumeration value="PROPOSAL_ADVERTISER"/>
* <enumeration value="PROPOSAL_ADVERTISER_ID"/>
* <enumeration value="PROPOSAL_AGENCIES"/>
* <enumeration value="PROPOSAL_AGENCY_IDS"/>
* <enumeration value="PROPOSAL_PO_NUMBER"/>
* <enumeration value="PROPOSAL_PRIMARY_SALESPERSON"/>
* <enumeration value="PROPOSAL_SECONDARY_SALESPEOPLE"/>
* <enumeration value="PROPOSAL_CREATOR"/>
* <enumeration value="PROPOSAL_SALES_PLANNERS"/>
* <enumeration value="PROPOSAL_PRICING_MODEL"/>
* <enumeration value="PROPOSAL_BILLING_SOURCE"/>
* <enumeration value="PROPOSAL_BILLING_CAP"/>
* <enumeration value="PROPOSAL_BILLING_SCHEDULE"/>
* <enumeration value="PROPOSAL_APPLIED_TEAM_NAMES"/>
* <enumeration value="PROPOSAL_APPROVAL_STAGE"/>
* <enumeration value="PROPOSAL_INVENTORY_RELEASE_DATE_TIME"/>
* <enumeration value="PROPOSAL_LOCAL_BUDGET"/>
* <enumeration value="PROPOSAL_LOCAL_REMAINING_BUDGET"/>
* <enumeration value="PROPOSAL_LINE_ITEM_START_DATE_TIME"/>
* <enumeration value="PROPOSAL_LINE_ITEM_END_DATE_TIME"/>
* <enumeration value="PROPOSAL_LINE_ITEM_RATE_TYPE"/>
* <enumeration value="PROPOSAL_LINE_ITEM_COST_PER_UNIT"/>
* <enumeration value="PROPOSAL_LINE_ITEM_LOCAL_COST_PER_UNIT"/>
* <enumeration value="PROPOSAL_LINE_ITEM_COST_PER_UNIT_GROSS"/>
* <enumeration value="PROPOSAL_LINE_ITEM_LOCAL_COST_PER_UNIT_GROSS"/>
* <enumeration value="PROPOSAL_LINE_ITEM_TYPE_AND_PRIORITY"/>
* <enumeration value="PROPOSAL_LINE_ITEM_SIZE"/>
* <enumeration value="PROPOSAL_LINE_ITEM_ARCHIVAL_STATUS"/>
* <enumeration value="PROPOSAL_LINE_ITEM_PRODUCT_ADJUSTMENT"/>
* <enumeration value="PROPOSAL_LINE_ITEM_BUFFER"/>
* <enumeration value="PROPOSAL_LINE_ITEM_TARGET_RATE_NET"/>
* <enumeration value="PROPOSAL_LINE_ITEM_BILLING_SOURCE"/>
* <enumeration value="PROPOSAL_LINE_ITEM_BILLING_CAP"/>
* <enumeration value="PROPOSAL_LINE_ITEM_BILLING_SCHEDULE"/>
* <enumeration value="PROPOSAL_LINE_ITEM_GOAL_PERCENTAGE"/>
* <enumeration value="PROPOSAL_LINE_ITEM_COST_ADJUSTMENT"/>
* <enumeration value="PROPOSAL_LINE_ITEM_COMMENTS"/>
* <enumeration value="PRODUCT_TEMPLATE_RATE_TYPE"/>
* <enumeration value="PRODUCT_TEMPLATE_STATUS"/>
* <enumeration value="PRODUCT_TEMPLATE_TYPE_AND_PRIORITY"/>
* <enumeration value="PRODUCT_TEMPLATE_PRODUCT_TYPE"/>
* <enumeration value="PRODUCT_TEMPLATE_DESCRIPTION"/>
* <enumeration value="PRODUCT_PRODUCT_TEMPLATE_NAME"/>
* <enumeration value="PRODUCT_RATE_TYPE"/>
* <enumeration value="PRODUCT_STATUS"/>
* <enumeration value="PRODUCT_TYPE_AND_PRIORITY"/>
* <enumeration value="PRODUCT_PRODUCT_TYPE"/>
* <enumeration value="PRODUCT_NOTES"/>
* <enumeration value="PROPOSAL_AGENCY_TYPE"/>
* <enumeration value="PROPOSAL_AGENCY_CREDIT_STATUS"/>
* <enumeration value="PROPOSAL_AGENCY_EXTERNAL_ID"/>
* <enumeration value="PROPOSAL_AGENCY_COMMENT"/>
* <enumeration value="SALESPEOPLE_PROPOSAL_CONTRIBUTION"/>
* <enumeration value="SALESPERSON_PROPOSAL_CONTRIBUTION"/>
* <enumeration value="CONTENT_CMS_NAME"/>
* <enumeration value="CONTENT_CMS_VIDEO_ID"/>
* <enumeration value="AD_UNIT_CODE"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "DimensionAttribute")
@XmlEnum
public enum DimensionAttribute {
/**
*
* Represents {@link LineItem#effectiveAppliedLabels} as a comma separated list of
* {@link Label#name} for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_LABELS,
/**
*
* Represents {@link LineItem#effectiveAppliedLabels} as a comma separated list of
* {@link Label#id} for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_LABEL_IDS,
/**
*
* Generated as {@code true} for {@link Dimension#LINE_ITEM_NAME} which is eligible
* for optimization, {@code false} otherwise.
* Can be used for filtering.
*
*
*/
LINE_ITEM_OPTIMIZABLE,
/**
*
* Represents {@link LineItem#deliveryRateType} for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_DELIVERY_PACING,
/**
*
* Represents {@link LineItem#frequencyCaps} as a comma separated list of
* "{@link FrequencyCap#maxImpressions} impressions per/every {@link FrequencyCap#numTimeUnits}
* {@link FrequencyCap#timeUnit}" (e.g. "10 impressions every day,500 impressions per lifetime")
* for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_FREQUENCY_CAP,
/**
*
* Represents the monthly reconciled rate of the line item for {@link Dimension#LINE_ITEM_NAME}
* and {@link Dimension#MONTH_AND_YEAR}.
*
*
*/
LINE_ITEM_RECONCILED_RATE,
/**
*
* Represents {@link Company#externalId} for {@link Dimension#ADVERTISER_NAME}.
*
*
*/
ADVERTISER_EXTERNAL_ID,
/**
*
* Represents name and email address in the form of name(email) of primary contact for
* {@link Dimension#ADVERTISER_NAME}.
*
*
*/
ADVERTISER_PRIMARY_CONTACT,
/**
*
* Represents {@link Order#startDateTime} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_START_DATE_TIME,
/**
*
* Represents {@link Order#endDateTime} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_END_DATE_TIME,
/**
*
* Represents {@link Order#externalOrderId} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_EXTERNAL_ID,
/**
*
* Represents {@link Order#poNumber} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_PO_NUMBER,
/**
*
* Represents {@link Order#orderIsProgrammatic} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_IS_PROGRAMMATIC,
/**
*
* Represents the name of {@link Order#agencyId} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_AGENCY,
/**
*
* Represents {@link Order#agencyId} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_AGENCY_ID,
/**
*
* Represents {@link Order#effectiveAppliedLabels} as a comma separated list of
* {@link Label#name} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_LABELS,
/**
*
* Represents {@link Order#effectiveAppliedLabels} as a comma separated list of
* {@link Label#id} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_LABEL_IDS,
/**
*
* The name and email address in the form of name(email) of the trafficker for
* {@link Dimension#ORDER_NAME}
*
*
*/
ORDER_TRAFFICKER,
/**
*
* Represents {@link Order#traffickerId} for {@link Dimension#ORDER_NAME}.
* Can be used for filtering.
*
*
*/
ORDER_TRAFFICKER_ID,
/**
*
* The names and email addresses as a comma separated list of name(email) of the
* {@link Order#secondaryTraffickerIds} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_SECONDARY_TRAFFICKERS,
/**
*
* The name and email address in the form of name(email) of the
* {@link Order#salespersonId} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_SALESPERSON,
/**
*
* The names and email addresses as a comma separated list of name(email) of the
* {@link Order#secondarySalespersonIds} for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_SECONDARY_SALESPEOPLE,
/**
*
* The total number of impressions delivered over the lifetime of an
* {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_LIFETIME_IMPRESSIONS,
/**
*
* The total number of clicks delivered over the lifetime of an
* {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_LIFETIME_CLICKS,
/**
*
* The lifetime impressions for {@link Dimension#ORDER_NAME} delivered by both DART
* and DoubleClick for Publishers ad servers. This is only available for
* networks that have been upgraded from the old to the new system.
*
*
*/
ORDER_LIFETIME_MERGED_IMPRESSIONS,
/**
*
* The lifetime clicks for {@link Dimension#ORDER_NAME} delivered by both DART and
* DoubleClick for Publishers ad servers. This is only available for networks
* that have been upgraded from the old to the new system.
*
*
*/
ORDER_LIFETIME_MERGED_CLICKS,
/**
*
* The cost of booking all the CPM ads for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_BOOKED_CPM,
/**
*
* The cost of booking all the CPC ads for {@link Dimension#ORDER_NAME}.
*
*
*/
ORDER_BOOKED_CPC,
/**
*
* Represents {@link LineItem#startDateTime} for {@link Dimension#LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
LINE_ITEM_START_DATE_TIME,
/**
*
* Represents {@link LineItem#endDateTime} for {@link Dimension#LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
LINE_ITEM_END_DATE_TIME,
/**
*
* Represents {@link LineItem#externalId} for {@link Dimension#LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
LINE_ITEM_EXTERNAL_ID,
/**
*
* Represents {@link LineItem#costType} for {@link Dimension#LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
LINE_ITEM_COST_TYPE,
/**
*
* Represents {@link LineItem#costPerUnit} for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_COST_PER_UNIT,
/**
*
* Represents the 3 letter currency code for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_CURRENCY_CODE,
/**
*
* The total number of impressions, clicks or days that is reserved
* for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_GOAL_QUANTITY,
/**
*
* The ratio between the goal quantity for {@link Dimension#LINE_ITEM_NAME} of
* {@link LineItemType#SPONSORSHIP} and the {@link #LINE_ITEM_GOAL_QUANTITY}.
* Represented as a number between 0..100.
*
*
*/
LINE_ITEM_SPONSORSHIP_GOAL_PERCENTAGE,
/**
*
* The total number of impressions delivered over the lifetime of a
* {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_LIFETIME_IMPRESSIONS,
/**
*
* The total number of clicks delivered over the lifetime of a
* {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_LIFETIME_CLICKS,
/**
*
* The lifetime impressions for {@link Dimension#LINE_ITEM_NAME} delivered by
* both DART and DoubleClick for Publishers ad servers. This is only available
* for networks that have been upgraded from the old to the new system.
*
*
*/
LINE_ITEM_LIFETIME_MERGED_IMPRESSIONS,
/**
*
* The lifetime clicks for {@link Dimension#LINE_ITEM_NAME} delivered by both
* DART and DoubleClick for Publishers ad servers. This is only available for
* networks that have been upgraded from the old to the new system.
*
*
*/
LINE_ITEM_LIFETIME_MERGED_CLICKS,
/**
*
* Represents {@link LineItem#priority} for {@link Dimension#LINE_ITEM_NAME} as
* a value between 1 and 16.
* Can be used for filtering.
*
*
*/
LINE_ITEM_PRIORITY,
/**
*
* Indicates if a creative is a regular creative or creative set.
* Values will be 'Creative' or 'Creative set'
*
*
*/
CREATIVE_OR_CREATIVE_SET,
/**
*
* The type of creative in a creative set - master or companion.
*
*
*/
MASTER_COMPANION_TYPE,
/**
*
* Represents the {@link LineItem#contractedUnitsBought} quantity
* for {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_CONTRACTED_QUANTITY,
/**
*
* Represents the {@link LineItem#discount} for {@link Dimension#LINE_ITEM_NAME}.
* The number is either a percentage or an absolute value depending on
* {@link LineItem#discountType}.
*
*
*/
LINE_ITEM_DISCOUNT,
/**
*
* The cost of booking for a non-CPD {@link Dimension#LINE_ITEM_NAME}.
*
*
*/
LINE_ITEM_NON_CPD_BOOKED_REVENUE,
/**
*
* Represents {@link Company#appliedLabels} as a comma separated list of
* {@link Label#name} for {@link Dimension#ADVERTISER_NAME}.
*
*
*/
ADVERTISER_LABELS,
/**
*
* Represents {@link Company#appliedLabels} as a comma separated list of
* {@link Label#id} for {@link Dimension#ADVERTISER_NAME}.
*
*
*/
ADVERTISER_LABEL_IDS,
/**
*
* Represents the click-through URL for {@link Dimension#CREATIVE_NAME}.
*
*
*/
CREATIVE_CLICK_THROUGH_URL,
/**
*
* Represents whether a creative is SSL-compliant.
*
*
*/
CREATIVE_SSL_SCAN_RESULT,
/**
*
* Represents whether a creative's SSL status was overridden.
*
*
*/
CREATIVE_SSL_COMPLIANCE_OVERRIDE,
/**
*
* Represents a {@link LineItemCreativeAssociation#startDateTime} for a
* {@link Dimension#LINE_ITEM_NAME} and a {@link Dimension#CREATIVE_NAME}.
* Includes the date without the time.
*
*
*/
LINE_ITEM_CREATIVE_START_DATE,
/**
*
* Represents a {@link LineItemCreativeAssociation#endDateTime} for a
* {@link Dimension#LINE_ITEM_NAME} and a {@link Dimension#CREATIVE_NAME}.
* Includes the date without the time.
*
*
*/
LINE_ITEM_CREATIVE_END_DATE,
/**
*
* Represents {@link Proposal#startDateTime} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_START_DATE_TIME,
/**
*
* Represents {@link Proposal#endDateTime} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_END_DATE_TIME,
/**
*
* Represents {@link Proposal#creationDateTime} for {@link Dimension#PROPOSAL_NAME}. Can be used
* for filtering.
*
*
*/
PROPOSAL_CREATION_DATE_TIME,
/**
*
* Represents the sold time for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_SOLD_DATE_TIME,
/**
*
* Represents {@link Proposal#isSold} for {@link Dimension#PROPOSAL_NAME}.
* Can be used for filtering.
*
*
*/
PROPOSAL_IS_SOLD,
/**
*
* Represents {@link Proposal#probabilityToClose} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_PROBABILITY_TO_CLOSE,
/**
*
* Represents {@link Proposal#status} for {@link Dimension#PROPOSAL_NAME}, including those
* post-sold status, e.g. DRAFT(SOLD). Can be used for filtering.
*
*
*/
PROPOSAL_STATUS,
/**
*
* Represents {@link Proposal#isArchived} for {@link Dimension#PROPOSAL_NAME}.
* Can be used for filtering.
*
*
*/
PROPOSAL_ARCHIVAL_STATUS,
/**
*
* Represents {@link Proposal#currency} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_CURRENCY,
/**
*
* Represents {@link Proposal#exchangeRate} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_EXCHANGE_RATE,
/**
*
* Represents {@link Proposal#agencyCommission} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_AGENCY_COMMISSION_RATE,
/**
*
* Represents {@link Proposal#valueAddedTax} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_VAT_RATE,
/**
*
* Represents {@link Proposal#proposalDiscount} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_DISCOUNT,
/**
*
* Represents {@link Proposal#advertiserDiscount} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_ADVERTISER_DISCOUNT,
/**
*
* Represents the advertiser name of {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_ADVERTISER,
/**
*
* Represents the advertiser id of {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_ADVERTISER_ID,
/**
*
* Represents the agency names as a comma separated string for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_AGENCIES,
/**
*
* Represents the agency ids as a comma separated string for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_AGENCY_IDS,
/**
*
* Represents {@link Proposal#poNumber} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_PO_NUMBER,
/**
*
* Represents name and email address in the form of name(email) of primary salesperson for
* {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_PRIMARY_SALESPERSON,
/**
*
* Represents name and email addresses in the form of name(email) of secondary salespeople as a
* comma separated string for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_SECONDARY_SALESPEOPLE,
/**
*
* Represents name and email address in the form of name(email) of creator for
* {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_CREATOR,
/**
*
* Represents name and email addresses in the form of name(email) of
* {@link Proposal#salesPlannerIds} as a comma separated list string for
* {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_SALES_PLANNERS,
/**
*
* Represents {@link Proposal#pricingModel} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_PRICING_MODEL,
/**
*
* Represents {@link Proposal#billingSource} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_BILLING_SOURCE,
/**
*
* Represents {@link Proposal#billingCap} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_BILLING_CAP,
/**
*
* Represents {@link Proposal#billingSchedule} for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_BILLING_SCHEDULE,
/**
*
* Represents {@link Proposal#appliedTeamIds} as a comma separated list of
* {@link Team#name}s for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_APPLIED_TEAM_NAMES,
/**
*
* Represents the approval stage for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_APPROVAL_STAGE,
/**
*
* Represents the inventory release date time for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_INVENTORY_RELEASE_DATE_TIME,
/**
*
* Represents {@link Proposal#budget} in local currency for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_LOCAL_BUDGET,
/**
*
* Represents the remaining budget in local currency for {@link Dimension#PROPOSAL_NAME}.
*
*
*/
PROPOSAL_LOCAL_REMAINING_BUDGET,
/**
*
* Represents {@link ProposalLineItem#startDateTime} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_START_DATE_TIME,
/**
*
* Represents {@link ProposalLineItem#endDateTime} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_END_DATE_TIME,
/**
*
* Represents {@link ProposalLineItem#rateType} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
PROPOSAL_LINE_ITEM_RATE_TYPE,
/**
*
* Represents {@link ProposalLineItem#costPerUnit} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_COST_PER_UNIT,
/**
*
* Represents {@link ProposalLineItem#costPerUnit} in local currency for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
* See {@link #PROPOSAL_LINE_ITEM_COST_PER_UNIT}
*
*
*/
PROPOSAL_LINE_ITEM_LOCAL_COST_PER_UNIT,
/**
*
* Represents gross cost per unit for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_COST_PER_UNIT_GROSS,
/**
*
* Represents gross cost per unit in local currency for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
* See {@link #PROPOSAL_LINE_ITEM_COST_PER_UNIT_GROSS}
*
*
*/
PROPOSAL_LINE_ITEM_LOCAL_COST_PER_UNIT_GROSS,
/**
*
* Represents line item type (if applicable) and line item priority (if applicable) for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_TYPE_AND_PRIORITY,
/**
*
* Represents the size of {@link ProposalLineItem#creativePlaceholders}
* for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_SIZE,
/**
*
* Represents {@link ProposalLineItem#isArchived} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
* Can be used for filtering.
*
*
*/
PROPOSAL_LINE_ITEM_ARCHIVAL_STATUS,
/**
*
* Represents the product adjustment of {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_PRODUCT_ADJUSTMENT,
/**
*
* Represents {@link ProposalLineItem#unitsBoughtBuffer} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_BUFFER,
/**
*
* Represents the target rate (net) of {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_TARGET_RATE_NET,
/**
*
* Represents {@link ProposalLineItem#billingSource} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_BILLING_SOURCE,
/**
*
* Represents {@link ProposalLineItem#billingCap} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_BILLING_CAP,
/**
*
* Represents {@link ProposalLineItem#billingSchedule} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_BILLING_SCHEDULE,
/**
*
* Represents {@link ProposalLineItem#unitsBought} for {@link Dimension#PROPOSAL_LINE_ITEM_NAME}
* The attribute is available only if {@link ProposalLineItem#lineItemType} is of type
* {@link LineItemType#SPONSORSHIP}, {@link LineItemType#HOUSE}, {@link LineItemType#NETWORK}, or
* {@link LineItemType#BUMPER}.
*
*
*/
PROPOSAL_LINE_ITEM_GOAL_PERCENTAGE,
/**
*
* Represents {@link ProposalLineItem#costAdjustment} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_COST_ADJUSTMENT,
/**
*
* Represents the {@link ProposalLineItem#notes comments} for
* {@link Dimension#PROPOSAL_LINE_ITEM_NAME}.
*
*
*/
PROPOSAL_LINE_ITEM_COMMENTS,
/**
*
* Represents {@link ProductTemplate#rateType} for {@link Dimension#PRODUCT_TEMPLATE_NAME}.
*
*
*/
PRODUCT_TEMPLATE_RATE_TYPE,
/**
*
* Represents {@link ProductTemplate#status} for {@link Dimension#PRODUCT_TEMPLATE_NAME}.
*
*
*/
PRODUCT_TEMPLATE_STATUS,
/**
*
* Represents the line item type (if applicable) and line item priority
* (if applicable) of {@link Dimension#PRODUCT_TEMPLATE_NAME}.
*
*
*/
PRODUCT_TEMPLATE_TYPE_AND_PRIORITY,
/**
*
* Represents {@link ProductTemplate#productType} for {@link Dimension#PRODUCT_TEMPLATE_NAME}.
*
*
*/
PRODUCT_TEMPLATE_PRODUCT_TYPE,
/**
*
* Represents {@link ProductTemplate#description} for {@link Dimension#PRODUCT_TEMPLATE_NAME}.
*
*
*/
PRODUCT_TEMPLATE_DESCRIPTION,
/**
*
* Represents the product template's name of {@link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_PRODUCT_TEMPLATE_NAME,
/**
*
* Represents {@link Product#rateType} for {@link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_RATE_TYPE,
/**
*
* Represents {@link Product#status} for {@link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_STATUS,
/**
*
* Represents the line item type (if applicable) and line item priority
* (if applicable) of {@link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_TYPE_AND_PRIORITY,
/**
*
* Represents the product type of {@link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_PRODUCT_TYPE,
/**
*
* Represents {@link Product#notes} for {@Link Dimension#PRODUCT_NAME}.
*
*
*/
PRODUCT_NOTES,
/**
*
* Represents the {@link Company#type} of {@link Dimension#PROPOSAL_AGENCY_NAME}.
*
*
*/
PROPOSAL_AGENCY_TYPE,
/**
*
* Represents the {@link Company#creditStatus} of {@link Dimension#PROPOSAL_AGENCY_NAME}.
*
*
*/
PROPOSAL_AGENCY_CREDIT_STATUS,
/**
*
* Represents {@link Company#externalId} for {@link Dimension#PROPOSAL_AGENCY_NAME}.
*
*
*/
PROPOSAL_AGENCY_EXTERNAL_ID,
/**
*
* Represents {@link Company#comment} for {@link Dimension#PROPOSAL_AGENCY_NAME}.
*
*
*/
PROPOSAL_AGENCY_COMMENT,
/**
*
* Represents the {@link Dimension#ALL_SALESPEOPLE_NAME}'s contribution to a
* {@link Dimension#PROPOSAL_NAME}. This is different from
* {@link #SALESPERSON_PROPOSAL_CONTRIBUTION} as this will include both primary and
* secondary salespeople.
*
*
*/
SALESPEOPLE_PROPOSAL_CONTRIBUTION,
/**
*
* Represents the {@link Dimension#SALESPERSON_NAME}'s contribution to a
* {@link Dimension#PROPOSAL_NAME}.
*
* See {@link #SALESPERSON_PROPOSAL_CONTRIBUTION}.
*
*
*/
SALESPERSON_PROPOSAL_CONTRIBUTION,
/**
*
* Represents the {@link CmsContent#displayName} within the first element of
* {@link Content#cmsContent} for {@link Dimension#CONTENT_NAME}.
*
*
*/
CONTENT_CMS_NAME,
/**
*
* Represents the {@link CmsContent#cmsContentId} within the first element of
* {@link Content#cmsContent} for {@link Dimension#CONTENT_NAME}.
*
*
*/
CONTENT_CMS_VIDEO_ID,
/**
*
* Represents {@link AdUnit#adUnitCode} for {@link Dimension#AD_UNIT_NAME}.
*
*
*/
AD_UNIT_CODE;
public String value() {
return name();
}
public static DimensionAttribute fromValue(String v) {
return valueOf(v);
}
}
| apache-2.0 |