Package org.omg.CORBA

Examples of org.omg.CORBA.Any


            String cName = consts[i].getIDLName();

            Class cls = consts[i].getType();
            TypeCode typeCode = getConstantTypeCode(cls);

            Any value = orb.create_any();
            consts[i].insertValue(value);

            cDef = new ConstantDefImpl(cid, cName, "1.0",
                    typeCode, value, container, impl);
            container.add(cName, cDef);
View Full Code Here


        ExceptionDescription ed = new ExceptionDescription(name, id,
                defined_in_id,
                version, type());

        Any any = getORB().create_any();

        ExceptionDescriptionHelper.insert(any, ed);

        return new Description(DefinitionKind.dk_Exception, any);
    }
View Full Code Here

    }

    public void establish_components(IORInfo info) {
        try {
            // Invocation Policy = EITHER
            Any any = ORB.init().create_any();
            any.insert_short(EITHER);
            byte[] taggedComponentData = codec.encode_value(any);
            info.add_ior_component(new TaggedComponent(TAG_INV_POLICY, taggedComponentData));
            // OTS Policy = ADAPTS
            any = ORB.init().create_any();
            any.insert_short(ADAPTS);
            taggedComponentData = codec.encode_value(any);
            info.add_ior_component(new TaggedComponent(TAG_OTS_POLICY, taggedComponentData));
        } catch (InvalidTypeForEncoding e) {
            throw JacORBMessages.MESSAGES.errorEncodingContext(e);
        }
View Full Code Here

        Transaction tx = null;
        if (piCurrent != null) {
            // A non-null piCurrent means that a TxServerInterceptor was
            // installed: check if there is a transaction propagation context
            try {
                Any any = piCurrent.get_slot(slotId);
                if (any.type().kind().value() != TCKind._tk_null) {
                    // Yes, there is a TPC: add the foreign transaction marker
                    tx = ForeignTransaction.INSTANCE;
                }
            } catch (InvalidSlot e) {
                throw JacORBMessages.MESSAGES.errorGettingSlotInTxInterceptor(e);
View Full Code Here

    public void receive_request_service_contexts(ServerRequestInfo ri) {
        JacORBLogger.ROOT_LOGGER.traceReceiveRequestServiceContexts(ri.operation());
        try {
            ServiceContext sc = ri.get_request_service_context(txContextId);
            Any any = codec.decode_value(sc.context_data, PropagationContextHelper.type());
            ri.set_slot(slotId, any);
        } catch (BAD_PARAM e) {
            // no service context with txContextId: do nothing
        } catch (FormatMismatch e) {
            throw JacORBMessages.MESSAGES.errorDecodingContextData(this.name(), e);
View Full Code Here

            // build default SSL component with minimum SSL options.
            SSL ssl = new SSL((short) MIN_SSL_OPTIONS, /* supported options */
                    (short) 0, /* required options  */
                    (short) sslPort);
            ORB orb = ORB.init();
            Any any = orb.create_any();
            SSLHelper.insert(any, ssl);
            byte[] componentData = codec.encode_value(any);
            defaultSSLComponent = new TaggedComponent(TAG_SSL_SEC_TRANS.value, componentData);
            defaultCSIComponent = CSIv2Util.createSecurityTaggedComponent(new IORSecurityConfigMetaData(), codec,
                    sslPort, orb);
View Full Code Here

                    // encode the principal name as mandated by RFC2743.
                    byte[] encodedName = CSIv2Util.encodeGssExportedName(principalName);

                    // encapsulate the encoded name.
                    Any any = ORB.init().create_any();
                    byte[] encapsulatedEncodedName;
                    GSS_NT_ExportedNameHelper.insert(any, encodedName);
                    try {
                        encapsulatedEncodedName = codec.encode_value(any);
                    } catch (InvalidTypeForEncoding e) {
                        throw JacORBMessages.MESSAGES.unexpectedException(e);
                    }

                    // create identity token.
                    identityToken = new IdentityToken();
                    identityToken.principal_name(encapsulatedEncodedName);
                } else if ((secMech.sas_context_mech.supported_identity_types & ITTAnonymous.value) != 0) {
                    // no run-as or caller identity and the target supports ITTAnonymous: use the anonymous identity.
                    identityToken = new IdentityToken();
                    identityToken.anonymous(true);
                }
            }

            if ((secMech.as_context_mech.target_requires & EstablishTrustInClient.value) != 0) {
                // will create authentication token with the configured pair serverUsername/serverPassword.
                byte[] encodedTargetName = secMech.as_context_mech.target_name;
                String name = serverUsername;
                if (name.indexOf('@') < 0) {
                    byte[] decodedTargetName =
                            CSIv2Util.decodeGssExportedName(encodedTargetName);
                    String targetName = new String(decodedTargetName, "UTF-8");
                    name += "@" + targetName; // "@default"
                }
                byte[] username = name.getBytes("UTF-8");
                // I don't know why there is not a better way to go from char[] -> byte[].
                byte[] password = serverPassword.getBytes("UTF-8");

                // create authentication token
                InitialContextToken authenticationToken = new InitialContextToken(username, password, encodedTargetName);
                // ASN.1-encode it, as defined in RFC 2743.
                encodedAuthenticationToken = CSIv2Util.encodeInitialContextToken(authenticationToken, codec);
            }

            if (identityToken != absentIdentityToken || encodedAuthenticationToken != noAuthenticationToken) {
                // at least one non-null token was created, create EstablishContext message with it.
                EstablishContext message = new EstablishContext(0, // stateless ctx id
                        noAuthorizationToken, identityToken, encodedAuthenticationToken);

                // create SAS context with the EstablishContext message.
                SASContextBody contextBody = new SASContextBody();
                contextBody.establish_msg(message);

                // stuff the SAS context into the outgoing request.
                Any any = ORB.init().create_any();
                SASContextBodyHelper.insert(any, contextBody);
                ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any));
                ri.add_request_service_context(sc, true /*replace existing context*/);
            }
        } catch (java.io.UnsupportedEncodingException e) {
View Full Code Here

    @Override
    public void receive_reply(ClientRequestInfo ri) {
        try {
            ServiceContext sc = ri.get_reply_service_context(sasContextId);
            Any msg = codec.decode_value(sc.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(msg);

            // At this point contextBody should contain a CompleteEstablishContext message, which does not require any
            // treatment. ContextError messages should arrive via receive_exception().
View Full Code Here

    @Override
    public void receive_exception(ClientRequestInfo ri) {
        try {
            ServiceContext sc = ri.get_reply_service_context(sasContextId);
            Any msg = codec.decode_value(sc.context_data, SASContextBodyHelper.type());
            SASContextBody contextBody = SASContextBodyHelper.extract(msg);

            // At this point contextBody may contain a either a CompleteEstablishContext message or a ContextError message.
            // Neither message requires any treatment. We decoded the contextbody just to check that it contains a
            // well-formed message.
View Full Code Here

                    // create SAS context with the EstablishContext message.
                    SASContextBody contextBody = new SASContextBody();
                    contextBody.establish_msg(message);

                    // stuff the SAS context into the outgoing request.
                    Any any = ORB.init().create_any();
                    SASContextBodyHelper.insert(any, contextBody);
                    ServiceContext sc = new ServiceContext(sasContextId, codec.encode_value(any));
                    ri.add_request_service_context(sc, true /*replace existing context*/);
                }
            }
View Full Code Here

TOP

Related Classes of org.omg.CORBA.Any

Copyright © 2018 www.massapicom. 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.