Author: aadamchik
Date: Sun Dec 24 09:10:04 2006
New Revision: 490046
URL: http://svn.apache.org/viewvc?view=rev&rev=490046
Log:
no change - reformatting the code according to the project Eclipse defaults
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/ConfigSaver.java
Modified:
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/ConfigSaver.java
URL:
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/ConfigSaver.java?view=diff&rev=490046&r1=490045&r2=490046
==============================================================================
---
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/ConfigSaver.java
(original)
+++
incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/conf/ConfigSaver.java
Sun Dec 24 09:10:04 2006
@@ -17,7 +17,6 @@
* under the License.
****************************************************************/
-
package org.apache.cayenne.conf;
import java.io.File;
@@ -37,6 +36,7 @@
* @author Andrus Adamchik
*/
public class ConfigSaver {
+
protected ConfigSaverDelegate delegate;
/**
@@ -47,15 +47,15 @@
}
/**
- * Constructor for ConfigSaver.
- */
+ * Constructor for ConfigSaver.
+ */
public ConfigSaver(ConfigSaverDelegate delegate) {
this.delegate = delegate;
}
- /**
- * Saves domains into the specified file. Assumes that the maps have
already
- * been saved.
+ /**
+ * Saves domains into the specified file. Assumes that the maps have
already been
+ * saved.
*/
public void storeDomains(PrintWriter pw) {
pw.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
@@ -158,69 +158,71 @@
pw.println("</domain>");
}
- private String attribute(String key, String value)
- {
- if (value != null)
- return " " + key + "=\"" + Util.encodeXmlAttribute(value) + "\"";
- else
- return "";
+ private String attribute(String key, String value) {
+ if (value != null)
+ return " " + key + "=\"" + Util.encodeXmlAttribute(value) + "\"";
+ else
+ return "";
}
/**
- * Stores DataSolurceInfo to the specified PrintWriter.
- * <code>info</code> object may contain full or partial information.
+ * Stores DataSolurceInfo to the specified PrintWriter. <code>info</code>
object may
+ * contain full or partial information.
*/
public void storeDataNode(PrintWriter pw, Project project, DataSourceInfo
info) {
- pw.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
- pw.println("<driver" +
- attribute("project-version", Project.CURRENT_PROJECT_VERSION)
+
- attribute("class", info.getJdbcDriver()) + ">");
-
- if (info.getDataSourceUrl() != null)
- pw.println("\t<url" + attribute("value", info.getDataSourceUrl()) +
"/>");
-
- pw.println("\t<connectionPool" +
- attribute("min", String.valueOf(info.getMinConnections())) +
- attribute("max", String.valueOf(info.getMaxConnections())) +
"/>");
-
- if (info.getUserName() != null) {
- pw.print("\t<login" + attribute("userName", info.getUserName()));
-
- if
(info.getPasswordLocation().equals(DataSourceInfo.PASSWORD_LOCATION_MODEL))
- {
- PasswordEncoding encoder = info.getPasswordEncoder();
- if (encoder != null)
- pw.print(attribute("password",
encoder.encodePassword(info.getPassword(), info.getPasswordEncoderSalt())));
- }
- else if
(info.getPasswordLocation().equals(DataSourceInfo.PASSWORD_LOCATION_CLASSPATH))
- {
- if (info.getPasswordSource() != null)
- {
- File passwordFile = new File(project.getProjectDirectory() +
File.separator + info.getPasswordSource());
- PasswordEncoding encoder = info.getPasswordEncoder();
- if (encoder != null && passwordFile != null)
- {
- try
- {
- PrintStream out = new PrintStream(new
FileOutputStream(passwordFile));
- out.print(encoder.encodePassword(info.getPassword(),
info.getPasswordEncoderSalt()));
- out.close();
- }
- catch (FileNotFoundException exception)
- {
- // TODO Auto-generated catch block
- exception.printStackTrace();
- }
- }
- }
- }
-
- pw.println(attribute("encoderClass",
info.getPasswordEncoderClass()) +
- attribute("encoderSalt",
info.getPasswordEncoderSalt()) +
- attribute("passwordLocation", info.getPasswordLocation()) +
- attribute("passwordSource", info.getPasswordSource()) +
"/>");
- }
+ pw.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
+ pw.println("<driver"
+ + attribute("project-version", Project.CURRENT_PROJECT_VERSION)
+ + attribute("class", info.getJdbcDriver())
+ + ">");
+
+ if (info.getDataSourceUrl() != null)
+ pw.println("\t<url" + attribute("value", info.getDataSourceUrl())
+ "/>");
+
+ pw.println("\t<connectionPool"
+ + attribute("min", String.valueOf(info.getMinConnections()))
+ + attribute("max", String.valueOf(info.getMaxConnections()))
+ + "/>");
+
+ if (info.getUserName() != null) {
+ pw.print("\t<login" + attribute("userName", info.getUserName()));
+
+ if
(info.getPasswordLocation().equals(DataSourceInfo.PASSWORD_LOCATION_MODEL)) {
+ PasswordEncoding encoder = info.getPasswordEncoder();
+ if (encoder != null)
+ pw.print(attribute("password", encoder.encodePassword(info
+ .getPassword(), info.getPasswordEncoderSalt())));
+ }
+ else if (info.getPasswordLocation().equals(
+ DataSourceInfo.PASSWORD_LOCATION_CLASSPATH)) {
+ if (info.getPasswordSource() != null) {
+ File passwordFile = new File(project.getProjectDirectory()
+ + File.separator
+ + info.getPasswordSource());
+ PasswordEncoding encoder = info.getPasswordEncoder();
+ if (encoder != null && passwordFile != null) {
+ try {
+ PrintStream out = new PrintStream(new
FileOutputStream(
+ passwordFile));
+
out.print(encoder.encodePassword(info.getPassword(), info
+ .getPasswordEncoderSalt()));
+ out.close();
+ }
+ catch (FileNotFoundException exception) {
+ // TODO Auto-generated catch block
+ exception.printStackTrace();
+ }
+ }
+ }
+ }
+
+ pw.println(attribute("encoderClass",
info.getPasswordEncoderClass())
+ + attribute("encoderSalt", info.getPasswordEncoderSalt())
+ + attribute("passwordLocation", info.getPasswordLocation())
+ + attribute("passwordSource", info.getPasswordSource())
+ + "/>");
+ }
- pw.println("</driver>");
+ pw.println("</driver>");
}
}