Examples of Parser


Examples of org.apache.clerezza.rdf.core.serializedform.Parser

   * @param arguments  specification of the transformation
   * @throws IOException  If an IO error occurs.
   */
  public SchemaGen(SchemaGenArguments arguments)
      throws IOException, URISyntaxException {
    Parser parser = Parser.getInstance();
    InputStream serializedGraph = arguments.getSchemaUrl().openStream();
    schemaGraph = parser.parse(serializedGraph,
        arguments.getFormatIdentifier());
    className = arguments.getClassName();

    if (arguments.getNamespace() == null) {
      namespace = getOntologyUri();
View Full Code Here

Examples of org.apache.cocoon.components.parser.Parser

       }
    }

    /** Configure this <code>Cocoon</code> instance. */
    public Configuration configure(ExcaliburComponentManager startupManager) throws ConfigurationException, ContextException {
        Parser p = null;
        Configuration roleConfig = null;
        Configuration sitemapConfig = null;

        try {
            this.configurationFile.refresh();
            p = (Parser)startupManager.lookup(Parser.ROLE);
            SAXConfigurationHandler b = new SAXConfigurationHandler();
            InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/cocoon.roles").openStream();
            InputSource is = new InputSource(inputStream);
            is.setSystemId(this.configurationFile.getSystemId());
            p.setContentHandler(b);
            p.parse(is);
            roleConfig = b.getConfiguration();
        } catch (Exception e) {
            getLogger().error("Could not configure Cocoon environment", e);
            throw new ConfigurationException("Error trying to load configurations", e);
        } finally {
            if (p != null) startupManager.release(p);
        }

        DefaultRoleManager drm = new DefaultRoleManager();
        drm.setLogger(getLogger());
        drm.configure(roleConfig);
        roleConfig = null;

        try {
            this.configurationFile.refresh();
            p = (Parser)startupManager.lookup(Parser.ROLE);
            SAXConfigurationHandler b = new SAXConfigurationHandler();
            InputStream inputStream = ClassUtils.getResource("org/apache/cocoon/sitemap/sitemap.roles").openStream();
            InputSource is = new InputSource(inputStream);
            is.setSystemId(this.configurationFile.getSystemId());
            p.setContentHandler(b);
            p.parse(is);
            sitemapConfig = b.getConfiguration();
        } catch (Exception e) {
            getLogger().error("Could not configure Cocoon environment", e);
            throw new ConfigurationException("Error trying to load configurations", e);
        } finally {
            if (p != null) startupManager.release(p);
        }

        DefaultRoleManager sitemapRoleManager = new DefaultRoleManager();
        sitemapRoleManager.setLogger(getLogger());
        sitemapRoleManager.configure(sitemapConfig);

        try {
            p = (Parser)startupManager.lookup(Parser.ROLE);
            SAXConfigurationHandler b = new SAXConfigurationHandler();
            InputSource is = this.configurationFile.getInputSource();
            p.setContentHandler(b);
            p.parse(is);
            this.configuration = b.getConfiguration();
        } catch (Exception e) {
            getLogger().error("Could not configure Cocoon environment", e);
            throw new ConfigurationException("Error trying to load configurations",e);
        } finally {
            if (p != null) startupManager.release(p);
        }

        Configuration conf = this.configuration;

        AbstractSitemap.setRoleManager(sitemapRoleManager, conf);
        AbstractSitemap.setLogKitManager(this.logKitManager);

        getLogger().debug("Root configuration: " + conf.getName());
        if (! "cocoon".equals(conf.getName())) {
            throw new ConfigurationException("Invalid configuration file\n" + conf.toString());
        }
        getLogger().debug("Configuration version: " + conf.getAttribute("version"));
        if (Constants.CONF_VERSION.equals(conf.getAttribute("version")) == false) {
            throw new ConfigurationException("Invalid configuration schema version. Must be '" + Constants.CONF_VERSION + "'.");
        }

        String userRoles = conf.getAttribute("user-roles", "");
        if ("".equals(userRoles) == false) {
            try {
                p = (Parser)startupManager.lookup(Parser.ROLE);
                SAXConfigurationHandler b = new SAXConfigurationHandler();
                org.apache.cocoon.environment.Context context =
                    (org.apache.cocoon.environment.Context) this.context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT);
                URL url = context.getResource(userRoles);
                InputSource is = new InputSource(new BufferedInputStream(url.openStream()));
                is.setSystemId(this.configurationFile.getSystemId());
                p.setContentHandler(b);
                p.parse(is);
                roleConfig = b.getConfiguration();
            } catch (Exception e) {
                getLogger().error("Could not configure Cocoon environment", e);
                throw new ConfigurationException("Error trying to load configurations", e);
            } finally {
View Full Code Here

Examples of org.apache.commons.cli.Parser

        .create('D'));

    // [-h|--help]
    options.addOption(new Option("h", "help", false, "Print help information"));

    Parser parser = new GnuParser();
    CommandLine cmdLine = null;

    try {
      cmdLine = parser.parse(options, args);

    } catch (ParseException e) {
      printUsage(options, ss.err);
      System.exit(1);
    }
View Full Code Here

Examples of org.apache.commons.cli2.commandline.Parser

   * @param args
   *            the args
   */
  private static void parseCommand(String[] args)
  {
    Parser parser = new Parser();

    // configure a HelpFormatter
    HelpFormatter hf = new HelpFormatter();
    DefaultOptionBuilder oBuilder = new DefaultOptionBuilder();
    ;

    // configure a parser
    Parser p = new Parser();
    p.setGroup(group);
    p.setHelpFormatter(hf);
    p.setHelpOption(oBuilder.withLongName("help").withShortName("?").create());
    cl = p.parseAndHelp(args);

    // abort application if no CommandLine was parsed
    if (cl == null)
    {
      System.exit(-1);
View Full Code Here

Examples of org.apache.commons.jexl.parser.Parser

     */
    public void testAssignment() throws Exception
    {
        JexlContext jc = JexlHelper.createContext();
        jc.getVars().put("aString", "Hello");
        Parser parser = new Parser(new StringReader(";"));
        SimpleNode tree = parser.parse(new StringReader("aString = 'World';"));
    }
View Full Code Here

Examples of org.apache.commons.jexl2.parser.Parser

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

Examples of org.apache.derby.iapi.sql.compile.Parser

                        "), Begin compiling prepared statement: " +
                        getSource() +
                        " :End prepared statement");
        }

        Parser p = cc.getParser();

        cc.setCurrentDependent(preparedStmt);

        //Only top level statements go through here, nested statement
        //will invoke this method from other places
        StatementNode qt = p.parseStatement(statementText, paramDefaults);

        parseTime = getCurrentTimeMillis(lcc);

                // Call user-written tree-printer if it exists
                walkAST( lcc, qt, ASTVisitor.AFTER_PARSE);
View Full Code Here

Examples of org.apache.droids.api.Parser

        }
        if (contentType == null){
          log.info("Missing content type... can't parse...");
        }
        else {
          Parser parser = droid.getParserFactory().getParser(contentType);
          if( parser == null ) {
            if (log.isDebugEnabled()) {
              log.debug("Could not find parser for " + contentType);
            }
          }
          else {
            Parse parse = parser.parse(entity, link);
            if( parse.getOutlinks() != null ) {
              Collection<Link> outlinks = getFilteredOutlinks( parse );
              droid.getQueue().addAll( outlinks );
            }
            entity.setParse(parse);
View Full Code Here

Examples of org.apache.felix.gogo.runtime.Parser

        assertEquals(5, c.execute("[1 2 [3 4] 5 6] size"));
    }

    public void testParentheses()
    {
        Parser parser = new Parser("(a|b)|(d|f)");
        List<List<List<Token>>> p = parser.program();
        assertEquals("a|b", p.get(0).get(0).get(0).toString());

        parser = new Parser("grep (d.*)|grep (d|f)");
        p = parser.program();
        assertEquals("d.*", p.get(0).get(0).get(1).toString());
    }
View Full Code Here

Examples of org.apache.felix.sigil.common.runtime.cli.Parser

    {
        FrameworkFactory factory = getFrameworkFactory();

        try
        {
            Parser parser = new PosixParser();
            CommandLine cl = parser.parse(options, args);

            if (cl.hasOption('?'))
            {
                printHelp();
            }
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.