Initializing and Restoring: Difference between revisions
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
At times, you may wish to perform initialization, backup or restoration of an Obsidian configuration. For example, you may wish to take a known good configuration from a development environment and apply it to a test environment. | At times, you may wish to perform initialization, backup or restoration of an Obsidian configuration. For example, you may wish to take a known good configuration from a development environment and apply it to a test environment. | ||
In Obsidian 3.0.0, we introduce an expansion of our [[Implementing_Jobs#Initializing_Job_Schedules | Initializing Job Schedules]] support that leverages the | In Obsidian 3.0.0, we introduce an expansion of our [[Implementing_Jobs#Initializing_Job_Schedules | Initializing Job Schedules]] support that leverages the [[Embedded_API#SystemRestoreManager_API | System Restore]] functionality of our API. | ||
By default, Obsidian will look for a file on the classpath named <code>/obsidianInitialization.json</code>. You may override the classpath resource name using the system property <code>obsidianInitClasspath</code>. For example, you could add the java system property <code>-DobsidianInitClasspath=/com/mycompany/obsidianInit.json</code>. You can also use a file-based resource by using the system property <code>obsidianInitFile</code>. For example, you could add the java system property <code>-DobsidianInitFile=/var/obsidian/obsidianScheduleInitialization.json</code>. | By default, Obsidian will look for a file on the classpath named <code>/obsidianInitialization.json</code>. You may override the classpath resource name using the system property <code>obsidianInitClasspath</code>. For example, you could add the java system property <code>-DobsidianInitClasspath=/com/mycompany/obsidianInit.json</code>. You can also use a file-based resource by using the system property <code>obsidianInitFile</code>. For example, you could add the java system property <code>-DobsidianInitFile=/var/obsidian/obsidianScheduleInitialization.json</code>. | ||
Note: Initialization only runs on scheduler instances. This means that a standalone Obsidian web application with no scheduler running will not do any initialization based on the presence of the appropriate JSON file. | Note: Initialization only runs on scheduler instances. This means that a standalone Obsidian web application with no scheduler running will not do any initialization based on the presence of the appropriate JSON file. | ||
<pre> | |||
{ | |||
"jobs" : [ | |||
{ | |||
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob", | |||
"nickname": "Daily Debug Log Cleanup", | |||
"recoveryType": "NONE", | |||
"state": "ENABLED", | |||
"schedule": "@daily", | |||
"parameters": [ | |||
{ | |||
"name": "level", | |||
"type": "STRING", | |||
"value": "DEBUG" | |||
}, | |||
{ | |||
"name": "maxAgeDays", | |||
"type": "INTEGER", | |||
"value": "7" | |||
} | |||
] | |||
}, | |||
{ | |||
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob", | |||
"nickname": "Weekly Info Log Cleanup", | |||
"recoveryType": "NONE", | |||
"state": "ENABLED", | |||
"schedule": "@weekly", | |||
"parameters": [ | |||
{ | |||
"name": "level", | |||
"type": "STRING", | |||
"value": "INFO" | |||
}, | |||
{ | |||
"name": "maxAgeDays", | |||
"type": "INTEGER", | |||
"value": "30" | |||
} | |||
] | |||
} | |||
] | |||
} | |||
</pre> | |||
Revision as of 21:22, 29 January 2015
As of Obsidian 3.0.0
At times, you may wish to perform initialization, backup or restoration of an Obsidian configuration. For example, you may wish to take a known good configuration from a development environment and apply it to a test environment.
In Obsidian 3.0.0, we introduce an expansion of our Initializing Job Schedules support that leverages the System Restore functionality of our API.
By default, Obsidian will look for a file on the classpath named /obsidianInitialization.json. You may override the classpath resource name using the system property obsidianInitClasspath. For example, you could add the java system property -DobsidianInitClasspath=/com/mycompany/obsidianInit.json. You can also use a file-based resource by using the system property obsidianInitFile. For example, you could add the java system property -DobsidianInitFile=/var/obsidian/obsidianScheduleInitialization.json.
Note: Initialization only runs on scheduler instances. This means that a standalone Obsidian web application with no scheduler running will not do any initialization based on the presence of the appropriate JSON file.
{
"jobs" : [
{
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob",
"nickname": "Daily Debug Log Cleanup",
"recoveryType": "NONE",
"state": "ENABLED",
"schedule": "@daily",
"parameters": [
{
"name": "level",
"type": "STRING",
"value": "DEBUG"
},
{
"name": "maxAgeDays",
"type": "INTEGER",
"value": "7"
}
]
},
{
"jobClass": "com.carfey.ops.job.maint.LogCleanupJob",
"nickname": "Weekly Info Log Cleanup",
"recoveryType": "NONE",
"state": "ENABLED",
"schedule": "@weekly",
"parameters": [
{
"name": "level",
"type": "STRING",
"value": "INFO"
},
{
"name": "maxAgeDays",
"type": "INTEGER",
"value": "30"
}
]
}
]
}