code
stringlengths
73
34.1k
label
stringclasses
1 value
public static ServiceController<DeploymentScanner> addService(final OperationContext context, final PathAddress resourceAddress, final String relativeTo, final String path, final int scanInterval, TimeUnit unit, final boolean autoDeployZip, ...
java
public ManagementModelNode findNode(String address) { ManagementModelNode root = (ManagementModelNode)tree.getModel().getRoot(); Enumeration<javax.swing.tree.TreeNode> allNodes = root.depthFirstEnumeration(); while (allNodes.hasMoreElements()) { ManagementModelNode node = (Management...
java
public ManagementModelNode getSelectedNode() { if (tree.getSelectionPath() == null) return null; return (ManagementModelNode)tree.getSelectionPath().getLastPathComponent(); }
java
public static Connection connectSync(final ProtocolConnectionConfiguration configuration) throws IOException { long timeoutMillis = configuration.getConnectionTimeout(); CallbackHandler handler = configuration.getCallbackHandler(); final CallbackHandler actualHandler; ProtocolTimeoutHand...
java
public void openBlockingInterruptable() throws InterruptedException { // We need to thread this call in order to interrupt it (when Ctrl-C occurs). connectionThread = new Thread(() -> { // This thread can't be interrupted from another thread. // Wi...
java
protected static void validateSignature(final DataInput input) throws IOException { final byte[] signatureBytes = new byte[4]; input.readFully(signatureBytes); if (!Arrays.equals(ManagementProtocol.SIGNATURE, signatureBytes)) { throw ProtocolLogger.ROOT_LOGGER.invalidSignature(Arrays...
java
public static ManagementProtocolHeader parse(DataInput input) throws IOException { validateSignature(input); expectHeader(input, ManagementProtocol.VERSION_FIELD); int version = input.readInt(); expectHeader(input, ManagementProtocol.TYPE); byte type = input.readByte(); s...
java
protected void checkConsecutiveAlpha() { Pattern symbolsPatter = Pattern.compile(REGEX_ALPHA_UC + "+"); Matcher matcher = symbolsPatter.matcher(this.password); int met = 0; while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); ...
java
public static ModelNode createBootUpdates(final String serverName, final ModelNode domainModel, final ModelNode hostModel, final DomainController domainController, final ExpressionResolver expressionResolver) { final ManagedServerOperationsFactory factory = new Mana...
java
private synchronized HostServerGroupEffect getMappableDomainEffect(PathAddress address, String key, Map<String, Set<String>> map, Resource root) { if (requiresMapping) { map(root); requiresMapping = false; } ...
java
private synchronized HostServerGroupEffect getHostEffect(PathAddress address, String host, Resource root) { if (requiresMapping) { map(root); requiresMapping = false; } Set<String> mapped = hostsToGroups.get(host); if (mapped == null) { // Unassigned ...
java
private void map(Resource root) { for (Resource.ResourceEntry serverGroup : root.getChildren(SERVER_GROUP)) { String serverGroupName = serverGroup.getName(); ModelNode serverGroupModel = serverGroup.getModel(); String profile = serverGroupModel.require(PROFILE).asString(); ...
java
@Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { for (AttributeAccess attr : attributes.values()) { resourceRegistration.registerReadOnlyAttribute(attr.getAttributeDefinition(), null); } }
java
@Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { // Register wildcard children last to prevent duplicate registration errors when override definitions exist for (ResourceDefinition rd : singletonChildren) { resourceRegistration.registerSubMode...
java
public static void installDomainConnectorServices(final OperationContext context, final ServiceTarget serviceTarget, final ServiceName endpointName, final Ser...
java
public static void installManagementChannelServices( final ServiceTarget serviceTarget, final ServiceName endpointName, final AbstractModelControllerOperationHandlerFactoryService operationHandlerService, final ServiceName modelControllerName, final String cha...
java
public static void isManagementResourceRemoveable(OperationContext context, PathAddress otherManagementEndpoint) throws OperationFailedException { ModelNode remotingConnector; try { remotingConnector = context.readResourceFromRoot( PathAddress.pathAddress(PathElement.path...
java
static void writeCertificates(final ModelNode result, final Certificate[] certificates) throws CertificateEncodingException, NoSuchAlgorithmException { if (certificates != null) { for (Certificate current : certificates) { ModelNode certificate = new ModelNode(); writ...
java
private static MBeanServer setQueryExpServer(QueryExp query, MBeanServer toSet) { // We assume the QueryExp is a QueryEval subclass or uses the QueryEval thread local // mechanism to store any existing MBeanServer. If that's not the case we have no // way to access the old mbeanserver to let us ...
java
PathAddress toPathAddress(final ObjectName name) { return ObjectNameAddressUtil.toPathAddress(rootObjectInstance.getObjectName(), getRootResourceAndRegistration().getRegistration(), name); }
java
public static TransactionalProtocolClient createClient(final ManagementChannelHandler channelAssociation) { final TransactionalProtocolClientImpl client = new TransactionalProtocolClientImpl(channelAssociation); channelAssociation.addHandlerFactory(client); return client; }
java
public static TransactionalProtocolClient.Operation wrap(final ModelNode operation, final OperationMessageHandler messageHandler, final OperationAttachments attachments) { return new TransactionalOperationImpl(operation, messageHandler, attachments); }
java
public static TransactionalProtocolClient.PreparedOperation<TransactionalProtocolClient.Operation> executeBlocking(final ModelNode operation, TransactionalProtocolClient client) throws IOException, InterruptedException { final BlockingQueueOperationListener<TransactionalProtocolClient.Operation> listener = new ...
java
private void init() { if (initialized.compareAndSet(false, true)) { final RowSorter<? extends TableModel> rowSorter = table.getRowSorter(); rowSorter.toggleSortOrder(1); // sort by date rowSorter.toggleSortOrder(1); // descending final TableColumnModel columnModel...
java
public void execute() throws IOException { try { prepare(); boolean commitResult = commit(); if (commitResult == false) { throw PatchLogger.ROOT_LOGGER.failedToDeleteBackup(); } } catch (PrepareException pe){ rollback(); ...
java
public void rollback() throws GitAPIException { try (Git git = getGit()) { git.reset().setMode(ResetCommand.ResetType.HARD).setRef(HEAD).call(); } }
java
public void commit(String msg) throws GitAPIException { try (Git git = getGit()) { Status status = git.status().call(); if (!status.isClean()) { git.commit().setMessage(msg).setAll(true).setNoVerify(true).call(); } } }
java
static void initializeExtension(ExtensionRegistry extensionRegistry, String module, ManagementResourceRegistration rootRegistration, ExtensionRegistryType extensionRegistryType) { try { boolean unknownModule = false; ...
java
private void addDependent(String pathName, String relativeTo) { if (relativeTo != null) { Set<String> dependents = dependenctRelativePaths.get(relativeTo); if (dependents == null) { dependents = new HashSet<String>(); dependenctRelativePaths.put(relativeTo...
java
private void getAllDependents(Set<PathEntry> result, String name) { Set<String> depNames = dependenctRelativePaths.get(name); if (depNames == null) { return; } for (String dep : depNames) { PathEntry entry = pathEntries.get(dep); if (entry != null) { ...
java
void addOption(final String value) { Assert.checkNotNullParam("value", value); synchronized (options) { options.add(value); } }
java
@SuppressWarnings("unchecked") public static <T> AttachmentKey<T> create(final Class<? super T> valueClass) { return new SimpleAttachmentKey(valueClass); }
java
InputStream openContentStream(final ContentItem item) throws IOException { final File file = getFile(item); if (file == null) { throw new IllegalStateException(); } return new FileInputStream(file); }
java
public ModelNode buildExecutableRequest(CommandContext ctx) throws Exception { try { for (FailureDescProvider h : providers) { effectiveProviders.add(h); } // In case some key-store needs to be persisted for (String ks : ksToStore) { ...
java
@Override public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); List<ResourceRoot> resourceRoots = DeploymentUtils.allResourceRoots(deploymentUnit); for (ResourceRoot resourc...
java
private PersistentResourceXMLDescription getSimpleMapperParser() { if (version.equals(Version.VERSION_1_0)) { return simpleMapperParser_1_0; } else if (version.equals(Version.VERSION_1_1)) { return simpleMapperParser_1_1; } return simpleMapperParser; }
java
public static DeploymentUnit getTopDeploymentUnit(DeploymentUnit unit) { Assert.checkNotNullParam("unit", unit); DeploymentUnit parent = unit.getParent(); while (parent != null) { unit = parent; parent = unit.getParent(); } return unit; }
java
protected Connection openConnection() throws IOException { // Perhaps this can just be done once? CallbackHandler callbackHandler = null; SSLContext sslContext = null; if (realm != null) { sslContext = realm.getSSLContext(); CallbackHandlerFactory handlerFactory =...
java
boolean applyDomainModel(ModelNode result) { if(! result.hasDefined(ModelDescriptionConstants.RESULT)) { return false; } final List<ModelNode> bootOperations= result.get(ModelDescriptionConstants.RESULT).asList(); return callback.applyDomainModel(bootOperations); }
java
public static Thread addShutdownHook(final Process process) { final Thread thread = new Thread(new Runnable() { @Override public void run() { if (process != null) { process.destroy(); try { process.waitFor();...
java
public void addOrderedChildResourceTypes(PathAddress resourceAddress, Resource resource) { Set<String> orderedChildTypes = resource.getOrderedChildTypes(); if (orderedChildTypes.size() > 0) { orderedChildren.put(resourceAddress, resource.getOrderedChildTypes()); } }
java
private static Map<String, ServerGroupDeploymentPlanResult> buildServerGroupResults(Map<UUID, DeploymentActionResult> deploymentActionResults) { Map<String, ServerGroupDeploymentPlanResult> serverGroupResults = new HashMap<String, ServerGroupDeploymentPlanResult>(); for (Map.Entry<UUID, DeploymentActio...
java
protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) { // Build attribute rules final Map<String, AttributeT...
java
protected Map<String, OperationTransformer> buildOperationTransformers(AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry) { final Map<String, OperationTransformer> operations = new HashMap<String, OperationTransformer>(); for(final Map.Entry<String,...
java
protected List<TransformationDescription> buildChildren() { if(children.isEmpty()) { return Collections.emptyList(); } final List<TransformationDescription> children = new ArrayList<TransformationDescription>(); for(final TransformationDescriptionBuilder builder : this.childr...
java
@Deprecated public static OptionMap create(final ExpressionResolver resolver, final ModelNode model, final OptionMap defaults) throws OperationFailedException { final OptionMap map = OptionMap.builder() .addAll(defaults) .set(Options.WORKER_READ_THREADS, RemotingSubsystemRoot...
java
@Override public PersistentResourceXMLDescription getParserDescription() { return PersistentResourceXMLDescription.builder(ElytronExtension.SUBSYSTEM_PATH, getNameSpace()) .addAttribute(ElytronDefinition.DEFAULT_AUTHENTICATION_CONTEXT) .addAttribute(ElytronDefinition.INITIAL_...
java
public synchronized void reset() { this.authorizerDescription = StandardRBACAuthorizer.AUTHORIZER_DESCRIPTION; this.useIdentityRoles = this.nonFacadeMBeansSensitive = false; this.roleMappings = new HashMap<String, RoleMappingImpl>(); RoleMaps oldRoleMaps = this.roleMaps; this.rol...
java
public synchronized void addRoleMapping(final String roleName) { HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings); if (newRoles.containsKey(roleName) == false) { newRoles.put(roleName, new RoleMappingImpl(roleName)); roleMappings = Co...
java
public synchronized Object removeRoleMapping(final String roleName) { /* * Would not expect this to happen during boot so don't offer the 'immediate' optimisation. */ HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings); if (newRoles.co...
java
public synchronized boolean undoRoleMappingRemove(final Object removalKey) { HashMap<String, RoleMappingImpl> newRoles = new HashMap<String, RoleMappingImpl>(roleMappings); RoleMappingImpl toRestore = removedRoles.remove(removalKey); if (toRestore != null && newRoles.containsKey(toRestore.getNam...
java
private Map<Set<ServerIdentity>, ModelNode> getDeploymentOverlayOperations(ModelNode operation, ModelNode host) { final PathAddress realAddress = PathAddress.pathAddress(operation.get(OP_ADDR)); if (realAddress.size() == 0 &&...
java
public static boolean isLogDownloadAvailable(CliGuiContext cliGuiCtx) { ModelNode readOps = null; try { readOps = cliGuiCtx.getExecutor().doCommand("/subsystem=logging:read-children-types"); } catch (CommandFormatException | IOException e) { return false; } ...
java
public static InetAddress getLocalHost() throws UnknownHostException { InetAddress addr; try { addr = InetAddress.getLocalHost(); } catch (ArrayIndexOutOfBoundsException e) { //this is workaround for mac osx bug see AS7-3223 and JGRP-1404 addr = InetAddress.getByName(nul...
java
public File getBootFile() { if (bootFile == null) { synchronized (this) { if (bootFile == null) { if (bootFileReset) { //Reset the done bootup and the sequence, so that the old file we are reloading from // overwrite...
java
void successfulBoot() throws ConfigurationPersistenceException { synchronized (this) { if (doneBootup.get()) { return; } final File copySource; if (!interactionPolicy.isReadOnly()) { copySource = mainFile; } else { ...
java
void backup() throws ConfigurationPersistenceException { if (!doneBootup.get()) { return; } try { if (!interactionPolicy.isReadOnly()) { //Move the main file to the versioned history moveFile(mainFile, getVersionedFile(mainFile)); ...
java
void commitTempFile(File temp) throws ConfigurationPersistenceException { if (!doneBootup.get()) { return; } if (!interactionPolicy.isReadOnly()) { FilePersistenceUtils.moveTempFileToMain(temp, mainFile); } else { FilePersistenceUtils.moveTempFileToMai...
java
void fileWritten() throws ConfigurationPersistenceException { if (!doneBootup.get() || interactionPolicy.isReadOnly()) { return; } try { FilePersistenceUtils.copyFile(mainFile, lastFile); } catch (IOException e) { throw ControllerLogger.ROOT_LOGGER.fai...
java
private void deleteRecursive(final File file) { if (file.isDirectory()) { final String[] files = file.list(); if (files != null) { for (String name : files) { deleteRecursive(new File(file, name)); } } } if ...
java
protected void updateModel(final OperationContext context, final ModelNode operation) throws OperationFailedException { // verify that the resource exist before removing it context.readResource(PathAddress.EMPTY_ADDRESS, false); Resource resource = context.removeResource(PathAddress.EMPTY_ADDRES...
java
ResultAction executeOperation() { assert isControllingThread(); try { /** Execution has begun */ executing = true; processStages(); if (resultAction == ResultAction.KEEP) { report(MessageSeverity.INFO, ControllerLogger.ROOT_LOGGER.operat...
java
void logAuditRecord() { trackConfigurationChange(); if (!auditLogged) { try { AccessAuditContext accessContext = SecurityActions.currentAccessAuditContext(); Caller caller = getCaller(); auditLogger.log( isReadOnly(), ...
java
private void processStages() { // Locate the next step to execute. ModelNode primaryResponse = null; Step step; do { step = steps.get(currentStage).pollFirst(); if (step == null) { if (currentStage == Stage.MODEL && addModelValidationSteps()) { ...
java
private void checkUndefinedNotification(Notification notification) { String type = notification.getType(); PathAddress source = notification.getSource(); Map<String, NotificationEntry> descriptions = getRootResourceRegistration().getNotificationDescriptions(source, true); if (!descriptio...
java
private ResultAction getFailedResultAction(Throwable cause) { if (currentStage == Stage.MODEL || cancelled || isRollbackOnRuntimeFailure() || isRollbackOnly() || (cause != null && !(cause instanceof OperationFailedException))) { return ResultAction.ROLLBACK; } return ...
java
public boolean canUpdateServer(ServerIdentity server) { if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) { throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server); } if (!parent.canChildProceed()) return false; ...
java
public void recordServerResult(ServerIdentity server, ModelNode response) { if (!serverGroupName.equals(server.getServerGroupName()) || !servers.contains(server)) { throw DomainControllerLogger.HOST_CONTROLLER_LOGGER.unknownServer(server); } boolean serverFailed = response.has(FAIL...
java
public void set(final Argument argument) { if (argument != null) { map.put(argument.getKey(), Collections.singleton(argument)); } }
java
public String get(final String key) { final Collection<Argument> args = map.get(key); if (args != null) { return args.iterator().hasNext() ? args.iterator().next().getValue() : null; } return null; }
java
public Collection<Argument> getArguments(final String key) { final Collection<Argument> args = map.get(key); if (args != null) { return new ArrayList<>(args); } return Collections.emptyList(); }
java
public List<String> asList() { final List<String> result = new ArrayList<>(); for (Collection<Argument> args : map.values()) { for (Argument arg : args) { result.add(arg.asCommandLineArgument()); } } return result; }
java
private void parseLdapAuthorization_1_5(final XMLExtendedStreamReader reader, final ModelNode realmAddress, final List<ModelNode> list) throws XMLStreamException { ModelNode addr = realmAddress.clone().add(AUTHORIZATION, LDAP); ModelNode ldapAuthorization = Util.getEmptyOperation(ADD, addr);...
java
public void merge(final ResourceRoot additionalResourceRoot) { if(!additionalResourceRoot.getRoot().equals(root)) { throw ServerLogger.ROOT_LOGGER.cannotMergeResourceRoot(root, additionalResourceRoot.getRoot()); } usePhysicalCodeSource = additionalResourceRoot.usePhysicalCodeSource; ...
java
@Override public void registerTransformers(SubsystemTransformerRegistration subsystemRegistration) { ResourceTransformationDescriptionBuilder builder = ResourceTransformationDescriptionBuilder.Factory.createSubsystemInstance(); builder.addChildResource(DeploymentPermissionsResourceDefinition.DEPLOYM...
java
ModelNode toModelNode() { ModelNode result = null; if (map != null) { result = new ModelNode(); for (Map.Entry<PathAddress, ResourceData> entry : map.entrySet()) { ModelNode item = new ModelNode(); PathAddress pa = entry.getKey(); i...
java
public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException { // Determine the patch id to rollback String patchId; final List<String> oneOffs = modificati...
java
static void restoreFromHistory(final InstallationManager.MutablePatchingTarget target, final String rollbackPatchId, final Patch.PatchType patchType, final PatchableTarget.TargetInfo history) throws PatchingException { if (patchType == Patch.PatchType.CUMULATIVE) { ...
java
void portForward(final Patch patch, IdentityPatchContext context) throws PatchingException, IOException, XMLStreamException { assert patch.getIdentity().getPatchType() == Patch.PatchType.CUMULATIVE; final PatchingHistory history = context.getHistory(); for (final PatchElement element : patch.ge...
java
static PatchingResult executeTasks(final IdentityPatchContext context, final IdentityPatchContext.FinalizeCallback callback) throws Exception { final List<PreparedTask> tasks = new ArrayList<PreparedTask>(); final List<ContentItem> conflicts = new ArrayList<ContentItem>(); // Identity pr...
java
static void prepareTasks(final IdentityPatchContext.PatchEntry entry, final IdentityPatchContext context, final List<PreparedTask> tasks, final List<ContentItem> conflicts) throws PatchingException { for (final PatchingTasks.ContentTaskDefinition definition : entry.getTaskDefinitions()) { final Patc...
java
static PatchingTask createTask(final PatchingTasks.ContentTaskDefinition definition, final PatchContentProvider provider, final IdentityPatchContext.PatchEntry context) { final PatchContentLoader contentLoader = provider.getLoader(definition.getTarget().getPatchId()); final PatchingTaskDescription descr...
java
static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException { // See if the prerequisites are met for (final String required : condition.getRequires()) { if (!target.isApplied(required)) { ...
java
public static List<DomainControllerData> domainControllerDataFromByteBuffer(byte[] buffer) throws Exception { List<DomainControllerData> retval = new ArrayList<DomainControllerData>(); if (buffer == null) { return retval; } ByteArrayInputStream in_stream = new ByteArrayInputS...
java
public static byte[] domainControllerDataToByteBuffer(List<DomainControllerData> data) throws Exception { final ByteArrayOutputStream out_stream = new ByteArrayOutputStream(512); byte[] result; try (DataOutputStream out = new DataOutputStream(out_stream)) { Iterator<DomainControllerD...
java
private boolean canSuccessorProceed() { if (predecessor != null && !predecessor.canSuccessorProceed()) { return false; } synchronized (this) { while (responseCount < groups.size()) { try { wait(); } catch (InterruptedE...
java
public void recordServerGroupResult(final String serverGroup, final boolean failed) { synchronized (this) { if (groups.contains(serverGroup)) { responseCount++; if (failed) { this.failed = true; } DomainControllerLo...
java
@SuppressWarnings("deprecation") protected ModelNode executeReadOnlyOperation(final ModelNode operation, final OperationMessageHandler handler, final OperationTransactionControl control, final OperationStepHandler prepareStep, final int operationId) { final AbstractOperationContext delegateContext = getDele...
java
public synchronized void addShutdownListener(ShutdownListener listener) { if (state == CLOSED) { listener.handleCompleted(); } else { listeners.add(listener); } }
java
protected synchronized void handleCompleted() { latch.countDown(); for (final ShutdownListener listener : listeners) { listener.handleCompleted(); } listeners.clear(); }
java
public boolean hasDeploymentSubsystemModel(final String subsystemName) { final Resource root = deploymentUnit.getAttachment(DEPLOYMENT_RESOURCE); final PathElement subsystem = PathElement.pathElement(SUBSYSTEM, subsystemName); return root.hasChild(subsystem); }
java
public ModelNode getDeploymentSubsystemModel(final String subsystemName) { assert subsystemName != null : "The subsystemName cannot be null"; return getDeploymentSubModel(subsystemName, PathAddress.EMPTY_ADDRESS, null, deploymentUnit); }
java
public ModelNode registerDeploymentSubsystemResource(final String subsystemName, final Resource resource) { assert subsystemName != null : "The subsystemName cannot be null"; assert resource != null : "The resource cannot be null"; return registerDeploymentSubResource(subsystemName, PathAddress....
java
static Resource getOrCreateSubDeployment(final String deploymentName, final DeploymentUnit parent) { final Resource root = parent.getAttachment(DEPLOYMENT_RESOURCE); return getOrCreate(root, PathElement.pathElement(SUBDEPLOYMENT, deploymentName)); }
java
static void cleanup(final Resource resource) { synchronized (resource) { for (final Resource.ResourceEntry entry : resource.getChildren(SUBSYSTEM)) { resource.removeChild(entry.getPathElement()); } for (final Resource.ResourceEntry entry : resource.getChildren...
java
Path resolveBaseDir(final String name, final String dirName) { final String currentDir = SecurityActions.getPropertyPrivileged(name); if (currentDir == null) { return jbossHomeDir.resolve(dirName); } return Paths.get(currentDir); }
java
static Path resolvePath(final Path base, final String... paths) { return Paths.get(base.toString(), paths); }
java
static Map<String, Set<String>> getChildAddresses(final OperationContext context, final PathAddress addr, final ImmutableManagementResourceRegistration registry, Resource resource, final String validChildType) { Map<String, Set<String>> result = new HashMap<>(); Predicate<String> validChildTypeFilter =...
java
public DiscreteInterval plus(DiscreteInterval other) { return new DiscreteInterval(this.min + other.min, this.max + other.max); }
java
public DiscreteInterval minus(DiscreteInterval other) { return new DiscreteInterval(this.min - other.max, this.max - other.min); }
java