Package org.omg.CORBA

Examples of org.omg.CORBA.Any


                   + container.getClassLoader().getParent());
      WebClassLoader wcl = (WebClassLoader)container.getWebClassLoader();
      String codebaseString;
      if (wcl != null && (codebaseString = wcl.getCodebaseString()) != null)
      {
         Any codebase = orb.create_any();
         codebase.insert_string(codebaseString);
         codebasePolicy = orb.create_policy(CodebasePolicy.TYPE, codebase);
         logger.debug("codebasePolicy: " + codebasePolicy);
      }
      else
      {
         logger.debug("Not setting codebase policy, codebase is null");
      }

      // Create csiv2Policy for both home and remote containing IorSecurityConfigMetadata
      Any secPolicy = orb.create_any();
      IorSecurityConfigMetaData securityConfig =
         container.getBeanMetaData().getIorSecurityConfigMetaData();
      // if no security metadata was found, get the default metadata from the registry.
      if (securityConfig == null)
        securityConfig = (IorSecurityConfigMetaData) Registry.lookup(CorbaORBService.IOR_SECURITY_CONFIG);
      secPolicy.insert_Value(securityConfig);
      csiv2Policy = orb.create_policy(CSIv2Policy.TYPE, secPolicy);

      // Create SSLPolicy
      //    (SSL_REQUIRED ensures home and remote IORs
      //     will have port 0 in the primary address)
      boolean sslRequired = false;
      if (securityConfig != null) {
         IorSecurityConfigMetaData.TransportConfig tc =
            securityConfig.getTransportConfig();
         sslRequired =
            tc.getIntegrity() ==
               IorSecurityConfigMetaData.TransportConfig.INTEGRITY_REQUIRED
            || tc.getConfidentiality() ==
               IorSecurityConfigMetaData.TransportConfig.CONFIDENTIALITY_REQUIRED
            || tc.getEstablishTrustInClient() ==
               IorSecurityConfigMetaData.TransportConfig.ESTABLISH_TRUST_IN_CLIENT_REQUIRED;
      }
      Any sslPolicyValue = orb.create_any();
      SSLPolicyValueHelper.insert(
            sslPolicyValue,
            (sslRequired) ? SSLPolicyValue.SSL_REQUIRED
                          : SSLPolicyValue.SSL_NOT_REQUIRED);
      sslPolicy = orb.create_policy(SSL_POLICY_TYPE.value, sslPolicyValue);
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);
         // Get the default IOR security metadata from the system registry.
View Full Code Here

                streamables[i].setMode(org.omg.CORBA.ARG_OUT.value);
            } else {
                streamables[i].setMode(org.omg.CORBA.ARG_INOUT.value);
            }

            Any value = orb.create_any();
            value.insert_Streamable(streamables[i]);
            list.add_value(streamables[i].getName(), value, streamables[i].getMode());
           
            corbaMsg.addStreamableArgument(streamables[i]);
        }       
        return list;
View Full Code Here

        assertNotNull(arguments[1]);
        assertNotNull(arguments[2]);
        assertNotNull(arguments[3]);
       
        NVList list = orb.create_list(2);       
        Any value = orb.create_any();
        value.insert_Streamable(p1);
        list.add_value(p1.getName(), value, p1.getMode());
        value.insert_Streamable(p2);
        list.add_value(p2.getName(), value, p2.getMode());
               
        msg.setList(list);
        NVList resultList = msg.getList();
        assertTrue(resultList.count() == 2);       
View Full Code Here

        request.invoke();
        Exception ex = request.env().exception();
        if (ex != null) {
            if (ex instanceof UnknownUserException) {
                UnknownUserException userEx = (UnknownUserException) ex;
                Any except = userEx.except;
                RaisesType raises = exceptions.get(except.type());
                if (raises == null) {
                    throw new CorbaBindingException("Couldn't find the exception type code to unmarshall");
                }
                QName elName = new QName("", raises.getException().getLocalPart());
                CorbaObjectHandler handler =
                    CorbaHandlerUtils.initializeObjectHandler(orb,
                                                              elName,
                                                              raises.getException(),
                                                              typeMaps,
                                                              service);
               
                CorbaStreamable exStreamable = new CorbaStreamable(handler, elName);
                exStreamable._read(except.create_input_stream());
                message.setStreamableException(exStreamable);
                message.setContent(Exception.class, new Fault(userEx));
            } else {
                message.setContent(Exception.class, new Fault(ex));
            }
View Full Code Here

        if (message.getStreamableArguments() != null) {
            CorbaStreamable[] arguments = message.getStreamableArguments();
            list = orb.create_list(arguments.length);

            for (int i = 0; i < arguments.length; ++i) {
                Any value = orb.create_any();
                value.insert_Streamable(arguments[i]);
                list.add_value(arguments[i].getName(), value, arguments[i].getMode());
            }
        } else {
            list = orb.create_list(0);
        }
View Full Code Here

   
    protected NamedValue getReturn(CorbaMessage message) {
        CorbaStreamable retVal = message.getStreamableReturn();
        NamedValue ret = null;
        if (retVal != null) {
            Any returnAny = orb.create_any();
            returnAny.insert_Streamable(retVal);
            ret = orb.create_named_value(retVal.getName(), returnAny, org.omg.CORBA.ARG_OUT.value);
        } else {
            // TODO: REVISIT: for some reason, the yoko ORB does not like to
            // have a null NamedValue return value. Create this 'empty'
            // one if a void return type is used.
View Full Code Here

            //
            // Create encapsulation
            //
           
            Any any = ORB.init().create_any();
           
            any.insert_string(codeBase);

            try {
                byte[] data = codec.encode(any);
                TaggedComponent component = new TaggedComponent(
                        TAG_JAVA_CODEBASE.value, data);
View Full Code Here

        Policy[] origPolicies = pm.get_policy_overrides(policyTypes);

        {
            try {
                Policy[] pl = new Policy[1];
                Any any = orb.create_any();
                any.insert_short(org.apache.yoko.orb.OB.RETRY_ALWAYS.value);
                pl[0] = orb.create_policy(
                        org.apache.yoko.orb.OB.RETRY_POLICY_ID.value, any);
                pm.set_policy_overrides(pl, SetOverrideType.ADD_OVERRIDE);

            } catch (PolicyError ex) {
                TEST(false);
            } catch (InvalidPolicies ex) {
                TEST(false);
            }

            policyTypes = new int[1];
            policyTypes[0] = org.apache.yoko.orb.OB.RETRY_POLICY_ID.value;
            Policy[] policy = pm.get_policy_overrides(policyTypes);
            TEST(policy.length == 1
                    && policy[0].policy_type() == org.apache.yoko.orb.OB.RETRY_POLICY_ID.value);

            RetryPolicy p = RetryPolicyHelper.narrow(policy[0]);
            TEST(p.retry_mode() == org.apache.yoko.orb.OB.RETRY_ALWAYS.value);
        }

        {
            try {
                Policy[] pl = new Policy[2];
                Any any = orb.create_any();
                any.insert_short(org.apache.yoko.orb.OB.RETRY_STRICT.value);
                pl[0] = orb.create_policy(
                        org.apache.yoko.orb.OB.RETRY_POLICY_ID.value, any);
                any = orb.create_any();
                any.insert_ulong(3000);
                pl[1] = orb.create_policy(
                        org.apache.yoko.orb.OB.TIMEOUT_POLICY_ID.value, any);

                pm.set_policy_overrides(pl, SetOverrideType.ADD_OVERRIDE);

            } catch (PolicyError ex) {
                TEST(false);
            } catch (InvalidPolicies ex) {
                TEST(false);
            }

            policyTypes = new int[2];
            policyTypes[0] = org.apache.yoko.orb.OB.RETRY_POLICY_ID.value;
            policyTypes[1] = org.apache.yoko.orb.OB.TIMEOUT_POLICY_ID.value;

            Policy[] policies = pm.get_policy_overrides(policyTypes);
            TEST(policies.length == 2);

            for (int i = 0; i < policies.length; ++i) {
                switch (policies[i].policy_type()) {
                case org.apache.yoko.orb.OB.RETRY_POLICY_ID.value: {
                    try {
                        RetryPolicy policy = RetryPolicyHelper
                                .narrow(policies[i]);
                        TEST(policy != null);
                        TEST(policy.retry_mode() == org.apache.yoko.orb.OB.RETRY_STRICT.value);
                    } catch (BAD_PARAM ex) {
                        TEST(false);
                    }
                    break;
                }
                case org.apache.yoko.orb.OB.TIMEOUT_POLICY_ID.value: {
                    try {
                        TimeoutPolicy policy = TimeoutPolicyHelper
                                .narrow(policies[i]);
                        TEST(policy != null);
                        TEST(policy.value() == 3000);
                    } catch (BAD_PARAM ex) {
                        TEST(false);
                    }
                    break;
                }
                default:
                    TEST(("org.omg.CORBA.PolicyManager.get_policy_overrides()"
                            + " returned policies with unexpected types") == null);
                }
            }
        }

        {
            try {
                Any any = orb.create_any();
                any.insert_short(org.apache.yoko.orb.OB.RETRY_ALWAYS.value);
                Policy[] pl = new Policy[2];
                pl[0] = orb.create_policy(
                        org.apache.yoko.orb.OB.RETRY_POLICY_ID.value, any);
                pl[1] = orb.create_policy(
                        org.apache.yoko.orb.OB.RETRY_POLICY_ID.value, any);
View Full Code Here

        // beyond the implementation of this method, and it's
        // counterpart readAny.
        //

        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
        Any any = orb.create_any();

        if (obj == null) {
            // JDK 1.3.1-1 doesn't like NULL typecodes, so
            // we write it as a null Value.

            any.insert_Value(null);

        } else if (obj instanceof String) {
            any.insert_Value((String) obj);

        } else if (obj instanceof org.omg.CORBA.Object) {
            any.insert_Object((org.omg.CORBA.Object) obj);

        } else if (obj instanceof Any) {
            any.insert_any((Any) obj);

        } else if (obj instanceof IDLEntity) {
            any.insert_Value((Serializable) obj);

        } else if (obj instanceof java.rmi.Remote) {
            Remote ro = (Remote) obj;
            org.omg.CORBA.Object corba_obj;
            try {
                corba_obj = (org.omg.CORBA.Object) PortableRemoteObject
                        .toStub(ro);
            } catch (java.rmi.NoSuchObjectException ex) {
                throw new org.omg.CORBA.MARSHAL("object not exported " + ro);
            }

            any.insert_Object((org.omg.CORBA.Object) corba_obj);

        } else if (obj instanceof Serializable || obj instanceof Externalizable) {

            any.insert_Value((Serializable) obj);

        } else {
            throw new MARSHAL("cannot write as " + obj.getClass()
                    + " to an Any");
        }
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.