perfsonar-dev - perfsonar: r3640 - in trunk/geant2_java-as/src/main/java/org/perfsonar/service: authService webadmin
Subject: perfsonar development work
List archive
perfsonar: r3640 - in trunk/geant2_java-as/src/main/java/org/perfsonar/service: authService webadmin
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3640 - in trunk/geant2_java-as/src/main/java/org/perfsonar/service: authService webadmin
- Date: Thu, 10 Apr 2008 03:20:28 -0400
Author: rodriguez
Date: 2008-04-10 03:20:27 -0400 (Thu, 10 Apr 2008)
New Revision: 3640
Modified:
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
trunk/geant2_java-as/src/main/java/org/perfsonar/service/webadmin/ASHandler.java
Log:
- Updated the Handler for the webadmin
- Improved how perfSONAR exceptions are created
Modified:
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
===================================================================
---
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
2008-04-09 13:12:30 UTC (rev 3639)
+++
trunk/geant2_java-as/src/main/java/org/perfsonar/service/authService/AuthNAction.java
2008-04-10 07:20:27 UTC (rev 3640)
@@ -83,7 +83,7 @@
else {
String m = "AuthNAction: Wrong parameter in
metadata";
logger.info(m);
- throw new
PerfSONARException("error.authn.wrong_params");
+ throw new
PerfSONARException("error.authn.wrong_params",m);
}
}
}
@@ -128,7 +128,7 @@
e.printStackTrace();
String m = "AuthNAction: Error getting the
SOAP envelope of the authN request";
logger.error(m);
- throw new PerfSONARException("error.authn.soap", m);
+ throw new PerfSONARException("error.authn.soap", m,
e);
}
}
}
@@ -155,7 +155,7 @@
throw e;
} catch (WSSecurityException e) {
logger.error("WSSecurityException: "+e.getMessage());
- throw new PerfSONARException("error.authn.wssec",e);
+ throw new
PerfSONARException("error.authn.wssec",e.getMessage(),e);
} catch (Exception e) {
e.printStackTrace();
String m = "Error getting the SOAP envelope of the
authN request";
@@ -193,7 +193,7 @@
e.printStackTrace();
String m = "AuthNAction: the SAML assertion is not
valid";
logger.info(m);
- throw new
PerfSONARException("error.authn.assertion_not_valid",m);
+ throw new
PerfSONARException("error.authn.assertion_not_valid",m,e);
}
logger.info("AuthNAction: the SAML assertion is valid");
@@ -221,7 +221,7 @@
e.printStackTrace();
String m = "AuthNAction: the X509 certificate is not
valid";
logger.info(m);
- throw new
PerfSONARException("error.authn.x509_not_valid",m);
+ throw new
PerfSONARException("error.authn.x509_not_valid",m,e);
}
logger.info("AuthNAction: the X509 certificate is valid");
Modified:
trunk/geant2_java-as/src/main/java/org/perfsonar/service/webadmin/ASHandler.java
===================================================================
---
trunk/geant2_java-as/src/main/java/org/perfsonar/service/webadmin/ASHandler.java
2008-04-09 13:12:30 UTC (rev 3639)
+++
trunk/geant2_java-as/src/main/java/org/perfsonar/service/webadmin/ASHandler.java
2008-04-10 07:20:27 UTC (rev 3640)
@@ -3,6 +3,7 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
@@ -13,6 +14,9 @@
import javax.servlet.http.HttpServletRequest;
+import perfSONARWebAdmin.auxiliary.PerfsonarProperties;
+import perfSONARWebAdmin.auxiliary.PerfsonarPropertiesImpl;
+import perfSONARWebAdmin.auxiliary.PerfsonarProperty;
import perfSONARWebAdmin.auxiliary.ServiceProperties;
import perfSONARWebAdmin.auxiliary.ServicePropertiesImpl;
import perfSONARWebAdmin.auxiliary.wizard.ConfigurationHandler;
@@ -206,32 +210,66 @@
*/
private void otherActions(String group, WizardProperties
functionProperties)
throws IOException {
- // A class that makes modifying service properties a little
bit easier
- ServiceProperties serviceProperties = null;
- // The only other group for rrd ma is the Store group
- if (group.equals("Store")) {
- serviceProperties = new
ServicePropertiesImpl(ServicePath
- + ServicePropertiesPath);
+ // The only other group for as is the Authentication group
+ if (group.equals("Authentication")) {
+// Using PerfsonarProperties in order to keep the
grouping and
+ // description
+ PerfsonarProperties serviceProperties = null;
+ serviceProperties = new PerfsonarPropertiesImpl();
+ serviceProperties.loadProperties(new
FileInputStream(ServicePath
+ + ServicePropertiesPath));
+ // Getting the names for every property of the group
+ Iterator it = functionProperties.orderedKeys();
+ // Setting the value of each property
+
+ // An object that holds the property
group,description,value and key
+ PerfsonarProperty property = new PerfsonarProperty();
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ // Setting service properties and wizard
properties
+
+ // Get the property
+ property = serviceProperties.getProperty(key);
+ // If key property does not exist the throw
an exception
+ if (property == null) {
+ throw new IOException("Key is invalid
" + key + " ");
+ } else {
+ // Change the value of the property
+
property.setValue(functionProperties.getProperty(key));
+ serviceProperties.setProperty(key,
property);
+ }
+ properties.setWizardProperty(key,
functionProperties
+ .getWizardProperty(key));
+ }
+ // Storing all changes
+ serviceProperties.storeProperties(new
FileOutputStream(ServicePath
+ + ServicePropertiesPath));
}
// We don't really have any other groups just the ones for
the servlet
// administration
else {
- serviceProperties = new
ServicePropertiesImpl(ServicePath
- + ServletPropertiesPath);
+ // A class that makes modifying service properties a
little bit
+ // easier
+ ServiceProperties serviceProperties = new
ServicePropertiesImpl(
+ ServicePath + ServletPropertiesPath);
+ // Getting the names for every property of the group
+ Iterator it = functionProperties.orderedKeys();
+ // Setting the value of each property
+ String value = null;
+ while (it.hasNext()) {
+ String key = (String) it.next();
+ // Setting service properties and wizard
properties
+ value = functionProperties.getProperty(key);
+ if (value == null) {
+ throw new IOException("Key is invalid
" + key + " ");
+ } else {
+ serviceProperties.setProperty(key,
value);
+ }
+ properties.setWizardProperty(key,
functionProperties
+ .getWizardProperty(key));
+ }
+ serviceProperties.storeProperties();
}
- // Getting the names for every property of the group
- Iterator it = functionProperties.orderedKeys();
- // Setting the value of each property
- while (it.hasNext()) {
- String key = (String) it.next();
- // Setting service properties and wizard properties
- serviceProperties.setProperty(key, functionProperties
- .getProperty(key));
- properties.setWizardProperty(key, functionProperties
- .getWizardProperty(key));
- }
- // Storing all changes
- serviceProperties.storeProperties();
properties.storeToXML(new FileOutputStream(new
File(ServicePath
+ WizardPropertiesPath)), " Last Modification
"
+
Calendar.getInstance().getTime().toString());
@@ -302,23 +340,41 @@
* @throws IOException
*/
private void lsActions(WizardProperties finalProperties) throws
IOException {
- // Using the ServiceProperties class to acces the
service.properties
- // file
- ServiceProperties serviceProperties = new
ServicePropertiesImpl(
- ServicePath + ServicePropertiesPath);
+ // Changes happen into the service.property file that uses
groupig and
+ // description
+ // In order to keep that functionality we need in this case
to use the
+ // PerfsonarProperties class
+ PerfsonarProperties serviceProperties = new
PerfsonarPropertiesImpl();
+ serviceProperties.loadProperties(new
FileInputStream(ServicePath
+ + ServicePropertiesPath));
Iterator it = finalProperties.orderedKeys();
// Iterating through the LS registration properties properties
+
+ // Initializing the PerfsonarProperty object that holds
information
+ // about grouping and description
+ PerfsonarProperty property = new PerfsonarProperty();
while (it.hasNext()) {
String key = (String) it.next();
// Set the service properties
- serviceProperties
- .setProperty(key,
finalProperties.getProperty(key));
+
+ // Get the PerfsonarProperty object
+ property = serviceProperties.getProperty(key);
+
+ // If property key does not exist throw an exceptrion
+ if (property == null) {
+ throw new IOException("Key is invalid " + key
+ " ");
+ } else {
+ // Else set the value right
+
property.setValue(finalProperties.getProperty(key));
+ serviceProperties.setProperty(key, property);
+ }
// Set the wizard properties
properties.setWizardProperty(key, finalProperties
.getWizardProperty(key));
}
// Storing service properties
- serviceProperties.storeProperties();
+ serviceProperties.storeProperties(new
FileOutputStream(ServicePath
+ + ServicePropertiesPath));
// Setting the LS registration componenets in components
properties file
addRegistrationComponents();
// Storing the wizard properties
@@ -335,13 +391,23 @@
*/
public boolean finishConfiguration() throws Exception {
- ServiceProperties serviceProperties = new
ServicePropertiesImpl(
- ServicePath +
ASHandler.ServicePropertiesPath);
- serviceProperties.setProperty("service.sax_parser.config",
ASHandler.ServicePath
- + ASHandler.ObjectsConfigPath);
- serviceProperties.setProperty("service.log.log4j.config",
ASHandler.ServicePath
- + ASHandler.LoggingPropertiesPath);
- serviceProperties.storeProperties();
+ PerfsonarProperties serviceProperties = new
PerfsonarPropertiesImpl();
+ serviceProperties.loadProperties(new
FileInputStream(ServicePath
+ + ServicePropertiesPath));
+ PerfsonarProperty property = new PerfsonarProperty();
+ property.setKey("service.sax_parser.config");
+ property.setValue(ServicePath + ObjectsConfigPath);
+ property.setGroup("Internals");
+ property.setDescription("Sax parser configuration paramater");
+ serviceProperties.setProperty(property.getKey(), property);
+ property = new PerfsonarProperty();
+ property.setKey("service.log.log4j.config");
+ property.setValue(ServicePath + LoggingPropertiesPath);
+ property.setGroup("Internals");
+ property.setDescription("Logging Properties path");
+ serviceProperties.setProperty(property.getKey(), property);
+ serviceProperties.storeProperties(new
FileOutputStream(ServicePath
+ + ServicePropertiesPath));
return true;
@@ -360,7 +426,7 @@
BufferedReader br = new BufferedReader(fr);
String line = "";
while (line != null) {
- if (line.startsWith("#ma_scheduler")) {
+ if (line.startsWith("#scheduler")) {
line = line.substring(1);
}
if (line.startsWith("#registrator")) {
@@ -392,7 +458,7 @@
BufferedReader br = new BufferedReader(fr);
String line = "";
while (line != null) {
- if (line.startsWith("ma_scheduler")) {
+ if (line.startsWith("scheduler")) {
line = "#" + line;
}
if (line.startsWith("registrator")) {
- perfsonar: r3640 - in trunk/geant2_java-as/src/main/java/org/perfsonar/service: authService webadmin, svnlog, 04/10/2008
Archive powered by MHonArc 2.6.16.