{"action":"created","issue":{"url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/5","labels_url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/5/comments","events_url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/5/events","html_url":"https://github.com/cloudfoundry-community/tomee-buildpack/issues/5","id":116602058,"number":5,"title":" Auto-reconfiguration of Resources for TomEE","user":{"login":"kelapure","id":206519,"avatar_url":"https://avatars.githubusercontent.com/u/206519?v=3","gravatar_id":"","url":"https://api.github.com/users/kelapure","html_url":"https://github.com/kelapure","followers_url":"https://api.github.com/users/kelapure/followers","following_url":"https://api.github.com/users/kelapure/following{/other_user}","gists_url":"https://api.github.com/users/kelapure/gists{/gist_id}","starred_url":"https://api.github.com/users/kelapure/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kelapure/subscriptions","organizations_url":"https://api.github.com/users/kelapure/orgs","repos_url":"https://api.github.com/users/kelapure/repos","events_url":"https://api.github.com/users/kelapure/events{/privacy}","received_events_url":"https://api.github.com/users/kelapure/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-11-12T17:42:41Z","updated_at":"2015-12-04T19:04:08Z","closed_at":null,"body":"**Problem**:\r\nToday configuration of cloud foundry backing services in TomEE is cumbersome. If I want to use postgres, I need to specify the following in my resources.xml\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<resources>\r\n  <!--\r\n    mainly a tomee.xml embed in the application\r\n    (META-INF or WEB-INF)\r\n  -->\r\n  <Resource id=\"jdbc/DefaultDB\" type=\"DataSource\">\r\n      JdbcDriver org.postgresql.Driver\r\n      JdbcUrl = jdbc:postgres://rohit:blahblahblah@9.89.203.244:4980/ilovejets\r\n      UserName rohit\r\n      Password blahblahblah\r\n      JtaManaged true\r\n  </Resource>\r\n</resources>\r\n```\r\n\r\nAn the following in my persistence.xml\r\n```xml\r\n<jta-data-source>jdbc/DefaultDB</jta-data-source>\r\n```\r\n\r\n_Where the URL is the one that I will have when I bind a postgres service and the name of the datasource in resources.xml and persistence.xml must be one and the same._\r\n\r\n**Solution**:\r\nModifications to the tomee Buildpack that provide facilities for automatically configuring as much of the resources.xml file for tomee as possible in order to remove as much of the busywork from app migration as possible.\r\n\r\nThe buildpack will perform all of this automatic configuration by interpreting the data it finds in the VCAP_SERVICES environment variable that is configured automatically by Cloud Foundry via either brokered services or user-provided services. \r\n\r\n**User Story**\r\nAs a developer I would like to have a mechanism that will automatically configure the tomee server in Cloud Foundry with the bound services.\r\n\r\n**Implementation Details**\r\nThis can be achieved with [ServiceProvider](http://tomee.apache.org/concepts.html) mechanism in TomEE. \r\n\r\nOne possible solution would be to carry out all of the automatic configuration work based on user-provided services (often simply called \"cups\"), with the underlying assumption being that managed brokered services imply a level of green-field preparation that allows application developers to consume the VCAP_SERVICES environment variables directly or through libraries like Spring Boot."},"comment":{"url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/comments/162053971","html_url":"https://github.com/cloudfoundry-community/tomee-buildpack/issues/5#issuecomment-162053971","issue_url":"https://api.github.com/repos/cloudfoundry-community/tomee-buildpack/issues/5","id":162053971,"user":{"login":"nebhale","id":60754,"avatar_url":"https://avatars.githubusercontent.com/u/60754?v=3","gravatar_id":"","url":"https://api.github.com/users/nebhale","html_url":"https://github.com/nebhale","followers_url":"https://api.github.com/users/nebhale/followers","following_url":"https://api.github.com/users/nebhale/following{/other_user}","gists_url":"https://api.github.com/users/nebhale/gists{/gist_id}","starred_url":"https://api.github.com/users/nebhale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nebhale/subscriptions","organizations_url":"https://api.github.com/users/nebhale/orgs","repos_url":"https://api.github.com/users/nebhale/repos","events_url":"https://api.github.com/users/nebhale/events{/privacy}","received_events_url":"https://api.github.com/users/nebhale/received_events","type":"User","site_admin":false},"created_at":"2015-12-04T19:04:08Z","updated_at":"2015-12-04T19:04:08Z","body":"@violetagg I think that's a great compromise.  In general we try to avoid mucking about in the actual application uploaded by the user, but this is the perfect point at which we would.  Eliminating the global nature of the last strategy is right on.\r\n\r\nWhat else do you think needs to be done to bring this to deliverable quality?"}}