code
stringlengths
73
34.1k
label
stringclasses
1 value
private boolean markAsObsolete(ContentReference ref) { if (obsoleteContents.containsKey(ref.getHexHash())) { //This content is already marked as obsolete if (obsoleteContents.get(ref.getHexHash()) + obsolescenceTimeout < System.currentTimeMillis()) { DeploymentRepositoryLogger.ROOT_L...
java
static ReadMasterDomainModelUtil readMasterDomainResourcesForInitialConnect(final Transformers transformers, final Transformers.TransformationInputs transformationInputs, ...
java
private List<ModelNode> describeAsNodeList(PathAddress rootAddress, final Resource resource, boolean isRuntimeChange) { final List<ModelNode> list = new ArrayList<ModelNode>(); describe(rootAddress, resource, list, isRuntimeChange); return list; }
java
public static RequiredConfigurationHolder populateHostResolutionContext(final HostInfo hostInfo, final Resource root, final ExtensionRegistry extensionRegistry) { final RequiredConfigurationHolder rc = new RequiredConfigurationHolder(); for (IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo info : hos...
java
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) { final Set<String> serverGroups = requiredConfigurationHolder.serverGroups; ...
java
public static Transformers.ResourceIgnoredTransformationRegistry createServerIgnoredRegistry(final RequiredConfigurationHolder rc, final Transformers.ResourceIgnoredTransformationRegistry delegate) { return new Transformers.ResourceIgnoredTransformationRegistry() { @Override public boole...
java
public static ModelNode addCurrentServerGroupsToHostInfoModel(boolean ignoreUnaffectedServerGroups, Resource hostModel, ModelNode model) { if (!ignoreUnaffectedServerGroups) { return model; } model.get(IGNORE_UNUSED_CONFIG).set(ignoreUnaffectedServerGroups); addServerGroupsTo...
java
public boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) { if (pathAddress.size() == 0) { return false; } boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress); ...
java
public Set<ServerConfigInfo> getServerConfigsOnSlave(Resource hostResource){ Set<ServerConfigInfo> groups = new HashSet<>(); for (ResourceEntry entry : hostResource.getChildren(SERVER_CONFIG)) { groups.add(new ServerConfigInfoImpl(entry.getModel())); } return groups; }
java
private static boolean syncWithMaster(final Resource domain, final PathElement hostElement) { final Resource host = domain.getChild(hostElement); assert host != null; final Set<String> profiles = new HashSet<>(); final Set<String> serverGroups = new HashSet<>(); final Set<String...
java
public Result cmd(String cliCommand) { try { // The intent here is to return a Response when this is doable. if (ctx.isWorkflowMode() || ctx.isBatchMode()) { ctx.handle(cliCommand); return new Result(cliCommand, ctx.getExitCode()); } ...
java
protected void boot(final BootContext context) throws ConfigurationPersistenceException { List<ModelNode> bootOps = configurationPersister.load(); ModelNode op = registerModelControllerServiceInitializationBootStep(context); if (op != null) { bootOps.add(op); } boot(b...
java
protected boolean boot(List<ModelNode> bootOperations, boolean rollbackOnRuntimeFailure) throws ConfigurationPersistenceException { return boot(bootOperations, rollbackOnRuntimeFailure, false, ModelControllerImpl.getMutableRootResourceRegistrationProvider()); }
java
public static <T> T getBundle(final Class<T> type) { return doPrivileged(new PrivilegedAction<T>() { public T run() { final Locale locale = Locale.getDefault(); final String lang = locale.getLanguage(); final String country = locale.getCountry(); ...
java
public String getName() { if (name == null && securityIdentity != null) { name = securityIdentity.getPrincipal().getName(); } return name; }
java
public String getRealm() { if (UNDEFINED.equals(realm)) { Principal principal = securityIdentity.getPrincipal(); String realm = null; if (principal instanceof RealmPrincipal) { realm = ((RealmPrincipal)principal).getRealm(); } this.real...
java
private ModelNode resolveSubsystems(final List<ModelNode> extensions) { HostControllerLogger.ROOT_LOGGER.debug("Applying extensions provided by master"); final ModelNode result = operationExecutor.installSlaveExtensions(extensions); if (!SUCCESS.equals(result.get(OUTCOME).asString())) { ...
java
private boolean applyRemoteDomainModel(final List<ModelNode> bootOperations, final HostInfo hostInfo) { try { HostControllerLogger.ROOT_LOGGER.debug("Applying domain level boot operations provided by master"); SyncModelParameters parameters = new SyncModelParameters(d...
java
static void rethrowIrrecoverableConnectionFailures(IOException e) throws SlaveRegistrationException { Throwable cause = e; while ((cause = cause.getCause()) != null) { if (cause instanceof SaslException) { throw HostControllerLogger.ROOT_LOGGER.authenticationFailureUnableToCo...
java
static void logConnectionException(URI uri, DiscoveryOption discoveryOption, boolean moreOptions, Exception e) { if (uri == null) { HostControllerLogger.ROOT_LOGGER.failedDiscoveringMaster(discoveryOption, e); } else { HostControllerLogger.ROOT_LOGGER.cannotConnect(uri, e); ...
java
public static AliasOperationTransformer replaceLastElement(final PathElement element) { return create(new AddressTransformer() { @Override public PathAddress transformAddress(final PathAddress original) { final PathAddress address = original.subAddress(0, original.size() ...
java
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file) throws IOException, StartException { persist(key, value, enableDisableMode, disable, file, null); }
java
void persist(final String key, final String value, final boolean enableDisableMode, final boolean disable, final File file, final String realm) throws IOException, StartException { final PropertiesFileLoader propertiesHandler = realm == null ? new PropertiesFileLoader(file.getAbsolutePath(), null) : ...
java
public static ServiceName deploymentUnitName(String name, Phase phase) { return JBOSS_DEPLOYMENT_UNIT.append(name, phase.name()); }
java
protected void updateModel(final ModelNode operation, final Resource resource) throws OperationFailedException { updateModel(operation, resource.getModel()); }
java
public void logAttributeWarning(PathAddress address, String attribute) { logAttributeWarning(address, null, null, attribute); }
java
public void logAttributeWarning(PathAddress address, Set<String> attributes) { logAttributeWarning(address, null, null, attributes); }
java
public void logAttributeWarning(PathAddress address, String message, String attribute) { logAttributeWarning(address, null, message, attribute); }
java
public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) { messageQueue.add(new AttributeLogEntry(address, null, message, attributes)); }
java
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, String attribute) { messageQueue.add(new AttributeLogEntry(address, operation, message, attribute)); }
java
public void logAttributeWarning(PathAddress address, ModelNode operation, String message, Set<String> attributes) { messageQueue.add(new AttributeLogEntry(address, operation, message, attributes)); }
java
public void logWarning(final String message) { messageQueue.add(new LogEntry() { @Override public String getMessage() { return message; } }); }
java
void flushLogQueue() { Set<String> problems = new LinkedHashSet<String>(); synchronized (messageQueue) { Iterator<LogEntry> i = messageQueue.iterator(); while (i.hasNext()) { problems.add("\t\t" + i.next().getMessage() + "\n"); i.remove(); ...
java
PatchEntry getEntry(final String name, boolean addOn) { return addOn ? addOns.get(name) : layers.get(name); }
java
protected void failedToCleanupDir(final File file) { checkForGarbageOnRestart = true; PatchLogger.ROOT_LOGGER.cannotDeleteFile(file.getAbsolutePath()); }
java
protected PatchEntry resolveForElement(final PatchElement element) throws PatchingException { assert state == State.NEW; final PatchElementProvider provider = element.getProvider(); final String layerName = provider.getName(); final LayerType layerType = provider.getLayerType(); ...
java
private void complete(final InstallationManager.InstallationModification modification, final FinalizeCallback callback) { final List<File> processed = new ArrayList<File>(); List<File> reenabled = Collections.emptyList(); List<File> disabled = Collections.emptyList(); try { t...
java
boolean undoChanges() { final State state = stateUpdater.getAndSet(this, State.ROLLBACK_ONLY); if (state == State.COMPLETED || state == State.ROLLBACK_ONLY) { // Was actually completed already return false; } PatchingTaskContext.Mode currentMode = this.mode; ...
java
static void undoChanges(final PatchEntry entry, final PatchContentLoader loader) { final List<ContentModification> modifications = new ArrayList<ContentModification>(entry.rollbackActions); for (final ContentModification modification : modifications) { final ContentItem item = modification.g...
java
private void recordRollbackLoader(final String patchId, PatchableTarget.TargetInfo target) { // setup the content loader paths final DirectoryStructure structure = target.getDirectoryStructure(); final InstalledImage image = structure.getInstalledImage(); final File historyDir = image.ge...
java
protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) { if (contentLoaders.containsKey(patchID)) { throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n } contentLoaders.p...
java
public File getTargetFile(final MiscContentItem item) { final State state = this.state; if (state == State.NEW || state == State.ROLLBACK_ONLY) { return getTargetFile(miscTargetRoot, item); } else { throw new IllegalStateException(); // internal wrong usage, no i18n ...
java
protected Patch createProcessedPatch(final Patch original) { // Process elements final List<PatchElement> elements = new ArrayList<PatchElement>(); // Process layers for (final PatchEntry entry : getLayers()) { final PatchElement element = createPatchElement(entry, entry.ele...
java
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) { // Process elements final List<PatchElement> elements = new ArrayList<PatchElement>(); // Process layers for (final PatchEntry entry : getLayers()) { final PatchElement elemen...
java
static File getTargetFile(final File root, final MiscContentItem item) { return PatchContentLoader.getMiscPath(root, item); }
java
protected static PatchElement createRollbackElement(final PatchEntry entry) { final PatchElement patchElement = entry.element; final String patchId; final Patch.PatchType patchType = patchElement.getProvider().getPatchType(); if (patchType == Patch.PatchType.CUMULATIVE) { pat...
java
protected static PatchElement createPatchElement(final PatchEntry entry, String patchId, final List<ContentModification> modifications) { final PatchElement patchElement = entry.element; final PatchElementImpl element = new PatchElementImpl(patchId); element.setProvider(patchElement.getProvider(...
java
void backupConfiguration() throws IOException { final String configuration = Constants.CONFIGURATION; final File a = new File(installedImage.getAppClientDir(), configuration); final File d = new File(installedImage.getDomainDir(), configuration); final File s = new File(installedImage....
java
static void backupDirectory(final File source, final File target) throws IOException { if (!target.exists()) { if (!target.mkdirs()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(target.getAbsolutePath()); } } final File[] files = source.listFiles(...
java
static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath(...
java
public CliCommandBuilder setController(final String hostname, final int port) { setController(formatAddress(null, hostname, port)); return this; }
java
public CliCommandBuilder setController(final String protocol, final String hostname, final int port) { setController(formatAddress(protocol, hostname, port)); return this; }
java
public CliCommandBuilder setTimeout(final int timeout) { if (timeout > 0) { addCliArgument(CliArgument.TIMEOUT, Integer.toString(timeout)); } else { addCliArgument(CliArgument.TIMEOUT, null); } return this; }
java
@Deprecated public static <T> ServiceBuilder<T> addServerExecutorDependency(ServiceBuilder<T> builder, Injector<ExecutorService> injector) { return builder.addDependency(ServerService.MANAGEMENT_EXECUTOR, ExecutorService.class, injector); }
java
public void handleChannelClosed(final Channel closed, final IOException e) { for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { if (activeOperation.getChannel() == closed) { // Only call cancel, to also interrupt still active threads acti...
java
@Override public boolean awaitCompletion(long timeout, TimeUnit unit) throws InterruptedException { long deadline = unit.toMillis(timeout) + System.currentTimeMillis(); lock.lock(); try { assert shutdown; while(activeCount != 0) { long remaining = deadline - S...
java
protected <T, A> ActiveOperation<T, A> registerActiveOperation(final Integer id, A attachment, ActiveOperation.CompletedCallback<T> callback) { lock.lock(); try { // Check that we still allow registration // TODO WFCORE-199 distinguish client uses from server uses and limit this ...
java
protected <T, A> ActiveOperation<T, A> getActiveOperation(final ManagementRequestHeader header) { return getActiveOperation(header.getBatchId()); }
java
protected <T, A> ActiveOperation<T, A> getActiveOperation(final Integer id) { //noinspection unchecked return (ActiveOperation<T, A>) activeRequests.get(id); }
java
protected List<Integer> cancelAllActiveOperations() { final List<Integer> operations = new ArrayList<Integer>(); for(final ActiveOperationImpl<?, ?> activeOperation : activeRequests.values()) { activeOperation.asyncCancel(false); operations.add(activeOperation.getOperationId()); ...
java
protected <T, A> ActiveOperation<T, A> removeActiveOperation(Integer id) { final ActiveOperation<T, A> removed = removeUnderLock(id); if(removed != null) { for(final Map.Entry<Integer, ActiveRequest<?, ?>> requestEntry : requests.entrySet()) { final ActiveRequest<?, ?> reques...
java
protected static void safeWriteErrorResponse(final Channel channel, final ManagementProtocolHeader header, final Throwable error) { if(header.getType() == ManagementProtocol.TYPE_REQUEST) { try { writeErrorResponse(channel, (ManagementRequestHeader) header, error); } catc...
java
protected static void writeErrorResponse(final Channel channel, final ManagementRequestHeader header, final Throwable error) throws IOException { final ManagementResponseHeader response = ManagementResponseHeader.create(header, error); final MessageOutputStream output = channel.writeMessage(); t...
java
protected static FlushableDataOutput writeHeader(final ManagementProtocolHeader header, final OutputStream os) throws IOException { final FlushableDataOutput output = FlushableDataOutputImpl.create(os); header.write(output); return output; }
java
protected static <T, A> ManagementRequestHandler<T, A> getFallbackHandler(final ManagementRequestHeader header) { return new ManagementRequestHandler<T, A>() { @Override public void handleRequest(final DataInput input, ActiveOperation.ResultHandler<T> resultHandler, ManagementRequestCont...
java
static void processFile(final IdentityPatchContext context, final File file, final PatchingTaskContext.Mode mode) throws IOException { if (mode == PatchingTaskContext.Mode.APPLY) { if (ENABLE_INVALIDATION) { updateJar(file, GOOD_ENDSIG_PATTERN, BAD_BYTE_SKIP, CRIPPLED_ENDSIG, GOOD_EN...
java
private static void updateJar(final File file, final byte[] searchPattern, final int[] badSkipBytes, final int newSig, final int endSig) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "rw"); try { final FileChannel channel = raf.getChannel(); try { ...
java
private static boolean validateEndRecord(File file, FileChannel channel, long startEndRecord, long endSig) throws IOException { try { channel.position(startEndRecord); final ByteBuffer endDirHeader = getByteBuffer(ENDLEN); read(endDirHeader, channel); if (endDir...
java
private static long scanForEndSig(final File file, final FileChannel channel, final ScanContext context) throws IOException { // TODO Consider just reading in MAX_REVERSE_SCAN bytes -- increased peak memory cost but less complex ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long start = channel...
java
private static long scanForLocSig(FileChannel channel) throws IOException { channel.position(0); ByteBuffer bb = getByteBuffer(CHUNK_SIZE); long end = channel.size(); while (channel.position() <= end) { read(bb, channel); int bufferPos = 0; while (...
java
private static boolean validateLocalFileRecord(FileChannel channel, long startLocRecord, long compressedSize) throws IOException { ByteBuffer lfhBuffer = getByteBuffer(LOCLEN); read(lfhBuffer, channel, startLocRecord); if (lfhBuffer.limit() < LOCLEN || getUnsignedInt(lfhBuffer, 0) != LOCSIG) { ...
java
private static void computeBadByteSkipArray(byte[] pattern, int[] badByteArray) { for (int a = 0; a < ALPHABET_SIZE; a++) { badByteArray[a] = pattern.length; } for (int j = 0; j < pattern.length - 1; j++) { badByteArray[pattern[j] - Byte.MIN_VALUE] = pattern.length - j -...
java
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new ...
java
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachme...
java
public void pause(ServerActivityCallback requestCountListener) { if (paused) { throw ServerLogger.ROOT_LOGGER.serverAlreadyPaused(); } this.paused = true; listenerUpdater.set(this, requestCountListener); if (activeRequestCountUpdater.get(this) == 0) { if (...
java
public void resume() { this.paused = false; ServerActivityCallback listener = listenerUpdater.get(this); if (listener != null) { listenerUpdater.compareAndSet(this, listener, null); } }
java
public static ModelNode createLocalHostHostInfo(final LocalHostControllerInfo hostInfo, final ProductConfig productConfig, final IgnoredDomainResourceRegistry ignoredResourceRegistry, final Resource hostModelResource) { final ModelNode info = new ModelNode(); ...
java
public void addModuleDir(final String moduleDir) { if (moduleDir == null) { throw LauncherMessages.MESSAGES.nullParam("moduleDir"); } // Validate the path final Path path = Paths.get(moduleDir).normalize(); modulesDirs.add(path.toString()); }
java
public String getModulePaths() { final StringBuilder result = new StringBuilder(); if (addDefaultModuleDir) { result.append(wildflyHome.resolve("modules").toString()); } if (!modulesDirs.isEmpty()) { if (addDefaultModuleDir) result.append(File.pathSeparator); ...
java
public static ModelControllerClient createAndAdd(final ManagementChannelHandler handler) { final ExistingChannelModelControllerClient client = new ExistingChannelModelControllerClient(handler); handler.addHandlerFactory(client); return client; }
java
public static ModelControllerClient createReceiving(final Channel channel, final ExecutorService executorService) { final ManagementClientChannelStrategy strategy = ManagementClientChannelStrategy.create(channel); final ManagementChannelHandler handler = new ManagementChannelHandler(strategy, executorSe...
java
@Override protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException { // Is the line an empty comment "#" ? if (line.startsWith(COMMENT_PREFIX) && line.length() == 1) { String nextLine = bufferedFileReader.readLine(); ...
java
@Deprecated public void validateOperation(final ModelNode operation) throws OperationFailedException { if (operation.hasDefined(ModelDescriptionConstants.OPERATION_NAME) && deprecationData != null && deprecationData.isNotificationUseful()) { ControllerLogger.DEPRECATED_LOGGER.operationDeprecated...
java
@SuppressWarnings("deprecation") @Deprecated public final void validateAndSet(ModelNode operationObject, final ModelNode model) throws OperationFailedException { validateOperation(operationObject); for (AttributeDefinition ad : this.parameters) { ad.validateAndSet(operationObject, mo...
java
<P extends PatchingArtifact.ArtifactState, S extends PatchingArtifact.ArtifactState> PatchingArtifactStateHandler<S> getHandlerForArtifact(PatchingArtifact<P, S> artifact) { return handlers.get(artifact); }
java
public <V> V getAttachment(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.get(key)); }
java
public <V> V attach(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.put(key, value)); }
java
public <V> V attachIfAbsent(final AttachmentKey<V> key, final V value) { assert key != null; return key.cast(contextAttachments.putIfAbsent(key, value)); }
java
public <V> V detach(final AttachmentKey<V> key) { assert key != null; return key.cast(contextAttachments.remove(key)); }
java
private void writeInterfaceCriteria(final XMLExtendedStreamWriter writer, final ModelNode subModel, final boolean nested) throws XMLStreamException { for (final Property property : subModel.asPropertyList()) { if (property.getValue().isDefined()) { writeInterfaceCriteria(writer, prop...
java
public static ExtensibleConfigurationPersister createHostXmlConfigurationPersister(final ConfigurationFile file, final HostControllerEnvironment environment, final ExecutorService executorService, final ExtensionRegistry hostExtensio...
java
public static ExtensibleConfigurationPersister createDomainXmlConfigurationPersister(final ConfigurationFile file, ExecutorService executorService, ExtensionRegistry extensionRegistry, final HostControllerEnvironment environment) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorServic...
java
public static ExtensibleConfigurationPersister createTransientDomainXmlConfigurationPersister(ExecutorService executorService, ExtensionRegistry extensionRegistry) { DomainXml domainXml = new DomainXml(Module.getBootModuleLoader(), executorService, extensionRegistry); ExtensibleConfigurationPersister pe...
java
static void apply(final String patchId, final Collection<ContentModification> modifications, final PatchEntry patchEntry, final ContentItemFilter filter) { for (final ContentModification modification : modifications) { final ContentItem item = modification.getItem(); // Check if we acce...
java
protected ServiceName serviceName(final String name) { return baseServiceName != null ? baseServiceName.append(name) : null; }
java
private boolean subModuleExists(File dir) { if (isSlotDirectory(dir)) { return true; } else { File[] children = dir.listFiles(File::isDirectory); for (File child : children) { if (subModuleExists(child)) { return true; ...
java
private String tail(String moduleName) { if (moduleName.indexOf(MODULE_NAME_SEPARATOR) > 0) { return moduleName.substring(moduleName.indexOf(MODULE_NAME_SEPARATOR) + 1); } else { return ""; } }
java
void resolveBootUpdates(final ModelController controller, final ActiveOperation.CompletedCallback<ModelNode> callback) throws Exception { connection.openConnection(controller, callback); // Keep a reference to the the controller this.controller = controller; }
java
static VaultConfig loadExternalFile(File f) throws XMLStreamException { if(f == null) { throw new IllegalArgumentException("File is null"); } if(!f.exists()) { throw new XMLStreamException("Failed to locate vault file " + f.getAbsolutePath()); } final Vau...
java
static VaultConfig readVaultElement_3_0(XMLExtendedStreamReader reader, Namespace expectedNs) throws XMLStreamException { final VaultConfig config = new VaultConfig(); final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { final String value = reader.getAttr...
java