-// create session
- VamsasSession vamsasSession = new VamsasSession(sessdir);
-
- this.getSessionManager().addSession(new SessionHandle(new SessionUrn(vamsasSession).getSessionUrn()));
- if (userId == null)
- {
- //create a default userHandle
- // userId = new UserHandle(System.getProperty("user.name", System.getProperty("USERNAME","Joe Doe")),
- // System.getProperty("host.name",System.getProperty("HOSTNAME", "Unknown") ));// clientName, clientVersion, sessionPath);
- userId = new UserHandle(null, null);
-
- }
-
- //FullName and organisation should not be null (otherwise UserHandle equals method raises an java.lang.NullPointerException )
- //use current OS user and hostname, if null
- if ( userId.getFullName() == null)
- {
- userId.setFullName(System.getProperty("user.name", System.getProperty("USERNAME","Joe Doe")));
+ // create session
+ VamsasSession vamsasSession = null;
+ if (vamsasDocument==null)
+ {
+ vamsasSession = new VamsasSession(sessdir);
+ } else {
+ vamsasSession = new VamsasSession(sessdir, vamsasDocument);
+ }
+
+ this.getSessionManager().addSession(
+ new SessionHandle(new SessionUrn(vamsasSession).getSessionUrn()));
+ if (userId == null) {
+ // create a default userHandle
+ // userId = new UserHandle(System.getProperty("user.name",
+ // System.getProperty("USERNAME","Joe Doe")),
+ // System.getProperty("host.name",System.getProperty("HOSTNAME",
+ // "Unknown") ));// clientName, clientVersion, sessionPath);
+ userId = new UserHandle(null, null);
+ }
+
+ // FullName and organisation should not be null (otherwise UserHandle equals
+ // method raises an java.lang.NullPointerException )
+ // use current OS user and hostname, if null
+ if (userId.getFullName() == null) {
+ userId.setFullName(System.getProperty("user.name", System.getProperty(
+ "USERNAME", "Joe Doe")));
+ }
+
+ if (userId.getOrganization() == null) {
+ userId.setOrganization(System.getProperty("host.name", System
+ .getProperty("HOSTNAME", "Unknown")));
+ }
+
+ if (clientHandle == null)
+ clientHandle = new ClientHandle("SimpleVamsasClientApp", "0.1");
+ else {
+ if (clientHandle.getClientName() == null) {
+ clientHandle.setClientName("SimpleVamsasClientApp");