예제 #1
0
 /**
  * Insert the given {@code Provider} at the specified {@code position}. The
  * positions define the preference order in which providers are searched for
  * requested algorithms.
  * <p/>
  * If a {@code SecurityManager} is installed, code calling this method needs
  * the {@code SecurityPermission} {@code insertProvider.NAME} (where NAME is
  * the provider name) to be granted, otherwise a {@code SecurityException}
  * will be thrown.
  *
  * @param provider
  *            the provider to insert.
  * @param position
  *            the position (starting from 1).
  * @return the actual position or {@code -1} if the given {@code provider}
  *         was already in the list. The actual position may be different
  *         from the desired position.
  * @throws SecurityException
  *             if a {@code SecurityManager} is installed and the caller does
  *             not have permission to invoke this method.
  */
 public static int insertProviderAt(Provider provider,
                                    int position)
 {
     lock (lockJ)
     {
         // check security access; check that provider is not already
         // installed, else return -1; if (position <1) or (position > max
         // position) position = max position + 1; insert provider, shift up
         // one position for next providers; Note: The position is 1-based
         java.lang.SecurityManager sm = java.lang.SystemJ.getSecurityManager();
         if (sm != null)
         {
             sm.checkSecurityAccess("insertProvider." + provider.getName()); //$NON-NLS-1$
         }
         if (getProvider(provider.getName()) != null)
         {
             return(-1);
         }
         int result = Services.insertProviderAt(provider, position);
         renumProviders();
         return(result);
     }
 }
예제 #2
0
파일: Provider.cs 프로젝트: minam365/JavApi
            /*
             * Returns a string containing a concise, human-readable description of
             * this {@code Service}.
             *
             * @return a printable representation for this {@code Service}.
             */
            public override String ToString()
            {
                String result = "Provider " + provider.getName() + " Service " //$NON-NLS-1$ //$NON-NLS-2$
                                + type + "." + algorithm + " " + className;    //$NON-NLS-1$ //$NON-NLS-2$

                if (aliases != null)
                {
                    result = result + "\nAliases " + aliases.toString(); //$NON-NLS-1$
                }
                if (attributes != null)
                {
                    result = result + "\nAttributes " + attributes.toString(); //$NON-NLS-1$
                }
                return(result);
            }
예제 #3
0
 /**
  * Insert the given {@code Provider} at the specified {@code position}. The
  * positions define the preference order in which providers are searched for
  * requested algorithms.
  * <p/>
  * If a {@code SecurityManager} is installed, code calling this method needs
  * the {@code SecurityPermission} {@code insertProvider.NAME} (where NAME is
  * the provider name) to be granted, otherwise a {@code SecurityException}
  * will be thrown.
  *
  * @param provider
  *            the provider to insert.
  * @param position
  *            the position (starting from 1).
  * @return the actual position or {@code -1} if the given {@code provider}
  *         was already in the list. The actual position may be different
  *         from the desired position.
  * @throws SecurityException
  *             if a {@code SecurityManager} is installed and the caller does
  *             not have permission to invoke this method.
  */
 public static int insertProviderAt(Provider provider,
         int position)
 {
     lock (lockJ)
     {
         // check security access; check that provider is not already
         // installed, else return -1; if (position <1) or (position > max
         // position) position = max position + 1; insert provider, shift up
         // one position for next providers; Note: The position is 1-based
         java.lang.SecurityManager sm = java.lang.SystemJ.getSecurityManager();
         if (sm != null)
         {
             sm.checkSecurityAccess("insertProvider." + provider.getName()); //$NON-NLS-1$
         }
         if (getProvider(provider.getName()) != null)
         {
             return -1;
         }
         int result = Services.insertProviderAt(provider, position);
         renumProviders();
         return result;
     }
 }