Examples of Naming


Examples of org.jnp.interfaces.Naming

         provider = "https:" + provider.substring(10);

      tryLogin(env);

      URL providerURL = null;
      Naming namingServer = null;
      try
      {
         providerURL = new URL(provider);
         // Retrieve the Naming interface
         namingServer = getNamingServer(providerURL);
View Full Code Here

Examples of org.jnp.interfaces.Naming

         else
            log.warn(msg);
         IOException e = new IOException(msg);
         throw e;
      }
      Naming namingServer = (Naming) obj;
      return namingServer;
   }
View Full Code Here

Examples of org.jnp.interfaces.Naming

    *
    * @throws Exception    Failed to invoke method.
    */
   public Object invoke(Invocation invocation) throws Exception
   {
      Naming theServer = namingMain.getNamingInstance();
      // Set the method hash to Method mapping
      if (invocation instanceof MarshalledInvocation)
      {
         MarshalledInvocation mi = (MarshalledInvocation) invocation;
         mi.setMethodMap(marshalledInvocationMapping);
View Full Code Here

Examples of org.jnp.interfaces.Naming

   // InitialContextFactory implementation
   public Context getInitialContext(Hashtable env) throws NamingException
   {
      Class[] interfaces = {Naming.class};
      Interceptor[] interceptors;
      Naming naming;

      // Get the login principal and credentials from the JNDI env
      Object credentials = env.get(Context.SECURITY_CREDENTIALS);
      Object principal = env.get(Context.SECURITY_PRINCIPAL);
      Object protocol = env.get(Context.SECURITY_PROTOCOL);

      if (principal != null && credentials != null)
      {
         if (protocol != null)
         {
            login(principal, credentials, protocol);
         }
         else
         {
            associateSecurityInformation(principal, credentials);
         }
         Interceptor[] tmp = {IsLocalInterceptor.singleton, SecurityClientInterceptor.singleton, InvokeRemoteInterceptor.singleton};
         interceptors = tmp;
      }
      else
      {
         Interceptor[] tmp = {IsLocalInterceptor.singleton, InvokeRemoteInterceptor.singleton};
         interceptors = tmp;
      }

      Naming local = NamingContext.getLocal();
      if (local != null) return new NamingContext(env, null, local);

      String providerUrl = (String) env.get(Context.PROVIDER_URL);
      if (providerUrl == null)
      {
View Full Code Here

Examples of org.jnp.interfaces.Naming

         boolean isRegistered = server.isRegistered(xmbean);
         assertTrue(xmbean+" is registered", isRegistered);

         // Lookup the Naming interface
         InitialContext ctx = this.getInitialContext();
         Naming naming = (Naming) ctx.lookup("secure/Naming");
         getLog().info("Found Naming proxy: "+naming);
         Name hello = ctx.getNameParser("").parse("Hello");

         // Try to create a binding without security context
         try
         {
            naming.bind(hello, "HelloBinding", "java.lang.String");
            fail("Was able to invoke secretEcho");
         }
         catch(Exception e)
         {
            getLog().info("bind op failed as expected", e);
         }

         SimplePrincipal jduke = new SimplePrincipal("jduke");
         SecurityAssociation.setPrincipal(jduke);
         SecurityAssociation.setCredential("theduke".toCharArray());
         naming.bind(hello, "HelloBinding", "java.lang.String");
         getLog().info("Was able to create Hello binding");

         SimplePrincipal guest = new SimplePrincipal("guest");
         SecurityAssociation.setPrincipal(guest);
         SecurityAssociation.setCredential("guest".toCharArray());
         try
         {
            naming.bind(hello, "HelloBinding2", "java.lang.String");
            fail("guest was able to create binding");
         }
         catch(Exception e)
         {
            getLog().info("guest bind op failed as expected", e);
View Full Code Here

Examples of org.jnp.interfaces.Naming

         boolean isRegistered = server.isRegistered(xmbean);
         assertTrue(xmbean+" is registered", isRegistered);

         // Lookup the Naming interface
         InitialContext ctx = this.getInitialContext();
         Naming naming = (Naming) ctx.lookup("secure/Naming");
         getLog().info("Found Naming proxy: "+naming);
         Name hello = ctx.getNameParser("").parse("Hello");

         SimplePrincipal jduke = new SimplePrincipal("jduke");
         SecurityAssociation.setPrincipal(jduke);
         SecurityAssociation.setCredential("theduke".toCharArray());

         // Lookup the previous Hello binding
         String value = (String) naming.lookup(hello);
         assertTrue("lookup(Hello) == HelloBinding", value.equals("HelloBinding"));
         getLog().info("lookup(Hello) = "+value);
      }
      finally
      {
View Full Code Here

Examples of org.jnp.interfaces.Naming

   }

   @Override
   protected void createService() throws Exception
   {
      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
      try
      {
         super.createService();
      }
      finally
View Full Code Here

Examples of org.jnp.interfaces.Naming

   }

   @Override
   protected void stopService() throws Exception
   {
      Naming naming = NamingContext.getHANamingServerForPartition(clusterPartition.getPartitionName());
      try
      {
         super.stopService();
      }
      finally
View Full Code Here

Examples of org.jnp.interfaces.Naming

//    env.setProperty("java.naming.provider.url", providerURL);
//    log.info("Env = " + env);
//    Context ctx = new InitialContext(env);
//    ctx.bind(NAME, VALUE);
     
      Naming namingServer = naming.getNamingInstance();
      namingServer.bind(parser.parse(NAME),
                                      new MarshalledValuePair(VALUE),
                                      VALUE.getClass().getName());
      log.info("Bound " + VALUE + " to " + namingServer + " under " + NAME);
      Context sub = namingServer.createSubcontext(parser.parse(SUBCONTEXT_NAME));
      sub.bind(parser.parse(NAME), VALUE);
      log.info("Bound " + VALUE + " to " + sub + " under " + NAME);
     
      // NOTE: we must bind the NonDeserializable directly, or else the
      // NamingContext will wrap it in a MarshalledValuePair, which will
      // defeat the test by triggering deserialization too late
      namingServer.bind(parser.parse(BAD_BINDING), new NonDeserializable(),
                                     NonDeserializable.class.getName());

      log.info("Bound a NonDeserializable to " + namingServer + " under " + BAD_BINDING);
     
   }
View Full Code Here

Examples of org.jnp.interfaces.Naming

//    env.setProperty("java.naming.provider.url", providerURL);
//   
//    Context ctx = new InitialContext(env);
//      ctx.unbind(NAME);
     
      Naming namingServer = naming.getNamingInstance();
      try
      {
         namingServer.unbind(parser.parse(SUBCONTEXT_NAME + "/" + NAME));
         log.info("Unbound " + SUBCONTEXT_NAME + "/" + NAME + " from " + namingServer);
      }
      catch (NameNotFoundException ignored)
      {
         // already unbound by test
      }
      try
      {
         namingServer.unbind(parser.parse(SUBCONTEXT_NAME));
         log.info("Unbound " + SUBCONTEXT_NAME + " from " + namingServer);
      }
      catch (NameNotFoundException ignored)
      {
         // already unbound by test
      }
      try
      {
         namingServer.unbind(parser.parse(NAME));
         log.info("Unbound " + NAME + " from " + namingServer);
      }
      catch (NameNotFoundException ignored)
      {
         // already unbound by test
      }
      try
      {
         namingServer.unbind(parser.parse(BAD_BINDING));
         log.info("Unbound " + BAD_BINDING + " from " + namingServer);
      }
      catch (NameNotFoundException ignored)
      {
         // already unbound by test
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.