Package com.peterhi.net2

Examples of com.peterhi.net2.Endpoint$Window


public class ServerApp {

  public static void main(String[] args) throws Exception {
    Endpoint endpoint = new Endpoint(22222);
    endpoint.addEndpointDataListener(new EndpointDataListener() {
      @Override
      public void received(EndpointDataEvent event) {
        System.out.println("Received " + new String(event.getData()) + ", from " + event.getAddress());
      }
    });
View Full Code Here


public class ClientApp {

  public static void main(String[] args) throws Exception {
    Endpoint endpoint = new Endpoint(0);
    endpoint.addEndpointStateListener(new EndpointStateListener() {
      @Override
      public void started(EndpointEvent event) {
        Endpoint endpoint = (Endpoint )event.getSource();
        InetAddress address;
       
View Full Code Here

        @Override
        public void run() {
          try {
            final X11 x11 = X11.INSTANCE;
            final Display display = x11.XOpenDisplay(null);
            Window window = new Window(nativeHandle);
            x11.XSelectInput(display, window,
                new NativeLong(X11.ExposureMask |
                    X11.VisibilityChangeMask |
                    X11.StructureNotifyMask |
                    X11.FocusChangeMask |
View Full Code Here

        screenVisual = new HashMap<Integer,Visual>();
 
  defaultDepth = display.default_depth;

        atomsWmSelection = new Atom[display.screens.length];
        Window wmSelectionWin = new Window(rootWin, 0,0, 1, 1, 0, new Window.Attributes());

  for (int i = 0; i< display.screens.length; i++) {
      Screen screen = display.screens[i];
      gnu.x11.Enum scrdepths = screen.depths();
      while (scrdepths.more()) {
          Depth depth = (Depth) scrdepths.next();
          screenDepth.put(depth.depth(), depth);
   
    gnu.x11.Enum enm = depth.visuals();       
    while (enm.more()) {
        Visual visual = (Visual) enm.next();             
        screenVisual.put(visual.id(), visual);
    }
      }

      // AWT in Java6u1 requires that the WM acquire these selections.
      // Note: even though the WM conventions recommend that CurrentTime
      // not be used we can use it here because the LG WM is the only one
      // acquiring these selections.

      atomsWmSelection[i] = (Atom)Atom.intern(display, "WM_S" + i);
      wmSelectionWin.set_selection_owner(atomsWmSelection[i], Display.CURRENT_TIME);
      display.check_error();
  }

  atomWmState = (Atom)Atom.intern(display, "WM_STATE");
  atomWmChangeState = (Atom)Atom.intern(display, "WM_CHANGE_STATE");
  atomWmProtocols = (Atom)Atom.intern(display, "WM_PROTOCOLS");
  atomWmDeleteWindow = (Atom)Atom.intern(display, "WM_DELETE_WINDOW");
  atomWmTakeFocus = (Atom)Atom.intern(display, "WM_TAKE_FOCUS");
  atomWmColormapWindows=(Atom)Atom.intern(display,"WM_COLORMAP_WINDOWS");
  atomWmTransientFor = (Atom)Atom.intern(display, "WM_TRANSIENT_FOR");
  atomCompoundText = (Atom)Atom.intern(display, "COMPOUND_TEXT");
  atomServerShutdown = (Atom)Atom.intern(display, "SERVER_SHUTDOWN");

  try {
            selectInput(rootWin);
  } catch (Error err) {
      if (err.code == Error.BAD_ACCESS && err.bad == rootWin.id) {
                logger.severe("Failed to access root window. Another WM is running?");
    throw new RuntimeException ("Failed to access root window\n"
        + "Another WM is running?"); // FIXME
      } else {
    throw err;
      }
  }
       
        // Remote Windows: Automatically composite redirect all root top-level windows
  compositeTopLevelWindows();

  // Init WmNET support for screen 0
  // TODO: multiscreen
  Window[] rootWins = new Window[1];
  Window[] checkWins = new Window[1];
  rootWins[0] = rootWin;
        checkWins[0] = new Window(rootWin, 0,0, 1, 1, 0, new Window.Attributes());
  X11WindowManagerHints.initWmNETSupport(display, rootWins, checkWins);

  // prepare for the event dispatch thread
  Thread eventThread = new Thread( this, "X11WindowManager" );
  // eventThread.setPriority(Thread.NORM_PRIORITY + 2); // FIXME
View Full Code Here

        if (service.endpoints == null) {
            service.endpoints = Lists.newArrayList();
        }

        for (String interfaceName : new String[] { "public", "internal", "admin" }) {
            Endpoint endpoint = new Endpoint();
            service.endpoints.add(endpoint);

            endpoint.id = service.id + "-" + interfaceName;
            endpoint.name = service.name;
            endpoint.interfaceName = interfaceName;
View Full Code Here

            setService(svc.getName());
        } else {
            throw new DeploymentException(
                            "If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint()
                                + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService()
                            + "' must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService() + "' "
                                             + "must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

        try {
            String url = PersonHttpTest.class.getResource(wsdlResource).toString();
            WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
            DescriptionElement descElement = reader.readWSDL(url);
            Description desc = descElement.toComponent();
            Endpoint endpoint = desc.getServices()[0].getEndpoints()[0];
            Binding<?> binding = BindingFactory.createBinding(endpoint);
            assertNotNull(binding);
            return binding;
        } catch (WSDLException e) {
            throw new RuntimeException(e);
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService() + "' "
                                             + "must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException(
                        "Could not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException(
                    "If endpoint is not set, the WSDL service '" + getService() + "' must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

TOP

Related Classes of com.peterhi.net2.Endpoint$Window

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.