directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r122787 - /incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java
Date Sun, 19 Dec 2004 21:08:53 GMT
Author: akarasulu
Date: Sun Dec 19 13:08:51 2004
New Revision: 122787

URL: http://svn.apache.org/viewcvs?view=rev&rev=122787
Log:
use jar resouce instead of file to read in templates
Modified:
   incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java

Modified: incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java
Url: http://svn.apache.org/viewcvs/incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java?view=diff&rev=122787&p1=incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java&r1=122786&p2=incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java&r2=122787
==============================================================================
--- incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java
(original)
+++ incubator/directory/eve/trunk/plugin/src/java/org/apache/eve/tools/schema/EveSchemaTool.java
Sun Dec 19 13:08:51 2004
@@ -142,15 +142,14 @@
         context.put( "owner", schema.getOwner() ) ;
         context.put( "deps", schema.getDependencies()  ) ;
 
-        FileReader fileIn = getResourceReader( "Schema.template" );
-        FileWriter writer = getResourceWriter( schema.getUnqualifiedClassName() );
+        Reader fileIn = getResourceReader( "Schema.template" );
+        Writer writer = getResourceWriter( schema.getUnqualifiedClassName() );
         Velocity.evaluate( context, writer, "LOG", fileIn );
         writer.flush();
         writer.close();
     }
 
 
-
     protected void generateRest() throws Exception
     {
         List types = new ArrayList();
@@ -280,18 +279,17 @@
                                 ProducerTypeEnum type )
             throws Exception
     {
-        FileReader fileIn = getResourceReader( template );
-        FileWriter writer = getResourceWriter( schema.getUnqualifiedClassName( type ) );
+        Reader fileIn = getResourceReader( template );
+        Writer writer = getResourceWriter( schema.getUnqualifiedClassName( type ) );
         Velocity.evaluate( context, writer, "LOG", fileIn );
         writer.flush();
         writer.close();
     }
 
 
-    protected FileReader getResourceReader( String res ) throws IOException
+    protected Reader getResourceReader( String res ) throws IOException
     {
-        String path = getClass().getResource( res ).getFile() ;
-        return new FileReader( path );
+        return new InputStreamReader( getClass().getResourceAsStream( res ) );
     }
 
 

Mime
View raw message