Package java.security

Examples of java.security.CodeSource


        try {    
            if (obj != null) {
                report.print("Class: ");
                report.println(obj.getClass().getName());
                report.print("Location: ");
                CodeSource cs = obj.getClass().getProtectionDomain().getCodeSource();
                if (cs != null)
                    report.println(cs.getLocation().toString());
                else
                    report.println("unknown");
            }
            else {
                report.print("Null object supplied");               
View Full Code Here


   {
      // Print out some codebase info for the ProbeHome
      ClassLoader cl = clazz.getClassLoader();
      results.append("\n"+clazz.getName()+"("+Integer.toHexString(clazz.hashCode())+").ClassLoader="+cl);
      ClassLoader parent = cl;
      CodeSource clazzCS = clazz.getProtectionDomain().getCodeSource();
      if( clazzCS != null )
         results.append("\n++++CodeSource: "+clazzCS);
      else
         results.append("\n++++Null CodeSource");

      results.append("\nImplemented Interfaces:");
      Class[] ifaces = clazz.getInterfaces();
      for(int i = 0; i < ifaces.length; i ++)
      {
         Class iface = ifaces[i];
         results.append("\n++"+iface+"("+Integer.toHexString(iface.hashCode())+")");
         ClassLoader loader = ifaces[i].getClassLoader();
         results.append("\n++++ClassLoader: "+loader);
         ProtectionDomain pd = ifaces[i].getProtectionDomain();
         CodeSource cs = pd.getCodeSource();
         if( cs != null )
            results.append("\n++++CodeSource: "+cs);
         else
            results.append("\n++++Null CodeSource");
      }
View Full Code Here

  // Now read the class bytes and define the class
  java.nio.ByteBuffer bb = res.getByteBuffer();
  if (bb != null) {
      // Use (direct) ByteBuffer:
      CodeSigner[] signers = res.getCodeSigners();
      CodeSource cs = new CodeSource(url, signers);
      return defineClass(name, bb, cs);
  } else {
      byte[] b = res.getBytes();
      // must read certificates AFTER reading bytes.
      CodeSigner[] signers = res.getCodeSigners();
      CodeSource cs = new CodeSource(url, signers);
      return defineClass(name, b, 0, b.length, cs);
  }
    }
View Full Code Here

     * @throws PermissionManagerException if permissions can't be set
     */
    public PermissionManager(final URL contextIdURL, final IEJBJarInfo ejbJarInfo) throws PermissionManagerException {
        super(contextIdURL);
        this.ejbJarInfo = ejbJarInfo;
        this.codeSource = new CodeSource(contextIdURL, (Certificate[]) null);

    }
View Full Code Here

  return protectionDomain;
    }

    private String defineClassSourceLocation(ProtectionDomain protectionDomain)
    {
  CodeSource cs = protectionDomain.getCodeSource();
  String source = null;
  if (cs != null && cs.getLocation() != null) {
      source = cs.getLocation().toString();
  }
  return source;
    }
View Full Code Here

    private ProtectionDomain defaultDomain = null;

    // Returns (and initializes) the default domain.
    private synchronized ProtectionDomain getDefaultDomain() {
  if (defaultDomain == null) {
      CodeSource cs =
    new CodeSource(null, (java.security.cert.Certificate[]) null);
      defaultDomain = new ProtectionDomain(cs, null, this, null);
  }
  return defaultDomain;
    }
View Full Code Here

                m_outDebug.println( getRes().getString( "  Is Sealed?: {0}", pkg.isSealed() ? getRes().getString( "True" ) : getRes().getString( "False" ) ) );
            }
           
            ProtectionDomain proDom = clazz.getProtectionDomain();
            m_outDebug.println( getRes().getString( "{0} protection domain:", clazz.getName() ) );
            CodeSource codeSource = proDom.getCodeSource();
            URL jarLocation = codeSource.getLocation();
            m_outDebug.println( getRes().getString( "  Location: {0}", jarLocation ) );
           
            // Try reading in the full jar so we can calculate its size and MD5 hash.
            try
            {
View Full Code Here

   protected Logger log = Logger.getLogger(getClass());

   public Manifest findManifest(Class<?> clazz) throws Exception
   {
      ProtectionDomain domain = clazz.getProtectionDomain();
      CodeSource source = domain.getCodeSource();
      URL location = source.getLocation();
      return findManifest(location);
   }
View Full Code Here

   }

   protected Set<URL> getURLs()
   {
      ProtectionDomain pd = getClass().getProtectionDomain();
      CodeSource cs = pd.getCodeSource();
      return Collections.singleton(cs.getLocation());
   }
View Full Code Here

   }

   protected Set<URL> getURLs()
   {
      ProtectionDomain pd = getClass().getProtectionDomain();
      CodeSource cs = pd.getCodeSource();
      return Collections.singleton(cs.getLocation());
   }
View Full Code Here

TOP

Related Classes of java.security.CodeSource

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.