Examples of Bus


Examples of org.objectweb.celtix.Bus

    /*
     * Create the instrumentation component and register it to instrumentation manager
     */
    public GreeterImpl() {
        in = new GreeterInstrumentation(this);
        Bus bus = Bus.getCurrent();
        im = bus.getInstrumentationManager();
        im.register(in);
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

    private Client() {
    }

    public static void main(String args[]) throws Exception {
       
        Bus bus = Bus.init();
       
        Object implementor = new CallbackImpl();
        String address = "http://localhost:9005/CallbackContext/CallbackPort";
        Endpoint.publish(address, implementor);
       
        if (args.length == 0) {
            System.out.println("please specify wsdl");
            System.exit(1);
        }

        URL wsdlURL;
        File wsdlFile = new File(args[0]);
        if (wsdlFile.exists()) {
            wsdlURL = wsdlFile.toURL();
        } else {
            wsdlURL = new URL(args[0]);
        }
       
        SOAPService ss = new SOAPService(wsdlURL, SERVICE_NAME);
        ServerPortType port = ss.getSOAPPort();
       
        EndpointReferenceType ref =
            EndpointReferenceUtils.getEndpointReference(new WSDLManagerImpl(bus), implementor);
       

        String resp = port.registerCallback(ref);

        System.out.println("Response from server: " + resp);
       
        bus.shutdown(true);
       
        System.exit(0);
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

public class ServerImpl implements ServerPortType  {
   
    public String registerCallback(EndpointReferenceType callback) {
       
        try {
            Bus bus = Bus.init();
            WSDLManager manager = new WSDLManagerImpl(bus);
       
            QName interfaceName = EndpointReferenceUtils.getInterfaceName(callback);
            String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(callback);
            QName serviceName = EndpointReferenceUtils.getServiceName(callback);
            String portString = EndpointReferenceUtils.getPortName(callback);
           
            QName portName = new QName(serviceName.getNamespaceURI(), portString);
           
            StringBuffer seiName = new StringBuffer();
            seiName.append(JAXBUtils.namespaceURIToPackage(interfaceName.getNamespaceURI()));
            seiName.append(".");
            seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(),
                                                      JAXBUtils.IdentifierType.INTERFACE));
           
            Class<?> sei = null;   
            try {
                sei = Class.forName(seiName.toString(),
                                    true, manager.getClass().getClassLoader());
            } catch (ClassNotFoundException ex) {
                ex.printStackTrace();
            }
           
            URL wsdlURL = new URL(wsdlLocation);           
           
            Service service = Service.create(wsdlURL, serviceName);
            CallbackPortType port =  (CallbackPortType)service.getPort(portName, sei);

            System.out.println("Invoking on callback object");
            String resp = port.serverSayHi(System.getProperty("user.name"));
            System.out.println("Response from callback object: " + resp);
 
            bus.shutdown(true);
           
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
View Full Code Here

Examples of org.objectweb.celtix.Bus

        for (String p : params) {
            System.out.print(" " + p);           
        }
        System.out.println();
       
        Bus bus = Bus.init();
       
        URL url = GreeterClient.class.getResource("/wsdl/hello_world.wsdl");
        assert null != url;
       
        QName serviceName = new QName("http://objectweb.org/hello_world_soap_http", "SOAPService");
        SOAPService ss = new SOAPService(url, serviceName);
        Greeter port = ss.getSoapPort();
       
        if ("sayHi".equals(operationName)) {
            System.out.println("Invoking sayHi...");
            System.out.println("server responded with: " + port.sayHi());
        } else if ("greetMe".equals(operationName) && params != null && params.length > 0) {
            System.out.println("Invoking greetMe...");
            System.out.println("server responded with: " + port.greetMe(params[0]));
        } else if ("greetMeOneWay".equals(operationName) && params != null && params.length > 0) {
            System.out.println("Invoking greetMeOneWay...");
            port.greetMeOneWay(params[0]);
            System.out.println("no response from server as method is OneWay");
        } else {
            System.err.println("No such operation");
        }
       
       
        bus.shutdown(true);
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

        /**
         * Creation of the endpoint could be part of the bus initialisation
         * based on configuration. For now, do it manually.
         */

        Bus bus = Bus.init(args);
        Runtime.getRuntime().addShutdownHook(
            new Thread(new GreeterServerMain().new TerminationHandler(bus, true)));
        Object implementor = new AnnotatedGreeterImpl();
        String address = "http://loalhost:8080/hello_world_soap_http";
        Endpoint.publish(address, implementor);
        bus.run();
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

    public EndpointReferenceUtilsTest(String arg0) {
        super(arg0);
    }

    public void testGetWSDLDefinitionFromImplementation() throws Exception {
        Bus bus = Bus.init();

        // This implementor is not derived from an SEI and does not implement
        // the Remote interface. It is however annotated with a WebService
        // annotation
        // in which the wsdl location attribute is not set.
        Object implementor = new AnnotatedGreeterNoOverloadImpl();
        WSDLManager manager = bus.getWSDLManager();
        EndpointReferenceType ref = EndpointReferenceUtils
                .getEndpointReference(manager, implementor);

        Definition def = EndpointReferenceUtils.getWSDLDefinition(manager, ref);
        assertNotNull("Could not generate wsdl", def);

        Port port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref);
        // FIXME - a soap binding and service/port should have been
        // generated
        // negative test case
        // fail("Did not expect a port to be found. Did someone fix this?");

        assertNotNull("Expected to find a port", port);

        // This implementor is annotated with a WebService annotation that has
        // no
        // wsdl location specified but it is derived from an interface that is
        // annotated with a WebService annotation in which the attribute IS set
        // -
        // to a url that can be resolved because the interface was generated as
        // part
        // of the test build.
        implementor = new DerivedGreeterImpl();
        ref = EndpointReferenceUtils.getEndpointReference(manager, implementor);
        def = EndpointReferenceUtils.getWSDLDefinition(manager, ref);
        assertNotNull("Could not load wsdl", def);

        port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref);
        // FIXME - a soap binding and service/port should have been generated
        // negative test case

        // fail("Did not expect a port to be found. Did someone fix this?");

        assertNotNull("Could not find port", port);
        bus.shutdown(true);
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

        bus.shutdown(true);
    }
   
    public void testEndpointInterfaceAnnotation() throws Exception {
       
        Bus bus = Bus.init();
       
        Object implementor = new AnotherDerivedGreeterImpl();
       
        WSDLManager manager = bus.getWSDLManager();
        EndpointReferenceType ref = EndpointReferenceUtils
                .getEndpointReference(manager, implementor);
        Definition def = EndpointReferenceUtils.getWSDLDefinition(manager, ref);
        assertNotNull("Could not load wsdl", def);
       
        Port port = EndpointReferenceUtils.getPort(bus.getWSDLManager(), ref);

        assertNull("Port should not be present in the reference.", port);
       
        bus.shutdown(true);
       
    }
View Full Code Here

Examples of org.objectweb.celtix.Bus

    protected MBServerStart() {       
    }
   
    public static void main(String[] args) throws BusException {
        // Create the InstrumentationsManager
        Bus bus = Bus.init(args);
        System.out.println("BusID is " + bus.getBusID());
        //AutomaticWorkQueue awq =
        bus.getWorkQueueManager().getAutomaticWorkQueue();
        //need to use awq to run the programe
        System.out.println("Waiting forever...");
        try {
            Thread.sleep(Long.MAX_VALUE);
        } catch (InterruptedException e) {
View Full Code Here

Examples of org.objectweb.celtix.Bus

        assertTrue(writer.toString().indexOf("jms:address") != -1);
    }

    public void testExtensionReturnsProperJAXBType() throws Exception {
        URL neturl = getClass().getResource("/wsdl/jms_test.wsdl");
        Bus bus = Bus.init();
        assertNotNull("Could not find WSDL", neturl);
        WSDLManager wsdlManager = bus.getWSDLManager();
        JAXBExtensionHelper.addExtensions(wsdlManager.getExtenstionRegistry(),
                                          javax.wsdl.Port.class,
                                         JMSAddressPolicyType.class);

        QName serviceName = new QName("http://celtix.objectweb.org/hello_world_jms", "HelloWorldService");
View Full Code Here

Examples of org.objectweb.celtix.Bus

    public void testPlugableWSDLManager() throws Exception {
        WSDLManager wsdlManager = new WSDLManagerImpl(null);
        Map<String, Object> properties = new WeakHashMap<String, Object>();
        properties.put("celtix.WSDLManager", wsdlManager);
        Bus bus = Bus.init(new String[0], properties);

        WSDLManager wsdlManagerNew = bus.getWSDLManager();

        //Verify that the WSDLManger is the one we plugged into bus previously
        assertEquals("wsdlManager is the one we expected", wsdlManager, wsdlManagerNew);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.