Exemplo n.º 1
0
        /// <summary>
        /// Destroys the binding for the specified name that is associated
        /// with a remote object.
        /// </summary>
        /// <param name="name"> a name in URL format (without the scheme component) </param>
        /// <exception cref="NotBoundException"> if name is not currently bound </exception>
        /// <exception cref="MalformedURLException"> if the name is not an appropriately
        ///  formatted URL </exception>
        /// <exception cref="RemoteException"> if registry could not be contacted </exception>
        /// <exception cref="AccessException"> if this operation is not permitted (if
        /// originating from a non-local host, for example)
        /// @since JDK1.1 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void unbind(String name) throws RemoteException, NotBoundException, java.net.MalformedURLException
        public static void Unbind(String name)
        {
            ParsedNamingURL parsed   = ParseURL(name);
            Registry        registry = GetRegistry(parsed);

            registry.Unbind(parsed.Name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a reference, a stub, for the remote object associated
        /// with the specified <code>name</code>.
        /// </summary>
        /// <param name="name"> a name in URL format (without the scheme component) </param>
        /// <returns> a reference for a remote object </returns>
        /// <exception cref="NotBoundException"> if name is not currently bound </exception>
        /// <exception cref="RemoteException"> if registry could not be contacted </exception>
        /// <exception cref="AccessException"> if this operation is not permitted </exception>
        /// <exception cref="MalformedURLException"> if the name is not an appropriately
        ///  formatted URL
        /// @since JDK1.1 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static Remote lookup(String name) throws NotBoundException, java.net.MalformedURLException, RemoteException
        public static Remote Lookup(String name)
        {
            ParsedNamingURL parsed   = ParseURL(name);
            Registry        registry = GetRegistry(parsed);

            if (parsed.Name == null)
            {
                return(registry);
            }
            return(registry.Lookup(parsed.Name));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Rebinds the specified name to a new remote object. Any existing
        /// binding for the name is replaced.
        /// </summary>
        /// <param name="name"> a name in URL format (without the scheme component) </param>
        /// <param name="obj"> new remote object to associate with the name </param>
        /// <exception cref="MalformedURLException"> if the name is not an appropriately
        ///  formatted URL </exception>
        /// <exception cref="RemoteException"> if registry could not be contacted </exception>
        /// <exception cref="AccessException"> if this operation is not permitted (if
        /// originating from a non-local host, for example)
        /// @since JDK1.1 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void rebind(String name, Remote obj) throws RemoteException, java.net.MalformedURLException
        public static void Rebind(String name, Remote obj)
        {
            ParsedNamingURL parsed   = ParseURL(name);
            Registry        registry = GetRegistry(parsed);

            if (obj == null)
            {
                throw new NullPointerException("cannot bind to null");
            }

            registry.Rebind(parsed.Name, obj);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns an array of the names bound in the registry.  The names are
        /// URL-formatted (without the scheme component) strings. The array contains
        /// a snapshot of the names present in the registry at the time of the
        /// call.
        /// </summary>
        /// <param name="name"> a registry name in URL format (without the scheme
        ///          component) </param>
        /// <returns>  an array of names (in the appropriate format) bound
        ///          in the registry </returns>
        /// <exception cref="MalformedURLException"> if the name is not an appropriately
        ///  formatted URL </exception>
        /// <exception cref="RemoteException"> if registry could not be contacted.
        /// @since JDK1.1 </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static String[] list(String name) throws RemoteException, java.net.MalformedURLException
        public static String[] List(String name)
        {
            ParsedNamingURL parsed   = ParseURL(name);
            Registry        registry = GetRegistry(parsed);

            String prefix = "";

            if (parsed.Port > 0 || !parsed.Host.Equals(""))
            {
                prefix += "//" + parsed.Host;
            }
            if (parsed.Port > 0)
            {
                prefix += ":" + parsed.Port;
            }
            prefix += "/";

            String[] names = registry.List();
            for (int i = 0; i < names.Length; i++)
            {
                names[i] = prefix + names[i];
            }
            return(names);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Returns a registry reference obtained from information in the URL.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static Registry getRegistry(ParsedNamingURL parsed) throws RemoteException
        private static Registry GetRegistry(ParsedNamingURL parsed)
        {
            return(LocateRegistry.GetRegistry(parsed.Host, parsed.Port));
        }