Diff
stringlengths 5
2k
| FaultInducingLabel
int64 0
1
|
---|---|
import org.apache.ambari.server.state.Config;
Map<String, String> kerberosConfiguration = getConfigurationProperties("kerberos-env");
/**
* Retrieve the current set of properties for the requested config type for the relevant cluster.
*
* @return a Map of property names to property values for the requested config type; or null if no data is found
* @throws AmbariException if an error occurs retrieving the relevant cluster details
*/
protected Map<String, String> getConfigurationProperties(String configType) throws AmbariException {
if (StringUtils.isNotEmpty(configType)) {
Cluster cluster = getCluster();
Config config = (cluster == null) ? null : cluster.getDesiredConfigByType(configType);
Map<String, String> properties = (config == null) ? null : config.getProperties();
if (properties == null) {
LOG.warn("The '{}' configuration data is not available:" +
"\n\tcluster: {}" +
"\n\tconfig: {}" +
"\n\tproperties: null",
configType,
(cluster == null) ? "null" : "not null",
(config == null) ? "null" : "not null");
}
return properties;
} else {
return null;
}
}
| 0 |
* 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 | 0 |
import org.apache.accumulo.core.clientImpl.ClientInfo; | 0 |
/**
* 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. | 0 |
/*
* 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.commons.configuration.io;
import java.net.URL;
import org.apache.commons.lang3.StringUtils;
/**
* <p>
* A specialized {@code FileLocationStrategy} implementation which searches for
* files on the class path.
* </p>
* <p>
* This strategy implementation ignores the URL and the base path components of
* the passed in {@link FileLocator}. It tries to look up the file name on both
* the class path and the system class path.
* </p>
*
* @version $Id: $
* @since 2.0
*/
public class ClasspathLocationStrategy implements FileLocationStrategy
{
/**
* {@inheritDoc} This implementation looks up the locator's file name as a
* resource on the class path.
*/
public URL locate(FileSystem fileSystem, FileLocator locator)
{
return StringUtils.isEmpty(locator.getFileName()) ? null
: FileLocatorUtils.locateFromClasspath(locator.getFileName());
}
} | 0 |
* 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 | 0 |
cmd.setBackgroundCommand(true); | 0 |
* The description container holds all {@link ComponentContainer}s.
/** The list of {@link ComponentContainer}s. */
private final List<ComponentContainer> containers = new ArrayList<ComponentContainer>();
/**
* Constructor
* @param options The options for this module
*/
/**
* Get the options
* @return The options
*/
* Return the list of {@link ComponentContainer}s.
return this.containers;
* Add a container to the list.
public void add(final ComponentContainer c) {
this.containers.add(c);
return "DescriptionContainer [options=" + options + ", containers=" + containers + "]"; | 0 |
public void testKillTasksImmediate() throws Exception {
expect(scheduler.getTasks(capture(queryCapture)))
.andReturn(ImmutableSet.<ScheduledTask>of());
control.replay();
KillResponse response = thriftInterface.killTasks(query, SESSION);
assertEquals(ResponseCode.OK, response.getResponseCode());
assertEquals(queryCapture.getValue().base(), query);
assertEquals(killQueryCapture.getValue().base(), query);
}
@Test
public void testKillTasksDelayed() throws Exception {
TaskQuery query = new TaskQuery()
.setOwner(ROLE_IDENTITY)
.setJobName("foo_job");
ScheduledTask task = new ScheduledTask()
.setAssignedTask(new AssignedTask()
.setTask(new TwitterTaskInfo()
.setOwner(ROLE_IDENTITY)));
expectAdminAuth(false);
expectAuth(ROLE, true);
Capture<Query> queryCapture = new Capture<Query>();
expect(scheduler.getTasks(capture(queryCapture)))
.andReturn(ImmutableSet.of(task));
Capture<Query> killQueryCapture = new Capture<Query>();
scheduler.killTasks(capture(killQueryCapture), eq(USER));
expect(scheduler.getTasks(capture(queryCapture)))
.andReturn(ImmutableSet.of(task)).times(2);
expect(scheduler.getTasks(capture(queryCapture)))
.andReturn(ImmutableSet.<ScheduledTask>of());
expect(scheduler.getTasks(capture(killQueryCapture)))
.andReturn(ImmutableSet.<ScheduledTask>of()); | 0 |
public class FileChangeEvent {
public FileChangeEvent(final FileObject file) {
*
public FileObject getFile() { | 1 |
Set<Resource> setResources = new HashSet<>();
Set<Resource> setResources = new HashSet<>(); | 0 |
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @version CVS $Id: DeliImpl.java,v 1.10 2004/03/05 13:01:55 bdelacretaz Exp $ | 1 |
@Deprecated | 0 |
import javax.xml.namespace.QName;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.stax.ext.XMLSecurityConstants;
import org.apache.xml.security.stax.ext.stax.XMLSecEvent;
void addWrappedToken(InboundSecurityToken securityToken);
* Returns the absolute path to the XMLElement
* @return A list containing full qualified element names
List<QName> getElementPath();
/**
* Returns the first XMLEvent for this token
*
* @return
*/
XMLSecEvent getXMLSecEvent();
/**
* Returns if the token is included in the message or not
* @return true if the token is included false otherwise
*/
boolean isIncludedInMessage(); | 0 |
MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
replay(maintHelper, injector, clusters, cluster, service, response);
MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
replay(maintHelper, injector, clusters, cluster);
MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class);
expect(injector.getInstance(MaintenanceStateHelper.class)).andReturn(maintHelper);
replay(maintHelper, injector, clusters, cluster, service1, service2,
response, response2); | 0 |
* A Spark {@link Source} that is tailored to expose an {@link AggregatorMetric}, wrapping an
* underlying {@link NamedAggregators} instance. | 1 |
GcsOptions gcsOptions = options.as(GcsOptions.class);
String gcpTempLocation = gcsOptions.getGcpTempLocation();
gcsOptions.getPathValidator().validateOutputFilePrefixSupported(gcpTempLocation); | 0 |
package com.twitter.mesos.scheduler.storage.db;
import java.io.IOException;
import java.net.URL;
import java.util.logging.Logger;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Utilities for dealing with DbStorage operations.
*
* @author John Sirois
*/
public final class DbStorageUtil {
private static final Logger LOG = Logger.getLogger(DbStorageUtil.class.getName());
private DbStorageUtil() {
// utility
}
/**
* Executes the sql defined in a resource file against the database covered by jdbcTemplate.
*
* @param jdbcTemplate The {@code JdbcTemplate} object to execute database operation against.
* @param contextClass A class whose package will be used as the base to search for the
* {@code sqlResourcePath}.
* @param sqlResourcePath The path to resource relative to the package of {@code contextClass}.
*/
public static void executeSql(JdbcTemplate jdbcTemplate, Class<?> contextClass,
String sqlResourcePath, boolean logSql) {
URL sqlUrl = Resources.getResource(contextClass, sqlResourcePath);
jdbcTemplate.execute(String.format("RUNSCRIPT FROM '%s'", sqlUrl));
if (logSql) {
try {
LOG.info(Resources.toString(sqlUrl, Charsets.UTF_8));
} catch (IOException e) {
LOG.warning("Failed to log sql that was successfully applied to db from: " + sqlUrl);
}
}
}
} | 0 |
} else {
// If force_toggle_kerberos is not specified, null will be returned. Therefore, perform an
// equals check to yield true if the result is Boolean.TRUE, otherwise false.
boolean forceToggleKerberos = kerberosHelper.getForceToggleKerberosDirective(requestProperties);
if (forceToggleKerberos || (cluster.getSecurityType() != securityType)) {
LOG.info("Received cluster security type change request from {} to {} (forced: {})",
cluster.getSecurityType().name(), securityType.name(), forceToggleKerberos);
if ((securityType == SecurityType.KERBEROS) || (securityType == SecurityType.NONE)) {
if (!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, cluster.getResourceId(), EnumSet.of(RoleAuthorization.CLUSTER_TOGGLE_KERBEROS))) {
throw new AuthorizationException("The authenticated user does not have authorization to enable or disable Kerberos");
}
// Since the security state of the cluster has changed, invoke toggleKerberos to handle
// adding or removing Kerberos from the cluster. This may generate multiple stages
// or not depending the current state of the cluster.
try {
requestStageContainer = kerberosHelper.toggleKerberos(cluster, securityType, requestStageContainer,
kerberosHelper.getManageIdentitiesDirective(requestProperties));
} catch (KerberosOperationException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
} else {
throw new IllegalArgumentException(String.format("Unexpected security type encountered: %s", securityType.name()));
cluster.setSecurityType(securityType);
} | 0 |
public String getElementTypeName() {
return elementTypeName;
}
public int getMinCount() {
return minCount;
}
public int getMaxCount() {
return maxCount;
}
public AtlasType getElementType() {
return elementType;
}
| 0 |
protected Attribute(final byte tag, final int name_index, final int length, final ConstantPool constant_pool)
public void dump(final DataOutputStream file) throws IOException
public static void addAttributeReader(final String name, final AttributeReader r)
public static void addAttributeReader(final String name, final UnknownAttributeReader r)
public static void removeAttributeReader(final String name)
public static Attribute readAttribute(final DataInputStream file, final ConstantPool constant_pool)
public static Attribute readAttribute(final DataInput file, final ConstantPool constant_pool)
public final void setLength(final int length)
public final void setNameIndex(final int name_index)
public final void setConstantPool(final ConstantPool constant_pool) | 0 |
if (o instanceof MockServer)
return name.compareTo(((MockServer) o).name);
if (newLoggers.size() >= numberOfLoggers)
break;
if (!result.containsKey(logger))
result.put(logger, 0); | 1 |
import org.apache.felix.dm.DependencyManager;
mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version(Base.OSGI_SPEC_VERSION), | 0 |
cleanup.set(null);
| 0 |
return Integer.valueOf(((Number) arg).intValue());
return Integer.valueOf(arg.toString()); | 0 |
package org.apache.hc.core5.benchmark; | 0 |
// try {
// System.out.println(FileSystemUtils.getFreeSpace("C:\\"));
// } catch (IOException ex) {
// ex.printStackTrace();
// }
assertEquals(true, FileSystemUtils.getFreeSpace("/") > 0); | 0 |
/*
* 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.commons.vfs;
/**
* delivers a file-not-folder exception which happens when trying to issue {@link org.apache.commons.vfs.FileObject#getChildren()} on a file.
*/
public class FileTypeHasNoContentException extends FileSystemException
{
public FileTypeHasNoContentException(final Object info0)
{
super("vfs.provider/read-not-file.error", info0);
}
public FileTypeHasNoContentException(Object info0, Throwable throwable)
{
super("vfs.provider/read-not-file.error", info0, throwable);
} | 0 |
* @param opts The FileSystemOptions.
* @param opts The FileSystemOptions
* @return The FTPFileEntryParserFactory.
* @param opts The FileSystemOptions.
* @param key The key.
* @param opts The FileSystemOptions.
* @return The key.
* @param opts The FileSystemOptions.
* @param passiveMode true if passive mode should be used, false otherwise.
* @param opts The FileSystemOptions.
* @return true if passive mode is being used.
* @param opts The FileSystemOptions.
* @param userDirIsRoot true if the user directory should be the root.
* @param opts The FileSystemOptions.
* @return true if the user directory is the root.
* @param opts The FileSystemOptions.
* @param ftpsType The file type.
* @param opts The FileSystemOptions.
* @return The file type.
* @param opts The FileSystemOptions.
* @return The timeout value.
* @param opts The FileSystemOptions.
* @param dataTimeout The timeout value.
* @param opts The FileSystemOptions.
* @return The language code.
* @param opts The FileSystemOptions.
* @param serverLanguageCode the language code.
* @param opts The FileSystemOptions.
* @return The default date format.
* @param opts The FileSystemOptions.
* @param defaultDateFormat The default date format.
* @param opts The FileSystemOptions.
* @return The recent date format.
* @param opts The FileSystemOptions
* @param recentDateFormat The recent date format.
* @param opts The FileSystemOptions.
* @return The server timezone id.
* @param opts The FileSystemOptions.
* @param serverTimeZoneId The server's timezone id.
* @param opts The FileSystemOptions.
* @return An array of short month names.
* @param opts The FileSystemOptions.
* @param shortMonthNames An array of short month names. | 0 |
import org.apache.beam.vendor.guava.v20_0.com.google.common.base.Splitter; | 0 |
@Override | 0 |
/**
* Key used to retrieve the value of the server identification string if not default.
*/
String SERVER_IDENTIFICATION = "server-identification";
* Retrieve the <code>FileSystemFactory</code> to be used to traverse the file system.
*
* @return a valid <code>FileSystemFactory</code> object or <code>null</code> if commands
* are not supported on this server
*/
FileSystemFactory getFileSystemFactory();
/** | 0 |
* @throws IOException if an input/output error occurs | 0 |
/*******************************************************************************
* Copyright (c) 2010 Neil Bartlett.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Neil Bartlett - initial API and implementation
*******************************************************************************/
package aQute.bnd.build.model.clauses;
import org.osgi.framework.Constants;
import aQute.libg.header.Attrs;
public class ImportPattern extends VersionedClause implements Cloneable {
public ImportPattern(String pattern, Attrs attributes) {
super(pattern, attributes);
}
public boolean isOptional() {
String resolution = attribs.get(aQute.lib.osgi.Constants.RESOLUTION_DIRECTIVE);
return Constants.RESOLUTION_OPTIONAL.equals(resolution);
}
public void setOptional(boolean optional) {
if (optional)
attribs.put(aQute.lib.osgi.Constants.RESOLUTION_DIRECTIVE, Constants.RESOLUTION_OPTIONAL);
else
attribs.remove(aQute.lib.osgi.Constants.RESOLUTION_DIRECTIVE);
}
@Override
public ImportPattern clone() {
return new ImportPattern(this.name, new Attrs(this.attribs));
}
} | 0 |
import java.util.Objects;
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
return Objects.equals(name, that.name) &&
Objects.equals(description, that.description) &&
Objects.equals(version, that.version) &&
Arrays.equals(enumValues, that.enumValues);
return Objects.hash(name, description, version, enumValues); | 0 |
import java.security.Key;
import java.security.PublicKey;
import org.apache.xml.security.keys.content.keyvalues.DSAKeyValue;
import org.apache.xml.security.keys.content.keyvalues.RSAKeyValue;
import org.apache.xml.security.utils.Constants;
import org.apache.xml.security.utils.JavaUtils;
import org.apache.xml.security.utils.SignatureElementProxy;
import org.apache.xml.security.utils.XMLUtils;
import org.apache.xpath.XPathAPI;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList; | 0 |
Table.ID.of(context.getClient().tableOperations().tableIdMap().get(tableName))); | 0 |
@Override
public Connection getConnection() throws SQLException {
if (getPool() == null) {
throw new IllegalStateException("Pool has not been set");
}
if (transactionRegistry == null) {
throw new IllegalStateException("TransactionRegistry has not been set");
}
return new ManagedConnection<>(getPool(), transactionRegistry, isAccessToUnderlyingConnectionAllowed());
}
/**
* @since 2.6.0
*/
public TransactionRegistry getTransactionRegistry() {
return transactionRegistry;
}
| 0 |
* limitations under the License. | 0 |
public InvalidCanonicalizerException(String msgID, Object[] exArgs) {
Exception originalException, String msgID, Object[] exArgs | 0 |
public abstract class InternalH2ServerTestBase {
public InternalH2ServerTestBase(final URIScheme scheme) {
public InternalH2ServerTestBase() {
protected H2TestServer server;
server = new H2TestServer(IOReactorConfig.DEFAULT, | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//jxpath/src/java/org/apache/commons/jxpath/util/BasicTypeConverter.java,v 1.11 2003/11/02 23:21:06 dmitri Exp $
* $Revision: 1.11 $
* $Date: 2003/11/02 23:21:06 $
* @version $Revision: 1.11 $ $Date: 2003/11/02 23:21:06 $
&& ((type.getModifiers() & Modifier.ABSTRACT) == 0)) {
&& ((type.getModifiers() & Modifier.ABSTRACT) == 0)) { | 0 |
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
/**
* An implementation of {@link OutputManager} using simple lists, for testing and in-memory
* contexts such as the {@link com.google.cloud.dataflow.sdk.runners.DirectPipelineRunner}.
*/
public static class ListOutputManager implements OutputManager<List<WindowedValue<?>>> {
private Map<TupleTag<?>, List<WindowedValue<?>>> outputLists = Maps.newHashMap();
@Override
public List<WindowedValue<?>> initialize(TupleTag<?> tag) {
List<WindowedValue<?>> list = Lists.newArrayList();
outputLists.put(tag, list);
return list;
}
@Override
public void output(List<WindowedValue<?>> list, WindowedValue<?> output) {
list.add(output);
}
public <T> List<WindowedValue<T>> getOutput(TupleTag<T> tag) {
// Safe cast by design, inexpressible in Java without rawtypes
@SuppressWarnings({"rawtypes", "unchecked"})
List<WindowedValue<T>> outputList = (List) outputLists.get(tag);
return outputList;
} | 0 |
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
* @author <a
* href="http://commons.apache.org/configuration/team-list.html">Commons
* Configuration team</a>
public class TestDefaultBeanFactory
@Before
public void setUp() throws Exception
@Test
@Test
public Map<String, Object> getBeanProperties()
Map<String, Object> props = new HashMap<String, Object>();
public Map<String, Object> getNestedBeanDeclarations() | 0 |
public class WordInfo {
public WordInfo(int index) { | 0 |
* <fb:class id="<i>widget-id</i>">
* <fb:field id="<i>sub-widget-id</i>" path="<i>relative-xpath</i>"
* </fb:class>
* @version CVS $Id: ClassJXPathBindingBuilder.java,v 1.2 2004/04/01 13:07:55 mpo Exp $ | 0 |
super(entityDef, TypeCategory.ENTITY); | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//collections/src/test/org/apache/commons/collections/TestMultiHashMap.java,v 1.15 2003/11/18 22:37:16 scolebourne Exp $
* @version $Revision: 1.15 $ $Date: 2003/11/18 22:37:16 $
public Map makeEmptyMap() { | 0 |
@XmlSeeAlso(value={ExecuteTask.class, ConfigureTask.class, ManualTask.class, RestartTask.class, StartTask.class, StopTask.class, ServerActionTask.class})
/**
* @return when a single Task is constructed, this is the type of stage it should belong to.
*/
public abstract StageWrapper.Type getStageWrapperType();
/**
* @return a verb to display that describes the type of task, e.g., "executing".
*/
public abstract String getActionVerb();
* Task that is a start command.
*/
START,
/**
* Task that is a stop command.
*/
STOP,
/**
return this == RESTART || this == START || this == STOP || this == SERVICE_CHECK; | 0 |
import javax.servlet.http.HttpSession;
public static HttpSession getSession(boolean create) { | 0 |
* An {@code IterableCoder} encodes any {@code Iterable}
* as the sequence of its elements, encoded according to the
* component coder. | 0 |
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.HashBiMap;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableList;
import org.apache.beam.vendor.guava.v20_0.com.google.common.collect.ImmutableMap; | 0 |
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//digester/src/java/org/apache/commons/digester/rss/Attic/Image.java,v 1.5 2003/04/16 11:23:51 jstrachan Exp $
* $Revision: 1.5 $
* $Date: 2003/04/16 11:23:51 $
import java.io.Serializable;
* @version $Revision: 1.5 $ $Date: 2003/04/16 11:23:51 $ | 0 |
import java.util.Collection;
import java.util.Collections; | 0 |
public BundleContext getBundleContext()
public void setBundleContext(BundleContext context) | 0 |
@Deprecated // since 1.5
final Option principalOption = new Option("pr", "principal", true, "principal (defaults to your OS user)");
@Deprecated // since 1.5
final Option loginOption = new Option("l", "login property", true, "login properties in the format key=value. Reuse -l for each property and/or comma seperate (prompt for properties if this option is missing");
opts.addOption(principalOption);
opts.addOption(loginOption); | 0 |
private CompactionWaitInfo compactionWaitInfo = new CompactionWaitInfo();
log.debug("Writing updated status to metadata table for " + logEntry.logSet + " " + ProtobufUtil.toString(status));
ReplicationTableUtil.updateFiles(tabletServer, extent, logEntry.logSet, status);
currentLogs = new HashSet<DfsLogger>();
for (String log : logEntry.logSet) {
currentLogs.add(new DfsLogger(tabletServer.getServerConfig(), log, logEntry.getColumnQualifier().toString()));
}
currentLogs = new HashSet<DfsLogger>();
private Set<DfsLogger> currentLogs = new HashSet<DfsLogger>();
public synchronized Set<String> getCurrentLogFiles() {
Set<String> result = new HashSet<String>();
for (DfsLogger log : currentLogs) {
result.add(log.getFileName());
}
return result;
public synchronized int getLogCount() {
public boolean beginUpdatingLogsUsed(InMemoryMap memTable, Collection<DfsLogger> more, boolean mincFinish) {
for (DfsLogger logger : more) {
if (addToOther) {
if (otherLogs.add(logger))
numAdded++;
if (currentLogs.contains(logger))
numContained++;
} else {
if (currentLogs.add(logger))
numAdded++;
if (otherLogs.contains(logger))
numContained++;
}
if (numAdded > 0 && numAdded != more.size()) {
if (numContained > 0 && numContained != more.size()) { | 0 |
return () -> phaser.arrive(); | 0 |
*
readScope.getSpan().addKVAnnotation("Number of Entries Read".getBytes(UTF_8), String.valueOf(numberOfEntriesRead).getBytes(UTF_8)); | 0 |
import org.apache.atlas.type.AtlasClassificationType;
import org.apache.atlas.type.AtlasEntityType;
AtlasClassificationType classificationType = typeRegistry.getClassificationTypeByName(classification.getTypeName());
if (classificationType == null) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, TypeCategory.CLASSIFICATION.name(), classification.getTypeName());
}
AtlasEntityType entityType = typeRegistry.getEntityTypeByName(referenceable.getTypeName());
if (entityType == null) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, TypeCategory.ENTITY.name(), referenceable.getTypeName());
}
| 0 |
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Iterables;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
/**
* Spark runner process context.
*/
public abstract class SparkProcessContext<InputT, OutputT, ValueT>
extends DoFn<InputT, OutputT>.ProcessContext {
private final DoFn<InputT, OutputT> fn;
protected WindowedValue<InputT> windowedValue;
SparkProcessContext(DoFn<InputT, OutputT> fn,
public abstract void output(OutputT output);
public abstract void output(WindowedValue<OutputT> output);
public <AggregatprInputT, AggregatorOutputT>
Aggregator<AggregatprInputT, AggregatorOutputT> createAggregatorInternal(
Combine.CombineFn<AggregatprInputT, ?, AggregatorOutputT> combineFn) {
public InputT element() {
public void outputWithTimestamp(OutputT output, Instant timestamp) {
public WindowingInternals<InputT, OutputT> windowingInternals() {
return new WindowingInternals<InputT, OutputT>() {
public void outputWindowedValue(OutputT output, Instant timestamp, Collection<?
protected abstract Iterator<ValueT> getOutputIterator();
protected Iterable<ValueT> getOutputIterable(final Iterator<WindowedValue<InputT>> iter,
final DoFn<InputT, OutputT> doFn) {
return new Iterable<ValueT>() {
public Iterator<ValueT> iterator() {
private class ProcCtxtIterator extends AbstractIterator<ValueT> {
private final Iterator<WindowedValue<InputT>> inputIterator;
private final DoFn<InputT, OutputT> doFn;
private Iterator<ValueT> outputIterator;
ProcCtxtIterator(Iterator<WindowedValue<InputT>> iterator, DoFn<InputT, OutputT> doFn) {
protected ValueT computeNext() {
/**
* Spark process runtime exception.
*/ | 0 |
SERVICE_SITE_CLUSTER = new HashMap<>();
SERVICE_SITE_SERVICE = new HashMap<>();
SERVICE_SITE_HOST = new HashMap<>();
GLOBAL_CLUSTER = new HashMap<>();
CONFIG_ATTRIBUTES = new HashMap<>();
List<Stage> stages = new ArrayList<>();
Map<String, Map<String, String>> confs = new HashMap<>();
Map<String, String> configurationsGlobal = new HashMap<>();
Map<String, Map<String, String>> confTags = new HashMap<>();
Map<String, String> confTagServiceSite = new HashMap<>();
Set<String> serviceSiteKeys = new HashSet<>();
Map<String, String> baseConfig = new HashMap<>();
Map<String, String> overrideConfig = new HashMap<>();
Set<String> configsKeys = new HashSet<>(); | 1 |
org.junit.Assume.assumeTrue(bcInstalled);
org.junit.Assume.assumeTrue(bcInstalled);
org.junit.Assume.assumeTrue(bcInstalled);
org.junit.Assume.assumeTrue(bcInstalled);
| 0 |
import com.google.common.collect.Iterators;
rowCnt = Iterators.size(s.iterator()); | 0 |
import org.apache.poi.hssf.util.Region;
* @version CVS $Id: EPCell.java,v 1.6 2004/07/05 18:38:03 tcurdt Exp $
public int getColumns() throws IOException, NullPointerException {
if (!_cols_fetched) {
String valueString = getValue(_cols_attribute);
if (valueString != null) {
_cols = NumericConverter.extractPositiveInteger(valueString);
_cols_fetched = true;
return _cols_fetched ?_cols.intValue() : -1;
public int getRows() throws IOException, NullPointerException {
if (!_rows_fetched) {
String valueString = getValue(_rows_attribute);
if (valueString != null) {
_rows = NumericConverter.extractPositiveInteger(valueString);
_rows_fetched = true;
}
return _rows_fetched ? _rows.intValue() : -1 ;
if(getColumns() != -1 && getRows() != -1) {
getSheet().addMergedRegion(new Region(getRow(),(short)getColumn(),getRow() + getRows() - 1,(short)(getColumn() + getColumns() - 1)));
}
| 0 |
public PeriodicReloadingTrigger(final ReloadingController ctrl, final Object ctrlParam,
final long triggerPeriod, final TimeUnit unit, final ScheduledExecutorService exec)
public PeriodicReloadingTrigger(final ReloadingController ctrl, final Object ctrlParam,
final long triggerPeriod, final TimeUnit unit)
public void shutdown(final boolean shutdownExecutor)
final ThreadFactory factory = | 0 |
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.EVALUATE_AFTER_RUNNING_LIMIT;
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.EVALUATE_ON_STATE_CHANGE;
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.FAILED;
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.KILL_TASK_AND_EVALUATE_ON_STATE_CHANGE;
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.REPLACE_TASK_AND_EVALUATE_ON_STATE_CHANGE;
import static org.apache.aurora.scheduler.updater.StateEvaluator.Result.SUCCEEDED;
class InstanceUpdater implements StateEvaluator<Optional<IScheduledTask>> {
@Override
public synchronized StateEvaluator.Result evaluate(Optional<IScheduledTask> actualState) {
private StateEvaluator.Result addFailureAndCheckIfFailed() {
private StateEvaluator.Result handleActualAndDesiredPresent(IScheduledTask actualState) {
StateEvaluator.Result updaterStatus = addFailureAndCheckIfFailed();
return StateEvaluator.Result.KILL_TASK_AND_EVALUATE_ON_STATE_CHANGE;
return StateEvaluator.Result.REPLACE_TASK_AND_EVALUATE_ON_STATE_CHANGE; | 0 |
/*
* Copyright 2016-2018 Seznam.cz, a.s. | 0 |
@Override
@Override
@Override
@Override
@Override
@Override
@Override | 0 |
zoo.putPersistentData(zTablePath + Constants.ZTABLE_COMPACT_CANCEL_ID, "0".getBytes(), existsPolicy); | 0 |
}else {
if(metric.getInstanceId() != null){
//instanceId "CHANNEL.ch1"
String instanceId = metric.getInstanceId();
instanceId = instanceId.matches("^\\w+\\..+$") ? instanceId.split("\\.")[1]:"";
//propertyId "metrics/flume/flume/CHANNEL/ch1/[ChannelCapacity]"
if(!propertyId.contains(instanceId)) continue;
} | 0 |
import org.apache.accumulo.harness.AccumuloClusterIT;
public class WriteAheadLogIT extends AccumuloClusterIT {
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
String tableName = getUniqueNames(1)[0];
c.tableOperations().create(tableName);
c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "750K");
opts.tableName = tableName;
try {
TestIngest.ingest(c, opts, new BatchWriterOpts());
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
vopts.tableName = tableName;
VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
getCluster().getClusterControl().adminStopAll();
} finally {
getCluster().start();
| 0 |
"FRAGMENT WIRE: " + rw.toString()); | 0 |
* 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
* 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. | 0 |
* $Revision: 1.10 $
* $Date: 2003/10/26 17:35:30 $
* @version $Id: PooledConnectionImpl.java,v 1.10 2003/10/26 17:35:30 dirkv Exp $
public Object makeObject(Object obj) throws Exception {
if (null == obj || !(obj instanceof PStmtKey)) {
throw new IllegalArgumentException();
} else {
// _openPstmts++;
PStmtKey key = (PStmtKey)obj;
if (null == key._resultSetType
&& null == key._resultSetConcurrency) {
return new PoolablePreparedStatementStub(
connection.prepareStatement(key._sql),
key, pstmtPool, connection);
return new PoolablePreparedStatementStub(
connection.prepareStatement(key._sql,
key._resultSetType.intValue(),
key._resultSetConcurrency.intValue()),
key, pstmtPool, connection); | 0 |
/*
* 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.
*/
| 0 |
* 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 | 0 |
* Copyright 2004,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
* @version CVS $Id: ContentTypeSetImpl.java,v 1.3 2004/03/05 13:02:15 bdelacretaz Exp $ | 1 |
package org.apache.batik.dom.anim; | 0 |
Method updateHadoopEnvConfig = UpgradeCatalog213.class.getDeclaredMethod("updateHadoopEnv");
.addMockedMethod(updateHadoopEnvConfig)
upgradeCatalog213.updateHadoopEnv();
expectLastCall().once(); | 0 |
throw new ConfigurationException("The property " + name + " has neither type nor field."); | 0 |
initialValue = 0 | 0 |
* are found for a job or an update for the job is already in progress.
* @return A unique update token if an update must be coordinated through
* {@link #updateShards(String, String, java.util.Set, String)} and
* {@link #finishUpdate(String, String, Optional, UpdateResult)}, or an absent value if
* the update was completed in-place and no further action is necessary.
Optional<String> initiateJobUpdate(JobConfiguration job)
* {@link #initiateJobUpdate(JobConfiguration)}.
* {@link #initiateJobUpdate(JobConfiguration)}
* @param updateToken The update token provided from {@link #initiateJobUpdate(JobConfiguration)},
* or not present if the update is being forcibly terminated.
* invalid. | 0 |
import org.apache.sshd.util.test.NoIoTestCase;
import org.junit.experimental.categories.Category;
@Category({ NoIoTestCase.class })
Map<BuiltinIdentities, Path> locationsMap = new EnumMap<>(BuiltinIdentities.class);
Map<BuiltinIdentities, KeyPair> idsMap = new EnumMap<>(BuiltinIdentities.class); | 0 |
namespace==sibling.getNamespaceURI() ) { | 0 |
Collection<T> result = new ArrayList<>(); | 0 |
import org.apache.accumulo.harness.MiniClusterConfigurationCallback;
import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
private static class ShellServerITConfigCallback implements MiniClusterConfigurationCallback {
@Override
public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration coreSite) {
// Only one tserver to avoid race conditions on ZK propagation (auths and configuration)
cfg.setNumTservers(1);
}
}
public static void setupMiniCluster() throws Exception {
SharedMiniClusterIT.startMiniClusterWithConfig(new ShellServerITConfigCallback());
SharedMiniClusterIT.stopMiniCluster();
assertEquals(2, ts.output.get().split("\n").length); | 0 |
package com.twitter.mesos.scheduler;
import com.twitter.mesos.gen.JobConfiguration;
import com.twitter.mesos.gen.RegisteredTaskUpdate;
import com.twitter.mesos.gen.ScheduleStatus;
import com.twitter.mesos.gen.TaskQuery;
import com.twitter.mesos.gen.TrackedTask;
import com.twitter.mesos.scheduler.configuration.ConfigurationManager;
import mesos.SchedulerDriver;
import mesos.SlaveOffer;
import mesos.TaskDescription;
public TaskDescription offer(final SlaveOffer slaveOffer) throws ScheduleException;
public void updateRegisteredTasks(RegisteredTaskUpdate update); | 0 |
import cz.seznam.euphoria.core.client.dataset.windowing.Window;
W extends Window>
Pair<KEYOUT, OUT>, W,
ReduceStateByKey<IN, KIN, WIN, KEY, VALUE, KEYOUT, OUT, STATE, W>>
public <WIN, W extends Window>
DatasetBuilder6<IN, WIN, KEY, VALUE, OUT, STATE, W>
windowBy(Windowing<WIN, W> windowing)
W extends Window>
KEY,DatasetBuilder6<IN, WIN, KEY, VALUE, OUT, STATE, W>>
private final Windowing<WIN, W> windowing;
Windowing<WIN, W> windowing /* optional */,
ReduceStateByKey<IN, IN, WIN, KEY, VALUE, KEY, OUT, STATE, W>
public <WIN, W extends Window>
GroupedDatasetBuilder6<IN, KIN, WIN, KEY, VALUE, OUT, STATE, W>
windowBy(Windowing<WIN, W> windowing)
W extends Window>
KEY, GroupedDatasetBuilder6<IN, KIN, WIN, KEY, VALUE, OUT, STATE, W>>
private final Windowing<WIN, W> windowing;
Windowing<WIN, W> windowing /* optional */,
CompositeKey<IN, KEY>, OUT, STATE, W>
Windowing<WIN, W> windowing,
Windowing<WIN, W> windowing,
Windowing<WIN, W> windowing, | 0 |
@Override | 0 |
.withArrayField("f_arr", FieldTypeDescriptor.of(FieldType.STRING)) | 0 |
private static Logger LOG = LoggerFactory.getLogger(PreCalculatedDigestSignatureTest.class);
LOG.debug("Is signature valid: " + validSignature);
LOG.debug("Wrote signature to " + signatureFilePath); | 0 |
Boolean defaultAutoCommit = isDefaultAutoCommit();
defaultAutoCommit = userMax;
Boolean defaultReadOnly = isDefaultReadOnly();
defaultReadOnly = userMax;
if (defaultAutoCommit != null &&
con.getAutoCommit() != defaultAutoCommit.booleanValue()) {
con.setAutoCommit(defaultAutoCommit.booleanValue());
if (defaultReadOnly != null &&
con.isReadOnly() != defaultReadOnly.booleanValue()) {
con.setReadOnly(defaultReadOnly.booleanValue()); | 0 |
import org.apache.commons.collections.CollectionUtils;
public static List<String> getSuperTypeNames(AtlasVertex<?,?> entityVertex) {
ArrayList<String> superTypes = new ArrayList<>();
Collection<String> propertyValues = entityVertex.getPropertyValues(Constants.SUPER_TYPES_PROPERTY_KEY, String.class);
if (CollectionUtils.isNotEmpty(propertyValues)) {
for(String value : propertyValues) {
superTypes.add(value);
}
}
return superTypes;
}
| 1 |
|| (sharedCache && HeaderConstants.PRIVATE.equals(elem.getName()))) {
String[] cacheableParams = { HeaderConstants.CACHE_CONTROL_MAX_AGE, "s-maxage",
HeaderConstants.CACHE_CONTROL_MUST_REVALIDATE,
HeaderConstants.CACHE_CONTROL_PROXY_REVALIDATE,
HeaderConstants.PUBLIC
String[] uncacheableRequestDirectives = { HeaderConstants.CACHE_CONTROL_NO_STORE };
Header[] authNHeaders = request.getHeaders(HeaderConstants.AUTHORIZATION);
"s-maxage", HeaderConstants.CACHE_CONTROL_MUST_REVALIDATE, HeaderConstants.PUBLIC
if (response.getFirstHeader(HeaderConstants.CACHE_CONTROL) != null) return false;
Header expiresHdr = response.getFirstHeader(HeaderConstants.EXPIRES);
Header dateHdr = response.getFirstHeader(HTTP.DATE_HEADER);
Header via = response.getFirstHeader(HeaderConstants.VIA); | 0 |
config.setVersion(cluster.getNextConfigVersion(config.getType()));
clusterConfigEntity.setVersion(config.getVersion()); | 0 |
import org.apache.beam.sdk.extensions.sql.schema.BeamRecordSqlType;
private static final BeamRecordSqlType SOURCE_RECORD_TYPE =
BeamRecordSqlType.create(
private static final BeamRecordSqlType RESULT_RECORD_TYPE =
BeamRecordSqlType.create( | 0 |
* A coder for JAXB annotated objects. This coder uses JAXB marshalling/unmarshalling mechanisms to
* encode/decode the objects. Users must provide the {@code Class} of the JAXB annotated object.
this.jaxbMarshaller =
new EmptyOnDeserializationThreadLocal<Marshaller>() {
@Override
protected Marshaller initialValue() {
try {
JAXBContext jaxbContext = getContext();
return jaxbContext.createMarshaller();
} catch (JAXBException e) {
throw new RuntimeException("Error when creating marshaller from JAXB Context.", e);
}
}
};
this.jaxbUnmarshaller =
new EmptyOnDeserializationThreadLocal<Unmarshaller>() {
@Override
protected Unmarshaller initialValue() {
try {
JAXBContext jaxbContext = getContext();
return jaxbContext.createUnmarshaller();
} catch (Exception e) {
throw new RuntimeException("Error when creating unmarshaller from JAXB Context.", e);
}
}
};
public void encode(T value, OutputStream outStream, Context context) throws IOException { | 1 |
private Map<OgnlContext, Class> defaultMapClassMap = new HashMap<OgnlContext, Class>();
Class defaultMapClass = getDefaultMapClass( context );
private Class getDefaultMapClass( OgnlContext context ) {
Class defaultMapClass = defaultMapClassMap.get( context );
if (defaultMapClass != null) {
return defaultMapClass;
}
/* Try to get LinkedHashMap; if older JDK than 1.4 use HashMap */
try
{
defaultMapClass = OgnlRuntime.classForName( context, "java.util.LinkedHashMap" );
}
catch ( ClassNotFoundException ex )
{
defaultMapClass = HashMap.class;
}
defaultMapClassMap.put( context, defaultMapClass );
return defaultMapClass;
} | 0 |
ImmutableNode root = (c != null) ? obtainRootNode(c) : null;
* Obtains the root node from a configuration whose data is to be copied. It
* has to be ensured that the synchronizer is called correctly.
*
* @param c the configuration that is to be copied
* @return the root node of this configuration
*/
private static ImmutableNode obtainRootNode(
HierarchicalConfiguration<ImmutableNode> c)
{
boolean needSynchronization = c instanceof AbstractConfiguration;
if (needSynchronization)
{
((AbstractConfiguration) c).beginRead(false);
}
try
{
return c.getRootNode();
}
finally
{
if (needSynchronization)
{
((AbstractConfiguration) c).endRead();
}
}
}
/** | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.