Index: /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/db/dao/data/ApplicationProperty.as
===================================================================
--- /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/db/dao/data/ApplicationProperty.as	(revision 365)
+++ /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/db/dao/data/ApplicationProperty.as	(revision 365)
@@ -0,0 +1,30 @@
+package gssim.gssimstudio.db.dao.data {
+
+[Bindable]
+[RemoteClass(alias = "gssim.db.dao.data.ApplicationProperty")] 
+public class ApplicationProperty {
+	
+	protected var version:int;
+	protected var key:String;
+	protected var value:String;
+	
+	public function getVersion():int {
+		return version;
+	}
+	public function setVersion(version:int):void {
+		this.version = version;
+	}
+	public function getKey():String {
+		return key;
+	}
+	public function setKey(key:String):void {
+		this.key = key;
+	}
+	public function getValue():String {
+		return value;
+	}
+	public function setValue(value:String):void {
+		this.value = value;
+	}
+}
+}
Index: /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudio.mxml
===================================================================
--- /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudio.mxml	(revision 183)
+++ /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/GSSimStudio.mxml	(revision 365)
@@ -23,43 +23,4 @@
 	
 <charts:ResourceChartModel id="experimentModel" /> 
-	
-<fx:XML id="xml">
-<qcgJob appId="gssim">
-	<task persistent="true" taskId="gssim">
-		<candidateHosts>
-			<hostName>zeus.cyfronet.pl</hostName>
-		</candidateHosts>
-		<execution type="single">
-			<executable>
-				<execFile>
-					<file>
-						<location type="URL">file:////mnt/auto/people/plgmcichenski/gssim/start-gssim-cp.sh</location>
-					</file>
-				</execFile>
-			</executable>
-			<arguments>
-				<value>input/experiment.properties</value>
-			</arguments>                                                                                        
-			<stageInOut>
-				<directory name="input" type="in">
-					<location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/input</location>
-				</directory>
-				
-				<directory name="output" type="out">
-					<location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}</location>
-				</directory>
-
-				<file name="gssim.log" type="out" required="false">
-					<location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}/gssim.log</location>
-				</file>
-
-				<file name="trash.log" type="out" required="false">
-					<location type="URL">gsiftp://gssim.man.poznan.pl//usr/local/admin/gssim/output/$\{JOB_ID}-$\{TASK_ID}/trash.log</location>
-				</file>
-			</stageInOut>
-		</execution>
-	</task>
-</qcgJob>
-</fx:XML>
 
 </fx:Declarations>
Index: /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/views/ExperimentEditor.mxml
===================================================================
--- /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/views/ExperimentEditor.mxml	(revision 237)
+++ /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/app/gssim/gssimstudio/editor/views/ExperimentEditor.mxml	(revision 365)
@@ -91,18 +91,16 @@
 				//prepare job description and generate properties file name
 				var propertyFileName : String = experiment.metaname + "_" + experiment.name + ".properties";
-				parentApplication.xml.children().children().children()[2].children()[0] =
-					"input/" + propertyFileName;
-				var jobDescription : String = parentApplication.xml.toXMLString();
-				jobDesc.text = jobDescription;
+				
+				//parentApplication.xml.children().children().children()[2].children()[0] =
+				//	"input/" + propertyFileName;
+				//var jobDescription : String = parentApplication.xml.toXMLString();
+				//jobDesc.text = jobDescription;
 				
 				//prepare grms addresses
-				//var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=grms/elder3.man.poznan.pl";
-				//var serviceURL : String = "https://elder3.man.poznan.pl:8443/gridge/services/GrmsJobFactory";
-				
-				var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=qcg-broker/qcg-broker.man.poznan.pl";
-				var serviceURL : String = "https://qcg-broker.man.poznan.pl:8443/qcg/services/JobFactory";
+				//var serviceDN : String = "/C=PL/O=GRID/O=PSNC/CN=qcg-broker/qcg-broker.man.poznan.pl";
+				//var serviceURL : String = "https://qcg-broker.man.poznan.pl:8443/qcg/services/JobFactory";
 				
 				parentApplication.service.uploadAndSubmitExperiment
-					(propertyFileName, experiment.toString(), serviceURL, serviceDN, jobDescription);
+					(propertyFileName, experiment.toString());
 			}
 			
Index: /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/DatabaseHelper.java
===================================================================
--- /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/DatabaseHelper.java	(revision 365)
+++ /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/DatabaseHelper.java	(revision 365)
@@ -0,0 +1,38 @@
+package gssim.gssimstudio.flex.app.editor;
+
+/**
+ * @author Mateusz Cichenski, Jarek Szymczak
+ */
+public class DatabaseHelper {
+
+	/**
+	 * The location of database source
+	 */
+	protected String dbAddress = "localhost:3306/gssim_results";
+	/**
+	 * Username to access database
+	 */
+	protected String dbUser = "gssim";
+	/**
+	 * Password to database [is it safe?]
+	 */
+	protected String dbPassword = "gssimstudiodb";
+	
+	/**
+	 * Application property for Service URL
+	 */
+	protected String apServiceURL = "service_url";
+	/**
+	 * Application property for Service Domain Name
+	 */
+	protected String apServiceDN = "service_domain_name";
+	/**
+	 * Application property for job description
+	 */
+	protected String apJobDescription = "job_description";
+	
+	/**
+	 * Job description token for property file
+	 */
+	protected String jdPropertyFile = "$PROPERTY_FILE";
+}
Index: /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java
===================================================================
--- /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java	(revision 183)
+++ /gssim_ui/branches/vine/gssimstudio/src/web/ui/flex/java/gssim/gssimstudio/flex/app/editor/GSSimStudio.java	(revision 365)
@@ -105,18 +105,5 @@
 @BlazeDsDestination(swfHeight = "800", locales = {"en_US","pl_PL"}, names = {"GSSim Studio","GSSim Studio"}, descriptions = {"Application for GSSim job description","Aplikacja do generowania zadaï¿œ dla symulatora GSSim"})
 @PortletDisplayName(locales = {"en", "pl"}, values = {"GSSimStudio Application", "Aplikacja GSSimStudio"})
-public class GSSimStudio implements ModelInitialization , FileUploadAccepter {
-
-	/**
-	 * The location of database source
-	 */
-	private String dbAddress = "localhost:3306/gssim_results";
-	/**
-	 * Username to access database
-	 */
-	private String dbUser = "gssim";
-	/**
-	 * Password to database [is it safe?]
-	 */
-	private String dbPassword = "gssimstudiodb";
+public class GSSimStudio implements ModelInitialization , FileUploadAccepter extends DatabaseHelper {
 	
 	private Boolean developement = true;
@@ -151,5 +138,5 @@
     
     @BlazeDsMethod()
-	public GSSimStudioModel uploadAndSubmitExperiment(String destFileName, String fileContent, String grmsURL, String grmsDN, String jobDescription) throws IOException {
+	public GSSimStudioModel uploadAndSubmitExperiment(String destFileName, String fileContent) throws IOException {
 		String expName = destFileName.split("_")[1].split(".properties")[0];
 		String metaexpName = destFileName.split("_")[0];
@@ -157,4 +144,46 @@
 		fileContent += "experiment.id="+expId.toString();
 		uploadPropertyFile(destFileName, fileContent);
+		
+		String grmsURL = null;
+		String grmsDN = null;
+		String jobDescription = null;
+		
+		try {
+			connection = factory().createDBConnection(dbAddress, dbUser,
+					dbPassword);
+			ApplicationPropertyDAO applicationPropertyDAO = factory.createApplicationProperty();
+			Finder finder = Finder.getApplicationPropertyFinder(apServiceURL);
+			List<ApplicationProperty> list = applicationPropertyDAO.find(finder);
+			if (list.isEmpty()) ;
+			else
+				grmsURL = list.get(0).getValue();
+			
+			finder = Finder.getApplicationPropertyFinder(apServiceDN);
+			list = applicationPropertyDAO.find(finder);
+			if (list.isEmpty()) ;
+			else
+				grmsDN = list.get(0).getValue();
+			
+			finder = Finder.getApplicationPropertyFinder(apJobDescription);
+			list = applicationPropertyDAO.find(finder);
+			if (list.isEmpty()) ;
+			else {
+				jobDescription = list.get(0).getValue();
+				//replace tokens
+				jobDescription.replace(jdPropertyFile, "input/" + destFileName);
+			}
+		} catch (SQLException e) {
+			;
+		} catch (InstantiationException e) {
+			;		
+		} catch (IllegalAccessException e) {
+			;	
+		} catch (ClassNotFoundException e) {
+			;	
+		} catch (Exception e) {
+			;	
+		} finally {
+			closeConnection(connection, null);
+		}	
 		
 		return doSubmitApplication(grmsURL, grmsDN, jobDescription);
@@ -1433,5 +1462,7 @@
 	
 	private void closeConnection(Connection connection, GSSimStudioModel model) {
-		String error = model.getError();
+		String error = null;
+		if (model != null)
+			error = model.getError();
 		
 		if (connection != null)
@@ -1439,5 +1470,4 @@
 				connection.close();
 			} catch (SQLException e) {
-				error = model.getError();
 				if (error == null || error.equals("")) {
 					error = "Error while trying to close the SQL connection";
@@ -1448,5 +1478,6 @@
 			}
 
-		model.setError(error);
+		if (model != null)
+			model.setError(error);
 	}
 
