Ejemplo n.º 1
0
        /**
         * Parses the AFM file.
         * If the webInfLibPath @is not null or empty and @is the valid absolute path to this
         * applications WEB-INF/lib folder (or any other folder containing jars to load),
         * jars inside that folder are also searched for fonts.
         */
        public Font parse(String webInfLibPath, string name)

        {
            MergePath mergePath = new MergePath();

            mergePath.addClassPath();

            File webInfLibFile = new File(webInfLibPath);

            if (webInfLibPath != null &&
                !webInfLibPath.isEmpty() &&
                webInfLibFile.isDirectory())
            {
                string webInfPath = Vfs.lookup(webInfLibFile.getAbsolutePath());

                for (File f : webInfLibFile.listFiles())
                {
                    /*
                     * only look for files that are either jars or zips
                     */
                    if (f.isFile() &&
                        (f.getAbsolutePath().endsWith(".jar") ||
                         f.getAbsolutePath().endsWith(".zip")))
                    {
                        /*
                         * get a path object with the Jar relative to WEB-INF/lib
                         */
                        string jarPath = webInfPath.lookup(f.getName());

                        /*
                         * Encapsulate it as a JarPath, else mergePath.lookup does not look
                         * "into" the jar when looking for resources
                         */
                        mergePath.addMergePath(JarPath.create(jarPath));
                    }
                }
            }

            string path = mergePath.lookup("com/caucho/quercus/lib/pdf/font/" + name + ".afm");

            if (!path.canRead())
            {
                if ("".equals(name))
                {
                    throw new IllegalArgumentException(L.l("Missing font name"));
                }

                throw new FileNotFoundException(L.l("Can't find font '{0}'", name));
            }

            _is = path.openRead();

            try {
                return(parseTop());
            } finally {
                _is.close();
            }
        }
Ejemplo n.º 2
0
        public override void init()
        {
            string mode
                = System.getProperty("com.google.appengine.tools.development.ApplicationPreparationMode");

            bool isGsDisabled = "true".equals(mode);

            if (!isGsDisabled)
            {
                string gsBucket = getIniString("google.cloud_storage_bucket");

                if (gsBucket != null)
                {
                    string stdPwd = getPwd();

                    GoogleMergePath mergePwd = new GoogleMergePath(stdPwd, gsBucket, true);
                    setPwd(mergePwd);

                    string    webInfDir   = getWebInfDir();
                    string    gsWebInfDir = mergePwd.getGooglePath().lookup("WEB-INF");
                    MergePath mergeWebInf = new MergePath(gsWebInfDir, webInfDir);

                    setWebInfDir(mergeWebInf);
                }
            }

            super.init();

            JdbcDriverContext jdbcDriverContext = getJdbcDriverContext();

            string driver = getIniString("google.jdbc_driver");

            if (driver == null)
            {
                driver = "com.google.appengine.api.rdbms.AppEngineDriver";
            }

            jdbcDriverContext.setDefaultDriver(driver);
            jdbcDriverContext.setDefaultUrlPrefix("jdbc:google:rdbms://");
            jdbcDriverContext.setDefaultEncoding(null);
            jdbcDriverContext.setProtocol("mysql", driver);
            jdbcDriverContext.setProtocol("google:rdbms", driver);
        }