当前位置: 首页>>代码示例>>Java>>正文


Java StatusCodes.Bad_InternalError方法代码示例

本文整理汇总了Java中com.digitalpetri.opcua.stack.core.StatusCodes.Bad_InternalError方法的典型用法代码示例。如果您正苦于以下问题:Java StatusCodes.Bad_InternalError方法的具体用法?Java StatusCodes.Bad_InternalError怎么用?Java StatusCodes.Bad_InternalError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.digitalpetri.opcua.stack.core.StatusCodes的用法示例。


在下文中一共展示了StatusCodes.Bad_InternalError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sign

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
/**
 * Sign the contents of the provided buffers using the provided {@link SecurityAlgorithm}.
 * Note that only the bytes between position and limit of each buffer are considered.
 *
 * @param securityAlgorithm the {@link SecurityAlgorithm}.
 * @param privateKey        the {@link PrivateKey} to sign with.
 * @param buffers           the data to sign.
 * @return the signature bytes.
 * @throws UaException
 */
public static byte[] sign(SecurityAlgorithm securityAlgorithm,
                          PrivateKey privateKey,
                          ByteBuffer... buffers) throws UaException {

    String transformation = securityAlgorithm.getTransformation();

    try {
        Signature signature = Signature.getInstance(transformation);
        signature.initSign(privateKey);

        for (ByteBuffer buffer : buffers) {
            signature.update(buffer);
        }

        return signature.sign();
    } catch (GeneralSecurityException e) {
        throw new UaException(StatusCodes.Bad_InternalError, e);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:30,代码来源:SignatureUtil.java

示例2: createNodeId

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
private NodeId createNodeId(UShort namespaceIndex, Object identifier, IdType type) {
    switch (type) {
        case Numeric:
            return new NodeId(namespaceIndex, (UInteger) identifier);
        case String:
            return new NodeId(namespaceIndex, (String) identifier);
        case Guid:
            return new NodeId(namespaceIndex, (UUID) identifier);
        case Opaque:
            return new NodeId(namespaceIndex, (ByteString) identifier);
        default:
            throw new UaRuntimeException(StatusCodes.Bad_InternalError, "unhandled type: " + type);
    }
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:15,代码来源:NamespaceManager.java

示例3: addUri

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
public synchronized UShort addUri(String uri) {
    UShort index = ushort(1);
    while (uriTable.containsKey(index)) {
        index = ushort(index.intValue() + 1);
        if (index.intValue() == 65535) {
            throw new UaRuntimeException(StatusCodes.Bad_InternalError, "uri table full");
        }
    }
    uriTable.put(index, uri);

    return index;
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:13,代码来源:NamespaceTable.java

示例4: addUri

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
public synchronized int addUri(String uri) {
    int index = 1;
    while (uriTable.containsKey(index)) {
        index++;
        if (index == 65535) {
            throw new UaRuntimeException(StatusCodes.Bad_InternalError, "uri table full");
        }
    }
    uriTable.put(index, uri);
    return index;
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:12,代码来源:ServerTable.java

示例5: createKey

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
private static byte[] createKey(String transformation, byte[] secret, byte[] seed, int offset, int length) {
    try {
        Mac mac = Mac.getInstance(transformation);

        byte[] tempBytes = P_hash(transformation, secret, seed, mac, offset + length);
        byte[] key = new byte[length];

        System.arraycopy(tempBytes, offset, key, 0, key.length);

        return key;
    } catch (Exception e) {
        throw new UaRuntimeException(StatusCodes.Bad_InternalError, e);
    }
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:15,代码来源:PShaUtil.java

示例6: sha1

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
/**
 * Compute the SHA1 digest for a given input.
 *
 * @param input the input to compute the digest for.
 * @return the SHA1 digest of {@code input}.
 */
public static byte[] sha1(byte[] input) {
    MessageDigest messageDigest = sha1Digest.get();

    if (messageDigest == null) {
        try {
            messageDigest = MessageDigest.getInstance("SHA1");
            sha1Digest.set(messageDigest);
        } catch (NoSuchAlgorithmException e) {
            throw new UaRuntimeException(StatusCodes.Bad_InternalError, e);
        }
    }

    return messageDigest.digest(input);
}
 
开发者ID:digitalpetri,项目名称:opc-ua-stack,代码行数:21,代码来源:DigestUtil.java

示例7: onCreateSession

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
public void onCreateSession(ServiceRequest<CreateSessionRequest, CreateSessionResponse> req) throws UaException {
    throw new UaException(StatusCodes.Bad_InternalError);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:5,代码来源:Session.java

示例8: onActivateSession

import com.digitalpetri.opcua.stack.core.StatusCodes; //导入方法依赖的package包/类
@Override
public void onActivateSession(ServiceRequest<ActivateSessionRequest, ActivateSessionResponse> req) throws UaException {
    throw new UaException(StatusCodes.Bad_InternalError);
}
 
开发者ID:digitalpetri,项目名称:ua-server-sdk,代码行数:5,代码来源:Session.java


注:本文中的com.digitalpetri.opcua.stack.core.StatusCodes.Bad_InternalError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。