perfsonar-dev - perfsonar: r4877 - in branches/simple-service-with-base2: . lib/repository lib/repository/xalan lib/repository/xalan/xalan lib/repository/xalan/xalan/2.7.0 lib/repository/xalan/xalan-serializer lib/repository/xalan/xalan-serializer/2.7.0 lib/repository/xerces lib/repository/xerces/xerces-xml-apis lib/repository/xerces/xerces-xml-apis/2.8.0 lib/repository/xerces/xercesImpl lib/repository/xerces/xercesImpl/2.8.0 src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/authService/selftest
Subject: perfsonar development work
List archive
perfsonar: r4877 - in branches/simple-service-with-base2: . lib/repository lib/repository/xalan lib/repository/xalan/xalan lib/repository/xalan/xalan/2.7.0 lib/repository/xalan/xalan-serializer lib/repository/xalan/xalan-serializer/2.7.0 lib/repository/xerces lib/repository/xerces/xerces-xml-apis lib/repository/xerces/xerces-xml-apis/2.8.0 lib/repository/xerces/xercesImpl lib/repository/xerces/xercesImpl/2.8.0 src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/authService/selftest
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4877 - in branches/simple-service-with-base2: . lib/repository lib/repository/xalan lib/repository/xalan/xalan lib/repository/xalan/xalan/2.7.0 lib/repository/xalan/xalan-serializer lib/repository/xalan/xalan-serializer/2.7.0 lib/repository/xerces lib/repository/xerces/xerces-xml-apis lib/repository/xerces/xerces-xml-apis/2.8.0 lib/repository/xerces/xercesImpl lib/repository/xerces/xercesImpl/2.8.0 src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/authService/selftest
- Date: Wed, 14 Jan 2009 09:14:54 -0500
Author: rodriguez
Date: 2009-01-14 09:14:53 -0500 (Wed, 14 Jan 2009)
New Revision: 4877
Added:
branches/simple-service-with-base2/lib/repository/xalan/
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.jar
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.jar.sha1
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.pom
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.pom.sha1
branches/simple-service-with-base2/lib/repository/xalan/xalan/
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.jar
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.jar.sha1
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.pom
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.pom.sha1
branches/simple-service-with-base2/lib/repository/xerces/
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.jar
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.jar.sha1
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.pom
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.pom.sha1
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar.sha1
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.pom
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.pom.sha1
Modified:
branches/simple-service-with-base2/pom.xml
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/EchoServiceEngine.java
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/ASValidFileTest.java
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/SelfTest.java
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/TruststoreTest.java
Log:
- Adding more dependencies
- Fixing some problems with the Echo message in the AS
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.jar
Property changes on:
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.jar.sha1
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.pom
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan/2.7.0/xalan-2.7.0.pom.sha1
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.jar
Property changes on:
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.jar.sha1
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.pom
Added:
branches/simple-service-with-base2/lib/repository/xalan/xalan-serializer/2.7.0/xalan-serializer-2.7.0.pom.sha1
Added:
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.jar
Property changes on:
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.jar.sha1
Added:
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.pom
Added:
branches/simple-service-with-base2/lib/repository/xerces/xerces-xml-apis/2.8.0/xerces-xml-apis-2.8.0.pom.sha1
Added:
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar
Property changes on:
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar.sha1
Added:
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.pom
Added:
branches/simple-service-with-base2/lib/repository/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.pom.sha1
Modified: branches/simple-service-with-base2/pom.xml
===================================================================
--- branches/simple-service-with-base2/pom.xml 2009-01-14 12:44:29 UTC (rev
4876)
+++ branches/simple-service-with-base2/pom.xml 2009-01-14 14:14:53 UTC (rev
4877)
@@ -4,7 +4,7 @@
<properties>
- <configurationFile>configuration-ma.xml</configurationFile>
+ <configurationFile>configuration-as.xml</configurationFile>
<axis2Id>axis2-1.4.1</axis2Id>
</properties>
@@ -509,6 +509,26 @@
<artifactId>rampart-core</artifactId>
<version>1.4</version>
</dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xerces-xml-apis</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ <version>2.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan-serializer</artifactId>
+ <version>2.7.0</version>
+ </dependency>
</dependencies>
Modified:
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/EchoServiceEngine.java
===================================================================
---
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/EchoServiceEngine.java
2009-01-14 12:44:29 UTC (rev 4876)
+++
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/EchoServiceEngine.java
2009-01-14 14:14:53 UTC (rev 4877)
@@ -1,6 +1,12 @@
package org.perfsonar.service.authService;
+import java.util.Properties;
+
+import net.geant.edugain.base.Configurator;
+
import org.apache.log4j.Logger;
+import org.perfsonar.base2.service.configuration.Configuration;
+import org.perfsonar.base2.service.configuration.ConfigurationManager;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
import org.perfsonar.base2.service.requesthandler.ServiceEngine;
import org.perfsonar.base2.service.requesthandler.ServiceMessage;
@@ -9,7 +15,9 @@
import org.perfsonar.base2.xml.nmwg.EventType;
import org.perfsonar.base2.xml.nmwg.Message;
import org.perfsonar.base2.xml.nmwg.Metadata;
+import org.perfsonar.service.authService.selftest.ASValidFileTest;
import org.perfsonar.service.authService.selftest.SelfTest;
+import org.perfsonar.service.authService.selftest.TruststoreTest;
public class EchoServiceEngine extends GenericServiceEngine implements
ServiceEngine {
public final static String[] SUPPORTED_EVENT_TYPE = {
"http://schemas.perfsonar.net/tools/admin/echo/2.0",
@@ -19,10 +27,38 @@
public final static String SUCCESS_CODE = "success/echo";
public final static String ERROR_CODE = "error/eventtype_not_supported";
+ private Configuration configuration;
+ private ConfigurationManager configurationManager;
+ private Properties props;
private SelfTest selfTest[] = null;
private static final Logger logger =
Logger.getLogger(EchoServiceEngine.class.getName());
+ public EchoServiceEngine() throws PerfSONARException {
+ //get configuration
+ configurationManager = ConfigurationManager.getInstance();
+ configuration = configurationManager.getConfiguration();
+ this.loadConfiguration();
+ }
+
+ private void loadConfiguration() throws PerfSONARException {
+ props=new Properties();
+ String
maxTtlToken=configuration.getExtensionOption("auth-engine",
"service.as.maxttl");
+ if (maxTtlToken!=null) {
+ try {
+ int max=Integer.parseInt(maxTtlToken);
+ props.put("service.as.maxttl",
String.valueOf(max));
+ logger.debug("EchoServiceEngine: setting max
ttl of token to "+max);
+ } catch (NumberFormatException e) {
+ logger.error("EchoServiceEngine: value of the
parameter service.as.maxttl is not valid. Disabled this feature");
+ }
+ }
+ props.put("provider",
configuration.getExtensionOption("auth-engine", "service.as.crypt_provider"));
+ props.put(Configurator.PROPS_TRUSTSTORE_PASSWD,
configuration.getExtensionOption("auth-engine",
"service.as.truststore_password"));
+
props.put(Configurator.PROPS_TRUSTSTORE_FILE,configuration.getExtensionOption("auth-engine",
"service.as.truststore_file"));
+
props.put(Configurator.PROPS_VALID_COMPONENTS,configuration.getExtensionOption("auth-engine",
"service.as.valid_components"));
+ }
+
public void takeAction(ServiceMessage serviceRequest, ServiceMessage
serviceResponse)
throws PerfSONARException {
//extract message
@@ -51,8 +87,15 @@
"This is
successful echo response from the service"));
}
else {
+ if (selfTest==null) {
+ logger.debug("EchoAction:
initializing self tests...");
+ selfTest = new SelfTest[]{new
TruststoreTest(props),
+ new
ASValidFileTest(props)};
+ }
+
response = executeEcho();
}
+ logger.debug(response.toString());
//exit with success
serviceResponse.setElement(response);
}
@@ -68,18 +111,23 @@
private Message executeEcho() {
logger.debug("EchoAction: Processing EchoAction request...");
Message response = new Message();
+ logger.debug("EchoAction: Setting Type:
'"+ECHO_RESPONSE_TYPE+"'...");
response.setType(ECHO_RESPONSE_TYPE);
Metadata responseMetadata=new Metadata();
+ logger.debug("EchoAction: Setting Metadata Id: 'meta'...");
responseMetadata.setId("meta");
EventType et=new EventType();
responseMetadata.setEventType(et);
+ logger.debug("EchoAction: Setting EventType:
'"+SUPPORTED_EVENT_TYPE[1]+"'...");
et.setEventType(SUPPORTED_EVENT_TYPE[1]);
Data responseData = new Data();
+ logger.debug("EchoAction: Setting MetadataIdRef:
'"+responseMetadata.getId()+"'...");
responseData.setMetadataIdRef(responseMetadata.getId());
responseData.setId("data");
+ logger.debug("EchoAction: foreach...");
for (SelfTest test : selfTest) {
logger.debug("EchoAction: Executing test...");
test.execTest(responseData);
Modified:
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/ASValidFileTest.java
===================================================================
---
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/ASValidFileTest.java
2009-01-14 12:44:29 UTC (rev 4876)
+++
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/ASValidFileTest.java
2009-01-14 14:14:53 UTC (rev 4877)
@@ -22,10 +22,15 @@
public void execTest(Data data) {
String error = "";
- String validsfile =
(String)props.get(Configurator.PROPS_VALID_COMPONENTS);
- File fp = new File(validsfile);
- if (!fp.exists()) {
- error = "Valids component file '"+validsfile+"'
doesn't exist";
+ String validsfile = "";
+ try {
+ validsfile =
(String)props.get(Configurator.PROPS_VALID_COMPONENTS);
+ File fp = new File(validsfile);
+ if (!fp.exists()) {
+ error = "Valids component file
'"+validsfile+"' doesn't exist";
+ }
+ } catch (Exception e) {
+ error = "Unknown error: "+e.getLocalizedMessage();
}
if (!error.equals("")) {
Modified:
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/SelfTest.java
===================================================================
---
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/SelfTest.java
2009-01-14 12:44:29 UTC (rev 4876)
+++
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/SelfTest.java
2009-01-14 14:14:53 UTC (rev 4877)
@@ -1,5 +1,6 @@
package org.perfsonar.service.authService.selftest;
+import org.perfsonar.base2.xml.Element;
import org.perfsonar.base2.xml.nmwg.Data;
import org.perfsonar.base2.xml.nmwg.EventType;
import org.perfsonar.base2.xml.nmwg.Metadata;
@@ -28,10 +29,18 @@
Data dataRes = new Data();
dataRes.setMetadataIdRef(metadataRes.getId());
dataRes.setId("data_"+metadataRes.getId());
- Datum datum=new Datum();
- datum.setText(description);
- dataRes.setDatum(datum);
+ Element datum = new Element();
+ datum.setName("datum");
+ datum.setNamespaceUri("http://ggf.org/ns/nmwg/base/2.0/");
+ datum.setNamespacePrefix("nmwg");
+ datum.setText(description);
+ dataRes.addChild(datum);
+
+// Datum datum=new Datum();
+// datum.setText(description);
+// dataRes.setDatum(datum);
+
data.addChild(metadataRes);
data.addChild(dataRes);
}
Modified:
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/TruststoreTest.java
===================================================================
---
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/TruststoreTest.java
2009-01-14 12:44:29 UTC (rev 4876)
+++
branches/simple-service-with-base2/src/main/java/org/perfsonar/service/authService/selftest/TruststoreTest.java
2009-01-14 14:14:53 UTC (rev 4877)
@@ -27,13 +27,14 @@
public void execTest(Data data) {
String error = "";
- String truststorefile =
(String)props.get(Configurator.PROPS_TRUSTSTORE_FILE);
- File fp = new File(truststorefile);
- if (!fp.exists()) {
- error = "Truststore file '"+truststorefile+"' doesn't
exist";
- }
- String truststorepass =
(String)props.get(Configurator.PROPS_TRUSTSTORE_PASSWD);
+ String truststorefile = "";
try {
+ truststorefile =
(String)props.get(Configurator.PROPS_TRUSTSTORE_FILE);
+ File fp = new File(truststorefile);
+ if (!fp.exists()) {
+ error = "Truststore file '"+truststorefile+"'
doesn't exist";
+ }
+ String truststorepass =
(String)props.get(Configurator.PROPS_TRUSTSTORE_PASSWD);
KeyStore ks =
KeyStore.getInstance(KeyStore.getDefaultType());
java.io.FileInputStream fis =
new java.io.FileInputStream(truststorefile);
@@ -47,6 +48,8 @@
error = "NoSuchAlgorithmException - Internal error
loading the truststore";
} catch (CertificateException e) {
error = "CertificateException - Internal error
loading the truststore";
+ } catch (Exception e) {
+ error = "Unknown error: "+e.getLocalizedMessage();
}
if (!error.equals("")) {
- perfsonar: r4877 - in branches/simple-service-with-base2: . lib/repository lib/repository/xalan lib/repository/xalan/xalan lib/repository/xalan/xalan/2.7.0 lib/repository/xalan/xalan-serializer lib/repository/xalan/xalan-serializer/2.7.0 lib/repository/xerces lib/repository/xerces/xerces-xml-apis lib/repository/xerces/xerces-xml-apis/2.8.0 lib/repository/xerces/xercesImpl lib/repository/xerces/xercesImpl/2.8.0 src/main/java/org/perfsonar/service/authService src/main/java/org/perfsonar/service/authService/selftest, svnlog, 01/14/2009
Archive powered by MHonArc 2.6.16.