code
stringlengths
73
34.1k
label
stringclasses
1 value
public OperationTransformerRegistry resolveServer(final ModelVersion mgmtVersion, final ModelNode subsystems) { return resolveServer(mgmtVersion, resolveVersions(subsystems)); }
java
void addSubsystem(final OperationTransformerRegistry registry, final String name, final ModelVersion version) { final OperationTransformerRegistry profile = registry.getChild(PathAddress.pathAddress(PROFILE)); final OperationTransformerRegistry server = registry.getChild(PathAddress.pathAddress(HOST, SE...
java
public synchronized void persistProperties() throws IOException { beginPersistence(); // Read the properties file into memory // Shouldn't be so bad - it's a small file List<String> content = readFile(propertiesFile); BufferedWriter bw = new BufferedWriter(new OutputStreamWrite...
java
protected void addLineContent(BufferedReader bufferedFileReader, List<String> content, String line) throws IOException { content.add(line); }
java
protected void endPersistence(final BufferedWriter writer) throws IOException { // Append any additional users to the end of the file. for (Object currentKey : toSave.keySet()) { String key = (String) currentKey; if (!key.contains(DISABLE_SUFFIX_KEY)) { writePrope...
java
public List<String> getServiceImplementations(String serviceTypeName) { final List<String> strings = services.get(serviceTypeName); return strings == null ? Collections.<String>emptyList() : Collections.unmodifiableList(strings); }
java
static synchronized LogContext configureLogContext(final File logDir, final File configDir, final String defaultLogFileName, final CommandContext ctx) { final LogContext embeddedLogContext = Holder.LOG_CONTEXT; final Path bootLog = logDir.toPath().resolve(Paths.get(defaultLogFileName)); final Pa...
java
static synchronized void clearLogContext() { final LogContext embeddedLogContext = Holder.LOG_CONTEXT; // Remove the configurator and clear the log context final Configurator configurator = embeddedLogContext.getLogger("").detach(Configurator.ATTACHMENT_KEY); // If this was a PropertyCon...
java
public static String matchOrigin(HttpServerExchange exchange, Collection<String> allowedOrigins) throws Exception { HeaderMap headers = exchange.getRequestHeaders(); String[] origins = headers.get(Headers.ORIGIN).toArray(); if (allowedOrigins != null && !allowedOrigins.isEmpty()) { f...
java
public static DeploymentReflectionIndex create() { final SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(ServerPermission.CREATE_DEPLOYMENT_REFLECTION_INDEX); } return new DeploymentReflectionIndex(); }
java
@Override public final Map<String, OperationEntry> getOperationDescriptions(final PathAddress address, boolean inherited) { if (parent != null) { RootInvocation ri = getRootInvocation(); return ri.root.getOperationDescriptions(ri.pathAddress.append(address), inherited); } ...
java
boolean hasNoAlternativeWildcardRegistration() { return parent == null || PathElement.WILDCARD_VALUE.equals(valueString) || !parent.getChildNames().contains(PathElement.WILDCARD_VALUE); }
java
public static ModelNode getAccessControl(ModelControllerClient client, OperationRequestAddress address, boolean operations) { return getAccessControl(client, null, address, operations); }
java
String generateSynopsis() { synopsisOptions = buildSynopsisOptions(opts, arg, domain); StringBuilder synopsisBuilder = new StringBuilder(); if (parentName != null) { synopsisBuilder.append(parentName).append(" "); } synopsisBuilder.append(commandName); if (isO...
java
protected static InstallationModificationImpl.InstallationState load(final InstalledIdentity installedIdentity) throws IOException { final InstallationModificationImpl.InstallationState state = new InstallationModificationImpl.InstallationState(); for (final Layer layer : installedIdentity.getLayers()) ...
java
public static InstalledIdentity load(final File jbossHome, final ProductConfig productConfig, final File... repoRoots) throws IOException { final InstalledImage installedImage = installedImage(jbossHome); return load(installedImage, productConfig, Arrays.<File>asList(repoRoots), Collections.<File>emptyL...
java
public static InstalledIdentity load(final InstalledImage installedImage, final ProductConfig productConfig, List<File> moduleRoots, final List<File> bundleRoots) throws IOException { return LayersFactory.load(installedImage, productConfig, moduleRoots, bundleRoots); }
java
public void shutdown() { final Connection connection; synchronized (this) { if(shutdown) return; shutdown = true; connection = this.connection; if(connectTask != null) { connectTask.shutdown(); } } if (connection...
java
private void onConnectionClose(final Connection closed) { synchronized (this) { if(connection == closed) { connection = null; if(shutdown) { connectTask = DISCONNECTED; return; } final ConnectTask...
java
public static ProtocolConnectionManager create(final Connection connection, final ConnectionOpenHandler openHandler) { return create(new EstablishedConnection(connection, openHandler)); }
java
public void await() { boolean intr = false; final Object lock = this.lock; try { synchronized (lock) { while (! readClosed) { try { lock.wait(); } catch (InterruptedException e) { ...
java
public void removeExtension(Resource rootResource, String moduleName, ManagementResourceRegistration rootRegistration) throws IllegalStateException { final ManagementResourceRegistration profileReg; if (rootRegistration.getPathAddress().size() == 0) { //domain or server extension ...
java
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) { final ModelNode preparedResult = prepared.getPreparedResult(); // Hmm do the server results need to get translated as well as the host...
java
private static String resolveJavaCommand(final Path javaHome) { final String exe; if (javaHome == null) { exe = "java"; } else { exe = javaHome.resolve("bin").resolve("java").toString(); } if (exe.contains(" ")) { return "\"" + exe + "\""; ...
java
public String getRelativePath() { final StringBuilder builder = new StringBuilder(); for(final String p : path) { builder.append(p).append("/"); } builder.append(getName()); return builder.toString(); }
java
protected void runScript(File script) { if (!script.exists()) { JOptionPane.showMessageDialog(cliGuiCtx.getMainPanel(), script.getAbsolutePath() + " does not exist.", "Unable to run script.", JOptionPane.ERROR_MESSAGE); return; } ...
java
private List<String> getCommandLines(File file) { List<String> lines = new ArrayList<>(); try (BufferedReader reader = new BufferedReader(new FileReader(file))) { String line = reader.readLine(); while (line != null) { lines.add(line); line = reade...
java
public Set<AttributeAccess.Flag> getFlags() { if (attributeAccess == null) { return Collections.emptySet(); } return attributeAccess.getFlags(); }
java
static ModelNode createOperation(final ModelNode operationToValidate) { PathAddress pa = PathAddress.pathAddress(operationToValidate.require(ModelDescriptionConstants.OP_ADDR)); PathAddress realmPA = null; for (int i = pa.size() - 1; i > 0; i--) { PathElement pe = pa.getElement(i); ...
java
public static ServiceName channelServiceName(final ServiceName endpointName, final String channelName) { return endpointName.append("channel").append(channelName); }
java
public InetAddress getRemoteAddress() { final Channel channel; try { channel = strategy.getChannel(); } catch (IOException e) { return null; } final Connection connection = channel.getConnection(); final InetSocketAddress peerAddress = connection.g...
java
public void addHandlerFactory(ManagementRequestHandlerFactory factory) { for (;;) { final ManagementRequestHandlerFactory[] snapshot = updater.get(this); final int length = snapshot.length; final ManagementRequestHandlerFactory[] newVal = new ManagementRequestHandlerFactory[l...
java
public boolean removeHandlerFactory(ManagementRequestHandlerFactory instance) { for(;;) { final ManagementRequestHandlerFactory[] snapshot = updater.get(this); final int length = snapshot.length; int index = -1; for(int i = 0; i < length; i++) { if...
java
public String translatePath(String path) { String translated; // special character: ~ maps to the user's home directory if (path.startsWith("~" + File.separator)) { translated = System.getProperty("user.home") + path.substring(1); } else if (path.startsWith("~")) { ...
java
private static String clearPath(String path) { try { ExpressionBaseState state = new ExpressionBaseState("EXPR", true, false); if (Util.isWindows()) { // to not require escaping FS name separator state.setDefaultHandler(WordCharacterHandler.IGNORE_LB_ESCAP...
java
@Override public synchronized void resume() { this.paused = false; ServerActivityCallback listener = listenerUpdater.get(this); if (listener != null) { listenerUpdater.compareAndSet(this, listener, null); } while (!taskQueue.isEmpty() && (activeRequestCount < maxR...
java
public synchronized void pauseDeployment(final String deployment, ServerActivityCallback listener) { final List<ControlPoint> eps = new ArrayList<ControlPoint>(); for (ControlPoint ep : entryPoints.values()) { if (ep.getDeployment().equals(deployment)) { if(!ep.isPaused()) { ...
java
public synchronized void resumeDeployment(final String deployment) { for (ControlPoint ep : entryPoints.values()) { if (ep.getDeployment().equals(deployment)) { ep.resume(); } } }
java
public synchronized void resumeControlPoint(final String entryPoint) { for (ControlPoint ep : entryPoints.values()) { if (ep.getEntryPoint().equals(entryPoint)) { ep.resume(); } } }
java
public synchronized ControlPoint getControlPoint(final String deploymentName, final String entryPointName) { ControlPointIdentifier id = new ControlPointIdentifier(deploymentName, entryPointName); ControlPoint ep = entryPoints.get(id); if (ep == null) { ep = new ControlPoint(this, de...
java
public synchronized void removeControlPoint(ControlPoint controlPoint) { if (controlPoint.decreaseReferenceCount() == 0) { ControlPointIdentifier id = new ControlPointIdentifier(controlPoint.getDeployment(), controlPoint.getEntryPoint()); entryPoints.remove(id); } }
java
private boolean runQueuedTask(boolean hasPermit) { if (!hasPermit && beginRequest(paused) == RunResult.REJECTED) { return false; } QueuedTask task = null; if (!paused) { task = taskQueue.poll(); } else { //the container is suspended, but we sti...
java
static Property getProperty(String propName, ModelNode attrs) { String[] arr = propName.split("\\."); ModelNode attrDescr = attrs; for (String item : arr) { // Remove list part. if (item.endsWith("]")) { int i = item.indexOf("["); if (i < 0...
java
private LoggingConfigurationService configure(final ResourceRoot root, final VirtualFile configFile, final ClassLoader classLoader, final LogContext logContext) throws DeploymentUnitProcessingException { InputStream configStream = null; try { LoggingLogger.ROOT_LOGGER.debugf("Found logging c...
java
public void validateOperations(final List<ModelNode> operations) { if (operations == null) { return; } for (ModelNode operation : operations) { try { validateOperation(operation); } catch (RuntimeException e) { if (exitOnError)...
java
public void validateOperation(final ModelNode operation) { if (operation == null) { return; } final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); final String name = operation.get(OP).asString(); OperationEntry entry = root.getOperationEntry(...
java
private void throwOrWarnAboutDescriptorProblem(String message) { if (validateDescriptions) { throw new IllegalArgumentException(message); } ControllerLogger.ROOT_LOGGER.warn(message); }
java
public static String buildDynamicCapabilityName(String baseName, String dynamicNameElement) { return buildDynamicCapabilityName(baseName, new String[]{dynamicNameElement}); }
java
public static String buildDynamicCapabilityName(String baseName, String ... dynamicNameElement) { assert baseName != null; assert dynamicNameElement != null; assert dynamicNameElement.length > 0; StringBuilder sb = new StringBuilder(baseName); for (String part:dynamicNameElement)...
java
public OperationBuilder addInputStream(final InputStream in) { Assert.checkNotNullParam("in", in); if (inputStreams == null) { inputStreams = new ArrayList<InputStream>(); } inputStreams.add(in); return this; }
java
@Override public InstalledIdentity getInstalledIdentity(String productName, String productVersion) throws PatchingException { final String defaultIdentityName = defaultIdentity.getIdentity().getName(); if(productName == null) { productName = defaultIdentityName; } final ...
java
@Override public List<InstalledIdentity> getInstalledIdentities() throws PatchingException { List<InstalledIdentity> installedIdentities; final File metadataDir = installedImage.getInstallationMetadata(); if(!metadataDir.exists()) { installedIdentities = Collections.singletonLi...
java
public StandaloneCommandBuilder setDebug(final boolean suspend, final int port) { debugArg = String.format(DEBUG_FORMAT, (suspend ? "y" : "n"), port); return this; }
java
public StandaloneCommandBuilder addSecurityProperty(final String key, final String value) { securityProperties.put(key, value); return this; }
java
@SuppressWarnings("deprecation") public BUILDER addAccessConstraint(final AccessConstraintDefinition accessConstraint) { if (accessConstraints == null) { accessConstraints = new AccessConstraintDefinition[] {accessConstraint}; } else { accessConstraints = Arrays.copyOf(access...
java
public BUILDER setAttributeGroup(String attributeGroup) { assert attributeGroup == null || attributeGroup.length() > 0; //noinspection deprecation this.attributeGroup = attributeGroup; return (BUILDER) this; }
java
@SuppressWarnings("deprecation") public BUILDER setAllowedValues(String ... allowedValues) { assert allowedValues!= null; this.allowedValues = new ModelNode[allowedValues.length]; for (int i = 0; i < allowedValues.length; i++) { this.allowedValues[i] = new ModelNode(allowedValues...
java
protected LogContext getOrCreate(final String loggingProfile) { LogContext result = profileContexts.get(loggingProfile); if (result == null) { result = LogContext.create(); final LogContext current = profileContexts.putIfAbsent(loggingProfile, result); if (current != ...
java
public void writeTo(DataOutput outstream) throws Exception { S3Util.writeString(host, outstream); outstream.writeInt(port); S3Util.writeString(protocol, outstream); }
java
public void readFrom(DataInput instream) throws Exception { host = S3Util.readString(instream); port = instream.readInt(); protocol = S3Util.readString(instream); }
java
protected int complete(CommandContext ctx, ParsedCommandLine parsedCmd, OperationCandidatesProvider candidatesProvider, final String buffer, int cursor, List<String> candidates) { if(parsedCmd.isRequestComplete()) { return -1; } // Headers completion if(parsedCmd.endsOnHead...
java
private Collection<? extends ResourceRoot> handleClassPathItems(final DeploymentUnit deploymentUnit) { final Set<ResourceRoot> additionalRoots = new HashSet<ResourceRoot>(); final ArrayDeque<ResourceRoot> toProcess = new ArrayDeque<ResourceRoot>(); final List<ResourceRoot> resourceRoots = Deploy...
java
@Override public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException { // Pass non-LIST values through the superclass so it can reject weird values and, in the odd chance // that's how this object is set up, turn undefined into a default list value. ...
java
public static ResourceDescriptionResolver getResourceDescriptionResolver(final String... keyPrefix) { StringBuilder prefix = new StringBuilder(SUBSYSTEM_NAME); for (String kp : keyPrefix) { prefix.append('.').append(kp); } return new StandardResourceDescriptionResolver(prefix...
java
void parseWorkerThreadPool(final XMLExtendedStreamReader reader, final ModelNode subsystemAdd) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttrib...
java
private static ModelNode createOperation(ServerIdentity identity) { // The server address final ModelNode address = new ModelNode(); address.add(ModelDescriptionConstants.HOST, identity.getHostName()); address.add(ModelDescriptionConstants.RUNNING_SERVER, identity.getServerName()); ...
java
private File buildDirPath(final String serverConfigUserDirPropertyName, final String suppliedConfigDir, final String serverConfigDirPropertyName, final String serverBaseDirPropertyName, final String defaultBaseDir) { String propertyDir = System.getProperty(serverConfigUserDirPropertyName); i...
java
private void validatePermissions(final File dirPath, final File file) { // Check execute and read permissions for parent dirPath if( !dirPath.canExecute() || !dirPath.canRead() ) { validFilePermissions = false; filePermissionsProblemPath = dirPath.getAbsolutePath(); ...
java
protected Path normalizePath(final Path parent, final String path) { return parent.resolve(path).toAbsolutePath().normalize(); }
java
void awaitStabilityUninterruptibly(long timeout, TimeUnit timeUnit) throws TimeoutException { boolean interrupted = false; try { long toWait = timeUnit.toMillis(timeout); long msTimeout = System.currentTimeMillis() + toWait; while (true) { if (interrup...
java
public static void addService(final ServiceTarget serviceTarget, final Bootstrap.Configuration configuration, final ControlledProcessState processState, final BootstrapListener bootstrapListener, final RunningModeControl runningModeControl, final Abstr...
java
public static final PatchOperationTarget createLocal(final File jbossHome, List<File> moduleRoots, List<File> bundlesRoots) throws IOException { final PatchTool tool = PatchTool.Factory.createLocalTool(jbossHome, moduleRoots, bundlesRoots); return new LocalPatchOperationTarget(tool); }
java
public static final PatchOperationTarget createStandalone(final ModelControllerClient controllerClient) { final PathAddress address = PathAddress.EMPTY_ADDRESS.append(CORE_SERVICES); return new RemotePatchOperationTarget(address, controllerClient); }
java
public static final PatchOperationTarget createHost(final String hostName, final ModelControllerClient client) { final PathElement host = PathElement.pathElement(HOST, hostName); final PathAddress address = PathAddress.EMPTY_ADDRESS.append(host, CORE_SERVICES); return new RemotePatchOperationTar...
java
public ResourceTransformerEntry resolveResourceTransformer(final PathAddress address, final PlaceholderResolver placeholderResolver) { return resolveResourceTransformer(address.iterator(), null, placeholderResolver); }
java
public OperationTransformerEntry resolveOperationTransformer(final PathAddress address, final String operationName, PlaceholderResolver placeholderResolver) { final Iterator<PathElement> iterator = address.iterator(); final OperationTransformerEntry entry = resolveOperationTransformer(iterator, operatio...
java
public void mergeSubsystem(final GlobalTransformerRegistry registry, String subsystemName, ModelVersion version) { final PathElement element = PathElement.pathElement(SUBSYSTEM, subsystemName); registry.mergeSubtree(this, PathAddress.EMPTY_ADDRESS.append(element), version); }
java
public List<PathAddressTransformer> getPathTransformations(final PathAddress address, PlaceholderResolver placeholderResolver) { final List<PathAddressTransformer> list = new ArrayList<PathAddressTransformer>(); final Iterator<PathElement> iterator = address.iterator(); resolvePathTransformers(i...
java
public T addContentModification(final ContentModification modification) { if (itemFilter.accepts(modification.getItem())) { internalAddModification(modification); } return returnThis(); }
java
public T addBundle(final String moduleName, final String slot, final byte[] newHash) { final ContentItem item = createBundleItem(moduleName, slot, newHash); addContentModification(createContentModification(item, ModificationType.ADD, NO_CONTENT)); return returnThis(); }
java
public T modifyBundle(final String moduleName, final String slot, final byte[] existingHash, final byte[] newHash) { final ContentItem item = createBundleItem(moduleName, slot, newHash); addContentModification(createContentModification(item, ModificationType.MODIFY, existingHash)); return return...
java
public T removeBundle(final String moduleName, final String slot, final byte[] existingHash) { final ContentItem item = createBundleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
java
public T addFile(final String name, final List<String> path, final byte[] newHash, final boolean isDirectory) { return addFile(name, path, newHash, isDirectory, null); }
java
public T modifyFile(final String name, final List<String> path, final byte[] existingHash, final byte[] newHash, final boolean isDirectory) { return modifyFile(name, path, existingHash, newHash, isDirectory, null); }
java
public T removeFile(final String name, final List<String> path, final byte[] existingHash, final boolean isDirectory) { return removeFile(name, path, existingHash, isDirectory, null); }
java
public T addModule(final String moduleName, final String slot, final byte[] newHash) { final ContentItem item = createModuleItem(moduleName, slot, newHash); addContentModification(createContentModification(item, ModificationType.ADD, NO_CONTENT)); return returnThis(); }
java
public T modifyModule(final String moduleName, final String slot, final byte[] existingHash, final byte[] newHash) { final ContentItem item = createModuleItem(moduleName, slot, newHash); addContentModification(createContentModification(item, ModificationType.MODIFY, existingHash)); return return...
java
public T removeModule(final String moduleName, final String slot, final byte[] existingHash) { final ContentItem item = createModuleItem(moduleName, slot, NO_CONTENT); addContentModification(createContentModification(item, ModificationType.REMOVE, existingHash)); return returnThis(); }
java
private static String getLogManagerLoggerName(final String name) { return (name.equals(RESOURCE_NAME) ? CommonAttributes.ROOT_LOGGER_NAME : name); }
java
public static XMLStreamException unexpectedEndElement(final XMLExtendedStreamReader reader) { return ControllerLogger.ROOT_LOGGER.unexpectedEndElement(reader.getName(), reader.getLocation()); }
java
public static XMLStreamException missingRequiredElement(final XMLExtendedStreamReader reader, final Set<?> required) { final StringBuilder b = new StringBuilder(); Iterator<?> iterator = required.iterator(); while (iterator.hasNext()) { final Object o = iterator.next(); b...
java
public static void requireNamespace(final XMLExtendedStreamReader reader, final Namespace requiredNs) throws XMLStreamException { Namespace actualNs = Namespace.forUri(reader.getNamespaceURI()); if (actualNs != requiredNs) { throw unexpectedElement(reader); } }
java
public static boolean readBooleanAttributeElement(final XMLExtendedStreamReader reader, final String attributeName) throws XMLStreamException { requireSingleAttribute(reader, attributeName); final boolean value = Boolean.parseBoolean(reader.getAttributeValue(0)); requireNoContent(rea...
java
@SuppressWarnings({"unchecked", "WeakerAccess"}) public static <T> List<T> readListAttributeElement(final XMLExtendedStreamReader reader, final String attributeName, final Class<T> type) throws XMLStreamException { requireSingleAttribute(reader, attributeName); // todo: fix this when thi...
java
@SuppressWarnings({ "unchecked" }) public static <T> T[] readArrayAttributeElement(final XMLExtendedStreamReader reader, final String attributeName, final Class<T> type) throws XMLStreamException { final List<T> list = readListAttributeElement(reader, attributeName, type); return list.to...
java
@Override public ModelNode resolveValue(ExpressionResolver resolver, ModelNode value) throws OperationFailedException { // Pass non-OBJECT values through the superclass so it can reject weird values and, in the odd chance // that's how this object is set up, turn undefined into a default list value...
java
public static void handleDomainOperationResponseStreams(final OperationContext context, final ModelNode responseNode, final List<OperationResponse.StreamEntry> streams) { if (responseNode.has...
java
public final synchronized void shutdown() { // synchronize on 'this' to avoid races with registerStreams stopped = true; // If the cleanup task is running tell it to stop looping, and then remove it from the scheduled executor if (cleanupTaskFuture != null) { cleanupTaskFuture.cance...
java
void gc() { if (stopped) { return; } long expirationTime = System.currentTimeMillis() - timeout; for (Iterator<Map.Entry<InputStreamKey, TimedStreamEntry>> iter = streamMap.entrySet().iterator(); iter.hasNext();) { if (stopped) { return; ...
java
private List<PermissionFactory> retrievePermissionSet(final OperationContext context, final ModelNode node) throws OperationFailedException { final List<PermissionFactory> permissions = new ArrayList<>(); if (node != null && node.isDefined()) { for (ModelNode permissionNode : node.asList()...
java