alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.nbbuild;

import java.io.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.*;
import java.util.Date;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;


/**
 * Takes result of given query and generates plan. It allows
 * to store all planning info on one place (in IZ).
 * 

* The generated plan may need to be postrocessed by PlanPreprocess task. * * @author Petr Kuzel */ public final class NoPlans extends Task { /** Holds URL of issuezilla's interface */ private URL urlBase; /** Holds value of property destination. */ private java.io.File target; /** * URL query part of IZ xml cgi to be executed */ private String query; /** Holds value of property proxyHost. */ private String proxyHost; /** Holds value of property proxyPort. */ private int proxyPort = -1; /** * Currently maps directly to <module-requirements>' module attribute. */ private String group; /** Getter for property urlBase. * @return Value of property urlBase. */ public URL getUrlBase() { if (urlBase == null) { try { urlBase = new URL("http://www.netbeans.org/issues/"); } catch (MalformedURLException e) { throw new Error("Internal error"); } } return this.urlBase; } /** Setter for property urlBase. * @param urlBase New value of property urlBase. */ public void setUrlBase(String urlBase) { try { this.urlBase = new URL(urlBase); } catch (MalformedURLException e) { throw new BuildException ("Invalid urlBase attribute!"); } } /** Getter for property destination. * @return Value of property destination. */ public java.io.File getTarget() { return this.target; } /** Setter for property destination. * @param destination New value of property destination. */ public void setTarget(java.io.File destination) { this.target = destination; } public String getQuery() { return query; } /** * URL query part of IZ xml cgi to be executed. * While inlining into source Ant script do not forget * to escape & characters using &amp; * entity reference. */ public void setQuery(String query) { this.query = query; } /** Getter for property proxyHost. * @return Value of property proxyHost. */ public String getProxyHost() { return this.proxyHost; } /** Setter for property proxyHost. * @param proxyHost New value of property proxyHost. */ public void setProxyHost(String proxyHost) { if ("".equals (proxyHost)) { proxyHost = null; } this.proxyHost = proxyHost; } /** Getter for property proxyPort. * @return Value of property proxyPort. */ public int getProxyPort() { return this.proxyPort; } /** Setter for property proxyPort. * @param proxyPort New value of property proxyPort. */ public void setProxyPort(int proxyPort) { this.proxyPort = proxyPort; } public String getGroup() { return group; } /** * Currently maps directly to <module-requirements>' module attribute. * May change in future. */ public void setGroup(String module) { this.group = module; } public void execute () throws BuildException { if (getTarget () == null) throw new BuildException ("Missing target attribute!"); if (getQuery () == null) throw new BuildException ("Missing query attribute!"); if (getGroup () == null) throw new BuildException ("Missing module attribute!"); Object previousPort = null; Object previousHost = null; if (proxyPort != -1) { previousPort = System.getProperties ().put ("http.proxyPort", new Integer (proxyPort).toString ()); } if (proxyHost != null) { previousHost = System.getProperties ().put ("http.proxyHost", proxyHost); } log ("Planning: " + getTarget ()); Writer w = null; try { File out = getTarget(); out.createNewFile(); w = new OutputStreamWriter(new FileOutputStream(out), "utf8"); Issuezilla iz = new Issuezilla(getUrlBase()); int[] plannedIssues = iz.query(getQuery()); w.write("\n"); w.write("\n\n\n"); w.write("\n"); for (int i = 0; i\n"); } w.write("\n"); } catch (IOException ex) { throw new BuildException (ex); } catch (org.xml.sax.SAXException ex) { throw new BuildException (ex); } finally { if (w != null) { try { w.close(); } catch (IOException e) { } } if (previousHost != null) { System.setProperty("http.proxyHost", (String)previousHost); } if (previousPort != null) { System.setProperty("http.proxy", (String)previousPort); } } } }

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.