[Coliut-svncommit] SF.net SVN: coliut: [3] client
Status: Planning
Brought to you by:
ronaldmaas
|
From: <ron...@us...> - 2008-05-17 20:39:55
|
Revision: 3
http://coliut.svn.sourceforge.net/coliut/?rev=3&view=rev
Author: ronaldmaas
Date: 2008-05-17 13:39:36 -0700 (Sat, 17 May 2008)
Log Message:
-----------
Add properties file and processing
Modified Paths:
--------------
client/Coliut.java
Added Paths:
-----------
client/ColiutProperties.java
client/coliut.properties
Modified: client/Coliut.java
===================================================================
--- client/Coliut.java 2008-05-17 12:22:05 UTC (rev 2)
+++ client/Coliut.java 2008-05-17 20:39:36 UTC (rev 3)
@@ -21,7 +21,17 @@
public static void main(String[] args)
{
- ColiutSocket cs = new ColiutSocket("coliut.sourceforge.net", "/coliut/coliut.php", 80);
+ // Get webserver properties
+ ColiutProperties cp = new ColiutProperties();
+ String servername = cp.getProperty("servername");
+ String documentname = cp.getProperty("documentname");
+ int port = Integer.parseInt(cp.getProperty("port"));
+
+ System.out.println(servername);
+ System.out.println(documentname);
+ System.out.println(port);
+
+ ColiutSocket cs = new ColiutSocket(servername, documentname, port);
String response = cs.getData("action=login&username=ronald&password=secret");
System.out.println(response);
String response2 = cs.getData("action=logout");
Added: client/ColiutProperties.java
===================================================================
--- client/ColiutProperties.java (rev 0)
+++ client/ColiutProperties.java 2008-05-17 20:39:36 UTC (rev 3)
@@ -0,0 +1,64 @@
+// Class to read the coliut properties
+//
+// Copyright (C) 2008 Ronald Maas <ron...@us...>
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+
+/**
+ * The ColiutProperties class.
+ *
+ * @author Ronald Maas <ron...@us...>
+ * @version 0.1
+ *
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class ColiutProperties
+{
+
+ private Properties properties;
+
+ /**
+ * Class constructor.
+ *
+ */
+
+ public ColiutProperties()
+ {
+ this.properties = new Properties();
+ try {
+ this.properties.load(new FileInputStream("coliut.properties"));
+ } catch (IOException e) {
+ System.out.println("Error on properties load " + e);
+ System.exit(1);
+ }
+ }
+
+ /**
+ * Gets a coliut property.
+ *
+ * @param propertyName The name of the property you're looking for
+ * @return The value of the property you're looking for
+ */
+
+ public String getProperty(String propertyName)
+ {
+ String propertyValue = this.properties.getProperty(propertyName);
+ return propertyValue;
+ }
+
+}
Added: client/coliut.properties
===================================================================
--- client/coliut.properties (rev 0)
+++ client/coliut.properties 2008-05-17 20:39:36 UTC (rev 3)
@@ -0,0 +1,3 @@
+servername=coliut.sourceforge.net
+documentname=/coliut/coliut.php
+port=80
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|