perfsonar-dev - perfsonar: r4161 - in trunk/ps-mdm-flowsub-mp: conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementPoint/flowsubscription src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard
Subject: perfsonar development work
List archive
perfsonar: r4161 - in trunk/ps-mdm-flowsub-mp: conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementPoint/flowsubscription src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard
Chronological Thread
- From:
- To:
- Subject: perfsonar: r4161 - in trunk/ps-mdm-flowsub-mp: conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementPoint/flowsubscription src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard
- Date: Thu, 10 Jul 2008 19:03:26 -0400
Author: michael.bischoff
Date: 2008-07-10 19:03:25 -0400 (Thu, 10 Jul 2008)
New Revision: 4161
Added:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ConfigurationHandler.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ImmutableServiceConfig.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/SimpleHandler.java
Removed:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/FlowSubscriptionMpConfig.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizardHandler.java
Modified:
trunk/ps-mdm-flowsub-mp/conf/axis-1.4/WEB-INF/web.xml
trunk/ps-mdm-flowsub-mp/conf/components.properties
trunk/ps-mdm-flowsub-mp/conf/service.properties
trunk/ps-mdm-flowsub-mp/conf/servlet.properties
trunk/ps-mdm-flowsub-mp/conf/wizard.properties
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/NfReplayControll.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/AuthenticatorImpl.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/BasicServiceConfig.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ServiceConfig.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/Wizard.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardRequest.java
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardResponse.java
Log:
Webadmin wizzard
Modified: trunk/ps-mdm-flowsub-mp/conf/axis-1.4/WEB-INF/web.xml
===================================================================
--- trunk/ps-mdm-flowsub-mp/conf/axis-1.4/WEB-INF/web.xml 2008-07-10
23:01:49 UTC (rev 4160)
+++ trunk/ps-mdm-flowsub-mp/conf/axis-1.4/WEB-INF/web.xml 2008-07-10
23:03:25 UTC (rev 4161)
@@ -56,7 +56,7 @@
<servlet>
<servlet-name>Wizard</servlet-name>
<servlet-class>
- perfSONARWebAdmin.admin.wizard.Wizard
+
org.perfsonar.service.measurementPoint.flowsubscription.wizard.Wizard
</servlet-class>
</servlet>
Modified: trunk/ps-mdm-flowsub-mp/conf/components.properties
===================================================================
--- trunk/ps-mdm-flowsub-mp/conf/components.properties 2008-07-10 23:01:49
UTC (rev 4160)
+++ trunk/ps-mdm-flowsub-mp/conf/components.properties 2008-07-10 23:03:25
UTC (rev 4161)
@@ -12,6 +12,6 @@
#Registration in LS
#the service will load this component depending on service.r.ls_url has a
valid value in service.properties
-registrator=org.perfsonar.service.base.registration.LSRegistrationComponent
+#registrator=org.perfsonar.service.base.registration.LSRegistrationComponent
authn=org.perfsonar.commons.auxiliary.components.authn.wssec.WSSecAuthNComponent
\ No newline at end of file
Modified: trunk/ps-mdm-flowsub-mp/conf/service.properties
===================================================================
--- trunk/ps-mdm-flowsub-mp/conf/service.properties 2008-07-10 23:01:49
UTC (rev 4160)
+++ trunk/ps-mdm-flowsub-mp/conf/service.properties 2008-07-10 23:03:25
UTC (rev 4161)
@@ -97,47 +97,47 @@
service.mp.flow.max_conn=20
### network layout
-service.mp.flow.exporter.0.name=arthur
-service.mp.flow.exporter.0.enabled=true
-service.mp.flow.exporter.0.address=145.145.127.1
-service.mp.flow.exporter.0.flowport=29001
-service.mp.flow.exporter.0.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.0.name=arthur
+service.common.flow.exporter.0.enabled=true
+service.common.flow.exporter.0.address=145.145.127.1
+service.common.flow.exporter.0.port=29001
+service.common.flow.exporter.0.interfaces=1,2,3,4,5,6
-service.mp.flow.exporter.1.name=ford
-service.mp.flow.exporter.1.enabled=true
-service.mp.flow.exporter.1.address=145.145.127.2
-service.mp.flow.exporter.1.flowport=29002
-service.mp.flow.exporter.1.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.1.name=ford
+service.common.flow.exporter.1.enabled=true
+service.common.flow.exporter.1.address=145.145.127.2
+service.common.flow.exporter.1.port=29002
+service.common.flow.exporter.1.interfaces=1,2,3,4,5,6
-service.mp.flow.exporter.2.name=trillian
-service.mp.flow.exporter.2.enabled=true
-service.mp.flow.exporter.2.address=145.145.127.3
-service.mp.flow.exporter.2.flowport=29003
-service.mp.flow.exporter.2.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.2.name=trillian
+service.common.flow.exporter.2.enabled=true
+service.common.flow.exporter.2.address=145.145.127.3
+service.common.flow.exporter.2.port=29003
+service.common.flow.exporter.2.interfaces=1,2,3,4,5,6
-service.mp.flow.exporter.3.name=zaphod
-service.mp.flow.exporter.3.enabled=true
-service.mp.flow.exporter.3.address=145.145.127.4
-service.mp.flow.exporter.3.flowport=29004
-service.mp.flow.exporter.3.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.3.name=zaphod
+service.common.flow.exporter.3.enabled=true
+service.common.flow.exporter.3.address=145.145.127.4
+service.common.flow.exporter.3.port=29004
+service.common.flow.exporter.3.interfaces=1,2,3,4,5,6
-service.mp.flow.exporter.4.name=router4
-service.mp.flow.exporter.4.enabled=false
-service.mp.flow.exporter.4.address=127.0.0.1
-service.mp.flow.exporter.4.flowport=6999
-service.mp.flow.exporter.4.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.4.name=router4
+service.common.flow.exporter.4.enabled=false
+service.common.flow.exporter.4.address=127.0.0.1
+service.common.flow.exporter.4.port=6999
+service.common.flow.exporter.4.interfaces=1,2,3,4,5,6
-service.mp.flow.exporter.5.name=router5
-service.mp.flow.exporter.5.enabled=false
-service.mp.flow.exporter.5.address=127.0.0.1
-service.mp.flow.exporter.5.flowport=6999
-service.mp.flow.exporter.5.interfaces=1,2,3,4,5,6
+service.common.flow.exporter.5.name=router5
+service.common.flow.exporter.5.enabled=false
+service.common.flow.exporter.5.address=127.0.0.1
+service.common.flow.exporter.5.port=6999
+service.common.flow.exporter.5.interfaces=1,2,3,4,5,6
### application locations
# Group=Applications
# Description= Zebedee for tunnels
-service.mp.flow.zebedee=/usr/bin/zebedee
+service.mp.flow.zebedee=/usr/bin/zebedee798079
# Group=Applications
# Description=nfdump for reading nfcapd files
Modified: trunk/ps-mdm-flowsub-mp/conf/servlet.properties
===================================================================
--- trunk/ps-mdm-flowsub-mp/conf/servlet.properties 2008-07-10 23:01:49
UTC (rev 4160)
+++ trunk/ps-mdm-flowsub-mp/conf/servlet.properties 2008-07-10 23:03:25
UTC (rev 4161)
@@ -1,7 +1,7 @@
#The type of the service
servlet.service_type=flowsubscription
#The ConfigurationHandler interface implementation used by the Wizard Servlet
-servlet.wizard.external_handler=org.perfsonar.service.measurementPoint.flowsubscription.wizard.WizardHandler
+servlet.wizard.configHandlers=org.perfsonar.service.measurementPoint.flowsubscription.wizard.WizardHandler
#The username used for authentication reasons when accessing properties
configuration and Wizard servlets
servlet.username=perfsonaruser
#The password used for authentication reasons when accessing properties
configuration and Wizard servlets
Modified: trunk/ps-mdm-flowsub-mp/conf/wizard.properties
===================================================================
--- trunk/ps-mdm-flowsub-mp/conf/wizard.properties 2008-07-10 23:01:49
UTC (rev 4160)
+++ trunk/ps-mdm-flowsub-mp/conf/wizard.properties 2008-07-10 23:03:25
UTC (rev 4161)
@@ -101,8 +101,8 @@
<Comment>Activate authentication for this service?</Comment>
<ProposedValue>on</ProposedValue>
<Group order="1" check="true">Authentication</Group>
- <AcceptedValue>off</AcceptedValue>
- <AcceptedValue>on</AcceptedValue>
+ <AcceptedValue>on</AcceptedValue>
+ <AcceptedValue>off</AcceptedValue>
</property>
<property>
<entry
key="service.as.authn_for_msg_types">SubscriptionRequest,UnSubscriptionRequest,SubscriptionKeepaliveRequest</entry>
@@ -118,179 +118,179 @@
</property>
<property>
- <entry key="service.mp.flow.inPort">11110</entry>
+ <entry key="service.mp.flow.inPort" required="true">11110</entry>
<Comment>port (and up) that the zebedee client should receive data
at</Comment>
<ProposedValue>11110</ProposedValue>
<Group order="1">Subscriptions</Group>
</property>
<property>
- <entry key="service.mp.flow.betweenPort">22220</entry>
+ <entry key="service.mp.flow.betweenPort" required="true">22220</entry>
<Comment>port (and up) that the zebedee client should use for sending
data (and listen for reverse connection setup from server</Comment>
<ProposedValue>22220</ProposedValue>
<Group order="2">Subscriptions</Group>
</property>
<property>
- <entry key="service.mp.flow.max_conn">20</entry>
+ <entry key="service.mp.flow.max_conn" required="true">20</entry>
<Comment>maximum client netflow subscriptions</Comment>
<ProposedValue>20</ProposedValue>
<Group order="3">Subscriptions</Group>
</property>
<property>
- <entry key="service.mp.flow.zebedee">/usr/bin/zebedee</entry>
+ <entry key="service.mp.flow.zebedee"
required="true">/usr/bin/zebedee</entry>
<Comment>zebedee executable</Comment>
<ProposedValue>/usr/bin/zebedee</ProposedValue>
<Group order="1">Applications</Group>
</property>
<property>
- <entry key="service.mp.flow.nfdump">/usr/local/bin/nfdump</entry>
+ <entry key="service.mp.flow.nfdump"
required="true">/usr/local/bin/nfdump</entry>
<Comment>nfdump executable</Comment>
<ProposedValue>/usr/local/bin/nfdump</ProposedValue>
<Group order="2">Applications</Group>
</property>
<property>
- <entry key="service.mp.flow.nfcapd">/usr/local/bin/nfcapd</entry>
+ <entry key="service.mp.flow.nfcapd"
required="true">/usr/local/bin/nfcapd</entry>
<Comment>nfcapd executable</Comment>
<ProposedValue>/usr/local/bin/nfcapd</ProposedValue>
<Group order="3">Applications</Group>
</property>
<property>
- <entry key="service.mp.flow.nfreplay">/usr/local/bin/nfreplay</entry>
+ <entry key="service.mp.flow.nfreplay"
required="true">/usr/local/bin/nfreplay</entry>
<Comment>nfreplay executable</Comment>
<ProposedValue>/usr/local/bin/nfreplay</ProposedValue>
<Group order="4">Applications</Group>
</property>
<property>
- <entry key="service.mp.flow.router.0.enabled">true</entry>
+ <entry key="service.common.flow.router.0.enabled"
required="true">true</entry>
<Comment>Is this router enabled?</Comment>
<ProposedValue>true</ProposedValue>
<Group order="1" check="true">router1</Group>
+ <AcceptedValue>true</AcceptedValue>
<AcceptedValue>false</AcceptedValue>
- <AcceptedValue>true</AcceptedValue>
</property>
<property>
- <entry key="service.mp.flow.router.0.name">router1</entry>
+ <entry key="service.common.flow.router.0.name">router1</entry>
<Comment>name of the router</Comment>
<ProposedValue>router1</ProposedValue>
<Group order="2">router1</Group>
</property>
<property>
- <entry key="service.mp.flow.router.0.address">127.0.0.1</entry>
- <Comment>Address of the exporter</Comment>
+ <entry key="service.common.flow.router.0.address">127.0.0.1</entry>
+ <Comment>Address / hostname of the exporter</Comment>
<ProposedValue>127.0.0.1</ProposedValue>
<Group order="3">router1</Group>
</property>
<property>
- <entry key="service.mp.flow.router.0.flowport">6669</entry>
+ <entry key="service.common.flow.router.0.port">6669</entry>
<Comment>Portnumber</Comment>
<ProposedValue>6669</ProposedValue>
<Group order="4">router1</Group>
</property>
<property>
- <entry key="service.mp.flow.router.1.enabled">true</entry>
+ <entry key="service.common.flow.router.1.enabled"
required="true">true</entry>
<Comment>Is this router enabled?</Comment>
<ProposedValue>true</ProposedValue>
<Group order="1" check="true">router2</Group>
+ <AcceptedValue>true</AcceptedValue>
<AcceptedValue>false</AcceptedValue>
- <AcceptedValue>true</AcceptedValue>
</property>
<property>
- <entry key="service.mp.flow.router.1.name">router2</entry>
+ <entry key="service.common.flow.router.1.name">router2</entry>
<Comment>name of the router</Comment>
<ProposedValue>router2</ProposedValue>
<Group order="2">router2</Group>
</property>
<property>
- <entry key="service.mp.flow.router.1.address">127.0.0.1</entry>
- <Comment>Address of the exporter</Comment>
+ <entry key="service.common.flow.router.1.address">127.0.0.1</entry>
+ <Comment>Address / hostname of the exporter</Comment>
<ProposedValue>127.0.0.1</ProposedValue>
<Group order="3">router2</Group>
</property>
<property>
- <entry key="service.mp.flow.router.1.flowport">6669</entry>
+ <entry key="service.common.flow.router.1.port">6669</entry>
<Comment>Portnumber</Comment>
<ProposedValue>6669</ProposedValue>
<Group order="4">router2</Group>
</property>
<property>
- <entry key="service.mp.flow.router.2.enabled">true</entry>
+ <entry key="service.common.flow.router.2.enabled"
required="true">true</entry>
<Comment>Is this router enabled?</Comment>
<ProposedValue>true</ProposedValue>
<Group order="1" check="true">router3</Group>
+ <AcceptedValue>true</AcceptedValue>
<AcceptedValue>false</AcceptedValue>
- <AcceptedValue>true</AcceptedValue>
</property>
<property>
- <entry key="service.mp.flow.router.2.name">router3</entry>
+ <entry key="service.common.flow.router.2.name">router3</entry>
<Comment>name of the router</Comment>
<ProposedValue>router3</ProposedValue>
<Group order="2">router3</Group>
</property>
<property>
- <entry key="service.mp.flow.router.2.address">127.0.0.1</entry>
- <Comment>Address of the exporter</Comment>
+ <entry key="service.common.flow.router.2.address">127.0.0.1</entry>
+ <Comment>Address / hostname of the exporter</Comment>
<ProposedValue>127.0.0.1</ProposedValue>
<Group order="3">router3</Group>
</property>
<property>
- <entry key="service.mp.flow.router.2.flowport">6669</entry>
+ <entry key="service.common.flow.router.2.port">6669</entry>
<Comment>Portnumber</Comment>
<ProposedValue>6669</ProposedValue>
<Group order="4">router3</Group>
</property>
<property>
- <entry key="service.mp.flow.router.3.enabled">true</entry>
+ <entry key="service.common.flow.router.3.enabled"
required="true">true</entry>
<Comment>Is this router enabled?</Comment>
<ProposedValue>true</ProposedValue>
<Group order="1" check="true">router4</Group>
+ <AcceptedValue>true</AcceptedValue>
<AcceptedValue>false</AcceptedValue>
- <AcceptedValue>true</AcceptedValue>
</property>
<property>
- <entry key="service.mp.flow.router.3.name">router4</entry>
+ <entry key="service.common.flow.router.3.name">router4</entry>
<Comment>name of the router</Comment>
<ProposedValue>router4</ProposedValue>
<Group order="2">router4</Group>
</property>
<property>
- <entry key="service.mp.flow.router.3.address">127.0.0.1</entry>
- <Comment>Address of the exporter</Comment>
+ <entry key="service.common.flow.router.3.address">127.0.0.1</entry>
+ <Comment>Address / hostname of the exporter</Comment>
<ProposedValue>127.0.0.1</ProposedValue>
<Group order="3">router4</Group>
</property>
<property>
- <entry key="service.mp.flow.router.3.flowport">6669</entry>
+ <entry key="service.common.flow.router.3.port">6669</entry>
<Comment>Portnumber</Comment>
<ProposedValue>6669</ProposedValue>
<Group order="4">router4</Group>
</property>
<property>
- <entry key="service.mp.flow.router.4.enabled">true</entry>
+ <entry key="service.common.flow.router.4.enabled"
required="true">true</entry>
<Comment>Is this router enabled?</Comment>
<ProposedValue>true</ProposedValue>
<Group order="1" check="true">router5</Group>
+ <AcceptedValue>true</AcceptedValue>
<AcceptedValue>false</AcceptedValue>
- <AcceptedValue>true</AcceptedValue>
</property>
<property>
- <entry key="service.mp.flow.router.4.name">router5</entry>
+ <entry key="service.common.flow.router.4.name">router5</entry>
<Comment>name of the router</Comment>
<ProposedValue>router3</ProposedValue>
<Group order="2">router5</Group>
</property>
<property>
- <entry key="service.mp.flow.router.4.address">127.0.0.1</entry>
- <Comment>Address of the exporter</Comment>
+ <entry key="service.common.flow.router.4.address">127.0.0.1</entry>
+ <Comment>Address / hostname of the exporter</Comment>
<ProposedValue>127.0.0.1</ProposedValue>
<Group order="3">router5</Group>
</property>
<property>
- <entry key="service.mp.flow.router.4.flowport">6669</entry>
+ <entry key="service.common.flow.router.4.port">6669</entry>
<Comment>Portnumber</Comment>
<ProposedValue>6669</ProposedValue>
<Group order="4">router5</Group>
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/NfReplayControll.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/NfReplayControll.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/NfReplayControll.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -314,6 +314,8 @@
private final File nfcapTargetDirectory;
+ private final static String EXPORTER_FIRST_PART =
"service.common.flow.exporter.";
+
public NfReplayControll() {
try {
logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
@@ -342,10 +344,10 @@
}
private void initExportingRouter(int i) throws PerfSONARException {
- String enabled =
configuration.getProperty("service.mp.flow.router."+i+".enabled");
+ String enabled =
configuration.getProperty(EXPORTER_FIRST_PART+i+".enabled");
if(!enabled.equalsIgnoreCase("true")) return;
- String name =
configuration.getProperty("service.mp.flow.router."+i+".name");
- int port =
Integer.parseInt(configuration.getProperty("service.mp.flow.router."+i+".flowport"));
+ String name =
configuration.getProperty(EXPORTER_FIRST_PART+i+".name");
+ int port =
Integer.parseInt(configuration.getProperty(EXPORTER_FIRST_PART+i+".port"));
logger.debug("loaded Router(name="+name+")");
Exporter exporter = new Exporter(name, port);
exporters.execute(exporter);
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/AuthenticatorImpl.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/AuthenticatorImpl.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/AuthenticatorImpl.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -4,6 +4,10 @@
import perfSONARWebAdmin.auxiliary.Authenticator;
+/**
+ * Implementation based upon
{@link
ServiceConfig}
+ * @author michael.bischoff
+ */
public class AuthenticatorImpl implements Authenticator, Serializable {
private static final long serialVersionUID = 1L;
@@ -15,7 +19,7 @@
public boolean authenticate(String userName, String password) {
return
serviceConfig.getWizardUsername().equalsIgnoreCase(userName.trim())
- &&
serviceConfig.getWizardPassword().equals(password.trim());
+ &&
serviceConfig.getWizardPassword().equals(password.trim());
}
public void setPassword(String password) {
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/BasicServiceConfig.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/BasicServiceConfig.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/BasicServiceConfig.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -1,76 +1,119 @@
package org.perfsonar.service.measurementPoint.flowsubscription.wizard;
-import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
-import java.util.Properties;
+import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.UnavailableException;
-
-import perfSONARWebAdmin.auxiliary.wizard.ConfigurationHandler;
+import perfSONARWebAdmin.auxiliary.PerfsonarProperties;
+import perfSONARWebAdmin.auxiliary.PerfsonarPropertiesImpl;
+import perfSONARWebAdmin.auxiliary.PerfsonarProperty;
+import perfSONARWebAdmin.auxiliary.ServletProperties;
+import perfSONARWebAdmin.auxiliary.ServletPropertiesImpl;
import perfSONARWebAdmin.auxiliary.wizard.WizardProperties;
import perfSONARWebAdmin.auxiliary.wizard.WizardProperty;
public class BasicServiceConfig implements ServiceConfig {
- private static final long serialVersionUID = 1L;
+ private static final String SERVICE_LOG_LOG4J_CONFIG =
"service.log.log4j.config";
- /** The path to the conf folder */
- private static final String confPath =
"WEB-INF/classes/perfsonar/conf/";
+ private static final String SERVICE_SAX_PARSER_CONFIG =
"service.sax_parser.config";
+ private static final long serialVersionUID = 1L;
+
+ /** The path to the configuration directory */
+ public static final String CONFIGURATION_PATH =
"WEB-INF/classes/perfsonar/conf/";
+ /** The path to the service.properties file */
+ public static final String SERVICE_PROPERTIES_PATH =
CONFIGURATION_PATH + "service.properties";
+ /** The path to the logging properties file */
+ public static final String LOGGING_PROPERTIES_PATH =
CONFIGURATION_PATH + "log4j.properties";
+ /** The path to the componenets.properties file */
+ public static final String COMPONENTS_PROPERTIES_PATH =
CONFIGURATION_PATH + "components.properties";
+ /** The path to the objects properties file */
+ public static final String OBJECTS_DOT_CONFIG_PATH =
CONFIGURATION_PATH + "objects.config";
/** The path to the wizard.properties file */
- private static final String WizardPropertiesPath = confPath +
"wizard.properties";
-
+ public static final String WIZARD_PROPERTIES_PATH =
CONFIGURATION_PATH + "wizard.properties";
/** The path to the servlet.properties file */
- private static final String ServletPropertiesPath = confPath +
"servlet.properties";
-
+ public static final String SERVLET_PROPERTIES_PATH =
CONFIGURATION_PATH + "servlet.properties";
+
+ // TODO serialise.
/** Hashatable used for seperating the wizard properties into groups
*/
private final ConcurrentMap<String, WizardProperties>
serviceProperties = new ConcurrentHashMap<String, WizardProperties>();
/** The handler that will eventually handle the users input */
- private volatile ConfigurationHandler handler;
+ transient
+ private volatile Collection<ConfigurationHandler> handlerList;
+ transient
+ private Object lifecyleMutex = new Object();
+
private volatile String wizardPassword;
private volatile String wizardUsername;
- public ConfigurationHandler getHandler() {
- return handler;
+ private volatile long timeStamp;
+
+ private volatile String servicePath;
+
+ private volatile boolean loaded;
+
+
+
+ private BasicServiceConfig(String servicePath,
Collection<ConfigurationHandler> checkList, Map<String, WizardProperties>
properties, String wizardUsername, String wizardPassword, long nanoTime) {
+ this.handlerList = checkList;
+ this.serviceProperties.putAll(properties);
+ this.wizardUsername = wizardUsername;
+ this.wizardPassword = wizardPassword;
+ this.servicePath = servicePath;
+ this.loaded = true;
+ this.timeStamp = nanoTime;
}
+
+ public BasicServiceConfig() {
+ /* no arg constructor */
+ }
- public void load(ServletConfig config) throws Exception {
- ServletContext sc = config.getServletContext();
- String servicePath = sc.getRealPath("/");
-
+ public long getTimeStamp() {
+ return timeStamp;
+ }
+
+ public Collection<ConfigurationHandler> getHandlers() {
+ return handlerList;
+ }
+
+ public void load(String path, Collection<ConfigurationHandler>
checks) throws Exception {
+ this.servicePath = path;
+ this.handlerList = checks;
+ this.timeStamp = System.nanoTime();
+
// The WizardProperties to be configured
WizardProperties properties = new WizardProperties();
// Loading the wizard properties
- properties.loadFromXML(sc.getResourceAsStream("/"+
WizardPropertiesPath));
+ properties.loadFromXML(new FileInputStream(servicePath +
WIZARD_PROPERTIES_PATH));
// Preparing properties into groups
prepareProperties(properties);
- // Check to see if there is a configuration handler available
- String cl = checkForExternalHandler(servicePath);
- if (cl == null) {
- throw new UnavailableException("Error! No
configuration handler has been set in servlet.properties file!\n");
- }
+ ServletProperties servletProperties = new
ServletPropertiesImpl(servicePath + SERVLET_PROPERTIES_PATH);
+ wizardUsername = servletProperties.getUserName();
+ wizardPassword = servletProperties.getPassword();
- // if the developer has specified a configuration handler then
- // we dynamically load it
- Class<?> clas = Class.forName(cl, true,
Thread.currentThread().getContextClassLoader());
- handler = (ConfigurationHandler) clas.newInstance();
- //handler.init(config, serviceProperties);
+ loaded = true;
}
public void unload() {
- handler = null;
+ loaded = false;
+ timeStamp = -1;
+ wizardPassword = null;
+ wizardUsername = null;
+ servicePath = null;
+ handlerList = null;
serviceProperties.clear();
}
@@ -79,19 +122,31 @@
*
* @param loadedProperties
* The properties loaded from the configuration file
+ * @throws IOException
*/
- protected void prepareProperties(WizardProperties loadedProperties) {
+ protected void prepareProperties(WizardProperties loadedProperties)
throws IOException {
// Check to see if any property was actually loaded
if (loadedProperties.isEmpty()) {
return;
}
+
+ PerfsonarProperties serviceDotProperties = new
PerfsonarPropertiesImpl();
+ serviceDotProperties.loadProperties(new
FileInputStream(servicePath + SERVICE_PROPERTIES_PATH));
Iterator<?> it = loadedProperties.keySet().iterator();
// Iterating through the properties so that we can divide
them into groups
while (it.hasNext()) {
+
WizardProperty property =
loadedProperties.getWizardProperty((String) it.next());
+ PerfsonarProperty value =
serviceDotProperties.getProperty(property.getKey());
+
+ if(value!=null && value.getValue()!=null) {
+ property.setPropertyValue(value.getValue());
+ property.setProposedValue(value.getValue());
+ }
+
String group = property.getGroup();
// If the property group has not been set then it is
placed in a
@@ -100,43 +155,20 @@
group = "Other";
}
- WizardProperties properties =
serviceProperties.putIfAbsent(group, new WizardProperties());
- properties.putWizardProperty(property.getKey(),
property);
+ synchronized (serviceProperties) {
+ WizardProperties properties;
+ if(!serviceProperties.containsKey(group)) {
+ properties = new WizardProperties();
+ serviceProperties.put(group,
properties);
+ } else {
+ properties =
serviceProperties.get(group);
+ }
+
properties.putWizardProperty(property.getKey(), property);
+ }
}
}
- /**
- * Method for retrieving the name of a class implementing the
- * ConfigurationHandler interface. The name of the class should be
places
- * inside the servlet.properties file.
- * @param servicePath
- *
- * @return A String with the name of the class
- * @throws FileNotFoundException
- * @throws IOException
- */
- protected String checkForExternalHandler(String servicePath) throws
FileNotFoundException, IOException {
- FileInputStream in = null;
- Properties pr = null;
- try {
- in = new FileInputStream(new File(servicePath +
ServletPropertiesPath));
- pr = new Properties();
- pr.load(in);
- } finally {
- if (in != null)
- in.close();
- }
-
- String cl =
pr.getProperty("servlet.wizard.external_handler").trim();
-
- if (cl == null || cl.equals("")) {
- return null;
- }
-
- return cl;
- }
-
- public Map<String, WizardProperties> getServiceProperties() {
+ public ConcurrentMap<String, WizardProperties> getProperties() {
return serviceProperties;
}
@@ -154,6 +186,76 @@
public String getWizardUsername() {
return wizardUsername;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.perfsonar.service.measurementPoint.flowsubscription.wizard.ServiceConfig#persist()
+ */
+ public void persist() throws IOException {
+ synchronized (lifecyleMutex) {
+ if(!loaded) {
+ throw new IllegalStateException("please load
the object first");
+ }
+ PerfsonarProperties properties = new
PerfsonarPropertiesImpl();
+ properties.loadProperties(new
FileInputStream(servicePath + SERVICE_PROPERTIES_PATH));
+
+ for(Entry<String, WizardProperties> entry :
serviceProperties.entrySet()) {
+ WizardProperties group = entry.getValue();
+
+ for(Iterator<?> i = group.orderedKeys();
i.hasNext() ; ) {
+ String key = (String) i.next();
+ WizardProperty property =
group.getWizardProperty(key);
+ properties.setProperty(
+ key,
+ new PerfsonarProperty(
+
property.getKey(),
+
property.getValue(),
+
property.getPropertyComment(),
+
property.getGroup()
+ )
+ );
+ }
+ }
+
+ if(properties.getProperty(SERVICE_SAX_PARSER_CONFIG)
== null) {
+
properties.setProperty(SERVICE_SAX_PARSER_CONFIG, getSaxParserProperty());
+ }
+ if(properties.getProperty(SERVICE_LOG_LOG4J_CONFIG)
== null) {
+
properties.setProperty(SERVICE_LOG_LOG4J_CONFIG, getLog4jProperty());
+ }
+
+ ServletProperties servletProperties = new
ServletPropertiesImpl(servicePath + SERVLET_PROPERTIES_PATH);
+ servletProperties.setUserName(wizardUsername);
+ servletProperties.setPassword(wizardPassword);
+
+ properties.storeProperties(new
FileOutputStream(servicePath + SERVICE_PROPERTIES_PATH));
+ }
+ }
+
+ private PerfsonarProperty getSaxParserProperty() {
+ PerfsonarProperty property = new PerfsonarProperty();
+ property.setKey(SERVICE_SAX_PARSER_CONFIG);
+ property.setValue(servicePath + OBJECTS_DOT_CONFIG_PATH);
+ property.setGroup("Internals");
+ property.setDescription("Sax parser configuration paramater");
+ return property;
}
+ private PerfsonarProperty getLog4jProperty() {
+ PerfsonarProperty property = new PerfsonarProperty();
+ property.setKey(SERVICE_LOG_LOG4J_CONFIG);
+ property.setValue(servicePath + LOGGING_PROPERTIES_PATH);
+ property.setGroup("Internals");
+ property.setDescription("Logging Properties path");
+ return property;
+ }
+
+ public ServiceConfig copy() {
+ return new BasicServiceConfig(servicePath, new
ArrayList<ConfigurationHandler>(handlerList), serviceProperties,
wizardUsername, wizardPassword, System.nanoTime());
+ }
+
+ @SuppressWarnings("unused")
+ private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
+ lifecyleMutex = new Object();
+ }
}
Added:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ConfigurationHandler.java
Deleted:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/FlowSubscriptionMpConfig.java
Added:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ImmutableServiceConfig.java
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ServiceConfig.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ServiceConfig.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/ServiceConfig.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -1,14 +1,19 @@
package org.perfsonar.service.measurementPoint.flowsubscription.wizard;
+import java.io.IOException;
import java.io.Serializable;
-import java.util.Map;
+import java.util.Collection;
+import java.util.concurrent.ConcurrentMap;
-import javax.servlet.ServletConfig;
-
-import perfSONARWebAdmin.auxiliary.wizard.ConfigurationHandler;
import perfSONARWebAdmin.auxiliary.wizard.WizardProperties;
-
+/**
+ * Class should provide limited thread safety it's designed to be bound to
the
+ * httpsession.
+ *
+ * @author michael.bischoff
+ *
+ */
public interface ServiceConfig extends Serializable {
void setWizardUsername(String userName);
@@ -19,12 +24,23 @@
String getWizardPassword();
- void load(ServletConfig config) throws Exception;
+ void load(String path, Collection<ConfigurationHandler> checks)
throws Exception;
void unload();
- ConfigurationHandler getHandler();
+ /**
+ * Creates a copy of this config the time stamp of the
+ * returning config will be set to now and the state of
+ * the copy will be 'loaded'
+ * @return config
+ */
+ ServiceConfig copy();
+
+ void persist() throws IOException;
+
+ Collection<ConfigurationHandler> getHandlers();
- Map<String, WizardProperties> getServiceProperties();
+ ConcurrentMap<String, WizardProperties> getProperties();
+ public long getTimeStamp();
}
Added:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/SimpleHandler.java
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/Wizard.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/Wizard.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/Wizard.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -1,8 +1,18 @@
package org.perfsonar.service.measurementPoint.flowsubscription.wizard;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentMap;
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServlet;
@@ -12,6 +22,8 @@
import org.apache.commons.codec.binary.Base64;
import perfSONARWebAdmin.auxiliary.Authenticator;
+import perfSONARWebAdmin.auxiliary.wizard.WizardProperties;
+import perfSONARWebAdmin.auxiliary.wizard.WizardProperty;
/**
* Servlet to be used as a wizard for configuration of a perfSONAR service
@@ -23,16 +35,25 @@
@SuppressWarnings("serial")
public class Wizard extends HttpServlet {
- private final ServiceConfig serviceConfig;
+ /** The path to the configuration directory */
+ public static final String CONFIGURATION_PATH =
"WEB-INF/classes/perfsonar/conf/";
+ /** The path to the servlet.properties file */
+ private static final String SERVLET_PROPERTIES_PATH =
CONFIGURATION_PATH + "servlet.properties";
+
+ private final ImmutableServiceConfig serviceConfig;
- private final Authenticator authenticator;
-
+ private volatile Authenticator authenticator;
+
+ private volatile String configPath;
+
+ private Object configurationMutex = new Object();
+
public Wizard() {
this(new BasicServiceConfig());
}
public Wizard(ServiceConfig serviceConfig) {
- this.serviceConfig = serviceConfig;
+ this.serviceConfig = new
ImmutableServiceConfig(serviceConfig);
authenticator = new AuthenticatorImpl(serviceConfig);
}
@@ -44,16 +65,27 @@
super.init(config);
try {
- serviceConfig.load(config);
+ ServletContext sc = config.getServletContext();
+ configPath = sc.getRealPath("/");
+
+ // Check to see if there is a configuration handler
available
+ String cl = checkForExternalHandler(configPath);
+ if (cl == null) {
+ throw new UnavailableException("Error! No
configuration handler has been set in servlet.properties file!\n");
+ }
+
+ List<ConfigurationHandler> handlers = new
ArrayList<ConfigurationHandler>();
+ String[] classes = cl.split(",");
+ for(String classz : classes) {
+ Class<?> handlerClass = Class.forName(classz,
true, Thread.currentThread().getContextClassLoader());
+ ConfigurationHandler handler =
(ConfigurationHandler) handlerClass.newInstance();
+ handlers.add(handler);
+ }
+ serviceConfig.reLoad(configPath, handlers);
} catch (Exception e) {
- throw new UnavailableException("Error initialising
servlet! " + e.getMessage() );
+ throw new UnavailableException("Error initialising
servlet! " + e.getClass() + " " + e.getLocalizedMessage() );
}
}
-
- @Override
- public void destroy() {
- serviceConfig.unload();
- }
/* (non-Javadoc)
* @see
javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
@@ -83,11 +115,17 @@
}
private void handleWizzardRequest(WizzardRequest request,
WizzardResponse response) throws IOException {
+ ServiceConfig sessionData = request.getLocalConfigCopy();
+ if(sessionData==null) {
+ sessionData = serviceConfig.copy();
+ request.setLocalConfigCopy(sessionData);
+ }
+
// If there are no parameters in the request this means, that
// the user is request the first page of the servlet
// So we will show him all properties!!!
if (request.getParameterMap().isEmpty()) {
-
response.showAllProperties(serviceConfig.getServiceProperties(), "Please fill
in all fields. Mandatory fields are marked with an asterisk.");
+
response.showAllProperties(sessionData.getProperties(), "Please fill in all
fields. Mandatory fields are marked with an asterisk.");
return;
}
@@ -95,23 +133,56 @@
// We are accessing the function parameter. If its equal to
// finish then we have the right input
if (request.isFinishingWizzard()) {
- boolean success = false;
-
+ update(sessionData, request);
+
+ ConfigurationHandler.Result result = new
ConfigurationHandler.Result();
+
try {
- success =
serviceConfig.getHandler().handleRequest(request);
+ for(ConfigurationHandler handler :
sessionData.getHandlers()) {
+ handler.process(request,result);
+ }
} catch (Exception e) {
response.showErrorPage("Problem occured while
finishing the configuration process! <a href=\"Wizard\">back</a> \n" , e);
}
- if (success) {
+ if(result.success()) {
+ try {
+ synchronized (configurationMutex) {
+ if(sessionData.getTimeStamp()
> serviceConfig.getTimeStamp()) {
+ sessionData.persist();
+
serviceConfig.reLoad(configPath, null);
+
request.getSession().invalidate(); // 'Our' session ended
+ } else {
+
response.showInfoPage("Optimisic locking failed, this means the configuration
was changed by someone else, there is currently no support for merging. go <a
href=\"Wizard\">back</a> and try again. \n");
+ }
+ }
+ } catch (Exception e) {
+ response.showErrorPage("Problem
occured while finishing the configuration process! <a
href=\"Wizard\">back</a> \n" , e);
+ }
+ }
+
+ if (result.success()) {
response.showInfoPage("You have succesfully
configured the service!You can restart tomcat for the changes to take
effect.\n Or go <a href=\"Wizard\">Back</a>");
} else {
response.showInfoPage("There was a problem
finishing the configuration! Please check your input again.\n <a
href=\"Wizard\">Back</a>");
}
}
}
+
+ protected void update(ServiceConfig sessionData, WizzardRequest
request) {
+ ConcurrentMap<String, WizardProperties> properties =
sessionData.getProperties();
+ for(Map.Entry<String, WizardProperties> groupEntry :
properties.entrySet()) {
+ WizardProperties groupProperties =
groupEntry.getValue();
+ for(Iterator<?> i = groupProperties.orderedKeys();
i.hasNext() ; ) {
+ String key = (String) i.next();
+ String value =
request.getParameter(key).trim();
+ WizardProperty pr =
groupProperties.getWizardProperty(key);
+ pr.setPropertyValue(value);
+ }
+ }
+ }
- private void authenticate(WizzardRequest request, WizzardResponse
response) throws IOException {
+ protected void authenticate(WizzardRequest request, WizzardResponse
response) throws IOException {
// If the "authenticated" parameter has not been set then we
ask for
// a username and password
String authorization = request.getHeader("Authorization");
@@ -141,12 +212,49 @@
if (!authenticator.authenticate(user, password)) {
response.askForPassword();
request.getSession().invalidate();
+ return;
}
+ ServiceConfig sessionData = request.getLocalConfigCopy();
+ if(sessionData==null) {
+ sessionData = serviceConfig.copy();
+ request.setLocalConfigCopy(sessionData);
+ }
+
// Authentication was successful we show the user all
// properties to be configured
request.setAuthenticated(true);
-
response.showAllProperties(serviceConfig.getServiceProperties(), "Please fill
in all fields. Mandatory fileds are marked with an asterisk.");
+ response.showAllProperties(sessionData.getProperties(),
"Please fill in all fields. Mandatory fileds are marked with an asterisk.");
}
+ /**
+ * Method for retrieving the name of a class implementing the
+ * ConfigurationHandler interface. The name of the class should be
places
+ * inside the servlet.properties file.
+ * @param path
+ *
+ * @return A String with the name of the class
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ protected String checkForExternalHandler(String path) throws
FileNotFoundException, IOException {
+ FileInputStream in = null;
+ Properties pr = null;
+ try {
+ in = new FileInputStream(new File(path +
SERVLET_PROPERTIES_PATH));
+ pr = new Properties();
+ pr.load(in);
+ } finally {
+ if (in != null)
+ in.close();
+ }
+
+ String cl = pr.getProperty("servlet.wizard.configHandlers");
+
+ if (cl == null || cl.trim().equals("")) {
+ return null;
+ }
+
+ return cl;
+ }
}
Deleted:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizardHandler.java
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardRequest.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardRequest.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardRequest.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -1,25 +1,17 @@
package org.perfsonar.service.measurementPoint.flowsubscription.wizard;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.security.Principal;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpSession;
-public class WizzardRequest implements HttpServletRequest {
+public class WizzardRequest extends HttpServletRequestWrapper {
+ private static final String SESSIN_LOCAL_USERCONFIG_KEY =
"org.perfsonar.service.measurementPoint.flowsubscription.wizard.WizzardRequest.LOCAL_USERCONFIG";
private final HttpSession session;
private final HttpServletRequest request;
public WizzardRequest(HttpServletRequest request) {
+ super(request);
this.request = request;
this.session = request.getSession(true);
if (session.isNew()) session.setMaxInactiveInterval(3600);
@@ -49,208 +41,12 @@
public void setAuthenticated(boolean authenticated) {
session.setAttribute("authenticated", authenticated ?
Boolean.TRUE : Boolean.FALSE);
}
-
- // ---- delecacates --
- public Object getAttribute(String name) {
- return request.getAttribute(name);
- }
- public Enumeration<?> getAttributeNames() {
- return request.getAttributeNames();
+ public ServiceConfig getLocalConfigCopy() {
+ return (ServiceConfig)
session.getAttribute(SESSIN_LOCAL_USERCONFIG_KEY);
}
-
- public String getAuthType() {
- return request.getAuthType();
+
+ public void setLocalConfigCopy(ServiceConfig config) {
+ session.setAttribute(SESSIN_LOCAL_USERCONFIG_KEY, config);
}
-
- public String getCharacterEncoding() {
- return request.getCharacterEncoding();
- }
-
- public int getContentLength() {
- return request.getContentLength();
- }
-
- public String getContentType() {
- return request.getContentType();
- }
-
- public String getContextPath() {
- return request.getContextPath();
- }
-
- public Cookie[] getCookies() {
- return request.getCookies();
- }
-
- public long getDateHeader(String name) {
- return request.getDateHeader(name);
- }
-
- public String getHeader(String name) {
- return request.getHeader(name);
- }
-
- public Enumeration getHeaderNames() {
- return request.getHeaderNames();
- }
-
- public Enumeration getHeaders(String name) {
- return request.getHeaders(name);
- }
-
- public ServletInputStream getInputStream() throws IOException {
- return request.getInputStream();
- }
-
- public int getIntHeader(String name) {
- return request.getIntHeader(name);
- }
-
- public Locale getLocale() {
- return request.getLocale();
- }
-
- public Enumeration getLocales() {
- return request.getLocales();
- }
-
- public String getMethod() {
- return request.getMethod();
- }
-
- public String getParameter(String name) {
- return request.getParameter(name);
- }
-
- public Map getParameterMap() {
- return request.getParameterMap();
- }
-
- public Enumeration getParameterNames() {
- return request.getParameterNames();
- }
-
- public String[] getParameterValues(String name) {
- return request.getParameterValues(name);
- }
-
- public String getPathInfo() {
- return request.getPathInfo();
- }
-
- public String getPathTranslated() {
- return request.getPathTranslated();
- }
-
- public String getProtocol() {
- return request.getProtocol();
- }
-
- public String getQueryString() {
- return request.getQueryString();
- }
-
- public BufferedReader getReader() throws IOException {
- return request.getReader();
- }
-
- public String getRemoteAddr() {
- return request.getRemoteAddr();
- }
-
- public String getRemoteHost() {
- return request.getRemoteHost();
- }
-
- public String getRemoteUser() {
- return request.getRemoteUser();
- }
-
- public RequestDispatcher getRequestDispatcher(String path) {
- return request.getRequestDispatcher(path);
- }
-
- public String getRequestedSessionId() {
- return request.getRequestedSessionId();
- }
-
- public String getRequestURI() {
- return request.getRequestURI();
- }
-
- public StringBuffer getRequestURL() {
- return request.getRequestURL();
- }
-
- public String getScheme() {
- return request.getScheme();
- }
-
- public String getServerName() {
- return request.getServerName();
- }
-
- public int getServerPort() {
- return request.getServerPort();
- }
-
- public String getServletPath() {
- return request.getServletPath();
- }
-
- public HttpSession getSession() {
- return request.getSession();
- }
-
- public HttpSession getSession(boolean create) {
- return request.getSession(create);
- }
-
- public Principal getUserPrincipal() {
- return request.getUserPrincipal();
- }
-
- public boolean isRequestedSessionIdFromCookie() {
- return request.isRequestedSessionIdFromCookie();
- }
-
- public boolean isRequestedSessionIdFromURL() {
- return request.isRequestedSessionIdFromURL();
- }
-
- public boolean isRequestedSessionIdValid() {
- return request.isRequestedSessionIdValid();
- }
-
- public boolean isSecure() {
- return request.isSecure();
- }
-
- public boolean isUserInRole(String role) {
- return request.isUserInRole(role);
- }
-
- public void removeAttribute(String name) {
- request.removeAttribute(name);
- }
-
- public void setAttribute(String name, Object o) {
- request.setAttribute(name, o);
- }
-
- public void setCharacterEncoding(String arg0)
- throws UnsupportedEncodingException {
- request.setCharacterEncoding(arg0);
- }
-
- public boolean isRequestedSessionIdFromUrl() {
- return request.isRequestedSessionIdFromURL();
- }
-
- public String getRealPath(String path) {
- throw new AssertionError("getRealPath is deprecated and
shouldn't be used anymore.");
- }
-
-
}
Modified:
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardResponse.java
===================================================================
---
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardResponse.java
2008-07-10 23:01:49 UTC (rev 4160)
+++
trunk/ps-mdm-flowsub-mp/src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard/WizzardResponse.java
2008-07-10 23:03:25 UTC (rev 4161)
@@ -9,15 +9,17 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
import perfSONARWebAdmin.auxiliary.wizard.WizardProperties;
import perfSONARWebAdmin.auxiliary.wizard.WizardProperty;
-public class WizzardResponse {
+public class WizzardResponse extends HttpServletResponseWrapper {
private HttpServletResponse response;
public WizzardResponse(HttpServletResponse response) {
+ super(response);
this.response = response;
this.response.setContentType("text/html");
}
@@ -37,7 +39,6 @@
showErrorPage(message, null);
}
-
public void showErrorPage(String message, Exception e) throws
IOException {
ServletOutputStream out = response.getOutputStream();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
@@ -56,13 +57,13 @@
out.println("<p class=\"info_wizard\" >" + message +
"</p>");
}
if(e != null) {
- out.println("<div id=\"closedStacktrace\"
onclick=\"document.getElementById('closedStacktrace').style.display =
\"hidden\"; " +
-
"document.getElementById(\'openStacktrace\').style.display=\"block\";\">");
- out.println("<span style=\"float:right\"
>[+]</span>");
- out.println("<div>");
- out.println("<div id=\"openStacktrace\"
onclick=\"document.getElementById('closedStacktrace').style.display =
\"block\"; " +
-
"document.getElementById(\'openStacktrace\').style.display=\"hidden\";\">");
- out.println("<span style=\"float:right\"
>[-]</span>");
+ out.println("<div id=\"closedStacktrace\"
onclick=\"document.getElementById('closedStacktrace').style.display = 'none';
" +
+
"document.getElementById(\'openStacktrace\').style.display = 'block';\">");
+ out.println("<span style=\"float:right;\"
>[+]</span>");
+ out.println("</div>");
+ out.println("<div id=\"openStacktrace\"
style=\"display:none;\"
onclick=\"document.getElementById('closedStacktrace').style.display =
'block'; " +
+
"document.getElementById(\'openStacktrace\').style.display= 'none';\">");
+ out.println("<span style=\"float:right;\"
>[-]</span>");
out.println("<pre>");
out.println(getFault(e));
out.println("</pre>");
@@ -76,7 +77,6 @@
out.close();
}
-
public void showAllProperties(Map<String, WizardProperties>
properties, String message) throws IOException {
List<String> groupnames = new
ArrayList<String>(properties.keySet());
Collections.sort(groupnames);
@@ -97,65 +97,17 @@
out.println("<div id=\"properties\" class=\"properties\">");
out.println("<form action=\"Wizard\" method=\"GET\"> ");
out.println("<input type=\"hidden\" name=\"function\"
value=\"finish\" >");
+ out.println("<table align=\"center\" style=\"width:100%;\">");
+
+ if(groupIt.hasNext()) {
+ showGroup(groupIt.next(), properties, "");
+ }
+
while (groupIt.hasNext()) {
- String group = groupIt.next();
- out.println("<p class=\"groupheading\">" + group + "
Configuration:</p>");
- WizardProperties pro = properties.get(group);
- Iterator<?> it = pro.orderedKeys();
- WizardProperty pr = pro.getWizardProperty((String)
it.next());
- String onClick;
- if (pr.getCheck() || group.equals("LS")) {
- out.println("<table align=\"center\">");
- onClick = " onclick=\"checkIt(this);\"";
- if (group.equals("LS")) {
- it = pro.orderedKeys();
- out.println("<input type=\"hidden\"
value=\"yes\" id=\"Vl_useLS\" />");
- } else {
- out.println("<input type=\"hidden\"
value=\""+ pr.getProposedValue() + "\" id=\"Vl_"+ pr.getKey() + "\" />");
- }
- } else {
- onClick = "";
- }
-
- String id = "";
- if (group.equals("LS") || pr.getCheck()) {
- if (group.equals("LS")) {
- out.println("<tr><td>Do you wish to
register with an LS?</td><td>");
- out.println("<input type=\"radio\"
name=\"useLS\" value=\"yes\" "+ onClick + "></input>");
- out.println("<input type=\"radio\"
checked name=\"useLS\" value=\"no\" "+ onClick + "></input></td><td>");
- } else if(pr.getCheck()){
- out.println("<tr><td>" +
pr.getPropertyComment()+ "</td><td>");
- String[] values =
pr.getAcceptedValues();
- if (values != null) {
- for (int i = 0; i <
values.length; i++) {
- String checked =
!values[i].equals(pr.getProposedValue()) ? "checked=\"checked\"" : "";
- out.println("<input
type=\"radio\"" + checked + " name=\"" + pr.getKey() + "\" value=\"" +
values[i] + "\" " + onClick + ">"+ values[i] + "</input></td><td>");
- }
- }
- }
- out.println("</td></tr>");
- out.println("</table>");
-
- id = pr.getKey();
- if (group.equals("LS")) {
- id = "useLS";
- }
- out.println("<div id=\"" + id + "\"
style=\"display:none;\">");
- out.println("<table align=\"center\">");
- } else {
- out.println("<div style=\"display:block;\">");
- out.println("<table align=\"center\">");
- showProperty(pr);
- }
-
- while (it.hasNext()) {
- pr = pro.getWizardProperty((String)
it.next());
- showProperty(pr);
- }
-
- out.println("</table>");
- out.println("</div>");
+ showGroup(groupIt.next(), properties, "border-top:
thin dotted rgb(70, 140, 70);");
}
+
+ out.println("</table>");
out.println("<input align=\"right\" input id=\"Button\"
class=\"submit_button\" type=\"submit\" name=\"Submit\" value=\"Submit
Changes\" />");
out.println("</form> ");
out.println("</div>");
@@ -165,22 +117,91 @@
out.close();
}
+ private void showGroup(String group, Map<String, WizardProperties>
properties, String style) throws IOException {
+ ServletOutputStream out = response.getOutputStream();
+ out.println("<tr><td colspan=\"3\" style=\"padding-left:0;
"+style+"\"><span class=\"groupheading\">" + group + "
Configuration:</span></td></tr>");
+
+ WizardProperties pro = properties.get(group);
+ Iterator<?> it = pro.orderedKeys();
+
+ WizardProperty pr = pro.getWizardProperty((String) it.next());
+
+ if (group.equals("LS") || pr.getCheck()) {
+ String onClick = "
onclick=\"showGroup(this,'"+group+"');\"";
+
+ if (group.equals("LS")) {
+ out.println("<tr>");
+ out.println("<td><input type=\"hidden\"
value=\"yes\" id=\"Vl_useLS\" /> Do you wish to register with an LS?</td>");
+ out.print("<td>");
+ out.print("<input type=\"radio\"
name=\"useLS\" value=\"yes\" "+ onClick + "> yes </input>");
+ out.print("<input type=\"radio\" checked
name=\"useLS\" value=\"no\" "+ onClick + "> no </input> ");
+ out.print("</td>");
+ out.println("</tr>");
+ it = pro.orderedKeys();
+ } else if(pr.getCheck()) {
+ out.println("<tr>");
+ String[] values = pr.getAcceptedValues();
+ if(values.length == 2) {
+ out.println("<tr>");
+ out.println("<td><input
type=\"hidden\" value=\""+ values[0] + "\" id=\"Vl_"+ pr.getKey() + "\" />" +
pr.getPropertyComment()+ "</td>");
+
+ if(values[0].equals(pr.getKey())) {
+ out.print("<td>");
+ out.println("<input
type=\"radio\" checked name=\"" + pr.getKey() + "\" value=\"" + values[0] +
"\" " + onClick + "/> "+ values[0] + " </input> ");
+ out.println("<input
type=\"radio\" name=\"" + pr.getKey() + "\" value=\"" + values[1] + "\" " +
onClick + "/> "+ values[1] + " </input> ");
+ out.print("</td>");
+ } else {
+ out.print("<td>");
+ out.println("<input
type=\"radio\" name=\"" + pr.getKey() + "\" value=\"" + values[0] + "\" " +
onClick + "/> "+ values[0] + " </input> ");
+ out.println("<input
type=\"radio\" checked name=\"" + pr.getKey() + "\" value=\"" + values[1] +
"\" " + onClick + "/> "+ values[1] + " </input> ");
+ out.print("</td>");
+ }
+ }
+ out.println("</tr>");
+ }
+
+ int i = 0;
+ while (it.hasNext()) {
+ pr = pro.getWizardProperty((String)
it.next());
+ showProperty(pr, pr.getGroup() + i++);
+ }
+
+ } else {
+ showProperty(pr, null);
+ while (it.hasNext()) {
+ pr = pro.getWizardProperty((String)
it.next());
+ showProperty(pr, null);
+ }
+ }
+
+
+
+ }
+
/**
* Method for getting the java script used by the showAllPrperties
Method
*
* @return The javascript
*/
- private String getScript() {
+ protected String getScript() {
String script = "<script src=\"Service_Admin.js\">"
+ "</script>\n"
+ "<script src=\"wz_tooltip.js\">"
+ "</script>\n"
+ "<script type=\"text/javascript\">\n"
- + "function checkIt(el) {\n"
- + " if (el.value
==document.getElementById(\"Vl_\"+el.name).value) {\n"
- + "
document.getElementById(el.name).style.display = \"block\";\n"
+ + "function showGroup(el,groupname) {\n"
+ + " if (el.value ==
document.getElementById(\"Vl_\"+el.name).value) {\n"
+ + " for (i=0;i<=25;i=i+1) { \n"
+ + " element =
document.getElementById(groupname + i); \n"
+ + " if(element == null)
break; \n"
+ + " element.style.display
= \"table-row\"; \n"
+ + " } \n"
+ " } else {\n"
- + "
document.getElementById(el.name).style.display = \"none\";\n"
+ + " for (i=0;i<=25;i=i+1) { \n"
+ + " element =
document.getElementById(groupname + i); \n"
+ + " if(element == null)
break; \n"
+ + " element.style.display
= \"none\"; \n"
+ + " } \n"
+ " }\n"
+ "}\n"
+ "</script>\n";
@@ -194,27 +215,39 @@
* The wizard property
* @throws IOException
*/
- private void showProperty(WizardProperty pr) throws IOException {
+ protected void showProperty(WizardProperty pr, String id) throws
IOException {
String fill = pr.isRequired() ? "*" : " ";
ServletOutputStream out = response.getOutputStream();
- out.println("<tr><td>" + pr.getPropertyComment()+"<span
class=\"greenasterisk\" >"+fill+"</span></td><td>");
+
+ if(id==null) {
+ out.println("<tr>");
+ } else {
+ out.println("<tr id="+id+" style=\"display:none;\">");
+ }
+
+ out.println("<td>" + pr.getPropertyComment()+"<span
class=\"greenasterisk\" >"+fill+"</span></td>");
String[] values = pr.getAcceptedValues();
if (values != null) {
+ out.print("<td>");
for (int i = 0; i < values.length; i++) {
String checked =
values[i].equals(pr.getProposedValue()) ? "checked=\"checked\"" : "";
- out.println("<input type=\"radio\"" + checked
+ " name=\""+ pr.getKey() + "\" value=\"" + values[i] + "\">"+ values[i] +
"</input>");
+ out.println("<input type=\"radio\" " +
checked + " name=\""+ pr.getKey() + "\" value=\"" + values[i] + "\">"+
values[i] + "</input>");
}
+ out.print("</td>");
} else {
String type = "text";
- String value=pr.getProposedValue();
+ String value= pr.getValue();
+ if(value==null || value.trim().equals("")) {
+ value = pr.getProposedValue();
+ }
if (pr.isPassword()) {
type = "password";
value="";
}
- out.println("<input class=\"input_style\"
onmouseover=\"setTip(null,'" +value + "','#D5E9D4')\" type=\"" + type + "\"
name=\"" + pr.getKey() + "\" size=40 value=\"" + value+ " \"/>");
+ out.println("<td><input class=\"input_style\"
onmouseover=\"setTip(null,'" +value + "','#D5E9D4')\" type=\"" + type + "\"
name=\"" + pr.getKey() + "\" size=40 value=\"" + value+ " \"/></td>");
}
- out.println("</td></tr>");
+ out.println("</tr>");
}
@@ -226,7 +259,9 @@
*/
protected String getFault(Exception e) {
StackTraceElement[] trace = e.getStackTrace();
- StringBuilder builder = new StringBuilder(e.getMessage());
+
+ StringBuilder builder = new StringBuilder(e.getClass() + " "
+ e.getLocalizedMessage());
+ builder.append("\n");
for (int j = 0; j < trace.length; j++) {
builder.append(trace[j].toString());
builder.append("\n");
- perfsonar: r4161 - in trunk/ps-mdm-flowsub-mp: conf conf/axis-1.4/WEB-INF src/main/java/org/perfsonar/service/measurementPoint/flowsubscription src/main/java/org/perfsonar/service/measurementPoint/flowsubscription/wizard, svnlog, 07/10/2008
Archive powered by MHonArc 2.6.16.