You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/10/09 13:01:48 UTC

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

dims        2004/10/09 04:01:47

  Modified:    contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc
                        BuildFileGenerator.java
               contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils
                        PropertyStore.java
  Log:
  Solidify assumptions in location of properties file
  
  Revision  Changes    Path
  1.20      +9 -1      ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileGenerator.java
  
  Index: BuildFileGenerator.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileGenerator.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- BuildFileGenerator.java	2 Sep 2004 13:03:15 -0000	1.19
  +++ BuildFileGenerator.java	9 Oct 2004 11:01:47 -0000	1.20
  @@ -108,7 +108,15 @@
   			//out.write("	<property file=\"ws4j2ee.properties\"/>\n");
   
   			out.write("	<path id=\"classpath\" >\n");
  -			File tempfile = new File("./target/classes");
  +
  +            File tempfile = null;
  +            if(file != null) {
  +                tempfile = new File(file.getParent(), "classes");
  +            }
  +            if(tempfile == null) {
  +                tempfile = new File("./target/classes");
  +            }
  +
   			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
   			tempfile = new File("target/test-classes");
   			out.write("		<pathelement location=\"/"+tempfile.getAbsolutePath()+"\"/>");
  
  
  
  1.3       +177 -87   ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/PropertyStore.java
  
  Index: PropertyStore.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/contrib/ews/src/org/apache/geronimo/ews/ws4j2ee/utils/PropertyStore.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyStore.java	11 Aug 2004 09:18:30 -0000	1.2
  +++ PropertyStore.java	9 Oct 2004 11:01:47 -0000	1.3
  @@ -1,87 +1,177 @@
  -/*
  - * Copyright 2001-2004 The Apache Software Foundation.
  - * 
  - * Licensed under the Apache License, Version 2.0 (the "License");
  - * you may not use this file except in compliance with the License.
  - * You may obtain a copy of the License at
  - * 
  - *      http://www.apache.org/licenses/LICENSE-2.0
  - * 
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed under the License is distributed on an "AS IS" BASIS,
  - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  -
  -package org.apache.geronimo.ews.ws4j2ee.utils;
  -
  -import java.io.File;
  -import java.io.FileInputStream;
  -import java.io.FileNotFoundException;
  -import java.io.FileOutputStream;
  -import java.io.IOException;
  -import java.util.Properties;
  -
  -import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  -
  -/**
  - * @author hemapani@opensource.lk
  - */
  -public class PropertyStore {
  -	private Properties properties;
  -	private File file;
  -	public PropertyStore(){
  -		File baseDir = new File(".");
  -		String path = baseDir.getAbsolutePath();
  -		if(path.endsWith("incubator-geronimo")
  -			||path.endsWith("incubator-geronimo\\")
  -			||path.endsWith("incubator-geronimo/")){
  -			path = new File("./modules/axis/").getAbsolutePath();
  -		}
  -		file = new File(path,"target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  -		
  -		file.getParentFile().mkdirs();
  -		FileInputStream in = null;
  -		System.out.println(file.getAbsolutePath() + " created .. ");
  -        try {
  -            properties = new Properties();
  -            if(file.exists()){
  -            	in = new FileInputStream(file);
  -            	properties.load(in);
  -            }
  -        } catch (FileNotFoundException e) {
  -        } catch (IOException e) {
  -        }finally{
  -			try{
  -				if(in != null){
  -					in.close();
  -				}
  -			}catch(Exception e){}
  -
  -        }
  -	}
  -	public void store(String repository){
  -		properties.setProperty(GenerationConstants.MAVEN_LOCAL_REPOSITARY,repository);
  -		FileOutputStream out = null;
  -		try {
  -				out = new FileOutputStream(file);
  -			properties.store(out,"repository Location");
  -		} catch (FileNotFoundException e) {
  -		} catch (IOException e) {
  -		}finally{
  -			try{
  -				if(out != null){
  -					out.close();
  -				}
  -			}catch(Exception e){}
  -		}
  -	}
  -	
  -	public static void main(String[] args){
  -		try{
  -			PropertyStore store = new PropertyStore();
  -			store.store(args[0]);
  -		}catch(Exception e){}
  -	}
  -}
  +/*
  +
  + * Copyright 2001-2004 The Apache Software Foundation.
  +
  + * 
  +
  + * Licensed under the Apache License, Version 2.0 (the "License");
  +
  + * you may not use this file except in compliance with the License.
  +
  + * You may obtain a copy of the License at
  +
  + * 
  +
  + *      http://www.apache.org/licenses/LICENSE-2.0
  +
  + * 
  +
  + * Unless required by applicable law or agreed to in writing, software
  +
  + * distributed under the License is distributed on an "AS IS" BASIS,
  +
  + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  +
  + * See the License for the specific language governing permissions and
  +
  + * limitations under the License.
  +
  + */
  +
  +
  +
  +package org.apache.geronimo.ews.ws4j2ee.utils;
  +
  +
  +
  +import java.io.File;
  +
  +import java.io.FileInputStream;
  +
  +import java.io.FileNotFoundException;
  +
  +import java.io.FileOutputStream;
  +
  +import java.io.IOException;
  +
  +import java.util.Properties;
  +
  +
  +
  +import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
  +
  +
  +
  +/**
  +
  + * @author hemapani@opensource.lk
  +
  + */
  +
  +public class PropertyStore {
  +
  +	private Properties properties;
  +
  +	private File file;
  +
  +	public PropertyStore(){
  +
  +		File baseDir = new File(".");
  +
  +		String path = baseDir.getAbsolutePath();
  +
  +		if(path.endsWith("geronimo")
  +
  +			||path.endsWith("geronimo\\")
  +			||path.endsWith("geronimo/")
  +			||path.endsWith("trunk")
  +			||path.endsWith("trunk\\")
  +
  +			||path.endsWith("trunk/")){
  +
  +			path = new File("./modules/axis/").getAbsolutePath();
  +
  +		}
  +
  +		file = new File(path,"target/"+GenerationConstants.WS4J2EE_PROPERTY_FILE);
  +
  +		
  +
  +		file.getParentFile().mkdirs();
  +
  +		FileInputStream in = null;
  +
  +		System.out.println(file.getAbsolutePath() + " created .. ");
  +
  +        try {
  +
  +            properties = new Properties();
  +
  +            if(file.exists()){
  +
  +            	in = new FileInputStream(file);
  +
  +            	properties.load(in);
  +
  +            }
  +
  +        } catch (FileNotFoundException e) {
  +
  +        } catch (IOException e) {
  +
  +        }finally{
  +
  +			try{
  +
  +				if(in != null){
  +
  +					in.close();
  +
  +				}
  +
  +			}catch(Exception e){}
  +
  +
  +
  +        }
  +
  +	}
  +
  +	public void store(String repository){
  +
  +		properties.setProperty(GenerationConstants.MAVEN_LOCAL_REPOSITARY,repository);
  +
  +		FileOutputStream out = null;
  +
  +		try {
  +
  +				out = new FileOutputStream(file);
  +
  +			properties.store(out,"repository Location");
  +
  +		} catch (FileNotFoundException e) {
  +
  +		} catch (IOException e) {
  +
  +		}finally{
  +
  +			try{
  +
  +				if(out != null){
  +
  +					out.close();
  +
  +				}
  +
  +			}catch(Exception e){}
  +
  +		}
  +
  +	}
  +
  +	
  +
  +	public static void main(String[] args){
  +
  +		try{
  +
  +			PropertyStore store = new PropertyStore();
  +
  +			store.store(args[0]);
  +
  +		}catch(Exception e){}
  +
  +	}
  +
  +}
  +