Package org.apache.schemas.yoko.bindings.corba

Examples of org.apache.schemas.yoko.bindings.corba.AddressType


        }
    }

    public void send(Message message) throws IOException {
        try {
            AddressType address = endpointInfo.getExtensor(AddressType.class);

            if (address == null) {
                LOG.log(Level.SEVERE, "Unable to locate a valid CORBA address");
                throw new CorbaBindingException("Unable to locate a valid CORBA address");
            }           
            org.omg.CORBA.Object targetObject = CorbaUtils.importObjectReference(orb, address.getLocation());
            message.put(CorbaConstants.ORB, orb);
            message.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, targetObject);
            message.setContent(OutputStream.class,
                               new CorbaOutputStream(message));
        } catch (java.lang.Exception ex) {
View Full Code Here


                                          portTypeName + "CORBAService");
            Service service = def.createService();
            service.setQName(serviceName);
            Port port = def.createPort();
            port.setName(portTypeName + "CORBAPort");
            AddressType address =
                (AddressType) def.getExtensionRegistry().createExtension(Port.class,
                                                                         CorbaConstants.NE_CORBA_ADDRESS);
            String addr = (String) env.get(ToolCorbaConstants.CFG_ADDRESS);
            if (addr == null) {
                addr = "IOR:";
            }
            address.setLocation(addr);
            port.addExtensibilityElement(address);
            service.addPort(port);
            port.setBinding(bindings[i]);
            def.addService(service);
        }
View Full Code Here

        }
    }

    public void send(Message message) throws IOException {   
        try {
            AddressType address = endpointInfo.getExtensor(AddressType.class);

            if (address == null) {
                LOG.log(Level.SEVERE, "Unable to locate a valid CORBA address");
                throw new CorbaBindingException("Unable to locate a valid CORBA address");
            }
            List args = message.getContent(List.class);
            EndpointReferenceType ref = (EndpointReferenceType)message.get(Message.ENDPOINT_ADDRESS);
            org.omg.CORBA.Object targetObject;
            // A non-null endpoint address from the message means that we want to invoke on a particular
            // object reference specified by the endpoint reference type.  If the reference is null, then
            // we want to invoke on the default location as specified in the WSDL.
            if (ref != null) {
                targetObject = CorbaObjectReferenceHelper.getReferenceById(ref.getAddress().getValue())
            } else {
                targetObject = CorbaUtils.importObjectReference(orb, address.getLocation());
            }
            message.put(CorbaConstants.ORB, orb);
            message.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, targetObject);
            message.setContent(OutputStream.class,
                               new CorbaOutputStream(message));
View Full Code Here

        CorbaBindingFactory corbaBF = new CorbaBindingFactory();
        corbaBF.init(bus);
        manager.registerBinding(CorbaConstants.NU_WSDL_CORBA, corbaBF);
       
        EndpointReferenceType endpoint = testUtils.getSimpleTestEndpointReference();
        AddressType address = CorbaUtils.getCorbaAddressType(bus, endpoint);
        assertNotNull(address);                  
    }
View Full Code Here

                                          portTypeName + "CORBAService");
            Service service = def.createService();
            service.setQName(serviceName);
            Port port = def.createPort();
            port.setName(portTypeName + "CORBAPort");
            AddressType address =
                (AddressType) def.getExtensionRegistry().createExtension(Port.class,
                                                                         CorbaConstants.NE_CORBA_ADDRESS);
            String addr = (String) env.get(ToolCorbaConstants.CFG_ADDRESS);
            if (addr == null) {
                addr = "IOR:";
            }
            address.setLocation(addr);
            port.addExtensibilityElement(address);
            service.addPort(port);
            port.setBinding(bindings[i]);
            def.addService(service);
        }
View Full Code Here

        super(b, ref);

        sbeCallback = cbFactory;

        String location = "";
        AddressType address = CorbaUtils.getCorbaAddressType(bus, ref);
        if (address != null) {
            location = address.getLocation();
        }
        LOG.info("Service address retrieved: " + location);

        // TODO: Get any configuration options for the ORB and set the appropriate properties.
        java.util.Properties props = System.getProperties();
View Full Code Here

    // -- from ServerBinding interface --
    public void activate() throws WSDLException, IOException {
        // Get the address that the DSI servant should be publishing

        String location = "";
        AddressType address = CorbaUtils.getCorbaAddressType(corbaBinding.getBus(),
                                                             corbaBinding.getEndpointReference());
        if (address != null) {
            location = address.getLocation();
        }

        org.omg.CORBA.Object obj = null;
        try {
            POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
            POAManager poaManager = rootPOA.the_POAManager();

            Policy[] policies = new Policy[3];
            policies[0] = rootPOA
                    .create_lifespan_policy(
                        org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
            policies[1] = rootPOA
                    .create_implicit_activation_policy(
                        org.omg.PortableServer.ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION);
            policies[2] = rootPOA
                    .create_id_uniqueness_policy(
                        org.omg.PortableServer.IdUniquenessPolicyValue.UNIQUE_ID);

            POA bindingPOA = rootPOA.create_POA("BindingPOA", poaManager, policies);
            CorbaDSIServant servant = new CorbaDSIServant(orb, bindingPOA, this, sbeCallback);
            byte[] objectId = bindingPOA.activate_object(servant);
            obj = bindingPOA.id_to_reference(objectId);
           
            if (location.startsWith("relfile:")) {
                String iorFile = location.substring("relfile:".length(), location.length());
                // allow for up to 3 '/' to match common uses of relfile url format
                for (int n = 0; n < 3; n++) {
                    if (iorFile.charAt(0) != '/') {
                        break;
                    } else {
                        iorFile = iorFile.substring(1);
                    }
                }

                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else if (location.startsWith("file:")) {
                String iorFile = location.substring("file:".length(), location.length());
                // allow for up to 3 '/' to match common uses of file url format
                for (int n = 0; n < 3; n++) {
                    if (iorFile.charAt(0) != '/') {
                        break;
                    } else {
                        iorFile = iorFile.substring(1);
                    }
                }
                // to match the ORB, file must have complete path information, therefore we add
                // a '/' prefix to the address
                //iorFile = "/" + iorFile;
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else if (location.startsWith("corbaloc")) {
                // Try add the key to the boot manager.  This is required for a corbaloc
                try {
                    int keyIndex = location.indexOf('/');
                    String key = location.substring(keyIndex + 1);
                    org.apache.yoko.orb.OB.BootManager bootManager =
                        org.apache.yoko.orb.OB.BootManagerHelper.narrow(
                            orb.resolve_initial_references("BootManager"));
                    bootManager.add_binding(key.getBytes(), obj);
                    LOG.info("Added key " + key + " to bootmanager");
                } catch (Exception ex) {
                    // TODO: Continue without for now
                }
                String ior = orb.object_to_string(obj);
                address.setLocation(ior);
                String iorFile = "endpoint.ior";
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
            } else {
                String ior = orb.object_to_string(obj);
                address.setLocation(ior);
                String iorFile = "endpoint.ior";
                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
                LOG.info("Object Reference: " + orb.object_to_string(obj));
            }
            // TODO: Provide other export mechanisms?
View Full Code Here

        return null;
    }

    public static AddressType getCorbaAddressType(Bus bus, EndpointReferenceType endpointRef) {
        AddressType addrType = null;
        try {
            Port wsdlPort = EndpointReferenceUtils.getPort(bus.getWSDLManager(),
                                                           endpointRef);
           
            List extElements = wsdlPort.getExtensibilityElements();
View Full Code Here

    }

    public ExtensibilityElement unmarshall(Class parentType, QName elementType,
            Element el, Definition def, ExtensionRegistry extReg)
        throws WSDLException {
        AddressType addrType = new AddressType();
        addrType.setElementType(elementType);

        // Store the location held in the address element
        NamedNodeMap addrAttributes = el.getAttributes();
        for (int i = 0; i < addrAttributes.getLength(); ++i) {
            if (addrAttributes.item(i).getNodeName().equals("location")) {
                addrType.setLocation(addrAttributes.item(i).getNodeValue());
            }
        }

        return addrType;
    }
View Full Code Here

            // obtain a reference to the target object
            Port wsdlPort = EndpointReferenceUtils.getPort(b.getWSDLManager(),
                    this.endpointRef);

            List extElements = wsdlPort.getExtensibilityElements();
            AddressType address = null;
            for (Iterator iter = extElements.iterator(); iter.hasNext();) {
                Object e = iter.next();
                if (e instanceof AddressType) {
                    address = (AddressType) e;
                    break;
                }
            }

            if (address == null) {
                LOG.log(Level.SEVERE, "Unable to locate a valid CORBA address");
                throw new CorbaBindingException("Unable to locate a valid CORBA address");
            }
           
            if (!isBindingCompatible(address.getLocation())) {
                LOG.log(Level.SEVERE, "Address not a valid CORBA address");
                throw new CorbaBindingException("Address not a valid CORBA address");
            }

            target = CorbaUtils.importObjectReference(orb, address.getLocation());
        } catch (java.lang.Exception ex) {
            LOG.log(Level.SEVERE, "Could not resolve target object");
            throw new WSDLException(WSDLException.OTHER_ERROR, "Could not resolve target object", ex);
        }
View Full Code Here

TOP

Related Classes of org.apache.schemas.yoko.bindings.corba.AddressType

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.