Created
August 22, 2011 14:03
-
-
Save stuartf/1162447 to your computer and use it in GitHub Desktop.
Add a bean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cXML = "" | |
components = 'sakai2-demo/components/sakai-provider-pack/WEB-INF/components.xml' | |
File.open(components) do |f| | |
cXML = REXML::Document.new(f) | |
beans = REXML::XPath.first(cXML, '//beans') | |
bean = beans.add_element("bean", { | |
"id" => "org.sakaiproject.user.api.UserDirectoryProvider", | |
"class" => "org.sakaiproject.provider.user.NakamuraUserDirectoryProvider", | |
"init-method" => "init" | |
}) | |
prop1 = bean.add_element("property", {"name" => "threadLocalManager"}) | |
prop1.add_element("ref", { | |
"bean" => "org.sakaiproject.thread_local.api.ThreadLocalManager" | |
}) | |
prop2 = bean.add_element("property", { | |
"name" => "serverConfigurationService" | |
}) | |
prop2.add_element("ref", { | |
"bean" => "org.sakaiproject.component.api.ServerConfigurationService" | |
}) | |
end | |
File.open(components, "w+") do |f| | |
cXML.write f | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment