Examples of FileSource


Examples of net.sf.laja.parser.engine2.source.FileSource

            public ConstructorParser.IConstructorFactory getFactory(int phase) {
                return new ConstructorFactory();
            }
        });

        ParsingResult result = parser.parse(new FileSource(filePath));

        if (!result.success()) {
            return null;
        }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.FileSource

    return parse(new StringSource(string));
  }

  // parse file
  public ParsingResult parseFile(String filename) throws ParserException {
    return parse(new FileSource(filename));
  }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.FileSource

    return parse(new StringSource(string));
  }

  // parse file
  public ParsingResult parseFile(String filename) throws ParserException {
    return parse(new FileSource(filename));
  }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.FileSource

   
    return template;
  }

  public static Template parseFile(final String filename, final TemplateTextWriter templateTextWriter, final Namespaces namespaces, final Classes classes, final GroovyClassLoader groovyClassLoader) {
    final FileSource sourceFile = new FileSource(filename);
   
    TemplateParser parser = new TemplateParser(new ITemplateFactoryFactory() {
      public ITemplateFactory getFactory(int phase) {
        return new TemplateFactory(sourceFile, templateTextWriter, namespaces, classes, groovyClassLoader);
      }
View Full Code Here

Examples of net.sf.laja.parser.engine2.source.FileSource

        return parse(new StringSource(string));
    }

    // parse file
    public ParsingResult parseFile(String filename) throws ParserException {
        return parse(new FileSource(filename));
    }
View Full Code Here

Examples of net.sf.minuteProject.configuration.bean.FileSource

      if (filename!= null)
        new DatabaseIO().write(database, filename);
  }
 
  private String getFileSourceName(DataModel dataModel) {
    FileSource fileSource = dataModel.getFileSource();
    Model model = dataModel.getModel();
      String filename = null;
      String filedir = null;
      String version = dataModel.getModel().getVersion();
      String defaultName = model.getName();
      if (version==null)
        defaultName = defaultName+"-"+version;
      if (fileSource!=null) {
        filename = fileSource.getName();
        filedir = fileSource.getDir();
        new File (filedir.toString()).mkdirs();
        if (filename!=null)
          filename = filedir+"/"+filename+".xml";
        else {
          filename = filedir+"/"+defaultName+".xml";
View Full Code Here

Examples of net.sf.minuteProject.configuration.bean.FileSource

    generator.setBaseElement (configuration);
    generator.generate(model.getConfiguration().getTarget());
  }

  private void loadModel(Model model) throws DocumentException {
    FileSource fileSource = model.getDataModel().getFileSource();
    if (fileSource!=null) {
      document = parse(fileSource);
      doc = new DocumentDom4j(document);
      root = document.getRootElement();
      rootElement = getRootElement(root);
View Full Code Here

Examples of org.apache.excalibur.source.impl.FileSource

    }

    protected void copyDirSource(Publication template, String publicationId,
            SourceResolver resolver, String publicationsUri, String source)
            throws MalformedURLException, IOException {
        FileSource directory = new FileSource(publicationsUri + "/" + template.getId() + "/"
                + source);
        Collection files = directory.getChildren();
        for (Iterator iter = files.iterator(); iter.hasNext();) {
            FileSource filesource = (FileSource) iter.next();
            if (filesource.isCollection()) {
                copyDirSource(template, publicationId, resolver, publicationsUri, source + "/"
                        + filesource.getName());
            } else {
                copySource(template, publicationId, resolver, publicationsUri, source + "/"
                        + filesource.getName());
            }
        }
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.FileSource

    public void testDirExistence() throws Exception
    {
        m_tempDir.mkdirs();
        long time = m_tempDir.lastModified();
        FileSource src = new FileSource("file", m_tempDir);
        assertTrue("Temp dir doesn't exist", src.exists());
        assertTrue("Temp dir is not traversable", src.isCollection());
        // Check it was created less than 1 secs ago
        assertEquals("Wrong creation date", time, src.getLastModified());

        assertTrue("Temp dir is not empty", src.getChildren().isEmpty());
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.FileSource

    public void testChildCreation() throws Exception
    {
        final String text = "Writing to a source";

        FileSource src = new FileSource("file", m_tempDir);

        FileSource child = (FileSource) src.getChild("child.txt");
        assertTrue("New file already exists", !child.exists());

        // Should not have a validity, since it doesn't exist
        assertNull("New file has a validity", child.getValidity());

        // Test the name
        assertEquals("Wrong name", "child.txt", child.getName());

        // Feed with some content
        fillSource(child, text);

        // And test it
        assertEquals(
            "Wrong length",
            text.length() + System.getProperty("line.separator").length(),
            child.getContentLength());
        assertEquals("Wrong content-type", "text/plain", child.getMimeType());
        assertTrue("New file is traversable", !child.isCollection());

        // Check that parent now has children
        Collection children = src.getChildren();
        assertEquals("Wrong number of children", 1, children.size());

        // And also that crawling up the hierarchy is OK
        Source parent = child.getParent();
        assertEquals("Wrong parent URI", src.getURI(), parent.getURI());

    }
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.