本文整理汇总了Java中org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription类的典型用法代码示例。如果您正苦于以下问题:Java EndpointDescription类的具体用法?Java EndpointDescription怎么用?Java EndpointDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EndpointDescription类属于org.eclipse.milo.opcua.stack.core.types.structured包,在下文中一共展示了EndpointDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: connect
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@FXML
void connect() {
state.progressVisibleProperty().set(true);
state.rootNodeProperty().set(null);
state.showAttributeItemProperty().set(null);
addressUrl.set(address.getSelectionModel().getSelectedItem());
logger.debug("try to open url: {}", addressUrl.get());
connection.getEndpoints(addressUrl.get()).thenCompose(endpoints -> {
EndpointDescription endpoint =
connection.findLowestEndpoint(endpoints).orElseThrow(() -> new CompletionException(new Exception("no endpoint found: " + addressUrl.get())));
return connection.connect(addressUrl.get(), endpoint);
}).whenCompleteAsync((c, ex) -> {
state.progressVisibleProperty().set(false);
if (ex != null) {
state.statusTextProperty().set(ex.getMessage());
logger.error(ex.getMessage(), ex);
} else {
readHierarchy();
updateAddressHistory();
}
}, FX_PLATFORM_EXECUTOR);
}
开发者ID:comtel2000,项目名称:opc-ua-client,代码行数:24,代码来源:ConnectViewPresenter.java
示例2: connect
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
public CompletableFuture<UaClient> connect(String url, EndpointDescription endpoint) {
clientHandles.set(0);
endpointDescription.set(endpoint);
logger.debug("use endpoint: {} [{}]", endpointDescription.get().getEndpointUrl(), endpointDescription.get().getSecurityMode());
if (!url.equals(endpointDescription.get().getEndpointUrl())) {
logger.warn("fix search (returned) endpoint url missmatch: {} ({})", url, endpointDescription.get().getEndpointUrl());
endpointDescription.set(changeEndpointUrl(endpointDescription.get(), url));
}
List<IdentityProvider> idProv = new ArrayList<>();
getIdentityProvider().ifPresent(idProv::add);
idProv.add(new AnonymousProvider());
OpcUaClientConfig config = OpcUaClientConfig.builder().setApplicationName(LocalizedText.english(name)).setApplicationUri("urn:comtel:opcua:client")
.setEndpoint(endpointDescription.get()).setIdentityProvider(new CompositeProvider(idProv)).setRequestTimeout(uint(5000))
.build();
return newClient(config).thenCompose(c -> c.connect());
}
开发者ID:comtel2000,项目名称:opc-ua-client,代码行数:21,代码来源:OpcUaClientConnector.java
示例3: getEndpoints
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
/**
* Query the GetEndpoints service at the given endpoint URL.
*
* @param endpointUrl the endpoint URL to get endpoints from.
* @return the {@link EndpointDescription}s returned by the GetEndpoints service.
*/
public static CompletableFuture<EndpointDescription[]> getEndpoints(String endpointUrl) {
UaTcpStackClientConfig config = UaTcpStackClientConfig.builder()
.setEndpointUrl(endpointUrl)
.build();
UaTcpStackClient client = new UaTcpStackClient(config);
GetEndpointsRequest request = new GetEndpointsRequest(
new RequestHeader(null, DateTime.now(), uint(1), uint(0), null, uint(5000), null),
endpointUrl, null, new String[]{Stack.UA_TCP_BINARY_TRANSPORT_URI});
return client.connect().thenCompose(c ->
c.<GetEndpointsResponse>sendRequest(request)
.whenComplete((r, ex) -> client.disconnect())
.thenApply(GetEndpointsResponse::getEndpoints)
);
}
开发者ID:eclipse,项目名称:milo,代码行数:24,代码来源:UaTcpStackClient.java
示例4: ClientExample
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
public ClientExample(X509Certificate certificate, KeyPair keyPair) throws Exception {
// Query endpoints and select highest security level.
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints("opc.tcp://localhost:12685/example").get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.sorted((e1, e2) -> e2.getSecurityLevel().intValue() - e1.getSecurityLevel().intValue())
.findFirst()
.orElseThrow(() -> new Exception("no endpoints returned"));
UaTcpStackClientConfig config = UaTcpStackClientConfig.builder()
.setApplicationName(LocalizedText.english("Stack Example Client"))
.setApplicationUri(String.format("urn:example-client:%s", UUID.randomUUID()))
.setCertificate(certificate)
.setKeyPair(keyPair)
.setEndpoint(endpoint)
.build();
client = new UaTcpStackClient(config);
}
开发者ID:eclipse,项目名称:milo,代码行数:20,代码来源:ClientExample.java
示例5: createClient
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
private UaTcpStackClient createClient(EndpointDescription endpoint) throws UaException {
UaTcpStackClientConfig config = UaTcpStackClientConfig.builder()
.setEndpoint(endpoint)
.setKeyPair(clientKeyPair)
.setCertificate(clientCertificate)
.setCertificateValidator(new InsecureCertificateValidator() {
@Override
public void validate(X509Certificate certificate) throws UaException {}
@Override
public void verifyTrustChain(List<X509Certificate> certificateChain) throws UaException {}
})
.build();
return new UaTcpStackClient(config);
}
开发者ID:eclipse,项目名称:milo,代码行数:17,代码来源:ClientServerTest.java
示例6: testGetIdentityToken
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testGetIdentityToken() throws Exception {
EndpointDescription endpoint = new EndpointDescription(
null, null, null, null, null,
new UserTokenPolicy[]{
new UserTokenPolicy(
"anonymous",
UserTokenType.Anonymous,
null, null, null)
},
null, null
);
AnonymousProvider p = new AnonymousProvider();
Tuple2<UserIdentityToken, SignatureData> t2 =
p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
assertEquals(t2.v1().getPolicyId(), "anonymous");
assertTrue(t2.v1() instanceof AnonymousIdentityToken);
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:AnonymousProviderTest.java
示例7: testGetIdentityToken_EmptyPolicyId
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testGetIdentityToken_EmptyPolicyId() throws Exception {
EndpointDescription endpoint = new EndpointDescription(
null, null, null, null, null,
new UserTokenPolicy[]{
new UserTokenPolicy(
"",
UserTokenType.Anonymous,
null, null, null)
},
null, null
);
AnonymousProvider p = new AnonymousProvider();
Tuple2<UserIdentityToken, SignatureData> t2 =
p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
assertEquals(t2.v1().getPolicyId(), "");
assertTrue(t2.v1() instanceof AnonymousIdentityToken);
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:AnonymousProviderTest.java
示例8: testGetIdentityToken_NullPolicyId
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testGetIdentityToken_NullPolicyId() throws Exception {
EndpointDescription endpoint = new EndpointDescription(
null, null, null, null, null,
new UserTokenPolicy[]{
new UserTokenPolicy(
null,
UserTokenType.Anonymous,
null, null, null)
},
null, null
);
AnonymousProvider p = new AnonymousProvider();
Tuple2<UserIdentityToken, SignatureData> t2 =
p.getIdentityToken(endpoint, ByteString.NULL_VALUE);
assertNull(t2.v1().getPolicyId());
assertTrue(t2.v1() instanceof AnonymousIdentityToken);
}
开发者ID:eclipse,项目名称:milo,代码行数:22,代码来源:AnonymousProviderTest.java
示例9: testGetIdentityToken_NoMatch_Throws
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testGetIdentityToken_NoMatch_Throws() {
EndpointDescription endpoint = new EndpointDescription(
null, null, null, null, null,
new UserTokenPolicy[]{
new UserTokenPolicy(
"username",
UserTokenType.UserName,
null, null, null)
},
null, null
);
AnonymousProvider p = new AnonymousProvider();
assertThrows(() -> p.getIdentityToken(endpoint, ByteString.NULL_VALUE));
}
开发者ID:eclipse,项目名称:milo,代码行数:18,代码来源:AnonymousProviderTest.java
示例10: startClient
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
private void startClient() throws Exception {
EndpointDescription[] endpoints = UaTcpStackClient
.getEndpoints("opc.tcp://localhost:12686/test-server").get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.None.getSecurityPolicyUri()))
.findFirst().orElseThrow(() -> new Exception("no desired endpoints returned"));
KeyStoreLoader loader = new KeyStoreLoader().load();
OpcUaClientConfig clientConfig = OpcUaClientConfig.builder()
.setApplicationName(LocalizedText.english("Eclipse Milo Test Client"))
.setApplicationUri("urn:eclipse:milo:examples:client")
.setCertificate(loader.getClientCertificate())
.setKeyPair(loader.getClientKeyPair())
.setEndpoint(endpoint)
.setRequestTimeout(uint(60000))
.build();
client = new OpcUaClient(clientConfig);
client.connect().get();
}
开发者ID:eclipse,项目名称:milo,代码行数:23,代码来源:OpcUaClientIT.java
示例11: testUsernamePassword
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testUsernamePassword() throws Exception {
logger.info("testUsernamePassword()");
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints("opc.tcp://localhost:12686/test-server").get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.None.getSecurityPolicyUri()))
.findFirst().orElseThrow(() -> new Exception("no desired endpoints returned"));
KeyStoreLoader loader = new KeyStoreLoader().load();
OpcUaClientConfig clientConfig = OpcUaClientConfig.builder()
.setApplicationName(LocalizedText.english("Eclipse Milo Test Client"))
.setApplicationUri("urn:eclipse:milo:test:client")
.setCertificate(loader.getClientCertificate())
.setKeyPair(loader.getClientKeyPair())
.setEndpoint(endpoint)
.setRequestTimeout(uint(60000))
.setIdentityProvider(new UsernameProvider("user", "password"))
.build();
OpcUaClient client = new OpcUaClient(clientConfig);
client.connect().get();
}
开发者ID:eclipse,项目名称:milo,代码行数:27,代码来源:OpcUaClientIT.java
示例12: testUsernamePassword_WithSecurity
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test
public void testUsernamePassword_WithSecurity() throws Exception {
logger.info("testUsernamePassword_WithSecurity()");
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints("opc.tcp://localhost:12686/test-server").get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.Aes256_Sha256_RsaPss.getSecurityPolicyUri()))
.findFirst().orElseThrow(() -> new Exception("no desired endpoints returned"));
KeyStoreLoader loader = new KeyStoreLoader().load();
OpcUaClientConfig clientConfig = OpcUaClientConfig.builder()
.setApplicationName(LocalizedText.english("Eclipse Milo Test Client"))
.setApplicationUri("urn:eclipse:milo:examples:client")
.setCertificate(loader.getClientCertificate())
.setKeyPair(loader.getClientKeyPair())
.setEndpoint(endpoint)
.setRequestTimeout(uint(60000))
.setIdentityProvider(new UsernameProvider("user", "password"))
.build();
OpcUaClient client = new OpcUaClient(clientConfig);
client.connect().get();
}
开发者ID:eclipse,项目名称:milo,代码行数:27,代码来源:OpcUaClientIT.java
示例13: getIdentityToken
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Override
public Tuple2<UserIdentityToken, SignatureData> getIdentityToken(
EndpointDescription endpoint,
ByteString serverNonce) throws Exception {
List<UserTokenPolicy> userIdentityTokens = l(endpoint.getUserIdentityTokens());
return userIdentityTokens.stream()
.filter(t -> t.getTokenType() == UserTokenType.Anonymous)
.findFirst()
.map(policy -> {
UserIdentityToken token = new AnonymousIdentityToken(policy.getPolicyId());
return new Tuple2<>(token, new SignatureData());
})
.orElseThrow(() -> new Exception("no anonymous token policy found"));
}
开发者ID:eclipse,项目名称:milo,代码行数:18,代码来源:AnonymousProvider.java
示例14: getIdentityToken
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Override
public Tuple2<UserIdentityToken, SignatureData> getIdentityToken(EndpointDescription endpoint,
ByteString serverNonce) throws Exception {
Iterator<IdentityProvider> iterator = providers.iterator();
while (iterator.hasNext()) {
IdentityProvider provider = iterator.next();
try {
return provider.getIdentityToken(endpoint, serverNonce);
} catch (Exception e) {
if (!iterator.hasNext()) {
throw e;
}
logger.debug("IdentityProvider={} failed, trying next...", provider.toString());
}
}
throw new Exception("no sufficient UserTokenPolicy found");
}
开发者ID:eclipse,项目名称:milo,代码行数:23,代码来源:CompositeProvider.java
示例15: findBest
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
public static EndpointDescription findBest(final EndpointDescription[] endpoints) {
/*
* We simply assume we have at least one and pick the first one. In a more
* productive scenario you would actually evaluate things like ciphers and
* security.
*/
return endpoints[0];
}
开发者ID:ctron,项目名称:milo-ece2017,代码行数:9,代码来源:Connect.java
示例16: createClientSync
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
public static OpcUaClient createClientSync() throws InterruptedException, ExecutionException {
final String endpoint = String.format("opc.tcp://%s:%s", Constants.HOST, Constants.PORT);
final EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints(endpoint)
.get();
return new OpcUaClient(buildConfiguration(endpoints));
}
开发者ID:ctron,项目名称:milo-ece2017,代码行数:9,代码来源:Connect.java
示例17: findEndpoint
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
private EndpointDescription findEndpoint(final EndpointDescription[] endpoints) {
EndpointDescription best = null;
for (final EndpointDescription ep : endpoints) {
if (best == null || ep.getSecurityLevel().compareTo(best.getSecurityLevel()) > 0) {
best = ep;
}
}
return best;
}
开发者ID:ctron,项目名称:de.dentrassi.camel.milo,代码行数:10,代码来源:SubscriptionManager.java
示例18: UaTcpStackClientConfigImpl
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
public UaTcpStackClientConfigImpl(
@Nullable String endpointUrl,
@Nullable EndpointDescription endpoint,
@Nullable KeyPair keyPair,
@Nullable X509Certificate certificate,
@Nullable X509Certificate[] certificateChain,
CertificateValidator certificateValidator,
LocalizedText applicationName,
String applicationUri,
String productUri,
ChannelConfig channelConfig,
UInteger channelLifetime,
ExecutorService executor,
NioEventLoopGroup eventLoop,
HashedWheelTimer wheelTimer) {
this.endpointUrl = endpointUrl;
this.endpoint = endpoint;
this.keyPair = keyPair;
this.certificate = certificate;
this.certificateChain = certificateChain;
this.certificateValidator = certificateValidator;
this.applicationName = applicationName;
this.applicationUri = applicationUri;
this.productUri = productUri;
this.channelConfig = channelConfig;
this.channelLifetime = channelLifetime;
this.executor = executor;
this.eventLoop = eventLoop;
this.wheelTimer = wheelTimer;
}
开发者ID:eclipse,项目名称:milo,代码行数:32,代码来源:UaTcpStackClientConfigBuilder.java
示例19: selectEndpoint
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Override
protected EndpointDescription selectEndpoint(EndpointDescription[] endpoints) {
return Arrays.stream(endpoints)
.filter(e -> !SecurityPolicy.None.getSecurityPolicyUri().equals(e.getSecurityPolicyUri()))
.findFirst()
.orElseThrow(() -> new RuntimeException("no secure endpoint found!"));
}
开发者ID:eclipse,项目名称:milo,代码行数:8,代码来源:ClientCertificateValidatorIT.java
示例20: testClientServerRoundTrip_TestStack_NoSecurity
import org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription; //导入依赖的package包/类
@Test(dataProvider = "getVariants")
public void testClientServerRoundTrip_TestStack_NoSecurity(Variant input) throws Exception {
EndpointDescription endpoint = endpoints[0];
logger.info("SecurityPolicy={}, MessageSecurityMode={}, input={}",
SecurityPolicy.fromUri(endpoint.getSecurityPolicyUri()), endpoint.getSecurityMode(), input);
UaTcpStackClient client = createClient(endpoint);
connectAndTest(input, client);
}
开发者ID:eclipse,项目名称:milo,代码行数:12,代码来源:ClientServerTest.java
注:本文中的org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论