Examples of NetworkInterfaceBinding


Examples of org.jboss.as.network.NetworkInterfaceBinding

        InetSocketAddress bindAddress = null;
        InetSocketAddress secureBindAddress = null;

        SocketBinding basicBinding = injectedSocketBindingValue.getOptionalValue();
        SocketBinding secureBinding = injectedSecureSocketBindingValue.getOptionalValue();
        final NetworkInterfaceBinding interfaceBinding = interfaceBindingValue.getOptionalValue();
        if (interfaceBinding != null) {
            useUnmanagedBindings = true;
            final int port = portValue.getOptionalValue();
            if (port > 0) {
                bindAddress = new InetSocketAddress(interfaceBinding.getAddress(), port);
            }
            final int securePort = securePortValue.getOptionalValue();
            if (securePort > 0) {
                secureBindAddress = new InetSocketAddress(interfaceBinding.getAddress(), securePort);
            }
        } else {
            if (basicBinding != null) {
                bindAddress = basicBinding.getSocketAddress();
            }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        if (parsed.getFailureMessage() != null) {
            throw new OperationFailedException(new ModelNode().set(parsed.getFailureMessage()));
        }

        try {
            NetworkInterfaceBinding nib = NetworkInterfaceService.createBinding(parsed);
            context.getResult().set(nib.getAddress().getHostAddress());
        } catch (SocketException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        } catch (UnknownHostException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        context.addStep(new OperationStepHandler() {
            @Override
            public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException {
                final ServiceController<?> controller = context.getServiceRegistry(false).getService(NetworkInterfaceService.JBOSS_NETWORK_INTERFACE.append(interfaceName));
                if(controller != null && controller.getState() == ServiceController.State.UP) {
                    final NetworkInterfaceBinding binding = NetworkInterfaceBinding.class.cast(controller.getValue());
                    final InetAddress address = binding.getAddress();
                    final ModelNode result = new ModelNode();
                    if(RESOLVED_ADDRESS.getName().equals(attributeName)) {
                        result.set(address.getHostAddress());
                    }
                    context.getResult().set(result);
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

    public synchronized void stop(StopContext arg0) {
        this.interfaceBinding = null;
    }

    public synchronized NetworkInterfaceBinding getValue() throws IllegalStateException {
        final NetworkInterfaceBinding binding = this.interfaceBinding;
        if (binding == null) {
            throw new IllegalStateException();
        }
        return binding;
    }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        }
        return binding;
    }

    private static NetworkInterfaceBinding resolveInterface(final OverallInterfaceCriteria criteria) throws SocketException {
        NetworkInterfaceBinding result = null;
        final Map<NetworkInterface, Set<InetAddress>> candidates = new HashMap<NetworkInterface, Set<InetAddress>>();
        final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
        while (networkInterfaces.hasMoreElements()) {
            storeAddresses(networkInterfaces.nextElement(), candidates);
        }
        Map<NetworkInterface, Set<InetAddress>> acceptable = criteria.getAcceptableAddresses(candidates);

        if (acceptable.size() == 1 && acceptable.values().iterator().next().size() == 1) {
            // single result
            Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next();
            InetAddress addr = entry.getValue().iterator().next();
            result = new NetworkInterfaceBinding(Collections.singleton(entry.getKey()), addr);
        }
        return result;
    }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        final Collection<NetworkInterface> interfaces = new ArrayList<NetworkInterface>();
        final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
        while (networkInterfaces.hasMoreElements()) {
            interfaces.add(networkInterfaces.nextElement());
        }
        return new NetworkInterfaceBinding(interfaces, address);
    }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        if (parsed.getFailureMessage() != null) {
            throw new OperationFailedException(new ModelNode().set(parsed.getFailureMessage()));
        }

        try {
            NetworkInterfaceBinding nib = NetworkInterfaceService.createBinding(parsed);
            context.getResult().set(nib.getAddress().getHostAddress());
        } catch (SocketException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        } catch (UnknownHostException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        InetSocketAddress bindAddress = null;
        InetSocketAddress secureBindAddress = null;

        SocketBinding basicBinding = injectedSocketBindingValue.getOptionalValue();
        SocketBinding secureBinding = injectedSecureSocketBindingValue.getOptionalValue();
        final NetworkInterfaceBinding interfaceBinding = interfaceBindingValue.getOptionalValue();
        if (interfaceBinding != null) {
            useUnmanagedBindings = true;
            final int port = portValue.getOptionalValue();
            if (port > 0) {
                bindAddress = new InetSocketAddress(interfaceBinding.getAddress(), port);
            }
            final int securePort = securePortValue.getOptionalValue();
            if (securePort > 0) {
                secureBindAddress = new InetSocketAddress(interfaceBinding.getAddress(), securePort);
            }
        } else {
            if (basicBinding != null) {
                bindAddress = basicBinding.getSocketAddress();
            }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

        if (parsed.getFailureMessage() != null) {
            throw new OperationFailedException(new ModelNode().set(parsed.getFailureMessage()));
        }

        try {
            NetworkInterfaceBinding nib = NetworkInterfaceService.createBinding(parsed);
            context.getResult().set(nib.getAddress().getHostAddress());
        } catch (SocketException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        } catch (UnknownHostException e) {
            throw ServerMessages.MESSAGES.cannotResolveInterface(e, e);
        }
View Full Code Here

Examples of org.jboss.as.network.NetworkInterfaceBinding

    public synchronized void stop(StopContext arg0) {
        this.interfaceBinding = null;
    }

    public synchronized NetworkInterfaceBinding getValue() throws IllegalStateException {
        final NetworkInterfaceBinding binding = this.interfaceBinding;
        if (binding == null) {
            throw new IllegalStateException();
        }
        return binding;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.