Index: branches/ll-drmaa-1.0.0/AUTHORS
===================================================================
--- branches/ll-drmaa-1.0.0/AUTHORS	(revision 19)
+++ branches/ll-drmaa-1.0.0/AUTHORS	(revision 19)
@@ -0,0 +1,9 @@
+$Id: AUTHORS 746 2008-03-06 15:07:58Z lukasz $
+
+Author:
+	Michal Matloka <michal.matloka@student.put.poznan.pl>
+	Mariusz Mamonski <mamonski@man.poznan.pl>
+
+Send bug reports to:
+	Mariusz Mamonski <mamonski@man.poznan.pl>
+	Michal Matloka <michal.matloka@student.put.poznan.pl>
Index: branches/ll-drmaa-1.0.0/TODO
===================================================================
--- branches/ll-drmaa-1.0.0/TODO	(revision 20)
+++ branches/ll-drmaa-1.0.0/TODO	(revision 20)
@@ -0,0 +1,4 @@
+= TODO =
+
+ * release DRMAA for LoadLeveler on APPs Track
+
Index: branches/ll-drmaa-1.0.0/doc/Makefile.am
===================================================================
--- branches/ll-drmaa-1.0.0/doc/Makefile.am	(revision 20)
+++ branches/ll-drmaa-1.0.0/doc/Makefile.am	(revision 20)
@@ -0,0 +1,52 @@
+# $Id$
+#
+# PSNC DRMAA for LoadLeveler
+# Copyright (C) 2010 Poznan Supercomputing and Networking Center
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+DOCUTILSFLAGS = \
+ -i utf-8 \
+ -o utf-8 \
+ --language=en \
+ --file-insertion-enabled \
+ --no-generator \
+ --tab-width=4
+RST2HTMLFLAGS = $(DOCUTILSFLAGS) \
+ --stylesheet=stylesheet.css \
+ --link-stylesheet
+RST2LATEXFLAGS = $(DOCUTILSFLAGS) \
+ --documentclass=article \
+ --documentoptions=a4paper,10pt \
+ --font-encoding=OT4 \
+ --graphicx-option=pdftex \
+ --use-latex-footnotes \
+ --footnote-references=superscript \
+ --use-latex-citations \
+ --use-latex-toc
+
+readme.html: $(top_srcdir)/README
+	$(RST2HTML) $(RST2HTMLFLAGS) $< $@
+readme.tex: $(top_srcdir)/README
+	$(RST2LATEX) $(RST2LATEXFLAGS) $< $@
+.tex.pdf:
+	pdflatex $< && pdflatex $<
+
+noinst_DATA = readme.html readme.pdf
+EXTRA_DIST = readme.html readme.tex readme.pdf
+
+clean-local:
+	-rm -rf *.log *.aux *.toc *.out
+MAINTAINERCLEANFILES = readme.html readme.tex readme.pdf
+
Index: branches/ll-drmaa-1.0.0/doc/rst.css
===================================================================
--- branches/ll-drmaa-1.0.0/doc/rst.css	(revision 20)
+++ branches/ll-drmaa-1.0.0/doc/rst.css	(revision 20)
@@ -0,0 +1,273 @@
+/*
+:Author: David Goodger (goodger@python.org)
+:Id: $Id$
+:Copyright: This stylesheet has been placed in the public domain.
+
+Default cascading style sheet for the HTML output of Docutils.
+
+See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
+customize this style sheet.
+*/
+
+/* used to remove borders from tables and images */
+.borderless, table.borderless td, table.borderless th {
+  border: 0 }
+
+table.borderless td, table.borderless th {
+  /* Override padding for "table.docutils td" with "! important".
+     The right padding separates the table cells. */
+  padding: 0 0.5em 0 0 ! important }
+
+.first {
+  /* Override more specific margin styles with "! important". */
+  margin-top: 0 ! important }
+
+.last, .with-subtitle {
+  margin-bottom: 0 ! important }
+
+.hidden {
+  display: none }
+
+a.toc-backref {
+  text-decoration: none ;
+  color: black }
+
+blockquote.epigraph {
+  margin: 2em 5em ; }
+
+dl.docutils dd {
+  margin-bottom: 0.5em }
+
+/* Uncomment (and remove this text!) to get bold-faced definition list terms
+dl.docutils dt {
+  font-weight: bold }
+*/
+
+div.abstract {
+  margin: 2em 5em }
+
+div.abstract p.topic-title {
+  font-weight: bold ;
+  text-align: center }
+
+div.admonition, div.attention, div.caution, div.danger, div.error,
+div.hint, div.important, div.note, div.tip, div.warning {
+  margin: 2em ;
+  border: medium outset ;
+  padding: 1em }
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title {
+  font-weight: bold ;
+  font-family: sans-serif }
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+  color: red ;
+  font-weight: bold ;
+  font-family: sans-serif }
+
+/* Uncomment (and remove this text!) to get reduced vertical space in
+   compound paragraphs.
+div.compound .compound-first, div.compound .compound-middle {
+  margin-bottom: 0.5em }
+
+div.compound .compound-last, div.compound .compound-middle {
+  margin-top: 0.5em }
+*/
+
+div.dedication {
+  margin: 2em 5em ;
+  text-align: center ;
+  font-style: italic }
+
+div.dedication p.topic-title {
+  font-weight: bold ;
+  font-style: normal }
+
+div.figure {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+div.footer, div.header {
+  clear: both;
+  font-size: smaller }
+
+div.line-block {
+  display: block ;
+  margin-top: 1em ;
+  margin-bottom: 1em }
+
+div.line-block div.line-block {
+  margin-top: 0 ;
+  margin-bottom: 0 ;
+  margin-left: 1.5em }
+
+div.sidebar {
+  margin: 0 0 0.5em 1em ;
+  border: medium outset ;
+  padding: 1em ;
+  background-color: #ffffee ;
+  width: 40% ;
+  float: right ;
+  clear: right }
+
+div.sidebar p.rubric {
+  font-family: sans-serif ;
+  font-size: medium }
+
+div.system-messages {
+  margin: 5em }
+
+div.system-messages h1 {
+  color: red }
+
+div.system-message {
+  border: medium outset ;
+  padding: 1em }
+
+div.system-message p.system-message-title {
+  color: red ;
+  font-weight: bold }
+
+div.topic {
+  margin: 2em }
+
+h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
+h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
+  margin-top: 0.4em }
+
+h1.title {
+  text-align: center }
+
+h2.subtitle {
+  text-align: center }
+
+hr.docutils {
+  width: 75% }
+
+img.align-left {
+  clear: left }
+
+img.align-right {
+  clear: right }
+
+ol.simple, ul.simple {
+  margin-bottom: 1em }
+
+ol.arabic {
+  list-style: decimal }
+
+ol.loweralpha {
+  list-style: lower-alpha }
+
+ol.upperalpha {
+  list-style: upper-alpha }
+
+ol.lowerroman {
+  list-style: lower-roman }
+
+ol.upperroman {
+  list-style: upper-roman }
+
+p.attribution {
+  text-align: right ;
+  margin-left: 50% }
+
+p.caption {
+  font-style: italic }
+
+p.credits {
+  font-style: italic ;
+  font-size: smaller }
+
+p.label {
+  white-space: nowrap }
+
+p.rubric {
+  font-weight: bold ;
+  font-size: larger ;
+  color: maroon ;
+  text-align: center }
+
+p.sidebar-title {
+  font-family: sans-serif ;
+  font-weight: bold ;
+  font-size: larger }
+
+p.sidebar-subtitle {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+p.topic-title {
+  font-weight: bold }
+
+pre.address {
+  margin-bottom: 0 ;
+  margin-top: 0 ;
+  font-family: serif ;
+  font-size: 100% }
+
+pre.literal-block, pre.doctest-block {
+  margin-left: 2em ;
+  margin-right: 2em }
+
+span.classifier {
+  font-family: sans-serif ;
+  font-style: oblique }
+
+span.classifier-delimiter {
+  font-family: sans-serif ;
+  font-weight: bold }
+
+span.interpreted {
+  font-family: sans-serif }
+
+span.option {
+  white-space: nowrap }
+
+span.pre {
+  white-space: pre }
+
+span.problematic {
+  color: red }
+
+span.section-subtitle {
+  /* font-size relative to parent (h1..h6 element) */
+  font-size: 80% }
+
+table.citation {
+  border-left: solid 1px gray;
+  margin-left: 1px }
+
+table.docinfo {
+  margin: 2em 4em }
+
+table.docutils {
+  margin-top: 0.5em ;
+  margin-bottom: 0.5em }
+
+table.footnote {
+  border-left: solid 1px black;
+  margin-left: 1px }
+
+table.docutils td, table.docutils th,
+table.docinfo td, table.docinfo th {
+  padding-left: 0.5em ;
+  padding-right: 0.5em ;
+  vertical-align: top }
+
+table.docutils th.field-name, table.docinfo th.docinfo-name {
+  font-weight: bold ;
+  text-align: left ;
+  white-space: nowrap ;
+  padding-left: 0 }
+
+h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
+h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
+  font-size: 100% }
+
+ul.auto-toc {
+  list-style-type: none }
Index: branches/ll-drmaa-1.0.0/doc/stylesheet.css
===================================================================
--- branches/ll-drmaa-1.0.0/doc/stylesheet.css	(revision 20)
+++ branches/ll-drmaa-1.0.0/doc/stylesheet.css	(revision 20)
@@ -0,0 +1,137 @@
+/*
+:Authors: Ian Bicking, Michael Foord
+:Contact: fuzzyman@voidspace.org.uk
+:Date: 2005/08/26 
+:Version: 0.1.0
+:Copyright: This stylesheet has been placed in the public domain.
+
+Stylesheet for Docutils.
+Based on ``blue_box.css`` by Ian Bicking
+and ``html4css1.css`` revision 1.46.
+*/
+
+@import url(html4css1.css);
+
+body {
+  font-family: Arial, sans-serif;
+}
+
+em, i {
+  /* Typically serif fonts have much nicer italics */
+  font-family: Times New Roman, Times, serif;
+}
+
+a.target {
+  color: blue;
+}
+
+a.target {
+  color: blue;
+}
+
+a.toc-backref {
+  text-decoration: none;
+  color: black;
+}
+
+a.toc-backref:hover {
+  background-color: inherit;
+}
+
+a:hover {
+  background-color: #cccccc;
+}
+
+div.attention, div.caution, div.danger, div.error, div.hint,
+div.important, div.note, div.tip, div.warning {
+  background-color: #cccccc;
+  padding: 3px;
+  width: 80%;
+}
+
+div.admonition p.admonition-title, div.hint p.admonition-title,
+div.important p.admonition-title, div.note p.admonition-title,
+div.tip p.admonition-title  {
+  text-align: center;
+  background-color: #999999;
+  display: block;
+  margin: 0;
+}
+
+div.attention p.admonition-title, div.caution p.admonition-title,
+div.danger p.admonition-title, div.error p.admonition-title,
+div.warning p.admonition-title {
+  color: #cc0000;
+  font-family: sans-serif;
+  text-align: center;
+  background-color: #999999;
+  display: block;
+  margin: 0;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  font-family: Helvetica, Arial, sans-serif;
+  border: thin solid black;
+  /* This makes the borders rounded on Mozilla, which pleases me */
+  -moz-border-radius: 8px;
+  padding: 4px;
+}
+
+h1 {
+  background-color: #444499;
+  color: #ffffff;
+  border: medium solid black;
+}
+
+h1 a.toc-backref, h2 a.toc-backref { 
+  color: #ffffff;
+}
+
+h2 {
+  background-color: #666666;
+  color: #ffffff;
+  border: medium solid black;
+}
+
+h3, h4, h5, h6 {
+  background-color: #cccccc;
+  color: #000000;
+}
+
+h3 a.toc-backref, h4 a.toc-backref, h5 a.toc-backref, 
+h6 a.toc-backref { 
+  color: #000000;
+}
+
+h1.title {
+  text-align: center;
+  background-color: #444499;
+  color: #eeeeee;
+  border: thick solid black;
+  -moz-border-radius: 20px;
+}
+
+table.footnote {
+  padding-left: 0.5ex;
+}
+
+table.citation {
+  padding-left: 0.5ex
+}
+
+pre.literal-block, pre.doctest-block {
+  border: thin black solid;
+  padding: 5px;
+}
+
+.image img { border-style : solid;
+            border-width : 2px;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+  font-size: 100%;
+}
+
+code, tt {
+  color: #000066;
+}
Index: branches/ll-drmaa-1.0.0/COPYING
===================================================================
--- branches/ll-drmaa-1.0.0/COPYING	(revision 20)
+++ branches/ll-drmaa-1.0.0/COPYING	(revision 20)
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
Index: branches/ll-drmaa-1.0.0/Makefile.am
===================================================================
--- branches/ll-drmaa-1.0.0/Makefile.am	(revision 20)
+++ branches/ll-drmaa-1.0.0/Makefile.am	(revision 20)
@@ -0,0 +1,26 @@
+# $Id$
+#
+# PSNC DRMAA for LoadLeveler
+# Copyright (C) 2010 Poznan Supercomputing and Networking Center
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+ACLOCAL_AMFLAGS = -I m4
+EXTRA_DIST = \
+ autoclean.sh \
+ autogen.sh \
+ m4/missing-dev-prog.sh
+
+SUBDIRS = drmaa_utils ll_drmaa 
+#doc
Index: branches/ll-drmaa-1.0.0/autogen.sh
===================================================================
--- branches/ll-drmaa-1.0.0/autogen.sh	(revision 20)
+++ branches/ll-drmaa-1.0.0/autogen.sh	(revision 20)
@@ -0,0 +1,49 @@
+#!/bin/sh
+# $Id$
+
+run() {
+	echo "running $@ ($PWD)"
+	eval "$@"
+}
+
+check()
+{
+	printf "checking for $1... "
+	if ($1 --version < /dev/null > /dev/null 2>&1); then
+		echo "yes"
+	else
+		echo "no"
+		exit 1
+	fi
+}
+
+ACLOCAL=${ACLOCAL:=aclocal}
+AUTOHEADER=${AUTOHEADER:=autoheader}
+AUTOCONF=${AUTOCONF:=autoconf}
+LIBTOOLIZE=${LIBTOOLIZE:=libtoolize}
+AUTOMAKE=${AUTOMAKE:=automake}
+
+check $ACLOCAL
+check $AUTOHEADER
+check $AUTOCONF
+check $LIBTOOLIZE
+check $AUTOMAKE
+
+mkdir -p scripts
+
+run ${ACLOCAL} -I m4 | grep -v ^/usr/share/aclocal || exit 1
+run ${LIBTOOLIZE} --automake --copy --force || exit 1
+run ${AUTOHEADER} --warnings=all || exit 1
+run ${AUTOMAKE} --foreign --add-missing --copy --warnings=all || exit 1
+run ${AUTOCONF} --warnings=all -Wno-obsolete || exit 1
+
+if [ -n "$*" ]; then
+	args="$*"
+elif [ -f config.log ]; then
+	args=`grep '\$ *\./configure ' config.log \
+			 | sed 's:^ *\$ *\./configure ::;s:--no-create::;s:--no-recursion::' \
+			 2>/dev/null`
+fi
+
+(cd drmaa_utils && run sh autogen.sh "$@")
+run ./configure ${args}
Index: branches/ll-drmaa-1.0.0/ll_drmaa/job.c
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/job.c	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/job.c	(revision 20)
@@ -0,0 +1,794 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <time.h>
+
+#include <drmaa_utils/common.h>
+#include <drmaa_utils/conf.h>
+#include <drmaa_utils/datetime.h>
+#include <drmaa_utils/drmaa.h>
+#include <drmaa_utils/drmaa_util.h>
+#include <drmaa_utils/environ.h>
+#include <drmaa_utils/template.h>
+
+#include <ll_drmaa/job.h>
+#include <ll_drmaa/session.h>
+#include <ll_drmaa/util.h>
+
+#include <llapi.h>
+
+static void
+lldrmaa_job_control( fsd_job_t *self, int action )
+{
+	int rc = 0;
+	LL_element *errObj = NULL;
+	LL_terminate_job_info cancel_info;
+	char *rest = NULL;
+	char *token = NULL;
+	char *ptr = NULL;
+	char *volatile job_list[2];
+
+	job_list[0] = self->job_id;
+	job_list[1] = NULL;
+
+	cancel_info.StepId.from_host = NULL;
+	ptr = fsd_strdup(self->job_id);
+	fsd_log_enter(( "({job_id=%s}, action=%s)", self->job_id, drmaa_control_to_str(action) ));
+
+	fsd_mutex_lock( &self->session->drm_connection_mutex );
+	TRY
+	{
+		switch( action )
+		{
+			case DRMAA_CONTROL_SUSPEND:
+					fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR,"job::control: could not send %s to job %s. Function not implemented.",drmaa_control_to_str(action), self->job_id);
+				break;
+			case DRMAA_CONTROL_HOLD:
+				rc = ll_control(LL_CONTROL_VERSION, LL_CONTROL_HOLD_USER, NULL, NULL, (char **)job_list, NULL,0);
+				fsd_log_warning(("This command does not affect a job step that is running unless the job step attempts to enter the Idle state."));
+				if(rc)
+					fsd_exc_raise_fmt(lldrmaa_map_control(rc),
+					"job::control: could not send %s to job %s. Error code: %d,%s",
+					drmaa_control_to_str(action), self->job_id, rc, lldrmaa_err_control(rc)
+					);
+				break;
+			case DRMAA_CONTROL_RESUME:
+					fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR,"job::control: could not send %s to job %s. Function not implemented.",drmaa_control_to_str(action), self->job_id);
+				break;
+			case DRMAA_CONTROL_RELEASE:
+				rc = ll_control(LL_CONTROL_VERSION, LL_CONTROL_HOLD_RELEASE, NULL,NULL, (char **)job_list,NULL,0);
+				if(rc)
+					fsd_exc_raise_fmt(lldrmaa_map_control(rc),
+					"job::control: could not send %s to job %s. Error code: %d,%s",
+					drmaa_control_to_str(action), self->job_id, rc, lldrmaa_err_control(rc)
+					);
+				break;
+			case DRMAA_CONTROL_TERMINATE:
+				cancel_info.version_num=LL_PROC_VERSION;
+				cancel_info.msg=NULL;
+
+				token = strtok_r(ptr, ".", &rest);
+				if(token == NULL)
+				{
+					fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_JOB,"Invalid job_id format");
+				}
+				cancel_info.StepId.from_host = fsd_strdup(token);
+
+				token = strtok_r(NULL, ".", &rest);
+				if(token == NULL)
+				{
+					fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_JOB,"Invalid job_id format");
+				}
+
+				cancel_info.StepId.cluster = fsd_atoi(token);
+
+				token = strtok_r(NULL, ".", &rest);
+				if(token!=NULL)
+				{
+					cancel_info.StepId.proc = fsd_atoi(token);
+					rc = ll_terminate_job(&cancel_info);
+				}
+				else /* No StepId specified */
+				{
+					fsd_exc_raise_fmt(FSD_DRMAA_ERRNO_INVALID_JOB, "Stepid is NULL");
+				}
+				if(rc)
+					fsd_exc_raise_fmt(
+					lldrmaa_map_terminate_job(rc),
+					"job::control: could not send %s to job %s. Error code: %d,%s",
+					drmaa_control_to_str(action), self->job_id, rc, lldrmaa_err_terminate_job(rc)
+					);
+
+				break;
+			default:
+				fsd_exc_raise_fmt(
+						FSD_ERRNO_INVALID_ARGUMENT,
+						"job::control: unknown action %d", action );
+		}
+
+		fsd_log_debug(("job::control: successful"));
+	 }
+	FINALLY
+	{
+		fsd_free(ptr);
+		if(cancel_info.StepId.from_host!=NULL)
+			fsd_free(cancel_info.StepId.from_host);
+		if(errObj != NULL)
+		{
+			ll_free_objs(errObj);
+			ll_deallocate(errObj);
+		}
+
+		fsd_mutex_unlock( &self->session->drm_connection_mutex );
+	}
+	END_TRY
+
+	fsd_log_return(( "" ));
+}
+
+void
+lldrmaa_job_read_job_info( fsd_job_t *self, enum StepState step_state, enum HoldType hold_type )
+{
+	fsd_log_enter(( "" ));
+
+	fsd_log_debug(("step state: %d",step_state));
+	fsd_log_debug(("hold type: %d",hold_type));
+	if( hold_type && ( step_state == STATE_HOLD || step_state == STATE_IDLE ))
+	{
+		if (hold_type == HOLDTYPE_USER)
+			self->state = DRMAA_PS_USER_ON_HOLD;
+		else if (hold_type == HOLDTYPE_SYSTEM)
+			self->state = DRMAA_PS_SYSTEM_ON_HOLD;
+		else if (hold_type == HOLDTYPE_USERSYS)
+			self->state = DRMAA_PS_USER_SYSTEM_ON_HOLD;
+		else
+		{
+			fsd_log_error(("hold_type does not match step_state, %d", hold_type));
+			fsd_assert(false);
+		}
+	}
+	else if( step_state == STATE_DEFERRED || step_state == STATE_IDLE || step_state == STATE_PENDING )
+		self->state = DRMAA_PS_QUEUED_ACTIVE;
+	else if( step_state == STATE_RUNNING )
+		self->state = DRMAA_PS_RUNNING;
+	else if( step_state == STATE_PREEMPTED )
+		self->state = DRMAA_PS_SYSTEM_SUSPENDED;
+	else if( step_state == STATE_COMPLETED )
+		self->state = DRMAA_PS_DONE;
+	else if ( step_state == STATE_VACATED)
+	{
+		if( ((lldrmaa_session_t*) self->session)->terminate_job_on_vacated )
+		{
+			lldrmaa_job_control(self, DRMAA_CONTROL_TERMINATE);
+		}
+		self->state = DRMAA_PS_FAILED;
+	}
+	else if( step_state == STATE_CANCELED || step_state == STATE_NOTQUEUED || step_state == STATE_NOTRUN ||
+			 step_state == STATE_REJECTED || step_state == STATE_REMOVED || step_state == STATE_TERMINATED ||
+			 step_state == STATE_SUBMISSION_ERR)
+		self->state = DRMAA_PS_FAILED;
+	else if ( step_state == STATE_COMPLETE_PENDING ||  step_state == STATE_PREEMPT_PENDING ||
+			  step_state == STATE_REJECT_PENDING ||  step_state == STATE_REMOVE_PENDING ||
+			  step_state == STATE_RESUME_PENDING || step_state == STATE_STARTING || step_state == STATE_VACATE_PENDING)
+		fsd_log_debug(("STATE_X_PENDING"));
+	else if ( step_state == STATE_UNEXPANDED)
+		self->state = DRMAA_PS_UNDETERMINED;
+	else
+	{
+		fsd_log_error(("step_state = %d, assert(0)",step_state));
+		fsd_assert(false);
+	}
+
+	self->last_update_time = time(NULL);
+
+	fsd_log_return(( "" ));
+}
+
+void
+lldrmaa_job_read_job_info_mon( fsd_job_t *self, const char * state , unsigned status)
+{
+	fsd_log_enter(( "" ));
+
+	self->exit_status = status;
+
+	if( strcmp(state,"JOB_STARTED") == 0)
+	{
+		self->state = DRMAA_PS_RUNNING;
+	}
+	else if( strcmp(state,"JOB_COMPLETED") == 0)
+	{
+		self->state = DRMAA_PS_DONE;
+	}
+	else if( strcmp(state,"JOB_VACATED") == 0 )
+	{
+		if( ((lldrmaa_session_t*) self->session)->terminate_job_on_vacated )
+		{
+			lldrmaa_job_control(self, DRMAA_CONTROL_TERMINATE);
+		}
+		self->state = DRMAA_PS_FAILED;
+	}
+	else if( strcmp(state,"JOB_REJECTED") == 0)
+	{
+		self->state = DRMAA_PS_FAILED;
+	}
+	else if( strcmp(state,"JOB_REMOVED") == 0)
+	{
+		self->state = DRMAA_PS_FAILED;
+	}
+	else if( strcmp(state,"JOB_NOTRUN") == 0)
+	{
+		self->state = DRMAA_PS_FAILED;
+	}
+	else
+	{
+		fsd_log_error(("state = %s, assert(0)",state));
+		fsd_assert(false);
+	}
+
+	fsd_log_info(("state: %s -> %s",state, drmaa_job_ps_to_str(self->state)));
+
+	if( self->state >= DRMAA_PS_DONE )
+		fsd_cond_broadcast( &self->status_cond );
+
+	fsd_log_return(( "" ));
+}
+
+static void
+lldrmaa_job_update_status( fsd_job_t *self )
+{
+	enum StepState step_state;
+	enum HoldType hold_type;
+	int rc;
+	int  obj_count,err_code;
+	LL_element * job=NULL,*data=NULL,*step=NULL;
+	char **host_list = NULL;
+	lldrmaa_job_t *llself = (lldrmaa_job_t*) self;
+
+	fsd_log_enter(( "({job_id=%s})", self->job_id ));
+
+	fsd_mutex_lock( &self->session->drm_connection_mutex );
+	TRY
+	{
+		fsd_log_debug(( "drm connection locked" ));
+		job = ll_query(JOBS);
+		if (!job) {
+				fsd_exc_raise_msg(FSD_ERRNO_INTERNAL_ERROR,
+							"ll_query() returns NULL. The subroutine was unable to create the appropriate pointer.");
+		}
+
+		fsd_calloc(host_list, 2, char *);
+		host_list[0] = fsd_strdup(self->job_id);
+		host_list[1] = NULL;
+
+		fsd_log_debug(("host_list[0]: %s",host_list[0]));
+
+		rc = ll_set_request(job,QUERY_STEPID,host_list,ALL_DATA);
+		if (rc) {
+				fsd_exc_raise_fmt(lldrmaa_map_set_request(rc),
+							"ll_set_request() return code is non-zero. %s",lldrmaa_err_set_request(rc));
+		}
+
+		data = ll_get_objs(job, LL_SCHEDD, NULL, &obj_count, &err_code);
+		if (data == NULL) {
+			fsd_log_debug(("Code: %d ll_get_objs() returns NULL. %s",lldrmaa_map_get_objs(err_code), lldrmaa_err_get_objs(err_code) ));
+			/* This error means that there is no info in LL_SCHEDD but this job have probably ended and will be detected by wait_thread. This won't be fsd_log_warning because displays too often during program execution */
+		} else {
+
+			rc = ll_get_data(data, LL_JobGetFirstStep, &step);
+			if(rc)
+			{
+				fsd_exc_raise_fmt(lldrmaa_map_get_data(rc),
+							"ll_get_data() return code is non-zero. %s",lldrmaa_err_get_data(rc));
+			}
+
+			rc = ll_get_data(step, LL_StepState,&step_state);
+			if (rc) {
+				fsd_exc_raise_fmt(lldrmaa_map_get_data(rc),
+							"ll_get_data() return code is non-zero. %s",lldrmaa_err_get_data(rc));
+			}
+
+			rc = ll_get_data(step, LL_StepHoldType, &hold_type);
+			if (rc) {
+				fsd_exc_raise_fmt(lldrmaa_map_get_data(rc),
+							"ll_get_data() return code is non-zero. %s",lldrmaa_err_get_data(rc));
+			}
+
+			llself->read_job_info( self, step_state, hold_type);
+
+			fsd_log_info(("LL State: %d -> DRMAA: %s",step_state,drmaa_job_ps_to_str(self->state)));
+		}
+	}
+	FINALLY
+	{
+		if(job!=NULL)
+		{
+			ll_free_objs(job);
+			ll_deallocate(job);
+		}
+		if(data!=NULL)
+		{
+			ll_free_objs(data);
+			ll_deallocate(data);
+		}
+		if(step!=NULL)
+		{
+			ll_free_objs(step);
+			ll_deallocate(step);
+		}
+		if(host_list!=NULL)
+			fsd_free_vector (host_list);
+
+		fsd_mutex_unlock( &self->session->drm_connection_mutex );
+	}
+	END_TRY
+
+	fsd_log_return(( "" ));
+}
+
+fsd_job_t *
+lldrmaa_job_new( char *job_id )
+{
+	lldrmaa_job_t *self = NULL;
+	self = (lldrmaa_job_t*)fsd_job_new( job_id );
+	fsd_realloc( self, 1, lldrmaa_job_t );
+	self->super.control = lldrmaa_job_control;
+	self->super.update_status = lldrmaa_job_update_status;
+	self->read_job_info_mon = lldrmaa_job_read_job_info_mon;
+	self->read_job_info = lldrmaa_job_read_job_info;
+	return (fsd_job_t*)self;
+}
+
+char *
+lldrmaa_job_create_req(
+		fsd_drmaa_session_t *session,
+		const fsd_template_t *jt,
+		fsd_environ_t **envp,
+		unsigned bulk,
+		int start,
+		int incr
+		)
+{
+	char *volatile cmd_file = NULL;
+	fsd_expand_drmaa_ph_t *volatile expand = NULL;
+	TRY
+	 {
+		expand = fsd_expand_drmaa_ph_new( NULL, NULL, fsd_strdup("0") );
+		cmd_file = (char *) lldrmaa_job_create_command_file( session, jt, envp, expand, bulk, start, incr );
+	 }
+	EXCEPT_DEFAULT
+	 {
+		remove(cmd_file);
+		fsd_exc_reraise();
+	 }
+	FINALLY
+	 {
+		if( expand )
+			expand->destroy( expand );
+	 }
+	END_TRY
+	return cmd_file;
+}
+
+
+static char *
+internal_map_file( fsd_expand_drmaa_ph_t *expand, const char *path,
+		bool *host_given, const char *name )
+{
+	const char *p;
+	for( p = path;  *p != ':';  p++ )
+		if( *p == '\0' )
+			fsd_exc_raise_fmt( FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_FORMAT,
+							"invalid format of drmaa_%s_path: missing colon", name );
+	if( host_given )
+		*host_given = ( p != path );
+	p++;
+	return expand->expand( expand, fsd_strdup(p),
+			FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD | FSD_DRMAA_PH_INCR );
+}
+
+char *
+lldrmaa_job_create_command_file(
+		fsd_drmaa_session_t *session,
+		const fsd_template_t *jt,
+		fsd_environ_t **envp,
+		fsd_expand_drmaa_ph_t *expand,
+		unsigned n_jobs,
+		int start,
+		int incr
+		)
+{
+	char template_cmd[] = "/tmp/drmaa_cmd_XXXXXX";
+	int fdt;
+	FILE * fd;
+
+
+	if((fdt = mkstemp(template_cmd) ) == -1)
+	{
+		fsd_log_error(("Can't create cmd file"));
+		fsd_exc_raise_msg(FSD_ERRNO_INTERNAL_ERROR,"Can't create cmd file");
+	}
+	close(fdt);
+
+	if((fd = fopen(template_cmd,"w") ) != NULL )
+	{
+		const char *input_path_orig = NULL;
+		const char *output_path_orig = NULL;
+		const char *error_path_orig = NULL;
+		char *volatile input_path = NULL;
+		char *volatile output_path = NULL;
+		char *volatile error_path = NULL;
+		bool input_host = false;
+		bool output_host = false;
+		bool error_host = false;
+		bool join_files = false;
+		const char *value;
+		const char *const *vector;
+		const char *job_category = "default";
+		fsd_log_debug(("Cmd file: %s opened",template_cmd));
+		fprintf(fd,"# File created by LoadLeveler DRMAA. If no LL DRMAA applications are running you can delete this file\n");
+
+		/* job name */
+		value = jt->get_attr( jt, DRMAA_JOB_NAME );
+		if( value )
+		{
+			fprintf(fd,"# @ job_name = %s\n",value);
+			fsd_log_debug(("# @ job_name = %s",value));
+		}
+
+		/* job state at submit */
+		value = jt->get_attr( jt, DRMAA_JS_STATE );
+		if( value )
+	 	{
+			if( 0 == strcmp( value, DRMAA_SUBMISSION_STATE_ACTIVE ) )
+			{}
+			else if( 0 == strcmp( value, DRMAA_SUBMISSION_STATE_HOLD ) )
+			{
+				fprintf(fd,"# @ hold = user\n");
+				fsd_log_debug(("# @ hold = user"));
+			}
+			else
+				fsd_exc_raise_msg(
+					FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
+					"invalid value of drmaa_js_state attribute" );
+	 	}
+
+		TRY
+		{
+			const char *command = NULL;
+			char *command_expanded = NULL;
+			const char *const *i;
+			int j;
+
+			/* remote command */
+			command = jt->get_attr( jt, DRMAA_REMOTE_COMMAND );
+			if( command == NULL )
+				fsd_exc_raise_msg(
+						FSD_DRMAA_ERRNO_CONFLICTING_ATTRIBUTE_VALUES,
+						"drmaa_remote_command not set for job template"
+						);
+
+			command_expanded = expand->expand( expand, fsd_strdup(command), FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD );
+
+			fprintf(fd,"# @ executable = %s\n", command_expanded);
+			fsd_log_debug(("# @ executable = %s\n", command_expanded));
+
+			fsd_free(command_expanded);
+
+			/* arguments list */
+			vector = jt->get_v_attr( jt, DRMAA_V_ARGV );
+
+			if( vector )
+		 	{
+				fprintf(fd,"# @ arguments =");
+				fsd_log_debug(("# @ arguments ="));
+
+				for( i = vector, j = 2;  *i;  i++, j++ )
+				{
+					char *arg_expanded = expand->expand( expand, fsd_strdup(*i), FSD_DRMAA_PH_HD | FSD_DRMAA_PH_WD );
+
+					fprintf(fd," '%s'", arg_expanded);
+					fsd_log_debug(("%s", arg_expanded));
+
+					fsd_free(arg_expanded);
+				}
+			}
+
+			fprintf(fd," \n");
+		}
+		END_TRY
+
+		/* start time */
+		value = jt->get_attr( jt, DRMAA_START_TIME );
+		if( value )
+	 	{
+			char buf[30];
+			const time_t time_ll = fsd_datetime_parse( value );
+			struct tm temp;
+			localtime_r(&time_ll,&temp);
+ 			strftime(buf, sizeof(buf),"%m/%d/%Y %H:%M:%S", &temp );
+			fprintf(fd,"# @ startdate = %s\n", buf);
+			fsd_log_debug(("# @ startdate = %s", buf));
+			fsd_log_debug(( "\n  drmaa_start_time: %s -> %ld",	value, (long)time_ll ));
+		 }
+
+		/* environment */
+		vector = jt->get_v_attr( jt, DRMAA_V_ENV );
+		if( vector )
+		{
+			const char *const *i;
+
+			fprintf(fd,"# @ environment =");
+			fsd_log_debug(("# @ environment ="));
+			for( i = vector;  *i;  i++ )
+	 		{
+				fprintf(fd," %s;",*i);
+				fsd_log_debug((" %s;",*i));
+			}
+			fprintf(fd," \n");
+		 }
+
+		 /* wall clock time soft and hard limit */
+		{
+		 	const char *value2;
+			value = jt->get_attr( jt, DRMAA_WCT_SLIMIT );
+			value2 = jt->get_attr( jt, DRMAA_WCT_HLIMIT );
+			if( value && value2)
+			{
+				fprintf(fd,"# @ wall_clock_limit = %s,%s\n",value,value2);
+				fsd_log_debug(("# @ wall_clock_limit = %s,%s",value,value2));
+			}
+			else if (value)
+			{
+				fprintf(fd,"# @ wall_clock_limit = %s\n",value);
+				fsd_log_debug(("# @ wall_clock_limit = %s",value));
+			}
+			else if (value2)
+			{
+				fprintf(fd,"# @ wall_clock_limit = ,%s\n",value);
+				fsd_log_debug(("# @ wall_clock_limit = ,%s",value));
+			}
+		}
+
+		/* native specification */
+		value = jt->get_attr( jt, DRMAA_NATIVE_SPECIFICATION );
+		if( value )
+		{
+			char * temp = fsd_strdup(value);
+			temp = fsd_replace(temp,"@","\n# $"); /* infinite loop when try replace @ with # @ */
+			temp = fsd_replace(temp,"# $","# @ ");
+
+			fprintf(fd,"# Native specification:%s\n", temp);
+			fsd_log_debug(("Native specification:%s", temp));
+			fsd_free(temp);
+		}
+
+		/* job category */
+		value = jt->get_attr( jt, DRMAA_JOB_CATEGORY );
+		if( value )
+			job_category = value;
+
+		{
+			char * temp;
+			fsd_conf_option_t *category_value = NULL;
+			category_value = fsd_conf_dict_get( session->job_categories, job_category );
+			if( category_value != NULL )
+		 	{
+				if( category_value->type != FSD_CONF_STRING )
+					fsd_exc_raise_fmt(
+							FSD_ERRNO_INTERNAL_ERROR,
+							"configuration error: job category should be string"
+							);
+
+				temp = fsd_strdup(category_value->val.string);
+				temp = fsd_replace(temp,"@","\n# $"); /* infinite loop when try replace @ with # @ */
+				temp = fsd_replace(temp,"# $","# @ ");
+
+				fprintf(fd,"# Job category:%s\n", temp);
+				fsd_log_debug(("Job category:\n%s",temp));
+				fsd_free(temp);
+		 	}
+			else
+		 	{
+				if( value != NULL )
+					fsd_exc_raise_fmt(
+							FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
+							"invalid job category: %s", job_category
+							);
+		 	}
+	 	}
+
+
+		{
+			unsigned i;
+			for(i=0;i<n_jobs;i++)
+			{
+				expand->set(expand, FSD_DRMAA_PH_INCR,fsd_asprintf("%d", start+incr*i)); /* set current value */
+
+				/* job working directory */
+				value = jt->get_attr( jt, DRMAA_WD );
+				if( value )
+				{
+					char *cwd_expanded = expand->expand( expand, fsd_strdup(value), FSD_DRMAA_PH_HD | FSD_DRMAA_PH_INCR );
+
+					expand->set( expand, FSD_DRMAA_PH_WD, fsd_strdup(cwd_expanded));
+					fprintf(fd,"# @ initialdir = %s\n",cwd_expanded);
+					fsd_log_debug(("# @ initialdir = %s",cwd_expanded));
+
+					fsd_free(cwd_expanded);
+		 		}
+
+				TRY
+			 	{
+					/* input path */
+					input_path_orig = jt->get_attr( jt, DRMAA_INPUT_PATH );
+					if( input_path_orig )
+					{
+						input_path = internal_map_file( expand, input_path_orig, &input_host,
+										"input" );
+						fsd_log_debug(( "\n  drmaa_input_path: %s -> %s",
+									input_path_orig, input_path ));
+					}
+
+					/* output path */
+					output_path_orig = jt->get_attr( jt, DRMAA_OUTPUT_PATH );
+					if( output_path_orig )
+					{
+						output_path = internal_map_file( expand, output_path_orig, &output_host,
+										"output" );
+						fsd_log_debug(( "\n  drmaa_output_path: %s -> %s",
+										output_path_orig, output_path ));
+					}
+
+					/* error path */
+					error_path_orig = jt->get_attr( jt, DRMAA_ERROR_PATH );
+					if( error_path_orig )
+					{
+						error_path = internal_map_file( expand, error_path_orig, &error_host,
+										"error" );
+						fsd_log_debug(( "\n  drmaa_error_path: %s -> %s",
+									error_path_orig, error_path ));
+					}
+
+					/* join files */
+					value = jt->get_attr( jt, DRMAA_JOIN_FILES );
+					if( value )
+					{
+						if( (value[0] == 'y' || value[0] == 'Y')  &&  value[1] == '\0' )
+							join_files = true;
+						else if( (value[0] == 'n' || value[0] == 'N')  &&  value[1] == '\0' )
+							join_files = false;
+						else
+							fsd_exc_raise_msg(
+									FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
+									"invalid value of drmaa_join_files attribute" );
+					}
+
+					if( join_files )
+					{
+						if( output_path == NULL )
+							fsd_exc_raise_msg(
+									FSD_DRMAA_ERRNO_CONFLICTING_ATTRIBUTE_VALUES,
+									"drmaa_join_files is set and output file is not given" );
+						if( error_path!=NULL && 0 != strcmp( output_path, error_path ) )
+							fsd_log_warning(( "Error file was given but will be ignored "
+										"since drmaa_join_files was set." ));
+
+						if (error_path)
+							fsd_free(error_path);
+
+						 error_path = fsd_strdup(output_path);
+					}
+					else
+					{
+						if( error_path == NULL  &&  output_path )
+							error_path = fsd_strdup( "/dev/null" );
+						if( output_path == NULL  &&  error_path )
+							output_path = fsd_strdup( "/dev/null" );
+					}
+
+
+					/* email addresses to send notifications */
+					vector = jt->get_v_attr( jt, DRMAA_V_EMAIL );
+					if( vector  &&  vector[0] )
+					{
+						/* only to one email address message may be send */
+						fprintf(fd,"# @ notify_user = %s\n",vector[0]);
+						fsd_log_debug(("# @ notify_user = %s\n",vector[0]));
+						if( vector[1] != NULL )
+						{
+							fsd_log_error(( "LL only supports one e-mail "
+										"notification address" ));
+							fsd_exc_raise_msg(FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,"LL only supports one e-mail "
+										"notification address");
+						}
+					}
+
+					/* block email */
+					value = jt->get_attr( jt, DRMAA_BLOCK_EMAIL );
+					if( value )
+					{
+						bool block;
+						if( strcmp(value, "0") == 0 )
+						{
+							block = true;
+							fprintf(fd,"# @ notification = never\n");
+							fsd_log_debug(("# @ notification = never"));
+						}
+						else if( strcmp(value, "1") == 0 )
+							block = false;
+						else
+							fsd_exc_raise_msg(
+									FSD_DRMAA_ERRNO_INVALID_ATTRIBUTE_VALUE,
+									"invalid value of drmaa_block_email attribute" );
+
+						if( block && output_path == NULL )
+						{
+							fsd_log_debug(( "output path not set and we want to block e-mail, "
+										"set to /dev/null" ));
+							output_path = fsd_strdup( "/dev/null" );
+						}
+					}
+
+					if( input_path )
+					{
+						fprintf(fd,"# @ input = %s\n", input_path);
+						fsd_log_debug(("# @ input = %s", input_path));
+					}
+
+					if( output_path )
+					{
+						fprintf(fd,"# @ output = %s\n", output_path);
+						fsd_log_debug(("# @ output = %s", output_path));
+					}
+
+					if( error_path )
+					{
+						fprintf(fd,"# @ error = %s\n", error_path);
+						fsd_log_debug(("# @ error = %s", error_path));
+				 	}
+			 	}
+				FINALLY
+			 	{
+					fsd_free( input_path );
+					fsd_free( output_path );
+					fsd_free( error_path );
+					input_path = NULL;
+					output_path = NULL;
+					error_path = NULL;
+			 	}
+				END_TRY
+
+				fprintf(fd,"# @ queue\n");
+				fsd_log_debug(("# @ queue"));
+			}
+		}
+
+		fclose(fd);
+	}
+	else
+	{
+		fsd_log_error(("Can't create cmd file"));
+		fsd_exc_raise_msg(FSD_ERRNO_INTERNAL_ERROR,"Can't create cmd file");
+	}
+
+	return fsd_strdup(template_cmd);
+}
+
Index: branches/ll-drmaa-1.0.0/ll_drmaa/util.c
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/util.c	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/util.c	(revision 20)
@@ -0,0 +1,475 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <drmaa_utils/common.h>
+#include <drmaa_utils/exception.h>
+#include <ll_drmaa/util.h>
+#include <string.h>
+
+#ifndef lint
+static char rcsid[]
+#	ifdef __GNUC__
+		__attribute__ ((unused))
+#	endif
+	= "$Id$";
+#endif
+
+
+const char *
+lldrmaa_err_ckpt(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return "Checkpoint completed successfully.";
+		case LL_CKPT_UNCLEAR:
+			return "Checkpoint event did not receive status and the success or failure of the checkpoint is unclear.";
+		case LL_CKPT_ERROR:
+			return "Error occurred attempting to checkpoint.";
+		case LL_CKPT_JOB_ID_ERR:
+			return "Format not valid for job step, not in the form host.jobid.stepid.";
+		case LL_CKPT_MALLOC_ERR:
+			return "Cannot allocate memory.";
+		case LL_CKPT_SOCKET_ERR:
+			return "API cannot create listen socket.";
+		case LL_CKPT_CONF_ERR:
+			return "Configuration file errors.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_ckpt(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return FSD_ERRNO_SUCCESS;
+		case LL_CKPT_UNCLEAR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CKPT_ERROR:
+			return FSD_DRMAA_ERRNO_SUSPEND_INCONSISTENT_STATE;
+		case LL_CKPT_JOB_ID_ERR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CKPT_MALLOC_ERR:
+			return FSD_ERRNO_NO_MEMORY;
+		case LL_CKPT_SOCKET_ERR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CKPT_CONF_ERR:
+			return FSD_ERRNO_DENIED_BY_DRM;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+const char *
+lldrmaa_err_control(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case LL_CONTROL_OK:
+			return "The specified command has been sent to the appropriate LoadLeveler daemon.";
+		case LL_CONTROL_CM_ERR:
+			return "The specified command cannot be sent to the central manager.";
+		case LL_CONTROL_MASTER_ERR:
+			return "The specified command cannot be sent to one of the LoadL_master daemons.";
+		case LL_CONTROL_CONFIG_ERR:
+			return "ll_control encountered an error while processing the administration or configuration file.";
+		case LL_CONTROL_XMIT_ERR:
+			return "A data transmission failure has occurred.";
+		case LL_CONTROL_AUTH_ERR :
+			return "The calling program does not have LoadLeveler administrator authority.";
+		case LL_CONTROL_VERSION_ERR:
+			return "An incorrect ll_control version has been specified.";
+		case LL_CONTROL_SYSTEM_ERR:
+			return "A system error has occurred.";
+		case LL_CONTROL_MALLOC_ERR:
+			return "The system cannot allocate memory.";
+		case LL_CONTROL_INVALID_OP_ERR:
+			return "A control_op operation that is not valid has been specified.";
+		case LL_CONTROL_JOB_LIST_ERR:
+			return "The job_list argument contains one or more errors.";
+		case LL_CONTROL_HOST_LIST_ERR:
+			return "The host_list argument contains one or more errors.";
+		case LL_CONTROL_USER_LIST_ERR:
+			return "The user_list argument contains one or more errors.";
+		case LL_CONTROL_HOLD_ERR:
+			return "Incompatible arguments have been specified for HOLD operation.";
+		case LL_CONTROL_PRIO_ERR:
+			return "Incompatible arguments have been specified for PRIORITY operation.";
+		case LL_CONTROL_FAVORJOB_ERR:
+			return "Incompatible arguments have been specified for FAVORJOB operation.";
+		case LL_CONTROL_FAVORUSER_ERR:
+			return "Incompatible arguments have been specified for FAVORUSER operation.";
+		case LL_CONTROL_SYS_ERR:
+			return "An error occurred while ll_control tried to start a child process.";
+		case LL_CONTROL_START_ERR:
+			return "An error occurred while ll_control tried to start the LoadL_master daemon.";
+		case LL_CONTROL_UNUSED_1_ERR:
+			return "Unused";
+		case LL_CONTROL_CLASS_ERR:
+			return "The class_list argument contains incompatible information.";
+		case LL_CONTROL_TMP_ERR:
+			return "ll_control cannot create a file in the /tmp directory.";
+		case LL_CONTROL_ERR:
+			return "LoadLeveler has encountered miscellaneous incompatible input specifications.";
+		case LL_CONTROL_NO_DCE_ID:
+			return "DCE identity can not be determined.";
+		case LL_CONTROL_NO_DCE_CRED:
+			return "No DCE credentials.";
+		case LL_CONTROL_INSUFFICIENT_DCE_CRED:
+			return "DCE credentials within 300 secs of expiration.";
+		case LL_CONTROL_64BIT_DCE_ERR:
+			return "64-bit API not supported when DCE is enabled";
+		case LL_CONTROL_NO_DCE_SUPPORT_ERR:
+			return "This version of LL does not support DCE security.";
+		case LL_CONTROL_NO_CTSEC_SUPPORT_ERR:
+			return "This version of LL does not support CTSEC security.";
+		case LL_CONTROL_NO_GANG_SUPPORT_ERR:
+			return "This version of LL does not support GANG scheduling.";
+		case LL_CONTROL_NO_PVM_SUPPORT_ERR:
+			return "This version of LL does not support PVM.";
+		case LL_CONTROL_NO_NQS_SUPPORT_ERR:
+			return "This version of LL does not support NQS.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_control(int _llerrno)
+{
+	switch( _llerrno )
+	 {
+		case LL_CONTROL_OK:                      /* Command successfully sent to appropriate LL daemon. */
+			return FSD_ERRNO_SUCCESS;
+		case LL_CONTROL_CM_ERR: 				 /* Cannot send command to central manager. */
+		case LL_CONTROL_MASTER_ERR:				 /* Cannot send command to one of LoadL_master daemons. */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CONTROL_CONFIG_ERR: 			 /* Errors encountered while processing the LL admin/config files. */
+			return FSD_ERRNO_DENIED_BY_DRM;
+		case LL_CONTROL_XMIT_ERR: 				 /* A data transmission failure occurred. */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CONTROL_AUTH_ERR:   			 /* Calling program does not have LL administrator authority. */
+			return FSD_ERRNO_AUTHZ_FAILURE;
+		case LL_CONTROL_VERSION_ERR: 			 /* An incorrect ll_control version has been specified. */
+		case LL_CONTROL_SYSTEM_ERR:  			 /* A system error occurred. */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case LL_CONTROL_MALLOC_ERR:  			 /* Unable to allocate memory. */
+			return FSD_ERRNO_NO_MEMORY;
+		case LL_CONTROL_INVALID_OP_ERR: 		 /* An invalid control_op operation has been specified. */
+		case LL_CONTROL_JOB_LIST_ERR:  			 /* job_list argument contains one or more errors. */
+		case LL_CONTROL_HOST_LIST_ERR:  		 /* host_list argument contains one or more errors. */
+		case LL_CONTROL_USER_LIST_ERR: 			 /* user_list argument contains one or more errors. */
+		case LL_CONTROL_HOLD_ERR:  				 /* Incompatible arguments specified for HOLD operation. */
+		case LL_CONTROL_PRIO_ERR: 				 /* Incompatible arguments specified for PRIORITY operation. */
+		case LL_CONTROL_FAVORJOB_ERR: 			 /* Incompatible arguments specified for FAVORJOB operation. */
+		case LL_CONTROL_FAVORUSER_ERR: 			 /* Incompatible arguments specified for FAVORUSER operation. */
+		case LL_CONTROL_SYS_ERR:  			  	 /* An error occurred while trying to start a child process. */
+		case LL_CONTROL_START_ERR: 				 /* An error occurred while trying to start the LoadL_master daemon. */
+		case LL_CONTROL_UNUSED_1_ERR:
+		case LL_CONTROL_CLASS_ERR:  			 /* class_list argument contains incompatible information. */
+		case LL_CONTROL_TMP_ERR:  				 /* Unable to create a file in /tmp directory. */
+		case LL_CONTROL_ERR:  					 /* Miscellaneous incompatible input specifications. */
+		case LL_CONTROL_NO_DCE_ID:  			 /* DCE identity can not be determined. */
+		case LL_CONTROL_NO_DCE_CRED:  		 	 /* No DCE credentials. */
+		case LL_CONTROL_INSUFFICIENT_DCE_CRED:    /* DCE credentials within 300 secs of expiration. */
+		case LL_CONTROL_64BIT_DCE_ERR:  			 /* 64-bit API not supported when DCE is enabled */
+		case LL_CONTROL_NO_DCE_SUPPORT_ERR:       /* This version of LL does not support DCE security. */
+		case LL_CONTROL_NO_CTSEC_SUPPORT_ERR: 	 /* This version of LL does not support CTSEC security. */
+		case LL_CONTROL_NO_GANG_SUPPORT_ERR:   	 /* This version of LL does not support GANG scheduling. */
+		case LL_CONTROL_NO_PVM_SUPPORT_ERR:    	 /* This version of LL does not support PVM. */
+		case LL_CONTROL_NO_NQS_SUPPORT_ERR:    	 /* This version of LL does not support NQS. */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+
+const char *
+lldrmaa_err_get_data(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK :
+			return "Operation successful";
+		case API_INVALID_INPUT:
+			return "You specified an object that is not valid.";
+		case LL_GET_DATA_NOT_VALID_LLAPI_SPECIFICATION_ERR:
+			return "You specified an LLAPI_Specification that is not valid.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_get_data(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK :                /* API call runs to complete */
+			return FSD_ERRNO_SUCCESS;
+		case API_INVALID_INPUT:      /* Invalid input */
+		case LL_GET_DATA_NOT_VALID_LLAPI_SPECIFICATION_ERR:    /* input not valid */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+const char *
+lldrmaa_err_get_objs(int _llerrno)
+{
+	switch( _llerrno )
+	{
+		case API_OK:
+			return "Operation successful";
+		case LL_GET_OBJS_QUERY_ELEMENT_NOT_VALID_ERR:
+			return "query_element not valid.";
+		case LL_GET_OBJS_QUERY_DEAMON_NOT_VALID_ERR:
+			return "query_daemon not valid.";
+		case LL_GET_OBJS_HOSTNAME_ERR:
+			return "Cannot resolve hostname.";
+		case LL_GET_OBJS_INVALID_REQUEST_ERR:
+			return "Request type for specified daemon not valid.";
+		case LL_GET_OBJS_SYS_ERR:
+			return "System error.";
+		case LL_GET_OBJS_NO_OBJECTS_ERR:
+			return "No valid objects meet the request.";
+		case LL_GET_OBJS_CONF_ERR:
+			return "Configuration error.";
+		case LL_GET_OBJS_DEAMON_CONNECTION_ERR:
+			return "Connection to daemon failed.";
+		case LL_GET_OBJS_HISTORY_F_PROCESS_ERR:
+			return "Error processing history file (LL_HISTORY_FILE query only).";
+		case LL_GET_OBJS_NO_HISTORY_FILE:
+			return "History file must be specified in the hostname argument (LL_HISTORY_FILE query only).";
+		case LL_GET_OBJS_HISTORY_F_NO_ACCES_ERR:
+			return "Unable to access the history file (LL_HISTORY_FILE query only).";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_get_objs(int _llerrno)
+{
+	switch( _llerrno )
+	{
+		case API_OK:								/* API call runs to complete */
+			return FSD_ERRNO_SUCCESS;
+		case LL_GET_OBJS_QUERY_ELEMENT_NOT_VALID_ERR:						/* Invalid input */
+		case LL_GET_OBJS_QUERY_DEAMON_NOT_VALID_ERR:					/* input not valid */
+		case LL_GET_OBJS_HOSTNAME_ERR:
+		case LL_GET_OBJS_INVALID_REQUEST_ERR:
+		case LL_GET_OBJS_SYS_ERR:
+		case LL_GET_OBJS_NO_OBJECTS_ERR:
+			return FSD_DRMAA_ERRNO_INVALID_JOB ; /* "No valid objects meet the request." */
+		case LL_GET_OBJS_CONF_ERR:
+			return FSD_ERRNO_DENIED_BY_DRM;
+		case LL_GET_OBJS_DEAMON_CONNECTION_ERR:
+			return FSD_ERRNO_DRM_COMMUNICATION_FAILURE;
+		case LL_GET_OBJS_HISTORY_F_PROCESS_ERR:
+		case LL_GET_OBJS_NO_HISTORY_FILE:
+		case LL_GET_OBJS_HISTORY_F_NO_ACCES_ERR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+const char *
+lldrmaa_err_set_request(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return "Operation successful";
+		case API_INVALID_INPUT:
+			return "You specified a query_element that is not valid.";
+		case LL_SET_REQUEST_QUERY_FLAG_NOT_VALID_ERR:
+			return "You specified a query_flag that is not valid.";
+		case LL_SET_REQUEST_OBJ_FILTER_NOT_VALID_ERR:
+			return "You specified an object_filter that is not valid.";
+		case LL_SET_REQUEST_DATA_FILTER_NOT_VALID_ERR:
+			return "You specified a data_filter that is not valid.";
+		case LL_SET_REQUEST_SYS_ERR:
+			return "A system error occurred.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_set_request(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:                           /* API call runs to complete */
+			return FSD_ERRNO_SUCCESS;
+		case API_INVALID_INPUT:                /* Invalid input */
+		case LL_SET_REQUEST_QUERY_FLAG_NOT_VALID_ERR:
+		case LL_SET_REQUEST_OBJ_FILTER_NOT_VALID_ERR:
+		case LL_SET_REQUEST_DATA_FILTER_NOT_VALID_ERR:
+		case LL_SET_REQUEST_SYS_ERR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+
+const char *
+lldrmaa_err_preempt_jobs(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return "Request successfully sent to the central manager.";
+		case API_INVALID_INPUT:
+			return "An LL_preempt_op that is not valid was specified.";
+		case API_CANT_CONNECT:
+			return "Cannot send request to central manager.";
+		case LL_PREEMPT_JOBS_VERSION_ERR:
+			return "An incorrect version was specified.";
+		case API_CONFIG_ERR :
+			return "Errors encountered while processing the LoadLeveler administration or configuration files.";
+		case LL_PREEMPT_JOBS_SYS_ERR:
+			return "A system error occurred.";
+		case API_CANT_TRANSMIT:
+			return "A data transmission failure occurred.";
+		case API_CANT_AUTH:
+			return "The calling program does not have LoadLeveler administrator authority.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_preempt_jobs(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:						/* API call runs to complete */
+			return FSD_ERRNO_SUCCESS;
+		case API_INVALID_INPUT:				/* Invalid input */
+			return FSD_ERRNO_INVALID_ARGUMENT;
+		case API_CANT_CONNECT:				/* can't connect to daemon */
+		case LL_PREEMPT_JOBS_VERSION_ERR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case API_CONFIG_ERR:				/* Error from init_params() */
+			return FSD_ERRNO_DENIED_BY_DRM;
+		case LL_PREEMPT_JOBS_SYS_ERR:
+		case API_CANT_TRANSMIT:				/* xdr error */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case API_CANT_AUTH:					/* can't authorize */
+			return FSD_ERRNO_AUTHZ_FAILURE;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+const char * lldrmaa_err_submit(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return "The job was submitted successfully.";
+		case LL_SUBMIT_ERROR:
+			return "Error, error messages written to stderr.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int lldrmaa_map_submit(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:			/* API call runs to complete */
+			return FSD_ERRNO_SUCCESS;
+		case LL_SUBMIT_ERROR:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+const char *
+lldrmaa_err_terminate_job(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return "Operation successful";
+		case API_INVALID_INPUT:
+			return "There is an error in the input parameter.";
+		case API_CONFIG_ERR:
+			return "An error occurred reading parameters from the administration or the configuration file.";
+		case API_CANT_TRANSMIT:
+			return "A data transmission failure occurred.";
+		case API_CANT_AUTH:
+			return "The subroutine cannot authorize the action because you are not a LoadLeveler administrator or you are not the user who submitted the job.";
+		case API_WRNG_PROC_VERSION:
+			return "The job object version number is incorrect.";
+		default:
+			fsd_assert(false);
+			return "Invalid error code";
+	}
+}
+
+int
+lldrmaa_map_terminate_job(int _llerrno)
+{
+	switch(_llerrno)
+	{
+		case API_OK:
+			return FSD_ERRNO_SUCCESS;		/* API call runs to complete */
+		case API_INVALID_INPUT:
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case API_CONFIG_ERR: /* Error from init_params() */
+			return FSD_ERRNO_DENIED_BY_DRM;
+		case API_CANT_TRANSMIT:				/* xdr error */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		case API_CANT_AUTH:					/* can't authorize */
+			return FSD_ERRNO_AUTHZ_FAILURE;
+		case API_WRNG_PROC_VERSION:			/* Wrong proc version */
+			return FSD_ERRNO_INTERNAL_ERROR;
+		default:
+			fsd_assert(false);
+			return FSD_ERRNO_INTERNAL_ERROR;
+	}
+}
+
+
Index: branches/ll-drmaa-1.0.0/ll_drmaa/job.h
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/job.h	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/job.h	(revision 20)
@@ -0,0 +1,47 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LL_DRMAA__JOB_H
+#define __LL_DRMAA__JOB_H
+
+#ifdef HAVE_CONFIG_H
+#	include <config.h>
+#endif
+
+#include <drmaa_utils/job.h>
+#include <drmaa_utils/environ.h>
+
+#include <llapi.h>
+
+typedef struct lldrmaa_job_s lldrmaa_job_t;
+
+fsd_job_t *
+lldrmaa_job_new(char *job_id );
+
+struct lldrmaa_job_s {
+	fsd_job_t super;
+
+	void (*read_job_info_mon)( fsd_job_t *self, const char * state , unsigned status);
+	void (*read_job_info)( fsd_job_t *self, enum StepState step_state, enum HoldType hold_type );
+};
+
+char* lldrmaa_job_create_req(fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, unsigned bulk, int start, int incr);
+char* lldrmaa_job_create_command_file( fsd_drmaa_session_t *session, const fsd_template_t *jt, fsd_environ_t **envp, fsd_expand_drmaa_ph_t *expand, unsigned n_jobs, int start, int incr);
+
+#endif /* __LL_DRMAA__JOB_H */
+
Index: branches/ll-drmaa-1.0.0/ll_drmaa/util.h
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/util.h	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/util.h	(revision 20)
@@ -0,0 +1,77 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LL_DRMAA__UTIL_H
+#define __LL_DRMAA__UTIL_H
+
+#ifdef HAVE_CONFIG_H
+#	include <config.h>
+#endif
+
+#include <llapi.h>
+
+#define LL_CKPT_UNCLEAR 1
+#define LL_CKPT_ERROR -1
+#define LL_CKPT_JOB_ID_ERR -2
+#define LL_CKPT_MALLOC_ERR -3
+#define LL_CKPT_SOCKET_ERR -4
+#define LL_CKPT_CONF_ERR -6
+
+#define LL_GET_DATA_NOT_VALID_LLAPI_SPECIFICATION_ERR -2
+
+#define LL_GET_OBJS_QUERY_ELEMENT_NOT_VALID_ERR -1
+#define LL_GET_OBJS_QUERY_DEAMON_NOT_VALID_ERR -2
+#define LL_GET_OBJS_HOSTNAME_ERR -3
+#define LL_GET_OBJS_INVALID_REQUEST_ERR -4
+#define LL_GET_OBJS_SYS_ERR -5
+#define LL_GET_OBJS_NO_OBJECTS_ERR -6
+#define LL_GET_OBJS_CONF_ERR -7
+#define LL_GET_OBJS_DEAMON_CONNECTION_ERR -9
+#define LL_GET_OBJS_HISTORY_F_PROCESS_ERR -10
+#define LL_GET_OBJS_NO_HISTORY_FILE -11
+#define LL_GET_OBJS_HISTORY_F_NO_ACCES_ERR -12
+
+#define LL_SET_REQUEST_QUERY_FLAG_NOT_VALID_ERR -2
+#define LL_SET_REQUEST_OBJ_FILTER_NOT_VALID_ERR -3
+#define LL_SET_REQUEST_DATA_FILTER_NOT_VALID_ERR -4
+#define LL_SET_REQUEST_SYS_ERR -5
+
+#define LL_PREEMPT_JOBS_VERSION_ERR -3
+#define LL_PREEMPT_JOBS_SYS_ERR -5
+
+#define LL_SUBMIT_ERROR -1
+
+const char * lldrmaa_err_ckpt(int _llerrno);
+const char * lldrmaa_err_control(int _llerrno);
+const char * lldrmaa_err_get_data(int _llerrno);
+const char * lldrmaa_err_get_objs(int _llerrno);
+const char * lldrmaa_err_preempt_jobs(int _llerrno);
+const char * lldrmaa_err_set_request(int _llerrno);
+const char * lldrmaa_err_submit(int _llerrno);
+const char * lldrmaa_err_terminate_job(int _llerrno);
+
+int lldrmaa_map_ckpt(int _llerrno);
+int lldrmaa_map_control( int _llerrno );
+int lldrmaa_map_get_data(int _llerrno);
+int lldrmaa_map_get_objs(int _llerrno);
+int lldrmaa_map_preempt_jobs(int _llerrno);
+int lldrmaa_map_set_request(int _llerrno);
+int lldrmaa_map_submit(int _llerrno);
+int lldrmaa_map_terminate_job(int _llerrno);
+
+#endif /* __LL_DRMAA__UTIL_H */
Index: branches/ll-drmaa-1.0.0/ll_drmaa/session.c
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/session.c	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/session.c	(revision 20)
@@ -0,0 +1,455 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <signal.h>
+#include <assert.h>
+
+#include <drmaa_utils/drmaa.h>
+#include <drmaa_utils/iter.h>
+#include <drmaa_utils/conf.h>
+
+#include <ll_drmaa/job.h>
+#include <ll_drmaa/session.h>
+#include <ll_drmaa/util.h>
+
+#include <llapi.h>
+
+static char *lldrmaa_session_run_job(fsd_drmaa_session_t *self, const fsd_template_t *jt);
+
+static fsd_iter_t *lldrmaa_session_run_bulk(fsd_drmaa_session_t *self, const fsd_template_t *jt, int start, int end, int incr );
+
+static fsd_job_t *lldrmaa_session_new_job( fsd_drmaa_session_t *self,  const char *job_id );
+
+static void lldrmaa_session_apply_configuration( fsd_drmaa_session_t *self );
+
+static void lldrmaa_session_destroy_nowait(fsd_drmaa_session_t *self);
+
+static void *lldrmaa_session_wait_thread( fsd_drmaa_session_t *self );
+
+static void lldrmaa_create_unix_domain_socket(lldrmaa_session_t *self);
+
+fsd_drmaa_session_t *
+lldrmaa_session_new( const char *contact )
+{
+	lldrmaa_session_t *volatile self = NULL;
+
+	TRY
+	 {
+		self = (lldrmaa_session_t*)fsd_drmaa_session_new(contact);
+
+		fsd_realloc( self, 1, lldrmaa_session_t );
+		self->super.run_job = lldrmaa_session_run_job;
+		self->super.run_bulk = lldrmaa_session_run_bulk;
+		self->super.new_job = lldrmaa_session_new_job;
+		self->super.wait_thread = lldrmaa_session_wait_thread;
+
+		self->super_destroy_nowait = self->super.destroy_nowait;
+		self->super.destroy_nowait = lldrmaa_session_destroy_nowait;
+
+		self->super_apply_configuration = self->super.apply_configuration;
+		self->super.apply_configuration = lldrmaa_session_apply_configuration;
+
+		self->terminate_job_on_vacated = true;
+		self->unix_socket_name = NULL;
+		self->socket_fd = -1;
+
+		lldrmaa_create_unix_domain_socket(self);
+
+		/* This must be called after creating socket as wait thread tries to accept new connections on it*/
+		self->super.load_configuration( &self->super, "ll_drmaa" );
+	 }
+	EXCEPT_DEFAULT
+	 {
+		fsd_free( self );
+		fsd_exc_reraise();
+	 }
+	END_TRY
+	return (fsd_drmaa_session_t*)self;
+}
+
+
+char *
+lldrmaa_session_run_job(
+		fsd_drmaa_session_t *self,
+		const fsd_template_t *jt
+		)
+{
+	char *job_id = NULL;
+	fsd_iter_t *volatile job_ids = NULL;
+	TRY
+	 {
+		job_ids = self->run_bulk( self, jt, 0, 0, 0 ); /* single job run as bulk job specialization */
+		job_id = fsd_strdup( job_ids->next( job_ids ) );
+	 }
+	FINALLY
+	 {
+		if( job_ids )
+			job_ids->destroy( job_ids );
+	 }
+	END_TRY
+	return job_id;
+}
+
+fsd_iter_t *
+lldrmaa_session_run_bulk(
+		fsd_drmaa_session_t *self,
+		const fsd_template_t *jt,
+		int start, int end, int incr )
+{
+	fsd_job_t *volatile job = NULL;
+	char **volatile job_ids = NULL;
+	unsigned n_jobs = 0;
+	volatile bool connection_lock = false;
+	lldrmaa_session_t *llself = (lldrmaa_session_t*) self;
+	fsd_environ_t *volatile env = NULL;
+
+	char *volatile  cmd_path = NULL;
+	int status;
+	LL_job job_info;
+
+	char *monitor_program = LL_DRMAA_BIN_DIR"/monitor";
+
+	TRY
+	{
+		if( start != end )
+			n_jobs = (end - start) / incr + 1;
+		else
+			n_jobs = 1;
+
+		fsd_log_debug(("Create cmd file"));
+		cmd_path = (char *volatile) lldrmaa_job_create_req( self, jt, (fsd_environ_t**)&env , n_jobs, start, incr);
+
+		fsd_log_debug(("llsubmit: %s",cmd_path));
+
+		connection_lock = fsd_mutex_lock( &self->drm_connection_mutex );
+		status = llsubmit(cmd_path, monitor_program, llself->unix_socket_name, &job_info, LL_JOB_VERSION);
+		connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex );
+
+		if(remove(cmd_path) == -1)
+			fsd_log_warning(("Can't delete cmd file: %s", cmd_path));
+
+		fsd_free(cmd_path); /* check if this affects llusbmit */
+
+		if(status) /* -1 Error, error messages written to stderr.*/
+		 {
+			fsd_log_error(("llsubmit: returned non-zero"));
+			fsd_exc_raise_fmt(lldrmaa_map_submit(status), "llsubmit returned non-zero. %s",lldrmaa_err_submit(status));
+		 }
+		else /* 0 */
+			fsd_log_debug(("llsubmit: %s",lldrmaa_err_submit(status)));
+
+		if( start != end )
+		 {
+			unsigned idx, i;
+			fsd_calloc( job_ids, n_jobs+1, char* );
+			for( idx = start, i = 0;  idx <= (unsigned)end;  idx += incr, i++ )
+			 {
+			 	job_ids[i] = fsd_asprintf("%s.%d.%d", job_info.step_list[i]->id.from_host, job_info.step_list[i]->id.cluster, job_info.step_list[i]->id.proc);
+
+				job = lldrmaa_job_new( fsd_strdup(job_ids[i]) );
+				job->session = self;
+				job->submit_time = time(NULL);
+				self->jobs->add( self->jobs, job );
+				job->release( job );
+				job = NULL;
+			 }
+			fsd_assert( i == n_jobs );
+		 }
+		else /* ! bulk */
+		 {
+			fsd_calloc( job_ids, n_jobs+1, char* );
+			job_ids[0] = fsd_asprintf( "%s.%d.0", job_info.step_list[0]->id.from_host, job_info.step_list[0]->id.cluster);
+
+			job = lldrmaa_job_new( fsd_strdup(job_ids[0]) );
+			job->session = self;
+			job->submit_time = time(NULL);
+			self->jobs->add( self->jobs, job );
+			job->release( job );
+			job = NULL;
+		 }
+	}
+	ELSE
+	{
+		connection_lock = fsd_mutex_lock( &self->drm_connection_mutex );
+		llfree_job_info(&job_info,LL_JOB_VERSION);
+		connection_lock = fsd_mutex_unlock( &self->drm_connection_mutex );
+		fsd_log_debug(("llfree_job_info run"));
+	}
+	FINALLY
+	{
+		if( connection_lock )
+			fsd_mutex_unlock( &self->drm_connection_mutex );
+		if( job )
+			job->release( job );
+		if( fsd_exc_get() != NULL )
+			fsd_free_vector( job_ids );
+	}
+	END_TRY
+
+	return fsd_iter_new( job_ids, n_jobs );
+}
+
+
+fsd_job_t *
+lldrmaa_session_new_job( fsd_drmaa_session_t *self, const char *job_id )
+{
+	fsd_job_t *job;
+	job = lldrmaa_job_new( fsd_strdup(job_id) );
+	job->session = self;
+	return job;
+}
+
+void
+lldrmaa_session_apply_configuration( fsd_drmaa_session_t *self )
+{
+	lldrmaa_session_t *llself = (lldrmaa_session_t*)self;
+	fsd_conf_option_t *terminate_job_on_vacated;
+
+	llself->super_apply_configuration(self); /* call method from the superclass */
+
+	terminate_job_on_vacated = fsd_conf_dict_get(self->configuration, "terminate_job_on_vacated" );
+	if( terminate_job_on_vacated )
+	 {
+		if( terminate_job_on_vacated->type == FSD_CONF_INTEGER && (terminate_job_on_vacated->val.integer == 0 || terminate_job_on_vacated->val.integer == 1))
+		 {
+			llself->terminate_job_on_vacated = (terminate_job_on_vacated->val.integer != 0 );
+			fsd_log_debug(("terminate_job_on_vacated: %d",llself->terminate_job_on_vacated));
+		 }
+		else
+			fsd_exc_raise_msg(
+					FSD_ERRNO_INTERNAL_ERROR,
+					"configuration: 'terminate_job_on_vacated' should be 0 or 1"
+					);
+	 }
+
+	if ( !self->wait_thread_started )
+		fsd_exc_raise_msg(FSD_ERRNO_INTERNAL_ERROR, "DRMAA for LL requires that wait thread is enable. Don't disable it in configuration file!" );
+}
+
+void
+lldrmaa_session_destroy_nowait(fsd_drmaa_session_t *self) {
+	lldrmaa_session_t *llself = (lldrmaa_session_t*) self;
+
+	fsd_log_enter(( "" ));
+
+	/*close socket */
+	if (close(llself->socket_fd) != 0) {
+		fsd_log_error(("Failed to close UNIX socket"));
+	} else {
+		llself->socket_fd = -1;
+	}
+
+	/*delete socket file*/
+	if (unlink(llself->unix_socket_name) != 0) {
+		fsd_log_error(("Failed to delete UNIX socket: %s", llself->unix_socket_name));
+	}
+
+	fsd_free(llself->unix_socket_name);
+
+	/* call the destroy_nowait method from the super class */
+	llself->super_destroy_nowait(self);
+	fsd_log_return(( "" ));
+}
+
+void *
+lldrmaa_session_wait_thread( fsd_drmaa_session_t *self )
+{
+	lldrmaa_session_t *llself = (lldrmaa_session_t*) self;
+	fsd_job_t *volatile job = NULL;
+	lldrmaa_job_t *lljob = NULL;
+	char state[256] = "";
+	char job_id[256] = "";
+	int status = -1;
+	char buffer[256] = "";
+	struct sockaddr_un saddress;
+	size_t address_length = 0;
+	int connection_fd = -1;
+
+	fsd_log_enter(( "" ));
+
+	fsd_mutex_lock( &self->mutex );
+	TRY
+	 {
+
+		while( self->wait_thread_run_flag )
+		TRY
+		 {
+			int bytes_read = -1;
+			int rc = -1;
+			fd_set fds;
+			struct timeval tv;
+
+			/*beginning of blocking part - release mutex */
+			fsd_mutex_unlock( &self->mutex );
+
+			fsd_log_debug(("WT - next iteration"));
+
+			FD_ZERO(&fds);
+			FD_SET(llself->socket_fd,&fds);
+			tv.tv_sec = 1;
+			tv.tv_usec = 0;
+
+			rc = select(llself->socket_fd+1, &fds, NULL, NULL, &tv);
+
+			if (rc < 0) {
+				fsd_log_error(("WT - select() failed (errno=%d)", errno));
+				fsd_mutex_lock( &self->mutex );
+				continue;
+			} else if (rc > 0 && FD_ISSET(llself->socket_fd,&fds)) {
+				fsd_log_debug(("WT - server socket ready for accept... "));
+			} else /*rc == 0 (timeout) || FD_ISSET == false */ {
+				fsd_log_debug(("WT - select() timeout"));
+				fsd_mutex_lock( &self->mutex );
+				continue;
+			}
+
+			if ((connection_fd = accept(llself->socket_fd, (struct sockaddr *) &saddress, &address_length)) == -1) {
+				fsd_log_error(("WT - failed to accept new connection (errno = %d)", errno));
+				fsd_mutex_lock( &self->mutex );
+				continue;
+			}
+
+			fsd_log_debug(("WT - connection accepted: fd = %d ", connection_fd));
+
+			if ((bytes_read = read(connection_fd, buffer, 255)) < 0) {
+				fsd_log_error(("WT - failed to read from socket (errno = %d)", errno));
+				close(connection_fd);
+				fsd_mutex_lock( &self->mutex );
+				continue;
+			} else {
+				buffer[bytes_read] = '\0'; /* make sure that message is NULL terminated */
+			}
+
+			close(connection_fd);
+
+			/*end of blocking part - acquire mutex */
+			fsd_mutex_lock( &self->mutex );
+
+			if (sscanf(buffer,"%s %s %d",state,job_id,&status) != 3) {
+				fsd_log_error(("WT - failed to decode message: %s", buffer));
+				continue;
+			}
+
+
+			fsd_log_info(("WT - monitor program: %s %s %d", state, job_id, status));
+			/*update job status */
+			TRY
+			 {
+				job = self->get_job( self, job_id );
+				lljob = (lldrmaa_job_t*) job;
+
+				if( job )
+				{
+					if( strcmp(state,"JOB_STARTED")==0 && job->state >= DRMAA_PS_DONE)
+					{
+						fsd_log_debug(("WT - received JOB_STARTED when job has already finished"));
+					}
+					else if ( strcmp(state, "JOB_COMPLETED")==0)
+					{
+						lljob->read_job_info_mon(job, state, status);
+					}
+					else
+					{
+						lljob->read_job_info_mon(job, state, -1);
+					}
+				}
+				else
+				{
+					fsd_log_error(("WT - Unknown job: %s", job_id));
+				}
+			 }
+			FINALLY
+			 {
+				if( job )
+					job->release( job );
+			 }
+			END_TRY
+
+			fsd_cond_broadcast( &self->wait_condition );
+		 }
+		EXCEPT_DEFAULT
+		 {
+			const fsd_exc_t *e = fsd_exc_get();
+
+			fsd_log_error(( "wait thread: <%d:%s>", e->code(e), e->message(e) ));
+			fsd_exc_reraise();
+		 }
+		END_TRY
+	 }
+	FINALLY
+	 {
+	 	fsd_log_debug(("WT - Terminated."));
+	 	fsd_mutex_unlock( &self->mutex );
+	 }
+	END_TRY
+
+	fsd_log_return(( " =NULL" ));
+	return NULL;
+}
+
+void
+lldrmaa_create_unix_domain_socket(lldrmaa_session_t *self)
+{
+	char socket_name_template[] = "/tmp/drmaa_socket_XXXXXX";
+	struct sockaddr_un address;
+	size_t address_length;
+	int rc;
+
+	if (mktemp(socket_name_template) == NULL)
+		fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR, "Can't generate socket tmp name: %s",socket_name_template);
+
+	fsd_log_info(("UNIX DOMAIN SOCKET name: %s",socket_name_template));
+
+	if ((self->socket_fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0)
+		fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR, "Unable to create UNIX socket");
+
+	address.sun_family = AF_UNIX;
+	address_length = sizeof(address.sun_family) + sprintf(address.sun_path, socket_name_template) + 1;
+
+	if(bind(self->socket_fd, (struct sockaddr *) &address, address_length) != 0)
+		fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR, "Bind failed (socket name: %s)", socket_name_template);
+
+	if((rc = chmod(socket_name_template, S_IRUSR|S_IWUSR)) == -1)
+	 {
+		char errbuf[256] = "InternalError";
+		(void)strerror_r(errno, errbuf, 256); /*on error the default message would be returned */
+		fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR, "Chmod() returned -1 errmsg: %s", errbuf);
+	 }
+	else if (rc != 0)
+	 {
+		fsd_assert(false);
+	 }
+	else
+	 {
+		fsd_log_debug(("Socket permissions changed with chmod()"));
+	 }
+
+	if(listen(self->socket_fd, 128) != 0)
+		fsd_exc_raise_fmt(FSD_ERRNO_INTERNAL_ERROR, "listen() failed");
+
+	self->unix_socket_name = fsd_strdup(socket_name_template);
+}
Index: branches/ll-drmaa-1.0.0/ll_drmaa/drmaa.c
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/drmaa.c	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/drmaa.c	(revision 20)
@@ -0,0 +1,194 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <sys/timers.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <drmaa_utils/common.h>
+#include <drmaa_utils/drmaa.h>
+#include <drmaa_utils/drmaa_base.h>
+#include <drmaa_utils/iter.h>
+#include <drmaa_utils/drmaa_attrib.h>
+
+#include <ll_drmaa/session.h>
+
+#include <llapi.h>
+
+static char lldrmaa_version[50] = "";
+
+static fsd_drmaa_session_t *
+lldrmaa_new_session( fsd_drmaa_singletone_t *self, const char *contact )
+{
+	return lldrmaa_session_new( contact );
+}
+
+static fsd_template_t *
+lldrmaa_new_job_template( fsd_drmaa_singletone_t *self )
+{
+	return drmaa_template_new();
+}
+
+static const char *
+lldrmaa_get_contact( fsd_drmaa_singletone_t *self )
+{
+	return "";
+}
+
+static void
+lldrmaa_get_version( fsd_drmaa_singletone_t *self,
+		unsigned *major, unsigned *minor )
+{
+	*major = 1;  *minor = 0;
+}
+
+static const char *
+lldrmaa_get_DRM_system( fsd_drmaa_singletone_t *self )
+{
+	if(lldrmaa_version[0] == '\0') /*no locks as drmaa_get_drm_system is usually called only once */
+	{
+		fsd_snprintf(NULL, lldrmaa_version, sizeof(lldrmaa_version) - 1,"LoadLeveler %s", ll_version());
+	}
+	return lldrmaa_version;
+}
+
+static const char *
+lldrmaa_get_DRMAA_implementation( fsd_drmaa_singletone_t *self )
+{
+	return PACKAGE_STRING;
+}
+
+fsd_iter_t *
+lldrmaa_get_attribute_names( fsd_drmaa_singletone_t *self )
+{
+	static const char *attribute_names[] = {
+		DRMAA_REMOTE_COMMAND,
+		DRMAA_JS_STATE,
+		DRMAA_WD,
+		DRMAA_JOB_CATEGORY,
+		DRMAA_NATIVE_SPECIFICATION,
+		DRMAA_BLOCK_EMAIL,
+		DRMAA_START_TIME,
+		DRMAA_JOB_NAME,
+		DRMAA_INPUT_PATH,
+		DRMAA_OUTPUT_PATH,
+		DRMAA_ERROR_PATH,
+		DRMAA_JOIN_FILES,
+		DRMAA_WCT_HLIMIT,
+		DRMAA_WCT_SLIMIT,
+		NULL
+	};
+	return fsd_iter_new_const( attribute_names, -1 );
+}
+
+fsd_iter_t *
+lldrmaa_get_vector_attribute_names( fsd_drmaa_singletone_t *self )
+{
+	static const char *attribute_names[] = {
+		DRMAA_V_ARGV,
+		DRMAA_V_ENV,
+		DRMAA_V_EMAIL,
+		NULL
+	};
+	return fsd_iter_new_const( attribute_names, -1 );
+}
+
+static int
+lldrmaa_wifexited(
+		int *exited, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	*exited = WIFEXITED(stat);
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+static int
+lldrmaa_wexitstatus(
+		int *exit_status, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	*exit_status = WEXITSTATUS(stat);
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+static int
+lldrmaa_wifsignaled(
+		int *signaled, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	*signaled = WIFSIGNALED(stat);
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+static int
+lldrmaa_wtermsig(
+		char *signal, size_t signal_len, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	int sig = WTERMSIG(stat);
+	strlcpy( signal, fsd_strsignal(sig), signal_len );
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+static int
+lldrmaa_wcoredump(
+		int *core_dumped, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	*core_dumped = ((stat)&0200); 
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+static int
+lldrmaa_wifaborted(
+		int *aborted, int stat,
+		char *error_diagnosis, size_t error_diag_len
+		)
+{
+	*aborted = (stat == -1);
+	return DRMAA_ERRNO_SUCCESS;
+}
+
+
+fsd_drmaa_singletone_t _fsd_drmaa_singletone = {
+	NULL,
+	FSD_MUTEX_INITIALIZER,
+
+	lldrmaa_new_session,
+	lldrmaa_new_job_template,
+
+	lldrmaa_get_contact,
+	lldrmaa_get_version,
+	lldrmaa_get_DRM_system,
+	lldrmaa_get_DRMAA_implementation,
+
+	lldrmaa_get_attribute_names,
+	lldrmaa_get_vector_attribute_names,
+
+	lldrmaa_wifexited,
+	lldrmaa_wexitstatus,
+	lldrmaa_wifsignaled,
+	lldrmaa_wtermsig,
+	lldrmaa_wcoredump,
+	lldrmaa_wifaborted
+};
+
Index: branches/ll-drmaa-1.0.0/ll_drmaa/monitor.c
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/monitor.c	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/monitor.c	(revision 20)
@@ -0,0 +1,95 @@
+
+#ifdef HAVE_CONFIG_H
+#	include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <time.h>
+
+#define CHAR_BUF 256
+
+void log_msg(const char* address, const char *suffix, const char *fmt, ...)
+{
+	FILE * fd;
+	char path[CHAR_BUF] = "";
+	char text[CHAR_BUF] = "";
+	int n;
+
+	if( snprintf(path,CHAR_BUF, "%s.%s", address, suffix) < 28 )   /* /tmp/drmaa_socket_XXXXXXX.err */
+	{
+		fprintf(stderr,"Can't create err file address"); /* nobody will see it... */
+		assert(0);
+	}
+	if((fd = fopen(path,"a")) != NULL)
+	{
+		va_list args;
+		va_start (args,fmt);
+		n = vsnprintf(text,CHAR_BUF, fmt, args);
+		va_end( args );
+		if( 0 <= n  &&  (size_t)n < CHAR_BUF )
+		{
+			fprintf(fd,"%d - %s", time(NULL), text);
+			fclose(fd);
+		}
+		else
+		{
+			fprintf(stderr,"Can't parse error text"); /* nobody will see it... */
+			assert(0);
+		}
+	}
+}
+
+int main(int argc, char **argv)
+{
+	/*LL_DRMAA_BIN_DIR is defined in config.h that was generated during ./configure process */
+	if(argc == 5)
+	{
+		struct sockaddr_un address;
+		size_t address_length;
+		int socket_fd = -1;
+		int nbytes;
+		char buffer[CHAR_BUF];
+
+		socket_fd = socket(PF_UNIX, SOCK_STREAM, 0);
+		if(socket_fd < 0)
+		 {
+			log_msg(argv[2], "err", "socket() failed\n");
+			return 1;
+		 }
+
+		address.sun_family = AF_UNIX;
+		address_length = sizeof(address.sun_family) +  sprintf(address.sun_path, argv[2]) + 1;
+
+		if(connect(socket_fd, (struct sockaddr *) &address, address_length) != 0)
+		 {
+			log_msg(argv[2], "err", "connect() failed. Address: %s (%d)\n", address.sun_path, errno);
+			return 1;
+		 }
+
+		nbytes = snprintf(buffer,CHAR_BUF, "%s %s %s\n", argv[3], argv[1], argv[4]);  /* JOB_xxxxxx job_id status*/
+#ifdef DEBUGGING
+		log_msg(argv[2], "debug", "Sending message: %s", buffer);
+#endif
+
+		if(write(socket_fd, buffer, nbytes) <= 0)
+		 {
+			log_msg(argv[2], "err", "Can't write data to socket: %s",buffer);
+		 }
+
+		close(socket_fd);
+	}
+	else
+	{
+		log_msg(argv[2],"err", "Not enough arguments\n");
+		return 1;
+	}
+	return 0;
+}
Index: branches/ll-drmaa-1.0.0/ll_drmaa/Makefile.am
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/Makefile.am	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/Makefile.am	(revision 20)
@@ -0,0 +1,41 @@
+# $Id$
+#
+# PSNC DRMAA for LoadLeveler
+# Copyright (C) 2010 Poznan Supercomputing and Networking Center
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+
+lib_LTLIBRARIES = libdrmaa.la
+libdrmaa_la_SOURCES = \
+ drmaa.c \
+ job.c job.h \
+ session.c session.h \
+ util.c util.h
+libdrmaa_la_CPPFLAGS = @LL_INCLUDES@ -I$(top_srcdir)/drmaa_utils/ 
+if GCC
+libdrmaa_la_CPPFLAGS += -Wno-long-long 
+endif
+
+libdrmaa_la_LIBADD = ../drmaa_utils/drmaa_utils/libdrmaa_utils.la @LL_LIBS@
+libdrmaa_la_LDFLAGS = @LL_LDFLAGS@ -version-info @LL_DRMAA_VERSION_INFO@
+
+bin_PROGRAMS = monitor
+
+monitor_SOURCES = monitor.c
+
+monitor_CPPFLAGS = -I$(top_srcdir)/drmaa_utils
+
+dist_sysconf_DATA = ll_drmaa.conf.example
Index: branches/ll-drmaa-1.0.0/ll_drmaa/ll_drmaa.conf.example
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/ll_drmaa.conf.example	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/ll_drmaa.conf.example	(revision 20)
@@ -0,0 +1,18 @@
+## $Id$
+## ll_drmaa.conf.example - Sample ll_drmaa configuration file.
+
+## Cache job state for number of seconds.  If set to positive integer
+## `drmaa_job_ps()` returns remembered job state without communicating with
+## DRM for `cache_job_state` seconds since last update.  By default it is
+## 0 meaning no caching will be performed.
+#cache_job_state: 5,
+
+## Attrubute which deciedes if job should be terminated when gets LoadLeveler vacated state or not.
+#terminate_job_on_vacated: 1,
+
+## Mapping of `drmaa_job_category` values to native specification.
+job_categories: {
+  #default: "@wall_clock_limit = 2:00:00",
+  parallel: "@ job_type = parallel",
+},
+
Index: branches/ll-drmaa-1.0.0/ll_drmaa/session.h
===================================================================
--- branches/ll-drmaa-1.0.0/ll_drmaa/session.h	(revision 20)
+++ branches/ll-drmaa-1.0.0/ll_drmaa/session.h	(revision 20)
@@ -0,0 +1,45 @@
+/* $Id$ */
+/*
+ * PSNC DRMAA for LL
+ * Copyright (C) 2010 Poznan Supercomputing and Networking Center
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __LL_DRMAA__SESSION_H
+#define __LL_DRMAA__SESSION_H
+
+#ifdef HAVE_CONFIG_H
+#	include <config.h>
+#endif
+
+#include <drmaa_utils/session.h>
+
+typedef struct lldrmaa_session_s lldrmaa_session_t;
+
+fsd_drmaa_session_t *
+lldrmaa_session_new( const char *contact );
+
+struct lldrmaa_session_s {
+	fsd_drmaa_session_t super;
+
+	void (*super_apply_configuration)(fsd_drmaa_session_t *self);
+	void (*super_destroy_nowait)( fsd_drmaa_session_t *self );
+
+	bool terminate_job_on_vacated;
+	char *unix_socket_name;
+	int socket_fd;
+};
+
+#endif /* __LL_DRMAA__SESSION_H */
+
Index: branches/ll-drmaa-1.0.0/NEWS
===================================================================
--- branches/ll-drmaa-1.0.0/NEWS	(revision 20)
+++ branches/ll-drmaa-1.0.0/NEWS	(revision 20)
@@ -0,0 +1,11 @@
+PSNC DRMAA for LoadLeveler Release Notes
+===============================
+
+1.0.1 release
+-------------
+
+ * Initial release
+ 
+.. vim700: spell spelllang=en
+.. vim: ft=rest
+.. vim: ts=2 sw=2 et
Index: branches/ll-drmaa-1.0.0/README
===================================================================
--- branches/ll-drmaa-1.0.0/README	(revision 20)
+++ branches/ll-drmaa-1.0.0/README	(revision 20)
@@ -0,0 +1,1 @@
+The manual for the DRMAA for LoadLeveler is available at project wiki: http://apps.man.poznan.pl/trac/ll-drmaa/wiki
Index: branches/ll-drmaa-1.0.0/m4/missing-dev-prog.sh
===================================================================
--- branches/ll-drmaa-1.0.0/m4/missing-dev-prog.sh	(revision 20)
+++ branches/ll-drmaa-1.0.0/m4/missing-dev-prog.sh	(revision 20)
@@ -0,0 +1,7 @@
+#!/bin/sh
+cat >&2 <<MESSAGE
+ * ERROR: $1 was not found at configuration time while some
+ * sources are build by it.  Either install $1 or download
+ * tarball with generated sources included.
+MESSAGE
+exit 1
Index: branches/ll-drmaa-1.0.0/m4/ax_gcc_warnings.m4
===================================================================
--- branches/ll-drmaa-1.0.0/m4/ax_gcc_warnings.m4	(revision 20)
+++ branches/ll-drmaa-1.0.0/m4/ax_gcc_warnings.m4	(revision 20)
@@ -0,0 +1,50 @@
+# $Id$
+#
+# SYNOPSIS
+#
+#   AX_GCC_FLAGS()
+#
+# DESCRIPTION
+#
+#   Check for LSF libraries and headers.
+#
+#   This macro calls::
+#
+#			AC_SUBST(GCC_W_NO_MISSING_FIELD_INITIALIZERS)
+#			AC_SUBST(GCC_W_NO_FORMAT_ZERO_LENGTH)
+#
+# LAST MODIFICATION
+#
+#   2008-10-13
+#
+# LICENSE
+#
+#   Written by Åukasz CieÅnik <lukasz.ciesnik@fedstage.com>
+#   and placed under Public Domain.
+#
+AC_DEFUN([AX_GCC_WARNINGS], [
+if test x$GCC == xyes; then
+	AC_SUBST([GCC_W_NO_MISSING_FIELD_INITIALIZERS])
+	AC_SUBST([GCC_W_NO_FORMAT_ZERO_LENGTH])
+	CFLAGS_save="$CFLAGS"
+
+	AC_MSG_CHECKING([whether gcc accepts -Wno-missing-field-initializers])
+	CFLAGS="$CFLAGS_save -Wall -Wextra -Wno-missing-field-initializers"
+	ax_gcc_warnings_src="int main(){ return 0; }"
+	AC_COMPILE_IFELSE([$ax_gcc_warnings_src],
+		[GCC_W_NO_MISSING_FIELD_INITIALIZERS="-Wno-missing-field-initializers"
+		AC_MSG_RESULT([yes])],
+		[GCC_W_NO_MISSING_FIELD_INITIALIZERS="-Wno-extra"
+		AC_MSG_RESULT([no])])
+
+	AC_MSG_CHECKING([whether gcc accepts -Wno-format-zero-length])
+	CFLAGS="$CFLAGS_save -Wno-format-zero-length"
+	AC_COMPILE_IFELSE([$ax_gcc_warnings_src],
+		[GCC_W_NO_FORMAT_ZERO_LENGTH="-Wno-format-zero-length"
+		AC_MSG_RESULT([yes])],
+		[GCC_W_NO_FORMAT_ZERO_LENGTH="-Wno-format"
+		AC_MSG_RESULT([no])])
+
+	CFLAGS="$CFLAGS_save"
+fi
+])
Index: branches/ll-drmaa-1.0.0/m4/ax_docutils.m4
===================================================================
--- branches/ll-drmaa-1.0.0/m4/ax_docutils.m4	(revision 20)
+++ branches/ll-drmaa-1.0.0/m4/ax_docutils.m4	(revision 20)
@@ -0,0 +1,33 @@
+# $Id$
+#
+# SYNOPSIS
+#
+#   AX_DOCUTILS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   Test for the Docutils -- Python driven reStructuredText processor.
+#   This macro calls (through AC_CHECK_PROGS)::
+#
+#     AC_SUBST(RST2HTML)
+#     AC_SUBST(RST2LATEX)
+#
+# LAST MODIFICATION
+#
+#   2007-12-14
+#
+# LICENSE
+#
+#   Written by Åukasz CieÅnik <lukasz.ciesnik@fedstage.com>
+#   and placed under Public Domain
+#
+
+AC_DEFUN([AX_DOCUTILS], [
+	AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py])
+	AC_CHECK_PROGS([RST2LATEX], [rst2latex rst2latex.py])
+	if test x$RST2HTML != x -a x$RST2LATEX != x; then
+		ifelse([$1], , :, [$1])
+	else
+		ifelse([$2], , :, [$2])
+	fi
+])
Index: branches/ll-drmaa-1.0.0/m4/ax_ll.m4
===================================================================
--- branches/ll-drmaa-1.0.0/m4/ax_ll.m4	(revision 20)
+++ branches/ll-drmaa-1.0.0/m4/ax_ll.m4	(revision 20)
@@ -0,0 +1,111 @@
+# $Id$
+#
+# SYNOPSIS
+#
+#   AX_LL([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+#
+# DESCRIPTION
+#
+#   Check for LL libraries and headers.
+#
+#   This macro calls::
+#
+#     AC_SUBST(LL_INCLUDES)
+#     AC_SUBST(LL_LDFLAGS)
+#     AC_SUBST(LL_LIBS)
+#
+# LAST MODIFICATION
+#
+#   2010-04-08
+#
+# LICENSE
+#
+#   Written by:
+#     Mariusz MamoÅski <mamonski@man.poznan.pl>
+#   Based on macro for LSF written by
+#     Lukasz Ciesnik <lukasz.ciesnik@gmail.com>
+#   Placed under Public Domain.
+#
+
+AC_DEFUN([AX_LL],[
+AC_ARG_WITH([ll-inc], [AC_HELP_STRING([--with-ll-inc=<include-dir>],
+		[Path to LoadLeveler headers directory (containing llapi.h)])])
+AC_ARG_WITH([ll-lib], [AC_HELP_STRING([--with-ll-lib=<lib-dir>],
+		[Path to directory with LoadLevler libraries (containing libllapi.a)])])
+
+AC_SUBST(LL_INCLUDES)
+AC_SUBST(LL_LDFLAGS)
+AC_SUBST(LL_LIBS)
+
+AC_MSG_NOTICE([checking for LoadLeveler])
+
+AC_MSG_CHECKING([for LoadLeveler compile flags])
+ax_ll_msg=""
+if test x$with_ll_inc != x; then
+	LL_INCLUDES="-I${with_ll_inc}"
+else
+	LLSUBMIT_PATH=`which llsubmit`
+	if test x"$LLSUBMIT_PATH" != x; then
+		LLSUBMIT_DIR=`dirname $LLSUBMIT_PATH`
+		LL_HOME=`dirname $LLSUBMIT_DIR`
+		LL_INCLUDES="-I$LL_HOME/include"
+	else
+		ax_ll_msg="no llsubmit in PATH"
+	fi
+fi
+
+AC_MSG_RESULT([$LL_INCLUDES$ax_ll_msg])
+
+AC_MSG_CHECKING([for LoadLeveler library dir])
+ax_ll_msg=""
+if test x$with_ll_lib == x; then
+	
+	LLSUBMIT_PATH=`which llsubmit`
+	
+	if test x"$LLSUBMIT_PATH" != x; then
+		LLSUBMIT_DIR=`dirname $LLSUBMIT_PATH`
+		LL_HOME=`dirname $LLSUBMIT_DIR`
+		with_ll_lib=$LL_HOME/lib
+	else
+		ax_ll_msg="no llsubmit in PATH"
+	fi
+fi
+AC_MSG_RESULT([$with_ll_lib$ax_ll_msg])
+
+
+LL_LIBS="-lllapi "
+LL_LDFLAGS="-L${with_ll_lib}"
+
+
+CPPFLAGS_save="$CPPFLAGS"
+LDFLAGS_save="$LDFLAGS"
+LIBS_save="$LIBS"
+CPPFLAGS="$CPPFLAGS $LL_INCLUDES"
+LDFLAGS="$LDFLAGS $LL_LDFLAGS"
+LIBS="$LIBS $LL_LIBS"
+
+ax_ll_ok="no"
+
+AC_MSG_CHECKING([for usable LL libraries/headers])
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include "llapi.h" ]],
+		[[ LL_job job_info; /*at least check for declared structs */
+		   return 0;
+		 ]])],
+	[ ax_ll_ok="yes"],
+	[ echo "*** The LoadLeveler test program failed to link or run. See the file config.log"
+	  echo "*** for the exact error that occured."],
+	[
+		ax_ll_ok=yes
+		echo $ac_n "cross compiling; assumed OK... $ac_c"
+	])
+CPPFLAGS="$CPPFLAGS_save"
+LDFLAGS="$LDFLAGS_save"
+LIBS="$LIBS_save"
+AC_MSG_RESULT([$ax_ll_ok])
+
+if test x"$ax_ll_ok" = xyes; then
+	ifelse([$1], , :, [$1])
+else
+	ifelse([$2], , :, [$2])
+fi
+])
Index: branches/ll-drmaa-1.0.0/m4/acx_pthread.m4
===================================================================
--- branches/ll-drmaa-1.0.0/m4/acx_pthread.m4	(revision 20)
+++ branches/ll-drmaa-1.0.0/m4/acx_pthread.m4	(revision 20)
@@ -0,0 +1,245 @@
+dnl $Id$
+
+dnl
+dnl Check for libs/cppflags needed for POSIX Threads
+dnl
+
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl Modified from the original version:
+dnl * Removed pthread-specific CC support
+dnl * Added FreeBSD specific -pthread/-lpthread flags
+dnl Notes:
+dnl * -D_THREAD_SAFE may not be necessary on FreeBSD
+dnl   and elsewhere.
+dnl - landonf March 25th, 2005
+dnl
+dnl This macro figures out how to build C programs using POSIX threads.
+dnl It sets the PTHREAD_LIBS output variable to the threads library and
+dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
+dnl C compiler flags that are needed. (The user can also force certain
+dnl compiler flags/libs to be tested by setting these environment
+dnl variables.)
+dnl
+dnl NOTE: You are assumed to not only compile your program with these
+dnl flags, but also link it with them as well. e.g. you should link
+dnl with $CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
+dnl $LIBS
+dnl
+dnl If you are only building threads programs, you may wish to use
+dnl these variables in your default LIBS, and CFLAGS:
+dnl
+dnl        LIBS="$PTHREAD_LIBS $LIBS"
+dnl        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
+dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
+dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
+dnl default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform, or
+dnl if you have any other suggestions or comments. This macro was based
+dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
+dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
+dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
+dnl We are also grateful for the helpful feedback of numerous users.
+dnl
+dnl @category InstalledPackages
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
+dnl @version 2005-01-14
+dnl @license GPLWithACException
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+
+	*freebsd*)
+	# freebsd 4 uses -pthread, freebsd 5 uses -lpthread
+	acx_pthread_flags="pthread -pthread"
+	;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                PTHREAD_LIBS="$flag"
+                ;;
+
+		pthread-config)
+		AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+		if test x"$acx_pthread_config" = xno; then continue; fi
+		PTHREAD_CFLAGS="`pthread-config --cflags`"
+		PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+		;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+	AC_MSG_CHECKING([for joinable pthread attribute])
+	attr_name=unknown
+	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+	    AC_TRY_LINK([#include <pthread.h>], [int attr=$attr;],
+                        [attr_name=$attr; break])
+	done
+        AC_MSG_RESULT($attr_name)
+        if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+            AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
+                               [Define to necessary symbol if this constant
+                                uses a non-standard name on your system.])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+            *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+            *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+            PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
Index: branches/ll-drmaa-1.0.0/.ignore
===================================================================
--- branches/ll-drmaa-1.0.0/.ignore	(revision 1)
+++ branches/ll-drmaa-1.0.0/.ignore	(revision 1)
@@ -0,0 +1,32 @@
+configure
+Makefile.in
+config.log
+scripts
+config.status
+stamp-h1
+config.h
+config.h.in
+std.out
+autom4te.cache
+drmaa_utils
+libtool
+aclocal.m4
+Makefile
+ltsugar.m4
+libtool.m4
+ltversion.m4
+lt~obsolete.m4
+ltoptions.m4
+readme.html
+readme.tex
+monitor
+.libs
+.deps
+.project
+.cproject
+ll_drmaa-1.0.1.tar.gz
+readme.toc
+readme.out
+readme.pdf
+readme.aux
+readme.log
Index: branches/ll-drmaa-1.0.0/configure.ac
===================================================================
--- branches/ll-drmaa-1.0.0/configure.ac	(revision 20)
+++ branches/ll-drmaa-1.0.0/configure.ac	(revision 20)
@@ -0,0 +1,207 @@
+AC_INIT([PSNC DRMAA for LoadLeveler], [1.0.1], [mamonski@man.poznan.pl], [ll_drmaa])
+AC_PREREQ(2.58)
+AC_REVISION([$Id$])
+AC_COPYRIGHT([
+PSNC DRMAA for LoadLeveler
+Copyright (C) 2010 Poznan Supercomputing and Networking Center
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+])
+
+LL_DRMAA_MAJOR=1
+LL_DRMAA_MINOR=0
+LL_DRMAA_MICRO=1
+LL_DRMAA_VERSION_INFO=1:1:0
+AC_SUBST([LL_DRMAA_MAJOR])
+AC_SUBST([LL_DRMAA_MINOR])
+AC_SUBST([LL_DRMAA_MICRO])
+AC_SUBST([LL_DRMAA_VERSION_INFO])
+
+AC_CONFIG_SRCDIR([ll_drmaa/drmaa.c])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_AUX_DIR([scripts])
+
+AM_INIT_AUTOMAKE
+
+# command-line arguments:
+AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+			[produce code suiteable for debugging and print logs at runtime]))
+AC_ARG_ENABLE(development, AC_HELP_STRING([--enable-development],
+			[enable development mode: make additional checks (suitable for PSNC DRMAA for LL developers)]))
+
+# programs:
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_RANLIB
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+AC_PROG_MAKE_SET
+AC_PROG_LN_S
+
+AX_DOCUTILS()
+if test x$RST2HTML = x; then
+	RST2HTML="sh m4/missing-dev-prog.sh docutils"
+fi
+if test x$RST2LATEX = x; then
+	RST2LATEX="sh m4/missing-dev-prog.sh docutils"
+fi
+
+# check compiler / set basic flags:
+if test x$ac_cv_prog_cc_stdc = xno; then
+	AC_MSG_ERROR([ANSI C compiler is required])
+fi
+
+if test x$GCC = xyes; then
+	CFLAGS="-pedantic  ${CFLAGS}"
+fi
+AM_CONDITIONAL([GCC], [test x$GCC = xyes])
+
+AX_GCC_WARNINGS()
+
+AH_TEMPLATE([DEBUGGING], [Produce debugging code])
+if test x$enable_debug = xyes; then
+	AC_DEFINE(DEBUGGING,[1])
+	CFLAGS="${CFLAGS} -O0"
+else
+	CPPFLAGS="-DNDEBUG ${CPPFLAGS}"
+fi
+
+AH_TEMPLATE([DEVELOPMENT], [Development mode])
+if test x$enable_development = xyes; then
+	AC_DEFINE(DEVELOPMENT, [1])
+fi
+
+AH_BOTTOM([
+#ifndef __GNUC__
+#	define __attribute__ /* nothing */
+#endif
+])
+
+# system:
+CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE ${CPPFLAGS}"
+
+AC_CANONICAL_HOST
+case "$host_os" in
+	*linux*)
+		CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
+		;;
+	*solaris*)
+		CPPFLAGS="${CPPFLAGS} -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
+		;;
+	*freebsd*)
+		;;
+	*darwin*)
+		CPPFLAGS="${CPPFLAGS} -D_XOPEN_SOURCE=400"
+		;;
+	*aix*)
+		CPPFLAGS="${CPPFLAGS} -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D__linux__"
+		;;
+	*)
+		CPPFLAGS="${CPPFLAGS} -D_XOPEN_SOURCE=500"
+		;;
+esac
+
+# project prerequisites:
+
+# libraries:
+ACX_PTHREAD([CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LIBS="$PTHREAD_LIBS $LIBS"],
+		[AC_MSG_ERROR([POSIX threads library is required.])])
+
+AX_LL([:], [AC_MSG_ERROR([
+LL libraries/headers not found;
+add --with-ll-inc and --with-ll-lib with appropriate locations.]) ])
+if ! echo $ac_configure_args | ${EGREP} -q '(--)(exec-)?prefix'; then
+	if test ${sysconfdir} == '${prefix}/etc'; then
+		# do not install configuration in /usr/local/etc
+		sysconfdir='/etc'
+		ac_configure_args="${ac_configure_args} --sysconfdir=${sysconfdir}"
+	fi
+fi
+CPPFLAGS="${CPPFLAGS} -DCONFDIR=${sysconfdir}"
+
+# headers:
+AC_HEADER_STDC
+AC_HEADER_TIME
+AC_HEADER_STDBOOL
+
+AC_CHECK_HEADERS([stddef.h stdlib.h string.h strings.h sys/time.h unistd.h])
+
+# types and structures:
+AC_TYPE_SIZE_T
+AC_STRUCT_TM
+
+# compiler characteristic
+AC_C_CONST
+AC_C_INLINE
+AC_C_VOLATILE
+
+# functions:
+# this cause problem on AIX systems
+#AC_FUNC_MALLOC
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([ \
+	asprintf \
+	fstat \
+	getcwd \
+	gettimeofday \
+	localtime_r \
+	memset \
+	mkstemp \
+	setenv \
+	strcasecmp \
+	strchr \
+	strdup \
+	strerror \
+	strlcpy \
+	strndup \
+	strstr \
+	strtol \
+	vasprintf \
+	])
+
+# system services:
+
+# turn on warning after all tests
+if test x$GCC = xyes; then
+	if test x$enable_development = xyes; then
+		CFLAGS="-Werror ${CFLAGS}"
+	fi
+	CFLAGS="-Wall -W -Wno-unused-parameter $GCC_W_NO_FORMAT_ZERO_LENGTH ${CFLAGS}"
+fi
+
+#eval bindir
+AH_TEMPLATE([LL_DRMAA_BIN_DIR], [Location of binary files])
+test "$prefix" = NONE && prefix="$ac_default_prefix"
+test "$exec_prefix" = NONE && exec_prefix='${prefix}'
+x="\$bindir"        
+eval y="$x"
+while test "$x" != "$y"; do
+		x="$y"
+		eval y="$x"
+done
+AC_DEFINE_UNQUOTED([LL_DRMAA_BIN_DIR], ["$x"])
+	
+
+AC_CONFIG_FILES([
+	Makefile
+	ll_drmaa/Makefile
+	doc/Makefile
+])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_SUBDIRS([drmaa_utils])
+AC_OUTPUT
+
+echo
+echo "Run 'make' now."
+
Index: branches/ll-drmaa-1.0.0/autoclean.sh
===================================================================
--- branches/ll-drmaa-1.0.0/autoclean.sh	(revision 20)
+++ branches/ll-drmaa-1.0.0/autoclean.sh	(revision 20)
@@ -0,0 +1,25 @@
+#!/bin/sh
+# $Id$
+
+echo "Removing all generated files. ($PWD)"
+
+make maintainer-clean
+
+rm -f aclocal.m4 configure configure.scan config.h.in confdefs.h libtool
+
+rm -rf autom4te.cache
+rm -rf scripts
+
+find . -name Makefile.in -exec rm -f {} \;
+find . -name Makefile -exec rm -f {} \;
+find . -name \*~ -exec rm -f {} \;
+find . -name \.#* -exec rm -f {} \;
+find . -name \*.core -exec rm -f {} \;
+find . -name \*.log -exec rm -f {} \;
+find . -name \*.a -exec rm -f {} \;
+find . -name \*.o -exec rm -f {} \;
+find . -name \*.lo* -exec rm -f {} \;
+find . -name \*.la* -exec rm -f {} \;
+
+(cd drmaa_utils && sh autoclean.sh "$@")
+echo "done."
