Create new SpiDevice instance

@param channel
spi channel to use
@param mode
spi mode (see http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus#Mode_numbers)

@return Return a new SpiDevice impl instance.

@throws java.io.IOException
774935
public static SpiDevice getInstance(SpiChannel channel, SpiMode mode) throws IOException {
        return new SpiDeviceImpl(channel, mode);
    }
1371300
@Process(actionType = CreateConnector.class)
    public void createConnector(final CreateConnector action, final Dispatcher.Channel channel) {

        final List<Property> connectors = getModelsFor(action.getAddressTemplate());
        // First create the connector, then create the security=sasl singleton and finally
        // create the sasl-policy=policy singleton
        Outcome<FunctionContext> outcome = new Outcome<FunctionContext>() {
            @Override
            public void onFailure(FunctionContext context) {
                channel.nack(context.getError());
            }

            @Override
            public void onSuccess(FunctionContext context) {
                lastModifiedInstance = action.getInstanceName();
                read(action.getAddressTemplate().getResourceType(), getModelsFor(action.getAddressTemplate()), channel);
            }
        };

        AddressTemplate securityAddress = action.getAddressTemplate().append("security=" + SASL_SINGLETON);
        AddressTemplate policyAddress = securityAddress.append("sasl-policy=" + POLICY_SINGLETON);
        new Async<FunctionContext>(new Progress.Nop()).waterfall(new FunctionContext(), outcome,
                new CreateConnectorFn(dispatcher, statementContext, action.getAddressTemplate(),
                        action.getInstanceName(), action.getNewModel()),
                new CreateSaslSingleton(dispatcher, statementContext, action.getInstanceName(), securityAddress),
                new CreateSaslSingleton(dispatcher, statementContext, action.getInstanceName(), policyAddress));
    }
478700
public static ManagedChannel newClientChannel(Transport transport, SocketAddress address,
        boolean tls, boolean testca, @Nullable String authorityOverride,
        int flowControlWindow, boolean directExecutor) {
    ManagedChannelBuilder<?> builder;
    if (transport == Transport.OK_HTTP) {
      builder = newOkHttpClientChannel(address, tls, testca);
    } else {
      try {
        builder = newNettyClientChannel(transport, address, tls, testca, flowControlWindow);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    if (authorityOverride != null) {
      builder.overrideAuthority(authorityOverride);
    }

    if (directExecutor) {
      builder.directExecutor();
    } else {
      // TODO(carl-mastrangelo): This should not be necessary.  I don't know where this should be
      // put.  Move it somewhere else, or remove it if no longer necessary.
      // See: https://github.com/grpc/grpc-java/issues/2119
      builder.executor(getExecutor());
    }

    return builder.build();
  }
633825
public Response createResponse(final String serviceId, final WebApplicationService service) {
        return this.samlObjectBuilder.newResponse(
            this.samlObjectBuilder.generateSecureRandomId(),
            ZonedDateTime.now(ZoneOffset.UTC).minusSeconds(this.skewAllowance), serviceId, service);
    }
476013
@Override
    public Channel openChannel() throws IOException, IllegalStateException {
        assertOpen();
        try {
            return this.bootstrap.clone().register().sync().channel();
        } catch (Exception e) {
            throw new IOException("Could not open channel.", e);
        }
    }
472445
public SocketIOChannel createInboundSocketIOChannel(SocketChannel sc) throws IOException {
        AsyncSocketChannel asc = new AsyncSocketChannel(sc, getAsyncChannelGroup());
        return AioSocketIOChannel.createIOChannel(sc.socket(), asc, this);
    }
829582
public final ControlAck createNewControlAck() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createNewControlAck");
    ControlAck msg = null;
    try {
      msg = new ControlAckImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createNewControlAck");
    return msg;
  }
533482
@Override
    public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options,
            FileAttribute<?>... attrs) throws IOException {
        return new ShrinkWrapFileChannel(newByteChannel(path, options, attrs));
    }
805700
public ServerSocketBar create(InetAddress addr, int port)
    throws ConfigException, IOException
  {
    synchronized (_sslInitLock) {
      if (_stdServerSocket != null)
        throw new IOException(L.l("Can't create duplicate ssl factory."));

      initConfig();

      _stdServerSocket = ServerSocketJni.createJNI(addr, port);

      initSSL();

      return this;
    }
  }
919759
public static ManagementClientChannelStrategy create(final ProtocolConnectionConfiguration configuration, final Channel.Receiver receiver, final CloseHandler<Channel> closeHandler) {
        return new Establishing(configuration, receiver, closeHandler);
    }
529412
public static CEMI createFromEMI(byte[] frame) throws KNXFormatException
	{
		// check for minimum frame length (i.e. busmonitor)
		if (frame.length < 4)
			throw new KNXFormatException("EMI frame too short");
		final int mc = frame[0] & 0xff;
		if (mc == CEMIBusMon.MC_BUSMON_IND) {
			return new CEMIBusMon(frame[1] & 0xff, (frame[2] & 0xff) << 8 | frame[3] & 0xff,
				false, truncate(frame, 4, frame.length - 4));
		}
		final Priority p = Priority.get(frame[1] >> 2 & 0x3);
		final boolean ack = (frame[1] & 0x02) != 0;
		final boolean c = (frame[1] & 0x01) != 0;
		final int dst = (frame[4] & 0xff) << 8 | frame[5] & 0xff;
		final KNXAddress a = (frame[6] & 0x80) != 0 ?
			(KNXAddress) new GroupAddress(dst) : new IndividualAddress(dst);
		final int hops = frame[6] >> 4 & 0x07;
		final int len = (frame[6] & 0x0f) + 1;
		final byte[] tpdu = truncate(frame, 7, Math.min(len, frame.length - 7));
		// no long frames in EMI2
		return c ? new CEMILData(mc, new IndividualAddress(0), a, tpdu, p, c)
			: new CEMILData(mc, new IndividualAddress(0), a, tpdu, p, true, true, ack,
				hops);
	}
553804
private synchronized Channel channel() throws IOException {
        if (autoReconnect) {
            try {
                connect();
            } catch (GeneralSecurityException e) {
                throw new IOException(e);
            }
        }

        return channel;
    }
868257
protected Channel createChannel(ChannelData config) throws ChannelException   
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "createChannel", config);
      
      Channel retChannel;
      if (config.isInbound())
      {
         if (tc.isDebugEnabled()) SibTr.debug(this, tc, "createChannel", "inbound");
         try
         {
            Class clazz = Class.forName(JFapChannelConstants.INBOUND_CHANNEL_CLASS);
            Constructor contruct = clazz.getConstructor(new Class[] 
                                                        {
                                                           ChannelFactoryData.class, 
                                                           ChannelData.class 
                                                        });
            retChannel = (Channel) contruct.newInstance(new Object[] 
                                                        { 
                                                           channelFactoryData, 
                                                           config 
                                                        });
         }
         catch (Exception e)
         {
            FFDCFilter.processException(e, 
                                        "com.ibm.ws.sib.jfapchannel.impl.JFapChannelFactory.createChannel",  
                                        JFapChannelConstants.JFAPCHANNELFACT_CREATECHANNEL_01,
                                        this);
            
            if (tc.isDebugEnabled()) SibTr.debug(this, tc, "Unable to instantiate inbound channel", e);

            // Rethrow as a channel exception
            throw new ChannelException(e);
         }
      }
      else
      {
         retChannel = new JFapChannelOutbound(channelFactoryData, config);
      }
      
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "createChannel", retChannel);
      return retChannel;
   }
268711
@Process(actionType = InitElytron.class)
    public void init(final Dispatcher.Channel channel) {
        ResourceAddress rootAddress = ROOT_ADDRESS.resolve(statementContext);

        Operation opRealElytron = new Operation.Builder(READ_RESOURCE_OPERATION, rootAddress)
                .param(RECURSIVE, true)
                .build();

        dispatcher.execute(new DMRAction(opRealElytron), new AsyncCallback<DMRResponse>() {

            @Override
            public void onFailure(final Throwable caught) {
                channel.nack(caught);
            }

            @Override
            public void onSuccess(final DMRResponse response) {
                ModelNode result = response.get();
                if (result.isFailure()) {
                    channel.nack(result.getFailureDescription());
                } else {
                    ModelNode payload = result.get(RESULT);

                    rootNode = payload;

                    // other resources
                    populate(payload, "key-store", keyStore);
                    populate(payload, "key-manager", keyManager);
                    populate(payload, "server-ssl-context", serverSSLContext);
                    populate(payload, "client-ssl-context", clientSSLContext);
                    populate(payload, "trust-manager", trustManager);
                    populate(payload, "credential-store", credentialStore);
                    populate(payload, "filtering-key-store", filteringKeyStore);
                    populate(payload, "ldap-key-store", ldapKeyStore);
                    populate(payload, "provider-loader", providerLoader);
                    populate(payload, "aggregate-providers", aggregateProviders);
                    populate(payload, "security-domain", securityDomain);

                    populate(payload, "aggregate-principal-transformer", aggregatePrincipalTransformer);
                    populate(payload, "chained-principal-transformer", chainedPrincipalTransformer);
                    populate(payload, "constant-principal-transformer", constantPrincipalTransformer);
                    populate(payload, "custom-principal-transformer", customPrincipalTransformer);
                    populate(payload, "regex-validating-principal-transformer", regexValidatingPrincipalTransformer);
                    populate(payload, "regex-principal-transformer", regexPrincipalTransformer);

                    populate(payload, "aggregate-security-event-listener", aggregateSecurityEventListener);
                    populate(payload, "file-audit-log", fileAuditLog);
                    populate(payload, "policy", policy);
                    populate(payload, "syslog-audit-log", syslogAuditLog);
                    populate(payload, "size-rotating-file-audit-log", sizeRotatingFileAuditLog);
                    populate(payload, "periodic-rotating-file-audit-log", periodicRotatingFileAuditLog);

                    populate(payload, "dir-context", dirContext);

                    // security realms
                    populate(payload, "properties-realm", propertiesRealm);
                    populate(payload, "filesystem-realm", filesystemRealm);
                    populate(payload, "caching-realm", cachingRealm);
                    populate(payload, "jdbc-realm", jdbcRealm);
                    populate(payload, "ldap-realm", ldapRealm);
                    populate(payload, "key-store-realm", keystoreRealm);
                    populate(payload, "aggregate-realm", aggregateRealm);
                    populate(payload, "custom-modifiable-realm", customModifiableRealm);
                    populate(payload, "custom-realm", customRealm);
                    populate(payload, "identity-realm", identityRealm);
                    populate(payload, "token-realm", tokenRealm);

                    populate(payload, "mapped-regex-realm-mapper", mappedRegexRealmMapper);
                    populate(payload, "simple-regex-realm-mapper", simpleRegexRealmMapper);
                    populate(payload, "custom-realm-mapper", customRealmMapper);
                    populate(payload, "constant-realm-mapper", constantRealmMapper);

                    populate(payload, "authentication-context", authenticationContext);
                    populate(payload, "authentication-configuration", authenticationconfiguration);

                    // factories
                    populate(payload, "aggregate-http-server-mechanism-factory", aggregateHttpServerMechanismFactory);
                    populate(payload, "aggregate-sasl-server-factory", aggregateSaslServerFactory);
                    populate(payload, "configurable-http-server-mechanism-factory",
                            configurableHttpServerMechanismFactory);
                    populate(payload, "configurable-sasl-server-factory", configurableSaslServerFactory);
                    populate(payload, "custom-credential-security-factory", customCredentialSecurityFactory);
                    populate(payload, "http-authentication-factory", httpAuthenticationFactory);
                    populate(payload, "kerberos-security-factory", kerberosSecurityFactory);
                    populate(payload, "mechanism-provider-filtering-sasl-server-factory",
                            mechanismProviderFilteringSaslServerFactory);
                    populate(payload, "provider-http-server-mechanism-factory", providerHttpServerMechanismFactory);
                    populate(payload, "provider-sasl-server-factory", providerSaslServerFactory);
                    populate(payload, "sasl-authentication-factory", saslAuthenticationFactory);
                    populate(payload, "service-loader-http-server-mechanism-factory",
                            serviceLoaderHttpServerMechanismFactory);
                    populate(payload, "service-loader-sasl-server-factory", serviceLoaderSaslServerFactory);

                    // mappers and decoders
                    populate(payload, "add-prefix-role-mapper", addPrefixRoleMapper);
                    populate(payload, "add-suffix-role-mapper", addSuffixRoleMapper);
                    populate(payload, "aggregate-role-mapper", aggregateRoleMapper);
                    populate(payload, "constant-role-mapper", constantRoleMapper);
                    populate(payload, "custom-role-mapper", customRoleMapper);
                    populate(payload, "logical-role-mapper", logicalRoleMapper);

                    populate(payload, "simple-permission-mapper", simplePermissionMapper);
                    populate(payload, "logical-permission-mapper", logicalPermissionMapper);
                    populate(payload, "custom-permission-mapper", customPermissionMapper);
                    populate(payload, "constant-permission-mapper", constantPermissionMapper);

                    populate(payload, "aggregate-principal-decoder", aggregatePrincipalDecoder);
                    populate(payload, "concatenating-principal-decoder", concatenatingPrincipalDecoder);
                    populate(payload, "constant-principal-decoder", constantPrincipalDecoder);
                    populate(payload, "custom-principal-decoder", customPrincipalDecoder);
                    populate(payload, "x500-attribute-principal-decoder", x500PrincipalDecoder);
                    populate(payload, "custom-role-decoder", customRoleDecoder);
                    populate(payload, "simple-role-decoder", simpleRoleDecoder);

                    channel.ack();
                }
            }
        });
    }
1360369
protected Channel provideChannel() throws IOException {
        if (channel == null || !channel.isOpen()) {
            Connection connection = connectionFactory.newConnection();
            channel = connection.createChannel();
        }
        return channel;
    }
858762
static WebServiceRef createWebServiceRefFromResource(Resource resource, Class<?> typeClass, String jndiName) throws InjectionException {
        // notice we send in 'Service.class' for the 'value' attribute, this is
        // because only service type injections are possible with the @Resource
        // annotation, so we'll use the default value for the 'value' attribute.
        return new WebServiceRefSimulator(resource.mappedName(), jndiName, typeClass, Service.class, null, "");
    }
982318
public JsJmsObjectMessage createJmsObjectMessage() throws MessageCreateFailedException {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createJmsObjectMessage");
    JsJmsObjectMessage msg = null;
    try {
      msg = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
    }
    catch (MessageDecodeFailedException e) {
      /* No need to FFDC this as JsMsgObject will already have done so */
      // No FFDC code needed
      throw new MessageCreateFailedException(e);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createJmsObjectMessage");
    return msg;
  }