/* * BEGIN_HEADER - DO NOT EDIT * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the "License"). You may not use this file except * in compliance with the License. * * You can obtain a copy of the license at * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html. * See the License for the specific language governing * permissions and limitations under the License. * * When distributing Covered Code, include this CDDL * HEADER in each file and include the License file at * https://open-jbi-components.dev.java.net/public/CDDLv1.0.html. * If applicable add the following below this CDDL HEADER, * with the fields enclosed by brackets "[]" replaced with * your own identifying information: Portions Copyright * [year] [name of copyright owner] */ /* * @(#)SetProjectPrivate.java * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved. * * END_HEADER - DO NOT EDIT */ package com.sun.caps.ant.taskdefs; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.BufferedReader; import java.io.FileReader; import java.util.*; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.taskdefs.Ant; import org.apache.tools.ant.Project; import org.apache.tools.ant.Target; import org.apache.tools.ant.Task; /** * Set extra project private properties. * * @author tli */ public class SetProjectPrivate extends Ant { private static final boolean DEBUG = false; private static final boolean ECHO = true; private static final String nbprojct = "nbproject"; private static final String userprop = "user.properties.file"; private static final String buildprop = "/build.properties"; private List locations; // List private String rootDir; private boolean reset = false; private boolean clean = false; /*private String[] caps_build_properties = { "caps.alaska.root", "caps.netbeans.home", "caps.netbeans.user", "caps.appserver.home", "caps.jbi.home", "j2ee.platform.classpath", "j2ee.platform.wsimport.classpath", "j2ee.platform.wsgen.classpath" };*/ private String[] caps_build_properties = { "enterprise.module.install.dir", "ide.module.install.dir", "netbeans.user", "j2ee.server.instance", "java.module.install.dir", "soa.module.install.dir", "xml.module.install.dir" }; public SetProjectPrivate () { // locations = new Vector(); } /** remove all private properties */ public void setClean (String s) { if ( DEBUG ) log ("clean = " + s); clean = s.equalsIgnoreCase("true"); } /** reset all private properties */ public void setReset (String s) { if ( DEBUG ) log ("reset = " + s); reset = s.equalsIgnoreCase("true"); } /** set root directory */ public void setRootDir (String s) { if ( DEBUG ) log ("root dir = " + s); rootDir = s; } /** Netbeans project locations. */ public void setLocations (String s) { if ( DEBUG ) log ("SET locations = " + s); StringTokenizer tok = new StringTokenizer (s, ",:"); locations = new Vector (); while ( tok.hasMoreTokens() ) { locations.add (tok.nextToken().trim()); } } private void addSystemProperty(String prop, Properties ps) { String pv = getProject().getProperty(prop); if (pv != null) { ps.setProperty(prop, pv); } } private void addUserProperty(String prop, Properties ps) { String pv = ps.getProperty(prop); String upv = getProject().getProperty(caps_build_properties[2]) + buildprop; ps.setProperty(prop, upv); } private boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i=0; i