perfsonar-dev - perfsonar: r3923 - trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType
Subject: perfsonar development work
List archive
perfsonar: r3923 - trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3923 - trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType
- Date: Fri, 30 May 2008 10:29:09 -0400
Author: mac
Date: 2008-05-30 10:29:09 -0400 (Fri, 30 May 2008)
New Revision: 3923
Modified:
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSAction.java
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
Log:
gLS - checking eventTypes
Modified:
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSAction.java
===================================================================
---
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSAction.java
2008-05-30 14:09:40 UTC (rev 3922)
+++
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSAction.java
2008-05-30 14:29:09 UTC (rev 3923)
@@ -55,6 +55,8 @@
protected ConfigurationComponent configuration;
+ protected boolean gls = false;
+
// ------------------------------------------------------------
Constructor
@@ -68,6 +70,23 @@
configuration = (ConfigurationComponent)AuxiliaryComponentManager.
getInstance().getComponent(ComponentNames.CONFIG);
+ //get service.ls.gls parameter from config
+ try {
+ String glsStr = configuration.getProperty("service.ls.gls");
+ if ("yes".equalsIgnoreCase(glsStr)||
+ "on".equalsIgnoreCase(glsStr)||
+ "true".equalsIgnoreCase(glsStr)) {
+ setGLS(true);
+ } else
+ setGLS(false);
+
+ } catch (Exception ex) {
+ setGLS(false);
+ }
+
+ if (gls) logger.info("Service works as Global-LS");
+ else logger.info("Service works as Home-LS");
+
}
@@ -261,6 +280,17 @@
}
} //ResultCode
+
+
+ public boolean isGLS() {
+
+ return gls;
+ }
+
+ public void setGLS(boolean g) {
+
+ gls = g;
+ }
} //LSAction
Modified:
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
===================================================================
---
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
2008-05-30 14:09:40 UTC (rev 3922)
+++
trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType/LSRegisterAction.java
2008-05-30 14:29:09 UTC (rev 3923)
@@ -7,6 +7,7 @@
import org.ggf.ns.nmwg.base.v2_0.Message;
import org.ggf.ns.nmwg.base.v2_0.Metadata;
import org.perfsonar.base.exceptions.PerfSONARException;
+import
org.perfsonar.client.base.requests.lookupService.LSRegisterRequestGenerator;
import org.perfsonar.service.lookupService.xmlType.storage.LookupServiceDAO;
@@ -22,6 +23,9 @@
// --------------------------------------------------------------
Constants
private final static boolean DEFAULT_ALLOW_REPLACE = true;
+
+ public final static String SERVICE_EVENT_TYPE =
LSRegisterRequestGenerator.SERVICE_EVENT_TYPE;
+ public final static String SUMMARY_EVENT_TYPE =
LSRegisterRequestGenerator.SUMMARY_EVENT_TYPE;
// ----------------------------------------------------- Instance
variables
@@ -66,7 +70,45 @@
logger.error(m);
throw new PerfSONARException("error.ls.no_metadata", m);
}
+
+ // ----------------------------------------- BEGIN OF GLS code
+
+ String reqEventType = null;
+ //check eventType
+ try {
+ reqEventType = requestMetadata.getEventType().getEventType();
+ logger.debug("[LS Registration] service event type is
["+reqEventType+"]");
+ } catch (Exception ex) {
+ }
+
+ //if no eventType and home LS -- use Service evt.
+ //for backward compatibility
+ if ((!isGLS()) && (reqEventType == null)) {
+ reqEventType = SERVICE_EVENT_TYPE;
+ }
+ //check GLS
+ if ((SERVICE_EVENT_TYPE.equals(reqEventType) && !isGLS())||
+ (SUMMARY_EVENT_TYPE.equals(reqEventType) && isGLS())) {
+
+ //OK - no action
+ logger.debug("[LS Registration] eventType accepted
["+reqEventType+"]");
+
+ } else {
+ String m = "[LS Registration] no service event type or wrong
eventType! Service is "+
+ ((isGLS()) ?
+ "[global-LS] and accepts ["+SUMMARY_EVENT_TYPE+"]" :
+ "[home-LS] and accepts ["+SERVICE_EVENT_TYPE+"]");
+ logger.error(m);
+ throw new PerfSONARException("error.ls.wrong_eventtype",m);
+ }
+
+ //reset event type - will not be used anymore
+
+ requestMetadata.setEventType(null);
+
+ // ----------------------------------------- END OF GLS code
+
//get accessPoint from Metadata - obligatory element
//if it's empty or null PerfSONARException will be thrown
String accessPoint = getAccessPoint(requestMetadata);
- perfsonar: r3923 - trunk/geant2_java-xml-ls/src/main/java/org/perfsonar/service/lookupService/xmlType, svnlog, 05/30/2008
Archive powered by MHonArc 2.6.16.