Package org.jnp.server

Examples of org.jnp.server.Main


   private void setupJNDIServer() throws Exception
   {
      // start JNDI server
      String detectorHost = InetAddress.getLocalHost().getHostName();

      Main JNDIServer = new Main();
      JNDIServer.setPort(detectorPort);
      JNDIServer.setBindAddress(detectorHost);
      JNDIServer.start();
      System.out.println("Started JNDI server on " + detectorHost + ":" + detectorPort);

   }
View Full Code Here


   {
      try
      {
         String host = InetAddress.getLocalHost().getHostAddress();

         Main jserver = new Main();
         int port = JNDI_PORT;
         jserver.setPort(port);
         jserver.setBindAddress(host);
         jserver.setRmiPort(31000);
         jserver.start();
         System.out.println("Started JNDI server on " + host + ":" + port);

         while (true)
         {
            Thread.sleep(5000);
View Full Code Here

   @BeforeClass
   public void startJndiServer() throws Exception {
      // Create an in-memory jndi
      namingServer = new SingletonNamingServer();
      namingMain = new Main();
      namingMain.setInstallGlobalService(true);
      namingMain.setPort(-1);
      namingMain.start();
      props = new Properties();
      props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
View Full Code Here

         System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
         System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");

         final NamingBeanImpl namingInfo = new NamingBeanImpl();
         namingInfo.start();
         final Main jndiServer = new Main();
         jndiServer.setNamingInfo(namingInfo);
         jndiServer.setPort(1099);
         jndiServer.setBindAddress("localhost");
         jndiServer.setRmiPort(1098);
         jndiServer.setRmiBindAddress("localhost");
         jndiServer.start();

         Configuration conf = new ConfigurationImpl();
         conf.getAcceptorConfigurations().add(new TransportConfiguration(NettyAcceptorFactory.class.getName()));
         conf.setSecurityEnabled(false);
         conf.setFileDeploymentEnabled(false);


         conf.getConnectorConfigurations().put("netty", new TransportConfiguration(NettyConnectorFactory.class.getName()));

         // disable server persistence since JORAM tests do not restart server
         final HornetQServer server = HornetQServers.newHornetQServer(conf, false);

         Hashtable<String, String> env = new Hashtable<String, String>();
         env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
         env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
         JMSServerManager serverManager = new JMSServerManagerImpl(server);
         serverManager.setContext(new InitialContext(env));
         serverManager.start();

         System.out.println("Server started, ready to start client test");

         // create the reader before printing OK so that if the test is quick
         // we will still capture the STOP message sent by the client
         InputStreamReader isr = new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(isr);

         System.out.println("OK");

         String line = null;
         while ((line = br.readLine()) != null)
         {
            if ("STOP".equals(line.trim()))
            {
               server.stop();
               jndiServer.stop();
               namingInfo.stop();
               System.out.println("Server stopped");
               System.exit(0);
            }
            else
View Full Code Here

   private final Main main;

   public WrappedJNDIServer()
   {
      main = new Main();
   }
View Full Code Here

            log.info("Remoting JNDI detector starting JNDI server instance since none where specified via configuration.");
            log.info("Remoting JNDI server started on host + " + host + " and port " + port);

            //If no server information provided, then start one of our own by default
            Main server = new Main();
            if (namingBean != null)
            {
               Class namingBeanClass = Class.forName("org.jnp.server.NamingBean");
               Method setNamingInfoMethod = server.getClass().getMethod("setNamingInfo", new Class[] {namingBeanClass});
               setNamingInfoMethod.invoke(server, new Object[] {namingBean});
            }
            server.setPort(port);
            server.setBindAddress(host);
            server.start();

            contextFactory = NamingContextFactory.class.getName();
            urlPackage = "org.jboss.naming:org.jnp.interfaces";
         }
         catch(Exception e)
View Full Code Here

   private final Main main;

   public WrappedJNDIServer()
   {
      main = new Main();
   }
View Full Code Here

   private Main startJndiServer() throws Exception {
      // Create an in-memory jndi
      NamingServer namingServer = new NamingServer();
      NamingContext.setLocal(namingServer);
      Main namingMain = new Main();
      namingMain.setInstallGlobalService(true);
      namingMain.setPort(-1);
      namingMain.start();
      return namingMain;
   }
View Full Code Here

  public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
    if ( bindToJndi ) {
      try {
        // Create an in-memory jndi
        namingServer = new SingletonNamingServer();
        namingMain = new Main();
        namingMain.setInstallGlobalService( true );
        namingMain.setPort( -1 );
        namingMain.start();
        props = new Properties();
        props.put( "java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
View Full Code Here

/*    */   {
/*    */     try
/*    */     {
/* 39 */       String host = InetAddress.getLocalHost().getHostAddress();
/*    */
/* 41 */       Main jserver = new Main();
/* 42 */       int port = 2410;
/* 43 */       jserver.setPort(port);
/* 44 */       jserver.setBindAddress(host);
/* 45 */       jserver.setRmiPort(31000);
/* 46 */       jserver.start();
/* 47 */       System.out.println("Started JNDI server on " + host + ":" + port);
/*    */       while (true)
/*    */       {
/* 51 */         Thread.sleep(5000L);
/*    */       }
View Full Code Here

TOP

Related Classes of org.jnp.server.Main

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.