public static function createDataSource(ResourceDescriptor $folder) { $timecode = md5(microtime()); // unique id based on time in microseconds (used to create temporary resources) // ResourceDescriptor Object for a Data Source $result = new ResourceDescriptor($timecode, 'jdbc', $folder->getUriString() . '/' . $timecode, 'false'); $result->setLabel('Test Data Source'); $result->setDescription('test data source'); $result->addProperty(new ResourceProperty('PROP_PARENT_FOLDER', $folder->getUriString())); $result->addProperty(new ResourceProperty('PROP_DATASOURCE_DRIVER_CLASS', 'org.postgresql.Driver')); $result->addProperty(new ResourceProperty('PROP_DATASOURCE_CONNECTION_URL', 'jdbc:postgresql://localhost:5432/sugarcrm')); $result->addProperty(new ResourceProperty('PROP_DATASOURCE_USERNAME', 'root')); $result->addProperty(new ResourceProperty('PROP_DATASOURCE_PASSWORD', 'password')); return $result; }