You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2004/06/14 10:31:15 UTC

cvs commit: ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils PropertyLoader.java

hemapani    2004/06/14 01:31:15

  Modified:    contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils
                        Utils.java JarFileLoader.java AntExecuter.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager
                        JARFile.java DynamicCompiler.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils
                        PropertyLoader.java
  Log:
  fixed the testcases
  
  Revision  Changes    Path
  1.9       +44 -4     ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/Utils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Utils.java	10 Jun 2004 11:35:19 -0000	1.8
  +++ Utils.java	14 Jun 2004 08:31:15 -0000	1.9
  @@ -65,7 +65,9 @@
   import java.net.ProtocolException;
   import java.net.URL;
   import java.net.URLConnection;
  +import java.util.ArrayList;
   import java.util.Stack;
  +import java.util.StringTokenizer;
   
   import javax.xml.namespace.QName;
   import javax.xml.parsers.DocumentBuilder;
  @@ -76,6 +78,7 @@
   import org.apache.axis.Constants;
   import org.apache.axis.encoding.Base64;
   import org.apache.axis.utils.JavaUtils;
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
   import org.apache.geronimo.ews.ws4j2ee.wsutils.J2EEFault;
   import org.w3c.dom.Attr;
   import org.w3c.dom.CharacterData;
  @@ -84,6 +87,7 @@
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +import org.w3c.dom.Text;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  @@ -781,10 +785,14 @@
               return "";
       }
   
  -    public static String getAbsolutePath(String path, String confFileLocation) {
  -        if (path.indexOf(":/") > -1 || path.indexOf(":\\") > -1)
  -            return path;
  -        return confFileLocation + "/" + path;
  +    public static String getAbsolutePath(String path, String confFileLocation)throws GenerationFault {
  +		if(path != null){
  +			if (path.indexOf(":/") > -1 || path.indexOf(":\\") > -1||path.startsWith("/"))
  +				return path;
  +			return confFileLocation + "/" + path;
  +		}else{
  +			throw new GenerationFault("the path can not be null");
  +		}
   
       }
       
  @@ -943,6 +951,38 @@
   			returnType.substring(1,index);
   		}
   		return returnType + end;
  +	}
  +	
  +	public static String getElementValue(Node node){
  +		NodeList nodes = node.getChildNodes();
  +		for(int i = 0;i<nodes.getLength();i++){
  +			Node temp = nodes.item(i);
  +			if(temp instanceof Text){
  +				return ((Text)temp).getNodeValue();
  +			}
  +		}
  +		return null;
  +	}
  +
  +	public static String javapkgToURI(String pkg){
  +		StringTokenizer tok = new StringTokenizer(pkg,".");
  +		ArrayList tokens = new ArrayList();
  +		while(tok.hasMoreElements()){
  +			tokens.add(tok.nextToken());
  +		}
  +		int size = tokens.size();
  +		if( size > 0){
  +			StringBuffer uribuf = new StringBuffer();
  +			uribuf.append("http://");
  +			uribuf.append((String)tokens.get(size -1));
  +			for(int i = size -2;i>=0;i--){
  +				uribuf.append(".");
  +				uribuf.append((String)tokens.get(i));
  +			}
  +			return uribuf.toString();
  +		}else{
  +			return pkg;
  +		}
   	}
   
   
  
  
  
  1.3       +3 -3      ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/JarFileLoader.java
  
  Index: JarFileLoader.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/JarFileLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JarFileLoader.java	10 Jun 2004 11:35:19 -0000	1.2
  +++ JarFileLoader.java	14 Jun 2004 08:31:15 -0000	1.3
  @@ -55,7 +55,7 @@
   				throw new GenerationFault("wscf file must not be null");
   		} catch (IOException e) {
   			e.printStackTrace();
  -			throw new GenerationFault(e);
  +			throw GenerationFault.createGenerationFault(e);
   		}
   	}
   	public InputStream getInputStreamForJarEntry(String path) throws GenerationFault{
  @@ -68,7 +68,7 @@
   				}
   			} catch (IOException e) {
   				e.printStackTrace();
  -				throw new GenerationFault(e);
  +				throw GenerationFault.createGenerationFault(e);
   			}
   		}
   	
  @@ -82,7 +82,7 @@
   			}
   		} catch (IOException e) {
   			e.printStackTrace();
  -			throw new GenerationFault(e);
  +			throw GenerationFault.createGenerationFault(e);
   		}
   	}
   	
  
  
  
  1.3       +15 -4     ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntExecuter.java
  
  Index: AntExecuter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/AntExecuter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AntExecuter.java	10 Jun 2004 11:35:19 -0000	1.2
  +++ AntExecuter.java	14 Jun 2004 08:31:15 -0000	1.3
  @@ -16,6 +16,11 @@
   
   package org.apache.geronimo.ews.ws4j2ee.utils;
   
  +import java.io.BufferedReader;
  +import java.io.InputStream;
  +import java.io.InputStreamReader;
  +import java.io.OutputStream;
  +
   
   /**
    * <p>To call this Class and execute a ant task the $JAVA_HOME/lib/tool.jar need
  @@ -26,14 +31,20 @@
   public class AntExecuter {
   	private String buildFile = "build.xml";
   	
  -	public void execute(String buildFile){
  -
  +	public void execute(String buildFile)throws Exception{
  +////		Process p = Runtime.getRuntime().exec("echo %JAVA_HOME%");
  +//  		Process p = Runtime.getRuntime().exec(new String[]{"notepad"});
  +//		BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
  +//		String line = null;
  +//		while((line = in.readLine())!= null){
  +//			System.out.println(line);
  +//		}
   //wait till the ant jar added
  -//		org.apache.tools.ant.Main.main(new String[]{"-f",buildFile});
  +//		org.apache.tools.ant.Main.main(new String[]{"-f",buildFile,"-verbose","-debug"});
   //TODO  following code should load the tool.jar but it does not work yet
   //		ClassLoader cl = org.apache.axis.utils.ClassUtils.createClassLoader(
   //					"H:/j2sdk1.4.1_01/lib/tools.jar",
   //					ClassLoader.getSystemClassLoader());
  -//		org.apache.tools.ant.Main.start(new String[]{"-f",buildFile},null,cl);
  +		//org.apache.tools.ant.Main.start(new String[]{"-f",buildFile},null,cl);
   	}
   }
  
  
  
  1.4       +1 -1      ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager/JARFile.java
  
  Index: JARFile.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager/JARFile.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JARFile.java	10 Jun 2004 11:33:12 -0000	1.3
  +++ JARFile.java	14 Jun 2004 08:31:15 -0000	1.4
  @@ -108,7 +108,7 @@
       		}
           } catch (IOException e) {
               e.printStackTrace();
  -            throw new GenerationFault(e);
  +            throw GenerationFault.createGenerationFault(e);
           }
       }
   
  
  
  
  1.3       +0 -1      ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager/DynamicCompiler.java
  
  Index: DynamicCompiler.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/packager/DynamicCompiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DynamicCompiler.java	4 Feb 2004 04:29:55 -0000	1.2
  +++ DynamicCompiler.java	14 Jun 2004 08:31:15 -0000	1.3
  @@ -84,7 +84,6 @@
   
           for (int i = 0; i < srcFiles.size(); i++) {
               String src = (String) srcFiles.get(i);
  -            System.out.println(src);
               comp.addFile(src);
           }
           try {
  
  
  
  1.2       +2 -2      ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils/PropertyLoader.java
  
  Index: PropertyLoader.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/wsutils/PropertyLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertyLoader.java	10 Jun 2004 11:35:19 -0000	1.1
  +++ PropertyLoader.java	14 Jun 2004 08:31:15 -0000	1.2
  @@ -20,7 +20,7 @@
   				proIn = GenerationConstants.class.getResourceAsStream("META-INF/"+propertyFile);
   			}
   			if(proIn == null){
  -				proIn = new FileInputStream("src/conf/"+propertyFile);
  +				proIn = new FileInputStream("conf/"+propertyFile);
   			}
   			if(proIn == null){
   				proIn = new FileInputStream(propertyFile);
  @@ -32,7 +32,7 @@
   			}
   			return properties;
   		} catch (Exception e) {
  -			throw new GenerationFault(e);
  +			throw GenerationFault.createGenerationFault(e);
   		} 
   	}
   }