perfsonar-dev - perfsonar: r3762 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register
Subject: perfsonar development work
List archive
perfsonar: r3762 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register
Chronological Thread
- From:
- To:
- Subject: perfsonar: r3762 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register
- Date: Tue, 22 Apr 2008 06:07:20 -0400
Author: roman
Date: 2008-04-22 06:07:20 -0400 (Tue, 22 Apr 2008)
New Revision: 3762
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
Log:
When a service sends first LS register request (right after
installation/configuration procedure or during because it might not be
finished) to LS
the xml database may not be prepared yet to provide metadatas to populate
that request. In such situation registration fails (next requests should be
fine because the xml db will be ready). The bug
fixed. Now the first request is made using metadatat config file (next
requests are populated with data from xml db).
Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
2008-04-22 09:36:55 UTC (rev 3761)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register/LSRegistrationComponent.java
2008-04-22 10:07:20 UTC (rev 3762)
@@ -43,26 +43,32 @@
private ConfigurationComponent configuration = null;
private Scheduler scheduler = null;
+ private static boolean firstRun = true;
+
// ---------------------------------- constructors
public LSRegistrationComponent() throws PerfSONARException {
+
try {
- this.logger = (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
+ this.logger =
+ (LoggerComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.LOGGER);
} catch (PerfSONARException e) {
throw new PerfSONARException(
- "error.common.no_logger",
+ "error.common.no_logger",
"LSRegistrationComponent.initComponent: Cannot get logger
component"
);
}
try {
- this.configuration = (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
+ this.configuration =
+ (ConfigurationComponent)
AuxiliaryComponentManager.getInstance().getComponent(ComponentNames.CONFIG);
} catch (PerfSONARException e) {
throw new PerfSONARException(
"error.common.no_configuration",
"LSRegistrationComponent.initComponent: Cannot get config
component"
);
}
+
}
// ---------------------------------- public methods
@@ -71,52 +77,87 @@
* Scheduler action
*/
public void runAction() {
- try {
- String lsURL =
configuration.getProperty("service.r.ls_url");
- logger.debug("LSRegistrationComponent.runAction:
register to LS: " + lsURL);
- String metadataConfigStore = "";
- try {
- metadataConfigStore =
configuration.getProperty(LSRegistrationComponent.MA_CONFIG_STORE);
- } catch (PerfSONARException ex) {
-
logger.debug("LSRegistrationComponent.runAction: Can't get property
"+LSRegistrationComponent.MA_CONFIG_STORE);
- }
+ try {
+ String lsURL = configuration.getProperty("service.r.ls_url");
+ logger.debug("LSRegistrationComponent.runAction: register to LS:
" + lsURL);
- ServiceLSRegistrator registrator = null;
+ String metadataConfigStore = "";
+ try {
+ metadataConfigStore =
+
configuration.getProperty(LSRegistrationComponent.MA_CONFIG_STORE);
+ } catch (PerfSONARException ex) {
+ logger.debug("LSRegistrationComponent.runAction: "
+ + "Can't get property "
+ + LSRegistrationComponent.MA_CONFIG_STORE);
+ }
- if (metadataConfigStore.equals("file")) {
- String maConfigFile =
configuration.getProperty(LSRegistrationComponent.MA_CONFIG_FILE);
+ ServiceLSRegistrator registrator = null;
-
logger.debug("LSRegistrationComponent.runAction: metadata config file to
register to LS: "+ maConfigFile);
+ if (metadataConfigStore.trim().equals("file")) {
- registrator = new GenericServiceLSRegistrator(
- new
PropertiesServiceDescription(),
- new
InformationXMLFileServiceContent(maConfigFile)
- );
- } else {
- registrator = new GenericServiceLSRegistrator(
- new
PropertiesServiceDescription(),
- new
InformationExistDbXmlrpcServiceContent()
- );
+ String maConfigFile =
+
configuration.getProperty(LSRegistrationComponent.MA_CONFIG_FILE);
-
logger.debug("LSRegistrationComponent.runAction: metadata configuration taken
from xml database");
- }
+ logger.debug("LSRegistrationComponent.runAction: "
+ + "metadata config file to register to LS: "
+ + maConfigFile);
- registrator.initRegistrator();
+ registrator = new GenericServiceLSRegistrator(
+ new PropertiesServiceDescription(),
+ new InformationXMLFileServiceContent(maConfigFile)
+ );
- responseMessage = registrator.register(lsURL);
-
- /* TODO: do something with message... ? */
+ } else {
- } catch (PerfSONARException e) {
- logger.error("LSRegistrationComponent.runAction:
Error while registration: " + e.getMessage());
- }
- }
+ // xmldb
- public Message getResponseMessage() {
- return responseMessage;
- }
+ if (firstRun) {
+ String maConfigFile =
+
configuration.getProperty(LSRegistrationComponent.MA_CONFIG_FILE);
+
+ logger.debug("LSRegistrationComponent.runAction: "
+ + "First run; metadata config file to register to
LS: "
+ + maConfigFile);
+
+ registrator = new GenericServiceLSRegistrator(
+ new PropertiesServiceDescription(),
+ new InformationXMLFileServiceContent(maConfigFile)
+ );
+
+ firstRun = false;
+
+ } else {
+
+ registrator = new GenericServiceLSRegistrator(
+ new PropertiesServiceDescription(),
+ new InformationExistDbXmlrpcServiceContent()
+ );
+
+ logger.debug("LSRegistrationComponent.runAction: "
+ + "metadata configuration taken from xml database");
+ }
+
+ }
+
+ registrator.initRegistrator();
+ responseMessage = registrator.register(lsURL);
+
+ /* TODO: do something with message... ? */
+
+ } catch (PerfSONARException e) {
+ logger.error("LSRegistrationComponent.runAction: "
+ + "Error while registration: "
+ + e.getMessage());
+ }
+ }
+
+
+ public Message getResponseMessage() {
+ return responseMessage;
+ }
+
// ---------------------- component that loads action to scheduler
public void initComponent() throws PerfSONARException {
@@ -156,7 +197,7 @@
}
} catch (PerfSONARException e) {
throw new PerfSONARException(
- "error.rrdma.no_scheduler",
+ "error.ma.no_scheduler",
"LSRegistrationComponent.initComponent:"
+ "LSCleanupLoader:
no [component." + componentName
+
".scheduler_component] parameter. "+ e.getMessage()
- perfsonar: r3762 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/register, svnlog, 04/22/2008
Archive powered by MHonArc 2.6.16.