Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [milo-dev] DelegateRegistry.registerEncoder()/registerDecoder() in static initializer block

Hi,

Have you pulled recently? This issue should have been fixed in this PR: https://github.com/eclipse/milo/pull/31

The equivalent to what you've done would be to call DelegateRegistry.getInstance(), although it shouldn't be necessary any more.

On Wed, Aug 17, 2016 at 11:58 PM, Shigeru Ishida <ishida_shigeru@xxxxxxxxxxx> wrote:
Hi Kevin,

When milo client and server run in isolation, server output error message below:
---
"no decoder registered for encodingId=446..."

"446" means Identifiers.OpenSecureChannelRequest_Encoding_DefaultBinary.

Client was able to encode OpenSecureChannelRequest message, but server was not able to
decode this message because missing the decoder.

And so I locally wrote two classes(UaEnumerationInitializer.java and UaStructureInitializer.java)
to execute "static initializer block" of all these classes below:
---
   org.eclipse.milo.opcua.stack.core.enumerated/*.java
   org.eclipse.milo.opcua.stack.core.structured/*.java

     static {
         DelegateRegistry.registerEncoder(ApplicationType::encode, ApplicationType.class);
         DelegateRegistry.registerDecoder(ApplicationType::decode, ApplicationType.class);
     }

UaEnumerationInitializer.java)
------------------------------------------------------------------------
package org.eclipse.milo.opcua.stack.core.types;

import org.eclipse.milo.opcua.stack.core.types.enumerated.ApplicationType;
import org.eclipse.milo.opcua.stack.core.types.enumerated.AttributeWriteMask;
.....

public class UaEnumerationInitializer {
        public static void execute() {
                ApplicationType.from(null);
                AttributeWriteMask.from(null);
                AxisScaleEnumeration.from(null);
                .....
------------------------------------------------------------------------

UaStructureInitializer)
------------------------------------------------------------------------
package org.eclipse.milo.opcua.stack.core.types;

import org.eclipse.milo.opcua.stack.core.types.structured.*;

public class UaStructureInitializer {
        public static void execute() {
                new ActivateSessionRequest();
                new ActivateSessionResponse();
                .....
------------------------------------------------------------------------

And I locally added these initializer methods in constructors of UaTcpStackClient.java
and UaTcpStackClient.java.

UaTcpStackClient.java)
------------------------------------------------------------------------
     public UaTcpStackClient(UaTcpStackClientConfig config) {
         this.config = config;

       + UaEnumerationInitializer.execute();
       + UaStructureInitializer.execute();
         .....
------------------------------------------------------------------------

UaTcpStackServer.java)
------------------------------------------------------------------------
     public UaTcpStackServer(UaTcpStackServerConfig config) {
         this.config = config;

       + UaEnumerationInitializer.execute();
       + UaStructureInitializer.execute();
         .....
------------------------------------------------------------------------

Please tell me other good method for that.

Regards,

--Shigeru
_______________________________________________
milo-dev mailing list
milo-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/milo-dev


Back to the top