Error opening environment more than once

Hi,
I have two java classes which both need to access a container in an environment (in parallel). When the first class is instantiated the environment is opened successfully. However, when the second class subsequently attempts to open the same environment I get an error. (I do not want to close the env from the first class, while the second class does its thing)
The classes are Stylesheet extensions for an xmleditor which allows the stylesheet to look up item ID codes and display their names to the user by looking up the values in an xml file stored in a bdbxml container. There is a situation where two different objects need to have access to the environment at the same time - but its giving me an error when I instantiate the env for the second time - without having closed the first one)
Any help would by gratefully received
Kind Regards
Swami Kevala
I thought I could create multiple handles to the same environment?

First is a class to encapsulate the environment (lifted mostly from the example code)
package org.isha.archives.bdbxml;
import java.io.*;
import java.util.*;
import com.sleepycat.db.*;
import com.sleepycat.dbxml.*;
//Class used to open and close a Berkeley DB environment
public class DbEnv
private Environment dbEnv_ = null;
private XmlManager mgr_ = null;
private boolean dbEnvIsOpen_ = false;
private File path2DbEnv_ = null;
public DbEnv(File path2DbEnv)
     throws Throwable {
          if (! path2DbEnv.isDirectory()) {
               throw new Exception(path2DbEnv.getPath() +
                         " does not exist or is not a directory.");
          EnvironmentConfig config = new EnvironmentConfig();
          config.setCacheSize(50 * 1024 * 1024);
          config.setAllowCreate(true);
          config.setInitializeCache(true);
          config.setTransactional(true);
          config.setInitializeLocking(true);
          config.setInitializeLogging(true);
          config.setErrorStream(System.err);
          config.setThreaded(true);
          config.setRunRecovery(true);
          config.setLogAutoRemove(true);
          dbEnv_ = new Environment(path2DbEnv, config);
          //Boolean used to know whether to close the environment
          // when the cleanup() method is called.
          dbEnvIsOpen_ = true;
          path2DbEnv_ = path2DbEnv;
          mgr_ = new XmlManager(dbEnv_, null);
//Returns the path to the database environment
public File getDbEnvPath() { return path2DbEnv_; }
//Returns the database environment encapsulated by this class.
public Environment getEnvironment() { return dbEnv_; }
//Returns the XmlManager encapsulated by this class.
public XmlManager getManager() { return mgr_; }
//Used to close the environment
public void cleanup() throws DatabaseException
if (dbEnvIsOpen_) {
dbEnv_.close();
dbEnvIsOpen_ = false;
Second is a class which encapsulates a container with a method for querying itself
package org.isha.archives.bdbxml;
import java.io.*;
import java.util.*;
import com.sleepycat.db.*;
import com.sleepycat.dbxml.*;
//Class used to open, query and close a Berkeley DB container
public class DbContainer
     private XmlContainer dbCont_ = null;
private XmlManager mgr_ = null;
private boolean dbContainerIsOpen_ = false;
private File path2DbContainer_ = null;
private XmlContainerConfig cfg_= null;
private String cntr_ = "";
public DbContainer(XmlManager myManager, String containerFileName, XmlContainerConfig containerConfig)
          throws Throwable {
          String containerFilepath = myManager.getHome() + "\\" + containerFileName;
          path2DbContainer_ = new File(containerFilepath);
          mgr_ = myManager;
          cfg_ = containerConfig;
          cntr_ = containerFileName;
          if (! path2DbContainer_.isFile()) {
               throw new Exception(path2DbContainer_.getPath() +
                         " does not exist or is not a directory.");
          dbCont_ = new XmlContainer();
//Return the XmlContainer itself
public XmlContainer getContainer() { return dbCont_; }
//Returns the filename of the container
     public String getFilename() { return cntr_; }
//Returns the XmlManager encapsulated by this class.
public XmlManager getManager() { return mgr_; }
//Used to close the container
public void close() throws DatabaseException
if (dbContainerIsOpen_) {
dbCont_.close();
dbContainerIsOpen_ = false;
//Used to open the container
public void open() {
          try {
               dbCont_ = mgr_.openContainer(cntr_, cfg_);
               dbContainerIsOpen_ = true;
          catch (Exception e) {
//Used to query the container
public String[] runQuery(String myQuery){
          String [] queryOutput = null;
          int counter = 0;
          try {
               XmlQueryContext context = mgr_.createQueryContext();
               //Default namespace declaration does not work yet - this will work in the next release of BDB XML
               //Until then we have to remove the namespace declaration from the reference.xml root element
               //When this becomes available we can add the namespace declaration and uncomment the following line
               //context.setNamespace("", defaultNS);
               XmlResults results = mgr_.query(myQuery, context);
               //Get the result set
               queryOutput = new String[results.size()];
               XmlValue value = results.next();
               while (value != null)
                    queryOutput[counter] = value.asString().replaceAll("\\n", "").replaceAll(" "," ");
                    System.out.println(queryOutput[counter]);
                    counter ++;
                    value = results.next();
          catch (Exception e) {
               //Exception Handling code here
          return queryOutput;
Now to explain what is happening:
When I open an xml document in xmlmind, it displays the document according to a prespecified CSS sheet. Sometimes the CSS rules alone are not sufficient to achieve the necessary effect/functionality, so the API allows you to write your own class, which contains methods to do what you want. As soon as the xml document is displayed, the CSS extension class gets instantiated.
Here is my extension class (called StyleSheetExtension). It contains a method called getKeywords. This method can then be invoked from within the CSS sheet, and is used to replace the keyword ID codes in the xml document with their corresponding keyword names - stored in an xml reference look-up document...
package org.isha.archives.xmlmind;
import com.xmlmind.xmledit.xmlutil.*;
import com.xmlmind.xmledit.doc.*;
import com.xmlmind.xmledit.view.DocumentView;
import com.xmlmind.xmledit.stylesheet.StyleValue;
import com.xmlmind.xmledit.stylesheet.StyleSpec;
import com.xmlmind.xmledit.stylesheet.StyleSpecsBase;
import com.xmlmind.xmledit.styledview.StyledViewFactory;
import com.xmlmind.xmledit.styledview.CustomViewManager;
import com.sleepycat.dbxml.*;
import com.sleepycat.db.*;
import java.io.File;
import java.util.logging.*;
import java.util.*;
import org.isha.archives.bdbxml.DbContainer;
import org.isha.archives.bdbxml.DbEnv;
public class StyleSheetExtension {
     //Logging variables
     private Logger logger = Logger.getLogger("StyleSheetExtension");
     private Handler fh = null;
     private java.util.logging.Formatter sf = null;
     //XMLMind variables
     private static final Namespace NS = Namespace.get("http://www.ishafoundation.org/archives/schema/transcript");
     //BDB variables
     private DbEnv myDbEnv = null;
     private File envDir = new File("C:\\BerkeleyDB");
     private DbContainer myDbContainer = null;
     private String containerFileName = "reference.dbxml";
     private XmlContainerConfig containerCfg = null;
     //Define Constructor
     public StyleSheetExtension(String[] args, StyledViewFactory viewFactory) {
//Set up simple logging system
try {
fh = new FileHandler("%t/_styleSheetExtn.log");
sf = new SimpleFormatter();
fh.setFormatter(sf);
logger.addHandler(fh);
logger.setLevel(Level.ALL);
logger.info("Starting StyleSheetExtension Class constructor");
} catch (Exception e)
{System.out.println("CustomErr: " + e.getMessage());
                //Exception Handling code
//Create custom BDB Environment and Container Objects
try {
                    myDbEnv = new DbEnv(envDir);
                    containerCfg = new XmlContainerConfig();
                    myDbContainer = new DbContainer(myDbEnv.getManager(), containerFileName, containerCfg);
                    myDbContainer.open();
               } catch (Throwable t) {
                    logger.severe("Problem with Env or Container new thing");
viewFactory.addDependency( NS, "topic", NS, "keywordIDs");
     public StyleValue getKeywords (StyleValue[] args, Node contextNode,
                         StyledViewFactory viewFactory) {
//Get keyword IDs as a String array
String[] keywordID = null;
String[] keywordValue = null;
String keywordIDStr = "";
String keywordValueStr ="";
Name keywordIDs = Name.get("keywordIDs");
keywordIDStr = contextNode.attributeValue(keywordIDs).trim();
keywordID = keywordIDStr.split("\\s+");
keywordValue = new String[keywordID.length];
//for each keyword ID element retrieve the corresponding keyword value
logger.info("getting values");
               keywordValue = getKeywordValuesFromDB(keywordID);
               Arrays.sort(keywordValue);
               logger.info(keywordValue[0] + " " + keywordValue[1]);
               int i = 0;
               for(i=0; i < keywordID.length; i++) {
                    keywordValueStr += keywordValue[i] + " ";
               keywordValueStr = keywordValueStr.trim();
          return StyleValue.createString(keywordValueStr);
private String[] getKeywordValuesFromDB(String[] IDs){
               String[] values = new String[IDs.length];
               String id = "";
               String value = "";
               String flwor = "";
               int i = 0;
               for(i=0; i < IDs.length; i++) {
                    id = IDs.trim();
                    flwor = "for $i in collection('" + myDbContainer.getFilename() + "') /reference/keywords/keyword \n";
                    flwor += "let $id := $i/@id/text() \n";
                    flwor += "let $val := $i/@value/text() \n";
                    flwor += "where $id = '" + id + "'\n";
                    flwor += "return $val";
                    String[] temp = new String[1];
                    temp = myDbContainer.runQuery(flwor);
                    values[i] = temp[0];
                    logger.info("value is: " + values[i]);
               return values;
package org.isha.archives.xmlmind;
import com.xmlmind.xmledit.xmlutil.*;
import com.xmlmind.xmledit.doc.*;
import com.xmlmind.xmledit.view.DocumentView;
import com.xmlmind.xmledit.stylesheet.StyleValue;
import com.xmlmind.xmledit.stylesheet.StyleSpec;
import com.xmlmind.xmledit.stylesheet.StyleSpecsBase;
import com.xmlmind.xmledit.styledview.StyledViewFactory;
import com.xmlmind.xmledit.styledview.CustomViewManager;
import com.sleepycat.dbxml.*;
import com.sleepycat.db.*;
import java.io.File;
import java.util.logging.*;
import java.util.*;
import org.isha.archives.bdbxml.DbContainer;
import org.isha.archives.bdbxml.DbEnv;
public class StyleSheetExtension {
     //Logging variables
     private Logger logger = Logger.getLogger("StyleSheetExtension");
     private Handler fh = null;
     private java.util.logging.Formatter sf = null;
     //XMLMind variables
     private static final Namespace NS = Namespace.get("http://www.ishafoundation.org/archives/schema/transcript");
     //BDB variables
     private DbEnv myDbEnv = null;
     private File envDir = new File("C:\\BerkeleyDB");
     private DbContainer myDbContainer = null;
     private String containerFileName = "reference.dbxml";
     private XmlContainerConfig containerCfg = null;
     //Define Constructor
     public StyleSheetExtension(String[] args, StyledViewFactory viewFactory) {
//Set up simple logging system
try {
fh = new FileHandler("%t/_styleSheetExtn.log");
sf = new SimpleFormatter();
fh.setFormatter(sf);
logger.addHandler(fh);
logger.setLevel(Level.ALL);
logger.info("Starting StyleSheetExtension Class constructor");
} catch (Exception e)
{System.out.println("CustomErr: " + e.getMessage());
                //Exception Handling code
//Create custom BDB Environment and Container Objects
try {
                    myDbEnv = new DbEnv(envDir);
                    containerCfg = new XmlContainerConfig();
                    myDbContainer = new DbContainer(myDbEnv.getManager(), containerFileName, containerCfg);
                    myDbContainer.open();
               } catch (Throwable t) {
                    logger.severe("Problem with Env or Container new thing");
viewFactory.addDependency( NS, "topic", NS, "keywordIDs");
     public StyleValue getKeywords (StyleValue[] args, Node contextNode,
                         StyledViewFactory viewFactory) {
//Get keyword IDs as a String array
String[] keywordID = null;
String[] keywordValue = null;
String keywordIDStr = "";
String keywordValueStr ="";
Name keywordIDs = Name.get("keywordIDs");
keywordIDStr = contextNode.attributeValue(keywordIDs).trim();
keywordID = keywordIDStr.split("\\s+");
keywordValue = new String[keywordID.length];
//for each keyword ID element retrieve the corresponding keyword value
logger.info("getting values");
               keywordValue = getKeywordValuesFromDB(keywordID);
               Arrays.sort(keywordValue);
               logger.info(keywordValue[0] + " " + keywordValue[1]);
               int i = 0;
               for(i=0; i < keywordID.length; i++) {
                    keywordValueStr += keywordValue[i] + " ";
               keywordValueStr = keywordValueStr.trim();
          return StyleValue.createString(keywordValueStr);
private String[] getKeywordValuesFromDB(String[] IDs){
               String[] values = new String[IDs.length];
               String id = "";
               String value = "";
               String flwor = "";
               int i = 0;
               for(i=0; i < IDs.length; i++) {
                    id = IDs[i].trim();
                    flwor = "for $i in collection('" + myDbContainer.getFilename() + "') /reference/keywords/keyword \n";
                    flwor += "let $id := $i/@id/text() \n";
                    flwor += "let $val := $i/@value/text() \n";
                    flwor += "where $id = '" + id + "'\n";
                    flwor += "return $val";
                    String[] temp = new String[1];
                    temp = myDbContainer.runQuery(flwor);
                    values[i] = temp[0];
                    logger.info("value is: " + values[i]);
               return values;
This instance (and consequently the newly created env and container objects) stay alive until the document is closed.
The xmlmind API also allows you to specify custom classes that will return a component that can be embedded in the stylesheet. (My class returns a JButton which - when clicked - brings up a dialog box which allows the user to specify /modify/addnew keywords to the selected text). As soon as the button is pressed I create a new env and container instance, for the duration of the pop-up window (since I have no way to pass the reference to the existing environment created by the StyleSheetExtension class.
Here's the class defn: (Here goes!) The env and container stuff is at the start of the nested-nested class called KpForm.
package org.isha.archives.xmlmind;
import com.sleepycat.dbxml.*;
import com.sleepycat.db.*;
import java.awt.*;
import java.io.*;
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.AbstractDocument;
import javax.swing.text.DocumentFilter;
import javax.swing.text.BadLocationException;
import javax.swing.event.*;
import javax.swing.text.DocumentFilter.FilterBypass;
import java.util.*;
import java.util.regex.*;
import java.lang.*;
import com.xmlmind.xmledit.xmlutil.*;
import com.xmlmind.xmledit.doc.Element;
import com.xmlmind.xmledit.edit.*;
import com.xmlmind.xmledit.stylesheet.*;
import com.xmlmind.xmledit.styledgadget.*;
import com.xmlmind.xmledit.styledview.*;
import com.xmlmind.xmledit.doc.*;
import java.util.logging.*;
import org.isha.archives.bdbxml.DbEnv;
import org.isha.archives.bdbxml.DbContainer;
public class OpenKeywordPicker implements ComponentFactory {
public Component createComponent(Element element,
Style style, StyleValue[] parameters,
StyledViewFactory viewFactory,
boolean[] stretch){
KeywordEdit topic = new KeywordEdit();
return topic;
     private class KeywordEdit extends JButton {
          //private Element element;
          public KeywordEdit()
               super.setText("Edit");
               super.addMouseListener(new java.awt.event.MouseAdapter() {
                              public void mouseClicked(java.awt.event.MouseEvent evt) {
                                   myJButtonMouseClicked(evt);
          private void myJButtonMouseClicked(java.awt.event.MouseEvent evt) {
                    KpForm myForm = new KpForm();
                    myForm.setVisible(true);
private class KpForm extends javax.swing.JFrame {
     // Variables declaration - do not modify
     private javax.swing.JButton jButton1;
     private javax.swing.JButton jButton2;
     private javax.swing.JButton jButton3;
     private javax.swing.JButton jButton4;
     private javax.swing.JButton jButton5;
     private javax.swing.JButton jButton6;
     private javax.swing.JLabel jLabel1;
     private javax.swing.JLabel jLabel2;
     private javax.swing.JLabel jLabel3;
     private javax.swing.JLabel jLabel4;
     private javax.swing.JLabel jLabel5;
     private javax.swing.JList jList1;
     private javax.swing.JList jList2;
     private javax.swing.JList jList3;
     private javax.swing.JScrollPane jScrollPane1;
     private javax.swing.JScrollPane jScrollPane2;
     private javax.swing.JScrollPane jScrollPane3;
     private javax.swing.JScrollPane jScrollPane4;
     private javax.swing.JTextArea jTextArea1;
     private javax.swing.JTextField jTextField1;
     private DefaultListModel model_1 = new DefaultListModel();
          private DefaultListModel model_2 = new DefaultListModel();
          private DefaultListModel model_3 = new DefaultListModel();
          private javax.swing.JOptionPane jOptionPane1;
          //private KeywordFilter filter_1 = new KeywordFilter();
          //BDB variables
          private DbEnv myDbEnv = null;
          private File envDir = new File("C:\\BerkeleyDB");
          private DbContainer myDbContainer = null;
          private String containerFileName = "reference.dbxml";
          private XmlContainerConfig containerCfg = null;
          private Logger logger = Logger.getLogger("OpenKeywordPicker.KeywordEdit.KpForm");
          private Handler fh = null;
          private java.util.logging.Formatter sf = null;
// End of variables declaration
     /** Creates new form kpForm */
     public KpForm() {
               super();
     initComponents();
     customInit();
          private void customInit(){
                    //Set up simple logging system
               try {
                    fh = new FileHandler("%t/_keywordPicker.log");
                    sf = new SimpleFormatter();
                    fh.setFormatter(sf);
                    logger.addHandler(fh);
                    logger.setLevel(Level.ALL);
                    logger.info("Starting Custom initialization");
               } catch (Exception e) {System.out.println("CustomErr: " + e.getMessage());
                          //Exception Handling code
                    //Create custom BDB Environment and Container Objects
                    try {
                         logger.info("0");
                         myDbEnv = new DbEnv(envDir);
                         logger.info("1");
                         containerCfg = new XmlContainerConfig();
                         logger.info("2");
                         myDbContainer = new DbContainer(myDbEnv.getManager(), containerFileName, containerCfg);
                         logger.info("3");
                         myDbContainer.open();
                    } catch (Throwable t) {
                         logger.severe("Problem with Env or Container new thing - Component: "+ t.getMessage());
          String[] dbIDKeywords;
          jList1.setModel(model_1);
          jList2.setModel(model_2);
          jList3.setModel(model_3);
          dbIDKeywords = getKeywordsFromDB();
          int i=0;
          for(i=0; i < dbIDKeywords.length; i+=2){
          model_1.addElement(new keywordOb(dbIDKeywords[i], dbIDKeywords[i+1]));
          jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          jList2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          jList3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
          //Setup Document Filter for TextField component
          AbstractDocument doc;
          doc = (AbstractDocument)(jTextField1.getDocument());
          doc.setDocumentFilter(filter_1);
          //Setup Document Listener for TextField component
          jTextField1.getDocument().addDocumentListener(new DocumentListener(){
          public void insertUpdate(DocumentEvent e) {
          String val = jTextField1.getText();
          if(val != null & val.trim() != ""){
          jButton1.setEnabled(true);
          else {
          jButton1.setEnabled(false);
          public void removeUpdate(DocumentEvent e) {
          String val = jTextField1.getText();
          if(val != null & !val.trim().equals("")){
          jButton1.setEnabled(true);
          else {
          jButton1.setEnabled(false);
          public void changedUpdate(DocumentEvent e) {
          //Plain text components do not fire these events
          private String[] getKeywordsFromDB(){
          String[] k = null;
          String flwor = "";
          flwor = "for $i in collection('" + containerFileName + "') /reference/keywords/keyword \n";
          flwor += "let $id := $i/@id/text() \n";
          flwor += "let $val := $i/@value/text() \n";
          flwor += "order by $val ascending \n";
          flwor += "return ($id, $val)";
          return k = myDbContainer.runQuery(flwor);
          private class keywordOb implements Comparable{
          private String id;
          private String value;
          public keywordOb(String id, String value){
          this.id = id;
          this.value = value;
          public String getId(){
          return id;
          public String getValue(){
          return value;
          public String toString(){
          return value;
          public int compareTo(Object o){
                              int result = (((keywordOb)this).toString()).compareTo(((keywordOb)o).toString());
                              return result;
          private class questionOb implements Comparable{
          private String id;
          private String value;
          private String[] keywordRefs;
          public questionOb(String id, String value, String[] keywordRefs){
          this.id = id;
          this.value = value;
          this.keywordRefs = keywordRefs;
          public questionOb(){
          this.id = "";
          this.value = "";
          this.keywordRefs = null;
          public String getId(){
          return id;
          public String getValue(){
          return value;
          public String toString(){
          return value;
          public String[] getKeywordRefs(){
          return keywordRefs;
          public void setId(String id){
          this.id = id;
          public void setValue(String value){
          this.value = value;
          public void setKeywordRefs(String[] keywords){
          this.keywordRefs = keywordRefs;
          public int compareTo(Object o){
                         int result = (((questionOb)this).toString()).compareTo(((questionOb)o).toString());
                         return result;
          //Add New Keyword to xml reference File
          private void addNewKeyword(String k){
          String keyword = k;
          int len = jTextField1.getDocument().getLength();
          //Tidy up string
          keyword = keyword.trim();
          keyword = keyword.replaceAll("\\s+"," ");
          keyword = capitalizeWords(keyword);
          String flwor = "";
          //Check that the keyword value doesn't already exist
          flwor = "let $i := collection('" + containerFileName + "')/reference/keywords/keyword[@value = '" + keyword + "'] \n";
          flwor += "return \n";
          flwor += "if(count($i)) then fn:true() \n";
          flwor += "else fn:false() \n";
          boolean keywordExists = bDbConnection.runBooleanQuery(flwor);
          if (keywordExists){
          jOptionPane1.showMessageDialog(new Frame(),
          "The keyword '" + keyword + "' already exists", "Message", jOptionPane1.INFORMATION_MESSAGE);
          try {
          jTextField1.getDocument().remove(0,len);
          } catch (Exception ex) {
          ex.printStackTrace();
          //Terminate method execution
          return;
          //Need to get ID of last keyword
          flwor = "for $i in collection('" + containerFileName + "')/reference/keywords/keyword/@id/text() \n";
          flwor += "order by $i descending \n";
          flwor += "return $i[fn:last()]";
          String[] lastIDArray = new String[1];
          lastIDArray = bDbConnection.runQuery(flwor);
          String lastIDStr = lastIDArray[0];
          //create incremented ID value
          //Note: XML ID attributes must start with a letter - that's why we need to do all this nonsense!
          int lastIDNum = new Integer(lastIDStr.substring(1));
          int nextIDNum = ++lastIDNum;
          String nextIDStr = String.format("%04d", nextIDNum);
          nextIDStr = "K" + nextIDStr;
          //OK Finally - actually add the keyword to the xml reference file
          //use BDB API for updating - since XQuery does not allow
          try
          XmlQueryContext qc = myManager.createQueryContext();
          XmlUpdateContext uc = myManager.createUpdateContext();
          XmlModify mod = myManager.createModify();
          XmlQueryExpression select = myManager.prepare("/reference/keywords", qc);
          mod.addAppendStep(select, XmlModify.Element, "keyword", "");
          select = myManager.prepare("/reference/keywords/keyword[fn:last()]", qc);
          mod.addAppendStep(select, XmlModify.Attribute, "id", nextIDStr);
          mod.addAppendStep(select, XmlModify.Attribute, "value", keyword);
          XmlDocument updateDoc = myContainer.getDocument(docName);
          XmlValue docValue = new XmlValue(updateDoc);
          mod.execute(docValue, qc, uc);
          catch(Exception e){
          System.out.println("Error adding keyword: " + e.getMessage());
          //Add the new keyword to the list of selected keywords
          model_2.addElement(keyword);
          sortModelElements(model_2);
          try {
          jTextField1.getDocument().remove(0,len);
          } catch (Exception ex) {
          ex.printStackTrace();
          private questionOb[] getQuestionsFromDB(keywordOb[] keywordIDs){
          questionOb[] qobs = null;
          String seq = "";
          String flwor = "";
          int num = 0;
          seq = keywordObsToSeq(keywordIDs);
          flwor = "for $i in " + seq + "\n";
          flwor += "let $q := collection('" + containerFileName + "') /reference/questions/question[./keywordRef/@idref/text() = $i] \n";
          flwor += "return $q";
          try
          XmlQueryContext context = myManager.createQueryContext();
          context.setEvaluationType(XmlQueryContext.Eager);
          context.setReturnType(XmlQueryContext.DeadValues);
          XmlResults results = myManager.query(flwor, context);
          // Report Query Info
          String message = "Found ";
          message += results.size() + " entries for query: '";
          message += flwor + "'\n";
          System.out.println(message);
          int numQuestions;
          numQuestions = results.size();
          qobs = new questionOb[numQuestions];
          String[] keyRefs = new String[1];
          String[] keyRefs2 = new String[1];
          XmlResults atts, atts2 = null;
          XmlValue keyRefElem, keyRefAtt = null;
          int i;
          for(i=0; i < numQuestions; i++){
          XmlValue val = results.next();
          atts = val.getAttributes();
          String id = atts.next().getNodeValue();
          String value = atts.next().getNodeValue();
          keyRefElem = val.getFirstChild();
          int j=0;
          while (!keyRefElem.isType(XmlValue.NONE)){
          if(keyRefElem.getType() == XmlValue.TEXT_NODE){
          keyRefElem = keyRefElem.getNextSibling();
          if(keyRefElem.isType(XmlValue.NONE)){
          break;
          System.out.println("1");
          atts2 = keyRefElem.getAttributes();
          System.out.println("2");
          keyRefs[j] = atts2.next().getNodeValue();
          System.out.println("3" + keyRefs[j]);
          System.arraycopy(keyRefs,0,keyRefs2,0,j+1);
          System.out.println("4");
          keyRefs = new String[j+2];
          System.out.println("5");
          System.arraycopy(keyRefs2,0,keyRefs,0,j+1);
          System.out.println("6");
          keyRefs2 = new String[j+2];
          System.out.println("7");
          keyRefElem = keyRefElem.getNextSibling();
          System.out.println("8");
          j++;
          System.out.println(keyRefs[0]+keyRefs[1]);
          //Create new Question Object with retrieved values
          System.out.println("bef");
          questionOb qo = new questionOb(id, value, keyRefs);
          System.out.println("aft");
          qobs[i] = qo;
                    catch(Exception e)
          System.out.println("XML Exception is "+ e.getMessage());
          return qobs;
          private void sortModelElements(DefaultListModel model){
          //Getting the size of the model
          int size = model.getSize();
          //Creating the keyword object based on the size of the model
          keywordOb[] word = new keywordOb[size];
          int i=0;
          //keywordOb j;
          for(i=0; i < size; i++){
          word[i] = (keywordOb) model.getElementAt(i);
          Arrays.sort(word);
          for(i=0; i < size; i++){
          //model.setElementAt(word[i], i);
          model.set(i,word[i]);
          public void messageBox(String message)
          jOptionPane1.showMessageDialog(new Frame(), message , "Message", jOptionPane1.INFORMATION_MESSAGE);
          class KeywordFilter extends DocumentFilter {
          public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr)
          throws BadLocationException {
          int len = fb.getDocument().getLength();
          if(len==0 & noFunnyChars(string) & !string.trim().equals("")){
          fb.insertString(offset, string, attr);
          if(len > 0 & noFunnyChars(string) & len < 30){
          fb.insertString(offset, string, attr);
          public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr)
          throws BadLocationException {
          int len = fb.getDocument().getLength();
          if(len==0 & noFunnyChars(string) & !string.trim().equals("")){
          fb.replace(offset, length, string, attr);
          if(len > 0 & noFunnyChars(string) & len < 30){
          fb.insertString(offset, string, attr);
          private boolean noFunnyChars(String s){
          String regex = "[A-Za-z\\s]+";
          boolean b = Pattern.matches(regex, s);
          return b;
          private String capitalizeWords(String s){
          String s2;
          char[] c = s.toCharArray();
          int i = 0;
          c[0] = Character.toUpperCase(c[0]);
          for(i=0; i < c.length; i++){
          if (!Character.isLetter(c[i])){
          c[i+1] = Character.toUpperCase(c[i+1]);
          s2 = String.valueOf(c);
          return s2;
          private String keywordObsToSeq(keywordOb[] a) {
          StringBuffer result = new StringBuffer();
          String resultStr = "";
          result.append("('" + a[0].getId() + "', ");
          for (int i=1; i < a.length; i++) {
          result.append("'" + a[i].getId() + "', ");
          resultStr = result.toString();
          resultStr = resultStr.trim();
          resultStr = resultStr.substring(0,resultStr.length()-1) + ")";
          return resultStr;
     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
          private void initComponents() {
          jScrollPane1 = new javax.swing.JScrollPane();
          jList1 = new javax.swing.JList();
          jScrollPane2 = new javax.swing.JScrollPane();
          jList2 = new javax.swing.JList();
          jLabel1 = new javax.swing.JLabel();
          jLabel2 = new javax.swing.JLabel();
          jLabel3 = new javax.swing.JLabel();
          jTextField1 = new javax.swing.JTextField();
          jButton1 = new javax.swing.JButton();
          jButton2 = new javax.swing.JButton();
          jButton3 = new javax.swing.JButton();
          jScrollPane3 = new javax.swing.JScrollPane();
          jList3 = new javax.swing.JList();
          jLabel4 = new javax.swing.JLabel();
          jButton4 = new javax.swing.JButton();
          jButton5 = new javax.swing.JButton();
          jLabel5 = new javax.swing.JLabel();
          jScrollPane4 = new javax.swing.JScrollPane();
          jTextArea1 = new javax.swing.JTextArea();
          jButton6 = new javax.swing.JButton();
          setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
          jList1.addMouseListener(new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
          jList1MouseClicked(evt);
          jScrollPane1.setViewportView(jList1);
          jList2.addMouseListener(new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
          jList2MouseClicked(evt);
          jScrollPane2.setViewportView(jList2);
          jLabel1.setText("Available Keywords");
          jLabel2.setText("Selected Keywords");
          jLabel3.setText("Add New Keyword");
          jTextField1.setFont(new java.awt.Font("Tahoma", 0, 12));
          jTextField1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
          jTextField1ActionPerformed(evt);
          jButton1.setText("Add Keyword");
          jButton1.setEnabled(false);
          jButton1.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
          jButton1ActionPerformed(evt);
          jButton2.setText("Modify Keyword");
          jButton3.setText("Remove Keyword");
          jList3.setModel(new javax.swing.AbstractListModel() {
          String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
          public int getSize() { return strings.length; }
          public Object getElementAt(int i) { return strings[i]; }
          jScrollPane3.setViewportView(jList3);
          jLabel4.setText("Questions");
          jButton4.setText("OK");
          jButton4.addActionListener(new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
          jButton4ActionPerformed(evt);
          jButton5.setText("Cancel");
          jLabel5.setText("Add New Question");
          jTextArea1.setColumns(20);
          jTextArea1.setRows(2);
          jScrollPane4.setViewportView(jTextArea1);
          jButton6.setText("Add Question");
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
          .addContainerGap(488, Short.MAX_VALUE)
          .addComponent(jButton5)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addGap(29, 29, 29))
          .addGroup(layout.createSequentialGroup()
          .addGap(38, 38, 38)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
          .addComponent(jButton6)
          .addContainerGap())
          .addGroup(layout.createSequentialGroup()
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
          .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)
          .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
          .addComponent(jLabel5)
          .addComponent(jLabel4)
          .addGroup(layout.createSequentialGroup()
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(jLabel1)
          .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
          .addGap(31, 31, 31)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(jLabel2)
          .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
          .addGap(32, 32, 32)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addComponent(jLabel3)
          .addComponent(jButton1)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
          .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
          .addComponent(jButton3, javax.swing.GroupLayout.Alignment.LEADING))))
          .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 559, Short.MAX_VALUE)))
          .addContainerGap(58, Short.MAX_VALUE))))
          layout.setVerticalGroup(
          layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
          .addGroup(layout.createSequentialGroup()
          .addGap(24, 24, 24)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
          .addGroup(layout.createSequentialGroup()
          .addComponent(jLabel1)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
          .addGroup(layout.createSequentialGroup()
          .addComponent(jLabel2)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
          .addGroup(layout.createSequentialGroup()
          .addComponent(jLabel3)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jButton1)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
          .addComponent(jButton2)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jButton3))))
          .addGap(29, 29, 29)
          .addComponent(jLabel4)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addGap(20, 20, 20)
          .addComponent(jLabel5)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
          .addComponent(jButton6)
          .addGap(31, 31, 31)
          .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
          .addComponent(jButton4)
          .addComponent(jButton5))
          .addGap(21, 21, 21))
          pack();
}// </editor-fold>
          //Event handlers
          private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
          // TODO add your handling code here:
                    try {
                         myDbContainer.close();
                         myDbEnv.cleanup();
                    } catch (Exception e) {
                         logger.info("Could not close container/or env - Component");
                    super.setVisible(false);
                    super.dispose();
               private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
          // TODO add your handling code here:
                    String val;
                    val = jTextField1.getText();
                    if(val != null & val.trim() != "" & noFunnyChars(val) ){
                         jButton1.setEnabled(true);
                    else {
                         jButton1.setEnabled(false);
               private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
          // TODO add your handling code here:
               // Add new keyword to the xml reference file
                    //addNewKeyword(jTextField1.getText());
               private void jList2MouseClicked(java.awt.event.MouseEvent evt) {
          // TODO add your handling code here:
                    if(evt.getClickCount() == 2) {
                         keywordOb k = (keywordOb)jList2.getSelectedValue();
                         model_2.removeElement(k);
                         model_1.addElement(k);
                         sortModelElements(model_1);
                         questionOb q = null;
                         //Remove associated questions from listbox
                         int i,j;
                         for(i=0; i < model_3.size(); i++){
                              q = (questionOb)model_3.getElementAt(i);
                              for(j=0; j < model_3.size(); j++){
                                   if (q.getKeywordRefs()[j].equals(k.getId())){
                                        model_3.removeElement(q);
                                        i--;
                                        break;
               private void jList1MouseClicked(java.awt.event.MouseEvent evt) {
          // TODO add your handling code here:
               if(evt.getClickCount() == 2) {
                         //Getting properties of the selecteditem item in jList1.
                    keywordOb k = (keywordOb)jList1.getSelectedValue();
                    //Removing the element from jList1
                    model_1.removeElement(k);
                    //Adding the element to jList2
                    model_2.addElement(k);
                    sortModelElements(model_2);
                    //Load the questions for the selected keywords
                    int len;
                    len = model_2.getSize();
                    keywordOb[] dbQuestionsOb = new keywordOb[5];
                    keywordOb[] selectedKeywordsOb = new keywordOb[len];
                    String[] selectedKeywordIDs = new String[len];
                    int i;
                    for(i=0; i < len; i++) {
                         selectedKeywordsOb[i] = (keywordOb)model_2.getElementAt(i);
                         selectedKeywordIDs[i] = selectedKeywordsOb[i].getId();
                    questionOb[] questionsOb = getQuestionsFromDB(selectedKeywordsOb);
                    model_3.removeAllElements();
                    for(i=0; i < questionsOb.length; i++){
                         model_3.addElement(questionsOb[i]);
                    // sortModelElements(model_3);
I think thats too much code for one post!

Similar Messages

  • ServletInputStream error when reading more than once

    I have an application which needs to look at fields in a multipart request in several different places of the code. The first time I look at the request, it works just fine, but every time after that it doesn't. Here is a simplified example of what is happening:
    private ServletInputStream in;
    private HttpServletRequest request;
    private byte[] buff = new byte[100*1024];
    public Class class1  {
        public class1(HttpServletRequest req) {
            super();
            request = req;
            in = request.getInputStream();
            String line = readLine();
            System.out.println("Testing line1: " + line);
    private ServletInputStream in2;
    private HttpServletRequest request;
    private byte[] buff = new byte[100*1024];
    public Class class2  {
        public class2(HttpServletRequest req) {
            super();
            request = req;
            in2 = request.getInputStream();
            String line = readLine();
            System.out.println("Testing line2: " + line);
    }Not sure that it is relevant, but in case it is, my readLine() method looks like this:
    private String readLine() throws IOException {
        int len = 0;
        String line = null;
        len = in.readLine(buff,0,buff.length);
        if(len < 0) return null;
        line = new String(buff,0,len,"ISO-8859-1");
        return line;
    }The request is basically passed around so it is the same request object both times. The first one outputs the first line as expected. In the second one however, line is null.
    Interestingly enough, I found the following to be true also:
    private ServletInputStream in;
    private ServletInputStream in2;
    public Class class3 {
        public class3(HttpServletRequest request){
            super();
            in = request.getInputStream();
            if(in != null) {
                in.close();
            in = null;
            in2 = request.getInputStream();
            String line = in2.readLine();
            // IOException OCCURS HERE SAYING: Stream closed
    }The stream was closed on the first "in" but not on the second, so why would I be getting this????
    Help!!

    I am not completely sure what to do now. Basically, I have a multipart request for a fileupload. Towards the beginning of my servlet, I need to get the form parameters. This is working fine. But since you say that the getInputStream() will return the same instance regardless of where it is called from, I am in trouble when later on in the code I need to actually upload the file. To integrate this into my core java framework, there really isn't a way that I can get all the information I need at the beginning and use it later. Is there a way I can get the form parameters WITHOUT using the inputstream? Then, my inputstream could be called in my mapper for uploading the file. I haven't found another way to do this, as multipart requests are handled differently. Any suggestions at all?

  • Permissions Error if Script is run more than once with out closing Diadem

    I am in a REAL pickle here and need some HELP......
    I get a permissions error message when I try and run my scripts more than once with out closing Diadem 2011.
    Call scriptinclude ("D:\_Calterm_Configuration_Files\Technical_Information\DIAdem_Scripts\Importing Multiple Data Logs_CaltermIII_Local.VBS")
    Error is around this portion of script:
    '******* GetFilePaths() *** *** NEW Function ***
    Function GetFilePaths(DefaultDir, ExtFilter, MultipleDir, Msg)
    Dim i, k, f, fso, iMax, FileListPath, StartIdx, CurrFiles, FileList
    ' Promt the User to select the ASCII files to load with a File Dialog
    FileListPath = AutoActPath & "FileDlgList.asc"
    Set fso = CreateObject("Scripting.FileSystemObject")
    StartIdx = 0
    ReDim FileList(0)
    Do ' Until (DlgState = "IDCancel")
    Call FileNameGet("ANY", "FileRead", DefaultDir, ExtFilter, FileListPath, 1, Msg)
    IF (DlgState = "IDCancel") THEN Exit Do
    ' Read in the saved list of file(s) selected in the File Dialog into FileList()
    **** This next line is where the ERROR happens *******
    Set f = fso.OpenTextFile(FileListPath, 1, True) ' f.ReadAll returns file contents
    CurrFiles = Split(vbCRLF & f.ReadAll, vbCRLF) ' turn file lines into an array
    f.Close ' close the file
    iMax = UBound(CurrFiles)
    IF iMax > 0 AND Trim(CurrFiles(iMax)) = "" THEN
    iMax = iMax - 1
    ReDim Preserve CurrFiles(iMax)
    END IF
    Call BubbleSort(CurrFiles) ' sort the array of file names alphabetically
    ' Append current file dialog selection(s) to any previous file dialog selection(s)
    IF iMax < 1 THEN iMax = 0
    ReDim Preserve FileList(k + iMax)
    FOR i = 1 TO iMax
    k = k + 1
    FileList(k) = CurrFiles(i)
    NEXT ' i
    IF MultipleDir <> TRUE THEN Exit Do ' forces only 1 dialog, good if all desired files are in the same folder
    Loop ' Until (DlgState = "IDCancel")
    GetFilePaths = FileList
    End Function ' GetFilePaths()
    266 6:18:34 PM Error:
    Error in <NoName(1).VBS> (Line: 8, Column: 1):
    Error in <Importing Multiple Data Logs_CaltermIII_Local.VBS> (Line: 140, Column: 5):
    Permission denied
    I can send the script and file I am loading if that would help.
    Solved!
    Go to Solution.

    Jcheese,
    I understood that if you call this script within DIAdem you don't get any error, however, when you run that script from another source (with DIAdem opened) for the second time you get the error, right? 
    If this is the case, I think it might be that the file haven't close correctly in the script. Could you upload the script file?
    Carmen C.

  • Custom Administrative Template Error 53 Key name specified more than once

    Hi All,
    Hope I've picked the correct forum. I am making my first foray into setting up a custom administrative template for some software that is developed in house. The current deployment method is to merge a reg file on each computer that requires the registry
    settings. I am trying to set this up so that it is controlled via GPO.
    My idea is that in the a GP can set the registry settings for one or more areas that are controlled by the software. 
    The problem I have - I get Error 53 Keyname specified more than once on Line 9 (second KEYNAME). In total I will have about 30 different sites this needs to be set up for.
    Does this mean that I can't set more than one registry key per "Policy" setting in the GPO?
    The adm file I have so far is below
    TIA
    Jason
    ---------------------------------------------CUT---------------------------------------------
    CLASS User
    CATEGORY "App Site Settings"
    POLICY !!Site1Policy
    EXPLAIN !!Site1Explain
    KEYNAME "Software\ApplicationCompany\Site1\Access"
    VALUENAME "SystemDatabase"
    VALUEON "D:\\App\\Data\\App.mdw"
    VALUEOFF DELETE
    KEYNAME "Software\ApplicationCompany\Site1\Arbitration"
    VALUENAME "ConfigPath"
    VALUEON "D:\\Site1\\Data"
    VALUEOFF DELETE
    KEYNAME "Software\ApplicationCompany\Site1\Common Settings"
    VALUENAME "ConfigFile"
    VALUEON "D:\\App\\Data\\App_Comms.mdb"
    VALUEOFF DELETE
    VALUENAME "SysConfig"
    VALUEON "D:\\Site1\\Data\\SITE1_SYS.mdb"
    VALUEOFF DELETE
    END POLICY
    POLICY !!Site2Policy
    EXPLAIN !!Site2Explain
    KEYNAME "Software\ApplicationCompany\Site2\Access"
    VALUENAME "SystemDatabase"
    VALUE "D:\\App\\Data\\App.mdw"
    KEYNAME "Software\ApplicationCompany\Site2\Arbitration"
    VALUENAME "ConfigPath"
    VALUE "D:\\Site2\\Data"
    KEYNAME "Software\ApplicationCompany\Site2\Common Settings"
    VALUENAME "ConfigFile"
    VALUE "D:\\App\\Data\\App_Comms.mdb"
    VALUENAME "SysConfig"
    VALUE "D:\\Site2\\Data\\Site2_SYS.mdb"
    END POLICY
    END CATEGORY
    [strings]
    Site1Policy = "Site1 settings"
    Site1Explain = "Enabling this setting configures the registry settings for dummy Site1."
    Site2Policy = "Site2 settings"
    Site2Explain = "Enabling this setting configures the registry settings for dummy Site2."

    Well - I ended up sorting this out - and no - you can't have the Keyname keyword twice - unless you enclose the the setting in a PART statement. Below is what I ended up with:
    ---------------------------------------------CUT---------------------------------------------
    CLASS USER
    CATEGORY "ApplicationSettings"
    KEYNAME "Software\ApplicationCompany\Site1\Common Settings"
    POLICY !!SITE1Policy
    #if version >= 3
    EXPLAIN !!PolicyExplain
    #endif
    KEYNAME "Software\ApplicationCompany\Site1\Access"
    PART !!ConfigFilePolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site1\Common Settings"
    VALUENAME ConfigFile
    DEFAULT !!ConfigFileDefault
    END PART ;!!ConfigFilePolicy
    PART !!SystemDBPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site1\Access"
    VALUENAME SystemDatabase
    DEFAULT !!SystemDBDefault
    END PART ;!!SystemDBPolicy
    PART !!SysConfigPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site1\Common Setting"
    VALUENAME SysConfig
    DEFAULT !!SysConfigDefault
    END PART ;!!SysConfigPolicy
    PART !!ArbitrationPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site1\Arbitration"
    VALUENAME ConfigPath
    DEFAULT !!ArbitrationDefault
    END PART ;!!ArbitrationPolicy
    END POLICY
    POLICY !!SITE2Policy
    #if version >= 3
    EXPLAIN !!PolicyExplain
    #endif
    KEYNAME "Software\ApplicationCompany\Site2\Access"
    PART !!ConfigFilePolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site2\Common Settings"
    VALUENAME ConfigFile
    DEFAULT !!ConfigFileDefault
    END PART ;!!ConfigFilePolicy
    PART !!SystemDBPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site2\Access"
    VALUENAME SystemDatabase
    DEFAULT !!SystemDBDefault
    END PART ;!!SystemDBPolicy
    PART !!SysConfigPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site2\Common Setting"
    VALUENAME SysConfig
    DEFAULT !!SysConfigDefault
    END PART ;!!SysConfigPolicy
    PART !!ArbitrationPolicy EDITTEXT
    KEYNAME "Software\ApplicationCompany\Site2\Arbitration"
    VALUENAME ConfigPath
    DEFAULT !!ArbitrationDefault
    END PART ;!!ArbitrationPolicy
    END POLICY
    END CATEGORY
    [Strings]
    ArbitrationDefault =D:\SITE\Data
    ArbitrationPolicy =Arbitration path
    ConfigFileDefault =D:\App\Data\App_Comms.mdb
    ConfigFilePolicy =Application configuration file
    PolicyExplain =Enter Explainition of the Registry settings here
    SysConfigDefault =D:\SITE\Data\SITE1_SYS.mdb
    SysConfigPolicy =Application site system configuration file
    SystemDBDefault =D:\App\Data\App.mdw
    SystemDBPolicy =Application system database path
    SITE1Policy =Site1 Application Settings
    SITE2Policy =Site2 Application Settings

  • Is it possible to open a form created with screen painter more than once?

    I have created a form with the screen painter. In the screen painter the form is assigned a FormUID. Probably because this is done, it is impossible to open the form more than once??
    Thanks,
    Kind regards

    Hi J.
    The answer is yes You just have to give your form a unique id.
    1) Give your form in screen painter a name like BTWO_DYNAMIC_UID (just plain text).
    2) Make sure your <i>FormType</i> and <i>appformnumber</i> have a unique number (i.e. 2000060001). You can do this in the xml source.
    3) By loading your document replace the BTWO_DYNAMIC_UID with an unique id. I have a counter that's a member of my class and increase that number to get a unique id (BTWO_F_1, BTWO_F_2 etc)
    I have added a code sample, SBOApplication is my SAP application object and mFormNumber is a member (integer) of my class.
    <i>Succes d'r mee, en als 't nie lukt hoor ik het wel... ;)</i>
    <b>Code (C#):</b>
    // New xml document
    XmlDocument oXmlDoc = new XmlDocument();
    private Form LoadUniqueForm(string AMyFile)
      // Define your path to
      sPath = @"Forms" + AMyFile;
      // Load the form
      oXmlDoc.Load(sPath);
      // Replace the string with an unique id
      mFormNumber++;
      string sXML = oXmlDoc.InnerXml.Replace("BTWO_DYNAMIC_UID", "BTWO_F_" + mFormNumber.ToString());
      // load the XML file in SAP
      SBOApplication.LoadBatchActions(ref sXML);
      // Return the form
      return SBOApplication.Forms.Item("BTWO_F_" + mFormNumber.ToString());

  • Powershell and Client Object Model - no error thrown if user is added more than once to same site or group

    Hello All -
    I am trying to add a user to a SharePoint site using PowerShell like below:-
    New-SPUser -UserAlias MyDomain\jan20a -Web http://SPServer/sites/MySite
    If I execute the above more than once, SharePoint does not throw that user already exists or something. This is not the same behavior in AD/Exchange PowerShell cmdlets.
    Also, even the client object model behaves the same way.
    Another interesting thing I noticed, I tried to remove a user from group in which the user was not part of it at all and still no error..!!
    Looks like SharePoint does not care of invalid input and just ignores it.
    Can anyone please confirm this and also the reason behind it ?

    It's not really invalid input, since the user exists and that is how SharePoint behaves (will behave same way in browser).  Try to input a user that and misspell the name, e.g. say you didn't have a MyDomain\Jan21a, then try to use same script above,
    only with invalid data.  It will bark at you.  Or try using a web that it cannot find, one that does not exist.  You'll get what I like to call, the red badge of courage if you enter invalid data.
    you can test that sharepoint will let you enter a user twice in the browser, and nothing bad comes from it.  Powershell is just unable to tell that the user was not in the site, when you removed it the second time. 
    Hope that confirms it, if it does please mark this reply accordingly.  thanks
    Stacy Simpkins | MCSE SharePoint | www.sharepointpapa.com

  • Error : Document contains same order item more than once in IDOC

    We have Intercompany IDOCs getting created in our system. The
    trigger for this is the Billing Document in the same system in
    differenct company code. The MEssage type being used is INVOIC and the
    basic type is INVOIC01.
    The IDOC is in the status of 51 with the error message
    Document contains same order item more than once
    Message No : M8 321.
    Can anyone tell me why raise this error and how to resolve it?
    Thanks.

    What I have recently learned is that in 6.0 SAP allows the same line item to be on an idoc multiple times.  However, the item has to be GR-based-IV and there has to be a unique entry in the delivery note of the GR.   I have successfully tested this in my development system.  
    What I can't get to work is if the GRs have the same delivery note value.   What I think is happening is these GRs are not unique so SAP cannot match a GR with an IR so it fails with this error. 
    Here are the examples:
    Works 
    GR# A           deliverynote/BOL    "abcd"
    GR# B           deliverynote/BOL     "efgh"
    Invoice idoc
    e1edp02    qualifier 016          abcd
    e1edp02    qualifier 016          efgh
    Doesn't work:
    GR# A           deliverynote/BOL    "abcd"
    GR# B           deliverynote/BOL     "abcd"
    Invoice idoc
    e1edp02    qualifier 016          abcd
    e1edp02    qualifier 016          abcd
    If anyone knows of a way to make the second scenario work, I'd like to hear your solution.
    Thanks
    Sandra

  • How to retrict user cannot open the same form more than once (Forms 6i)

    Our users always open the same forms more than once. For example the customer form, the user may access a customer record in the first form, however, he will open a new customer form to edit the same record, the result is he cannot save the record because the record is locked in the first customer form.
    How can I control the user cannot open the same form more than 1 time.
    Best Regards,
    Kane

    The customer form is only an example, I found there will cause a lot of problems is I cannot control the user from calling 1 program more than 1 than within application. Sometimes a user (not good in using computer) will overlap the form for many times.....
    Is there any simple way to do that?...can I have some PL/SQL statement or build-in functions that let me easily found our what forms the user has already opened, then I can control whether I let him open this form or not.
    Urgent...please
    Thanks

  • Error: An attribute cannot appear more than once in the same start tag

    Hi Everyone,
    when i run the page sometimes it works fine but sometimes it throws Compilation Error as below.
    "Error(502,1224): file:/C:/Jdeveloper/jdevhome/jdev/myhtml/OA_HTML/fwk/t/Session_2055663493/region1.uix<Line 502, Column 1224>: XML-20124: (Fatal Error) An attribute cannot appear more than once in the same start tag."
    And i delete the particular file from the path and run the page so this time it works fine.
    But later after sometime i get the same error but the session number will be changed, then again i need to delete it and run.
    What can be the permanent solution for this issue?
    Plz let me know any suggetions.
    Thanks.

    Seems like the mdl file is corrupted or was not generated correctly.
    Can you try to create the mdl file again and then try the import ?
    If it doesn't work then try contacting Oracle Support.

  • Statechart module: Using a master statechart to launch a slave statechart more than once without getting Error 1100 at Obtain Queue (No object of that name was found)

    Hello,
    I am trying to create a project using the statechart module, and one of the techniques I am trying to use is a "master-slave" statechart structure, illustrated by the code I have attached to this post (you probably need the statechart module installed to look at my example code).  The problem I have recently discovered is that the slave statecharts cannot be launched more than once without raising an Error 1100 at Obtain Queue.  I have gathered from a few other posts that the cause of this error is the fact that the First Call primitive is used by the Statechart module to initialize the statechart when it is first run.  This works fine for the first launch of the slave statechart, but the second launch and subsequent launches of the statechart fail on Error 1100, since the First Call primitive won't let the statechart initialize (the First Call primitive tells the statechart it has already been initialized (this isn't the first call), and the External Trigger function then tries to send an external trigger to a queue that doesn't exist).
    What I can't gather from those posts is the correction I need to make to get this design to work.  I tried to send the slave statecharts a boolean flag for the "Init?" terminal, to force a reinitializing of the slave statechart.  I couldn't get that to work.  I tried to not load the slave sub VI as a slave sub VI, and launch it using some VI Server code, so that maybe the slave sub VI would be loaded and unloaded, therefore causing the statechart to properly initialize, but I couldn't get that to work either.  What correction should I make?  How do I get this to work?
    I really want to use this design pattern, first of all since I wrote a lot of code already with this structure, and second of all, it makes a lot of sense to me.  How do I make it work?  If someone could post a version of my code that functions the same, but without the error, I would appreciate that.  If you don't have time for that, but would be able to outline the steps I need to take to get it to work, that would be helpful, as well.
    Thanks to anyone for any assistance they can provide.  If you need any other information, please let me know.
    Attachments:
    Statechart Sample.zip ‏431 KB

    Thanks, Deborah.  I tried this approach out, and it turns out you can't just wire a TRUE to the "Init?" terminal.  You have to wire a TRUE for the first run of the slave statechart, and then it has to become a FALSE.  If you wire a TRUE, it will constantly try to reset the statechart, which doesn't work.
    The master statechart has to keep track of whether it has called the slave statechart, and communicate that to the slave statechart.  On the very first call of the slave statechart, the "First Call?" function inside of the "Run Statechart" function will give a TRUE, which initializes the statechart properly, and then gives a FALSE from that point after.  After that, the "First Call?" function doesn't work anymore (it will always return FALSE), and an initial TRUE, with subsequent FALSE values, has to be provided manually.
    I attached a version that does this, which appears to work.  Let me know if it doesn't work for someone, or if you have a better idea to implement the correction.
    Thanks to everyone for the replies!
    Attachments:
    Master-Slave Statechart Sample.zip ‏439 KB

  • Heading level hierarchy errors when topics are in TOC more than once

    I have discovered that the hierarchy in the Heading levels in
    the Printed Documentation will differ from than in my online help
    table of contents hierarchy, and that the problem is due to topics
    that are intentionally in the TOC more than once.
    For example, in chapter 5 of a particular help system the
    hierarchy should be:
    Heading 1 < Chapter 5 title from top-level book>
    Heading 2 <title of second level book>
    Heading 3 <title of topic that appears under second-level
    book>*
    What I actually get is:
    Heading 1 < Chapter title from top-level book>
    Heading 2 <title of second level book>
    Heading 4 <title of topic that appears under second-level
    book>*
    * This same topic appeared in an earlier chapter. In that
    chapter it was really at a Heading 4 level.
    Due to company styles, etc. we use a numbering system at the
    headings and in the TOC, so instead of
    5
    5.1
    5.1.1
    I erroneously get
    5
    5.1
    5.1.1.1
    This type of hierarchy issue appears multiple times in this
    particular document (which I inherited by the way.)
    Other than restructuring the document to not reuse topics in
    different places in the TOC, is there a solution or a workaround
    for this problem?
    What I am doing so far, is generating the Print Documentation
    one chapter at a time. As long as a topic is not reused with the
    same chapter, my hierarchy of heading levels is maintained;
    otherwise, it is not. Then I can put the chapters back together
    after fixing the few places that still have heading level problems.
    This however, will be quite cumbersome as this document is
    translated into nine other languages.
    I am using RoboHelp X5 for Word / Word 2003 for the source
    and most of the translations; RoboHelp Asian Edition, Simplified
    Chinese / Word 2003 for the Chinese translation. The heading level
    hierarchy error occurs in both versions.

    >> AF: I've commented in sections...
    Without Maintain Heading Levels, RH will apply heading levels
    to the books and then the topic levels will get bumped down. So a
    top level book will be Heading 1 and the Headings in the topic will
    get bumped down to 2, 3 and 4 etc. If then you have another book
    one level down so that it gets Heading 2 applied, the same topic
    but under the level two book would then get 3, 4 and 5 applied.
    That is not the original problem but hopefully we are agreed
    that is how things work on that.
    >> Yes - that is the expected behavior. When it didn't
    happen as expected, that's what led me to the discovery of the
    cause of the problem (topic reuse).
    Your problem was that firstly Heading 3 got bumped to Heading
    4 if the same topic was inserted into the TOC twice. I assume it
    was OK in the first instance, or is it that when you add it twice
    it goes wrong everywhere?
    >> Your assumption is correct. First occurrence is
    correct. Second, third, and fourth (yes - there is one topic that
    is used 4 times! ) are not correct based on TOC hierarchy.
    On the numbering, nothing surprises me. If you look at my
    site you will see that for RH HTML, i gave up on getting it right.
    I have had many queries on this and more than a few people have
    indicated they will work on the problem and get it working. I'm
    still waiting. There are many posts about outline numbering
    problems. Has anyone got it working satisfactorily?
    >> I don't really have numbering problems. The
    numbering is following the RoboHelp-generated hierarchy and the
    .dot template that I apply. It's just that the RH-generated
    hierarchy and its heading levels don't correspond to the "real"
    hierarchy because of the reuse issue.
    I have seen various Word gurus maintain that numbering has
    not worked entirely satisfactorily since Word 2! Also enough posts
    to convince me this is a Word issue, not a RH issue.
    If you want to create a new project and knock something up
    that demonstrates this problem, by all means zip it up and send it.
    I'll assume it will be a small project and zip to less than 5mb. If
    more, contact me first.
    >> Unless you have RoboHelp X3 Asian Edition,
    Simplified Chinese, there is really no need. I plan to either avoid
    the reuse issue in the source, or build the print doc in sections
    which is easy enough in RoboHelp X5 for the non-Chinese languages.
    It is in the older Asian edition where the problems are compounded
    by the omitted reuse topics. If you do have RoboHelp X3 Asian
    Edition, Simplified Chinese and want to experiment, I can send you
    a cut-down version of the project. Don't feel obligated though;
    unless you can read Chinese (I can't) it is very tedious to work
    with.

  • LSMW error: Field name '' used more than once in file"

    Hi,
    I am doing a sample vendor master load with LSMW but while reading data I am getting an error
    "Field name '' used more than once in file
    'C:\Users\sdurgia\Desktop\LSMW\MM\vendor_master_te
    s'."
    Not getting proper reason.Can you please guide?
    Urgent please help.
    BR
    Sumeet

    Hi,
    FYI.
    LIFNR
    BUKRS
    EKORG
    KTOKK
    NAME1
    NAME2
    SORT1
    SORT2
    STREET
    HOUSE_NUM1
    STR_SUPPL1
    STR_SUPPL2
    CITY2
    CITY1
    REGION
    POST_CODE1
    LAND1
    TAXJURCODE
    PFACH
    PSTL2
    REMARK
    TEL_NUMBER
    TEL_EXTENS
    MOB_NUMBER
    FAX_NUMBER
    FAX_EXTENS
    SMTP_ADDR
    DEFLT_COMM
    KUNNR
    VBUND
    KONZS
    BEGRU
    STCD1
    STCD2
    STCD3
    STCD4
    SCACD
    SFRGR
    DLGRP
    BANKS
    BANKL
    BANKN
    KOINH
    BKONT
    LNRZA
    XZEMP
    AKONT
    ZUAWA
    FDGRV
    BEGRU1
    QSSKZ
    QSZNR
    QSZDT
    ALKTN
    ZTERM
    TOGRU
    REPRF
    KULTG
    ZWELS
    ZAHLS
    LNRZB
    HBKID
    TOGRR
    EIKTO
    WAERS
    ZTERM1
    INCO1
    INCO2
    EIKTO1
    WEBRE
    XERSY
    XERSR
    VSBED
    NAMEK
    J_1IPANO
    QLAND
    LFBW-QSREC
    XVERR
    FYTYP
    STCDT
    BKREF
    4000048674
    2550
    M004
    DHL EXPRESS (USA) INC
    PAY
    4000069273
    PO BOX 4723
    HOUSTON
    TX
    US
    77210-4723
    CONTAC: IRMA MURILLO
    800-225-5345
    281-874-0678
    [email protected]
    94-3380425
    US
    11000536
    999999
    ACCOUNT HOLDER
    221300
    1
    AP VEND
    Z011
    X
    T
    B
    USD
    Z011

  • Method called more than once - and dies with EXC_BAD_ACCESS error

    Hi,
    In my app, I have 4 views with their respective viewControllers. In the appDelegate.m, I provide methods that allows to switch to any of these views. Following is code for switching to the editView:
    -(void) flipToEditView {
    [self populateTheList]; // populate an array
    EditViewController *anEditVC = [[EditViewController alloc] initWithNibName:@"EditView" bundle:nil];
    [self setEditVC:anEditVC];
    [viewController.view removeFromSuperview];
    [self.window addSubview:[editVC view]];
    [anEditVC release]; }
    The view is not switched - and moreover, this method is called more than once; and the app dies with EXCBADACCESS!
    2009-08-23 14:54:40.648 iNotate[2128:20b] Album (before): x= 0 y=20 width=320 height=460
    2009-08-23 14:54:40.653 iNotate[2128:20b] Album (after): x= 0 y= 0 width=320 height=480
    warning: Couldn't find minimal bounds for "_sigtramp" - backtraces may be unreliable
    (gdb) bt
    #0 -[iNotateAppDelegate flipToEditView] (self=0x523690, _cmd=0x9563) at /Users/sam/MY_FILES/iPhone Apps/app/Classes/iNotateAppDelegate.m:116
    #1 0x00008661 in -[FirstView editAction] (self=0x546a30, _cmd=0xac94) at /Users/sam/MY_FILES/iPhone Apps/app/FirstView.m:25
    #2 0x30a4eee6 in -[UIApplication sendAction:to:from:forEvent:] ()
    #3 0x30ab0d36 in -[UIControl sendAction:to:forEvent:] ()
    #4 0x30ab11fe in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
    #5 0x30ab0544 in -[UIControl touchesEnded:withEvent:] ()
    #6 0x30a67917 in -[UIWindow sendEvent:] ()
    #7 0x30a56fff in -[UIApplication sendEvent:] ()
    #8 0x30a561e0 in _UIApplicationHandleEvent ()
    #9 0x31565dea in SendEvent ()
    #10 0x3156840c in PurpleEventTimerCallBack ()
    #11 0x94a713c5 in CFRunLoopRunSpecific ()
    #12 0x94a71aa8 in CFRunLoopRunInMode ()
    #13 0x31566600 in GSEventRunModal ()
    #14 0x315666c5 in GSEventRun ()
    #15 0x30a4eca0 in -[UIApplication _run] ()
    #16 0x30a5a09c in UIApplicationMain ()
    #17 0x000027e8 in main (argc=1, argv=0xbffff068) at /Users/sam/MY_FILES/iPhone Apps/app/main.m:14
    Current language: auto; currently objective-c
    (gdb) continue
    2009-08-23 14:54:55.885 iNotate[2128:20b] >>>>>>>>>>>>>>>>>> populateTheList
    (gdb) bt
    #0 -[iNotateAppDelegate flipToEditView] (self=0x523690, _cmd=0x9563) at /Users/sam/MY_FILES/iPhone Apps/app/Classes/iNotateAppDelegate.m:116
    #1 0x00008661 in -[FirstView editAction] (self=0x5457b0, _cmd=0xac94) at /Users/sam/MY_FILES/iPhone Apps/app/FirstView.m:25
    #2 0x30a4eee6 in -[UIApplication sendAction:to:from:forEvent:] ()
    #3 0x30ab0d36 in -[UIControl sendAction:to:forEvent:] ()
    #4 0x30ab11fe in -[UIControl(Internal) _sendActionsForEvents:withEvent:] ()
    #5 0x30ab0544 in -[UIControl touchesEnded:withEvent:] ()
    #6 0x30a67917 in -[UIWindow sendEvent:] ()
    #7 0x30a56fff in -[UIApplication sendEvent:] ()
    #8 0x30a561e0 in _UIApplicationHandleEvent ()
    #9 0x31565dea in SendEvent ()
    #10 0x3156840c in PurpleEventTimerCallBack ()
    #11 0x94a713c5 in CFRunLoopRunSpecific ()
    #12 0x94a71aa8 in CFRunLoopRunInMode ()
    #13 0x31566600 in GSEventRunModal ()
    #14 0x315666c5 in GSEventRun ()
    #15 0x30a4eca0 in -[UIApplication _run] ()
    #16 0x30a5a09c in UIApplicationMain ()
    #17 0x000027e8 in main (argc=1, argv=0xbffff068) at /Users/sam/MY_FILES/iPhone Apps/app/main.m:14
    (gdb) continue
    2009-08-23 14:55:22.493 iNotate[2128:20b] >>>>>>>>>>>>>>>>>> populateTheList
    Program received signal: “EXCBADACCESS”.
    (gdb) continue
    What's happening here?
    Sam!

    -(void) flipToEditView {
    [self populateTheList]; // populate an array
    EditViewController *anEditVC = [[EditViewController alloc] initWithNibName:@"EditView" bundle:nil];
    [self setEditVC:anEditVC];
    [viewController.view removeFromSuperview];
    [self.window addSubview:[editVC view]];
    [anEditVC release]; }
    }<---- is this } matched elsewhere?

  • File open on more than one computer at a time

    I maintain a network of four Macs (Cube, G4 Tower, Mini, and G5 Tower) all running OS 10.4.11. Recently two people working on the network discovered that they both had a certain file open at the same time. In order to determine the extent of the problem, on each computer I created and kept open a TextEdit file. I then attempted to open each TextEdit file from the three computers on which the file was not stored. To my dismay I received no error or warning message of any sort. I was able to open all four files on all four computers at the same time!
    Each of the computers has a single user, and each computer is logged into the other computers as the user on that computer (i.e., each guest is logged in as the host). I wonder if that might be the source of the trouble.
    I never noticed any file being open on more than one computer at a time when all the computers were running 10.3.9, only after I upgraded to 10.4.
    Any ideas?

    This is absolutely standard behavior and I don't expect this to change any time soon.
    Let me try to explain based on a model of a file stored on Server1 and being accessed by Client1 and Client2:
    Here's what's happening:
    Client1 connects to the server and opens the file for reading.
    Client1 reads the file and closes it
    Client2 connects to the server and opens the file for reading.
    Client2 reads the file and closes it
    Since Client1 closed the file there's nothing to indicate to Client2 that the document is in use anywhere else because, in fact, it isn't.
    There's nothing on the server that knows whether Client1 opened the file to look at it, to copy it, to back it up to some other media or to actually edit it. It is only that last step that should prevent another client from opening the file.
    If you think about it, that makes perfect sense. If you copy the file over the network to Client1 you do not want the server to think that Client1 has an exclusive hold on that file and to prevent Client2 from opening it.
    The only time the file is in use is a) when the file is being read, and b) when the file is being saved. When it's just being viewed the client doesn't have an active hold on the file.
    The actual fix here is for the application to set a flag that the file is in use and for the server to honor that flag. It's supported by the networking protocols but it's rarely implemented in applications except those that expect a multi-user setup.

  • Can you create a form in which its never possible for the same person te sign the form more than once.

    Hi, I've been looking into this for awhile and believe the answer is 'no' but was just wondering if anyone here would know of a solution.
    The company I work for has a formulier on which a number of Excel files are placed. This form is then sent to a five (often different) people who are then required to open the Excel files and if accord to place their digital signature. We would like to make sure that no one is able to sign the form more than once and also if possible to make sure they have opened the Excel files. It would be great if anyone had any tips...
    All the very best,
    Martin Angell

    I am not an Excel or Excel-to-PDF conversion expert, so I do not know how Excel forms are converted to PDF form fields. With this caveat here's what I do know.
    In Acrobat It is possible to create a PDF form in which there are JavaScripts associated with fields (any fields, including signature fields). These JavaSripts can do a lot of things, including checking the signer's certificates on the already signed signature fields. Then you can make all unsigned signature fields read-only, in which case the user will not be able to actually sign them. After that you can overlay a button field on top of each unsigned signature field with exactly the same dimensions and associate a JavaAcript with this button field. This JavaScript would put up an UI asking the user for the signing certificate and its password, check this certificate's CN against the list of already signed signature fields and initiate the signing of the unsigned signature field behind this button if your condition is satisfied.
    I never tried that myself but it could work. This looks complicated and it is but if you really want it you can try.

Maybe you are looking for