Changeset 1343


Ignore:
Timestamp:
Nov 29, 2005, 4:37:58 PM (17 years ago)
Author:
per
Message:

Hibernate 3.

Location:
trunk
Files:
21 added
17 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r1194 r1343  
    413413
    414414        <!-- Define the hibernatedoclet task -->
    415     <path id="xdoclet.classpath">
    416         <fileset dir="${build_lib}/">
    417           <include name="*.jar"/>
    418         </fileset>
    419     </path>
    420 
    421     <taskdef name="hibernatedoclet"
    422       classname="xdoclet.modules.hibernate.HibernateDocletTask">
    423         <classpath refid="xdoclet.classpath"/>
    424     </taskdef>
     415        <path id="xdoclet.classpath">
     416          <fileset dir="${build_lib}/">
     417            <include name="*.jar"/>
     418          </fileset>
     419        </path>
     420
     421        <taskdef name="hibernatedoclet"
     422          classname="xdoclet.modules.hibernate.HibernateDocletTask">
     423            <classpath refid="xdoclet.classpath"/>
     424        </taskdef>
    425425
    426426        <!-- Execute the hibernatedoclet task -->
     
    432432        </hibernatedoclet>
    433433
    434         <!-- Upgrade grammar from Hibernate1 to Hibernate2 -->
    435         <replace dir=".">
    436             <include name="*.hbm.xml"/>
     434        <!-- Upgrade grammar from Hibernate2 to Hibernate3 -->
     435        <replace dir="${build}">
     436            <include name="org/proteios/core/element/*.hbm.xml"/>
    437437            <replacefilter token="readonly=" value="inverse="/>
    438438            <replacefilter token="role=" value="name="/>
    439             <replacefilter token="hibernate-mapping.dtd" value="hibernate-mapping-2.0.dtd"/>
     439            <replacefilter token="Hibernate Mapping DTD 2.0" value="Hibernate Mapping DTD 3.0"/>
     440            <replacefilter token="hibernate-mapping-2.0.dtd" value="hibernate-mapping-3.0.dtd"/>
    440441        </replace>
    441442    </target>
  • trunk/dist/batchProteios.bat

    r1338 r1343  
    1 java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\conf\0.8;.\proteios\lib\c3p0.jar;.\proteios\lib\cglib2.jar;.\proteios\lib\commons-collections.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j.jar;.\proteios\lib\ehcache.jar;.\proteios\lib\hibernate2.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\jgroups.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.8.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache.jar;.\proteios\lib\proxool.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.batch.BMain %*
     1java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0-0.9.0.jar;.\proteios\lib\asm-attrs.jar;.\proteios\lib\asm.jar;.\proteios\lib\cglib-2.1.jar;.\proteios\lib\commons-collections-2.1.1.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging-1.0.4.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j-1.6.jar;.\proteios\lib\ehcache-1.1.jar;.\proteios\lib\hibernate3.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\antlr-2.7.5H3.jar;.\proteios\lib\jgroups-2.2.7.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.9.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache-2.1.jar;.\proteios\lib\proxool-0.8.3.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\jaxen-1.1-beta-4.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql-connector-java-3.1.10-bin.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j-1.5.1.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.batch.BMain %*
  • trunk/dist/batchProteios.sh

    r1338 r1343  
    1 java -Xmx1000m -cp .:./bin:./proteios/conf:./proteios/conf/0.8:./proteios/lib/c3p0.jar:./proteios/lib/cglib2.jar:./proteios/lib/commons-collections.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j.jar:./proteios/lib/ehcache.jar:./proteios/lib/hibernate2.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/jgroups.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.8.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache.jar:./proteios/lib/proxool.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql.jar:./proteios/lib/postgresql.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.batch.BMain $*
     1java -Xmx1000m -cp .:./bin:./proteios/conf:./proteios/lib/c3p0-0.9.0.jar:./proteios/lib/asm-attrs.jar:./proteios/lib/asm.jar:./proteios/lib/cglib-2.1.jar:./proteios/lib/commons-collections-2.1.1.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging-1.0.4.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j-1.6.jar:./proteios/lib/ehcache-1.1.jar:./proteios/lib/hibernate3.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/antlr-2.7.5H3.jar:./proteios/lib/jgroups-2.2.7.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.9.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache-2.1.jar:./proteios/lib/proxool-0.8.3.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/jaxen-1.1-beta-4.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql-connector-java-3.1.10-bin.jar:./proteios/lib/postgresql.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j-1.5.1.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.batch.BMain $*
  • trunk/dist/initDatabase.bat

    r1130 r1343  
    1 java -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0.jar;.\proteios\lib\cglib2.jar;.\proteios\lib\commons-collections.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j.jar;.\proteios\lib\ehcache.jar;.\proteios\lib\hibernate2.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\jgroups.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.8.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache.jar;.\proteios\lib\proxool.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql.jar;.\proteios\lib\postgresql.jar org.proteios.core.InitDatabase %*
     1java -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0-0.9.0.jar;.\proteios\lib\cglib-2.1.jar;.\proteios\lib\commons-collections-2.1.1.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging-1.0.4.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j-1.6.jar;.\proteios\lib\ehcache-1.1.jar;.\proteios\lib\hibernate3.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\jgroups-2.2.7.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.9.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache-2.1.jar;.\proteios\lib\proxool-0.8.3.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql-connector-java-3.1.10-bin.jar;.\proteios\lib\postgresql.jar org.proteios.core.InitDatabase %*
  • trunk/dist/initDatabase.sh

    r1130 r1343  
    1 java -cp .:./bin:./proteios/conf:./proteios/lib/c3p0.jar:./proteios/lib/cglib2.jar:./proteios/lib/commons-collections.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j.jar:./proteios/lib/ehcache.jar:./proteios/lib/hibernate2.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/jgroups.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.8.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache.jar:./proteios/lib/proxool.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql.jar:./proteios/lib/postgresql.jar org.proteios.core.InitDatabase $*
     1java -cp .:./bin:./proteios/conf:./proteios/lib/c3p0-0.9.0.jar:./proteios/lib/asm.jar:./proteios/lib/asm-attrs.jar:./proteios/lib/cglib-2.1.jar:./proteios/lib/commons-collections-2.1.1.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging-1.0.4.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j-1.6.jar:./proteios/lib/ehcache-1.1.jar:./proteios/lib/hibernate3.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/jgroups-2.2.7.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.9.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache-2.1.jar:./proteios/lib/proxool-0.8.3.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/jaxen-1.1-beta-4.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql-connector-java-3.1.10-bin.jar:./proteios/lib/postgresql.jar org.proteios.core.InitDatabase $*
  • trunk/dist/run_proteios.bat

    r1338 r1343  
    1 java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0.jar;.\proteios\lib\cglib2.jar;.\proteios\lib\commons-collections.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j.jar;.\proteios\lib\ehcache.jar;.\proteios\lib\hibernate2.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\jgroups.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.8.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache.jar;.\proteios\lib\proxool.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\xercesImpl.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.gui.main.GMain
     1java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0-0.9.0.jar;.\proteios\lib\asm-attrs.jar;.\proteios\lib\asm.jar;.\proteios\lib\cglib-2.1.jar;.\proteios\lib\commons-collections-2.1.1.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging-1.0.4.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j-1.6.jar;.\proteios\lib\ehcache-1.1.jar;.\proteios\lib\hibernate3.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\antlr-2.7.5H3.jar;.\proteios\lib\jgroups-2.2.7.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.9.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache-2.1.jar;.\proteios\lib\proxool-0.8.3.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\xercesImpl.jar;.\proteios\lib\jaxen-1.1-beta-4.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql-connector-java-3.1.10-bin.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j-1.5.1.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.gui.main.GMain
  • trunk/dist/run_proteios.sh

    r1338 r1343  
    1 java -Xmx100m -cp .:./bin:./proteios/conf:./proteios/conf/0.8:./proteios/lib/c3p0.jar:./proteios/lib/cglib2.jar:./proteios/lib/commons-collections.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j.jar:./proteios/lib/ehcache.jar:./proteios/lib/hibernate2.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/jgroups.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.8.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache.jar:./proteios/lib/proxool.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xml-apis.jar:./proteios/lib/xercesImpl.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql.jar:./proteios/lib/postgresql.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.gui.main.GMain
     1java -Xmx1000m -cp .:./bin:./proteios/conf:./proteios/lib/c3p0-0.9.0.jar:./proteios/lib/asm-attrs.jar:./proteios/lib/asm.jar:./proteios/lib/cglib-2.1.jar:./proteios/lib/commons-collections-2.1.1.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging-1.0.4.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j-1.6.jar:./proteios/lib/ehcache-1.1.jar:./proteios/lib/hibernate3.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/antlr-2.7.5H3.jar:./proteios/lib/jgroups-2.2.7.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.9.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache-2.1.jar:./proteios/lib/proxool-0.8.3.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xml-apis.jar:./proteios/lib/xercesImpl.jar:./proteios/lib/jaxen-1.1-beta-4.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql-connector-java-3.1.10-bin.jar:./proteios/lib/postgresql.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j-1.5.1.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.gui.main.GMain
  • trunk/dist/xmlrpcServer.bat

    r1338 r1343  
    1 java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\conf\0.8;.\proteios\lib\c3p0.jar;.\proteios\lib\cglib2.jar;.\proteios\lib\commons-collections.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j.jar;.\proteios\lib\ehcache.jar;.\proteios\lib\hibernate2.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\jgroups.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.8.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache.jar;.\proteios\lib\proxool.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\xmlrpc.jar;.\proteios\lib\commons-codec-1.3.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.server.XMLRPCServer %*
     1java -Xmx1000m -cp .;.\bin;.\proteios\conf;.\proteios\lib\c3p0-0.9.0.jar;.\proteios\lib\asm-attrs.jar;.\proteios\lib\asm.jar;.\proteios\lib\cglib-2.1.jar;.\proteios\lib\commons-collections-2.1.1.jar;.\proteios\lib\commons-dbcp.jar;.\proteios\lib\commons-lang.jar;.\proteios\lib\commons-logging-1.0.4.jar;.\proteios\lib\commons-pool.jar;.\proteios\lib\concurrent.jar;.\proteios\lib\connector.jar;.\proteios\lib\dom4j-1.6.jar;.\proteios\lib\ehcache-1.1.jar;.\proteios\lib\hibernate3.jar;.\proteios\lib\jaas.jar;.\proteios\lib\jcs.jar;.\proteios\lib\jdbc2_0-stdext.jar;.\proteios\lib\antlr-2.7.5H3.jar;.\proteios\lib\jgroups-2.2.7.jar;.\proteios\lib\jta.jar;.\proteios\lib\log4j-1.2.9.jar;.\proteios\lib\odmg.jar;.\proteios\lib\optional.jar;.\proteios\lib\oscache-2.1.jar;.\proteios\lib\proxool-0.8.3.jar;.\proteios\lib\swarmcache.jar;.\proteios\lib\xalan.jar;.\proteios\lib\xerces.jar;.\proteios\lib\jaxen-1.1-beta-4.jar;.\proteios\lib\xml-apis.jar;.\proteios\lib\jdom.jar;.\proteios\lib\mysql-connector-java-3.1.10-bin.jar;.\proteios\lib\postgresql.jar;.\proteios\lib\xmlrpc.jar;.\proteios\lib\commons-codec-1.3.jar;.\proteios\lib\lsid-client-1.1.1.jar;.\proteios\lib\axis.jar;.\proteios\lib\activation.jar;.\proteios\lib\mail.jar;.\proteios\lib\dnsjava-1.3.2.jar;.\proteios\lib\castor-0.9.5.jar;.\proteios\lib\saaj.jar;.\proteios\lib\jaxrpc.jar;.\proteios\lib\wsdl4j-1.5.1.jar;.\proteios\lib\commons-discovery-0.2.jar org.proteios.server.XMLRPCServer %*
  • trunk/dist/xmlrpcServer.sh

    r1338 r1343  
    1 java -Xmx1000m -cp .:./bin:./proteios/conf:./proteios/conf/0.8:./proteios/lib/c3p0.jar:./proteios/lib/cglib2.jar:./proteios/lib/commons-collections.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j.jar:./proteios/lib/ehcache.jar:./proteios/lib/hibernate2.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/jgroups.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.8.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache.jar:./proteios/lib/proxool.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql.jar:./proteios/lib/postgresql.jar:./proteios/lib/xmlrpc.jar:./proteios/lib/commons-codec-1.3.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.server.XMLRPCServer $*
     1java -Xmx1000m -cp .:./bin:./proteios/conf:./proteios/lib/c3p0-0.9.0.jar:./proteios/lib/asm-attrs.jar:./proteios/lib/asm.jar:./proteios/lib/cglib-2.1.jar:./proteios/lib/commons-collections-2.1.1.jar:./proteios/lib/commons-dbcp.jar:./proteios/lib/commons-lang.jar:./proteios/lib/commons-logging-1.0.4.jar:./proteios/lib/commons-pool.jar:./proteios/lib/concurrent.jar:./proteios/lib/connector.jar:./proteios/lib/dom4j-1.6.jar:./proteios/lib/ehcache-1.1.jar:./proteios/lib/hibernate3.jar:./proteios/lib/jaas.jar:./proteios/lib/jcs.jar:./proteios/lib/jdbc2_0-stdext.jar:./proteios/lib/antlr-2.7.5H3.jar:./proteios/lib/jgroups-2.2.7.jar:./proteios/lib/jta.jar:./proteios/lib/log4j-1.2.9.jar:./proteios/lib/odmg.jar:./proteios/lib/optional.jar:./proteios/lib/oscache-2.1.jar:./proteios/lib/proxool-0.8.3.jar:./proteios/lib/swarmcache.jar:./proteios/lib/xalan.jar:./proteios/lib/xerces.jar:./proteios/lib/jaxen-1.1-beta-4.jar:./proteios/lib/xml-apis.jar:./proteios/lib/jdom.jar:./proteios/lib/mysql-connector-java-3.1.10-bin.jar:./proteios/lib/postgresql.jar:./proteios/lib/xmlrpc.jar:./proteios/lib/commons-codec-1.3.jar:./proteios/lib/lsid-client-1.1.1.jar:./proteios/lib/axis.jar:./proteios/lib/activation.jar:./proteios/lib/mail.jar:./proteios/lib/dnsjava-1.3.2.jar:./proteios/lib/castor-0.9.5.jar:./proteios/lib/saaj.jar:./proteios/lib/jaxrpc.jar:./proteios/lib/wsdl4j-1.5.1.jar:./proteios/lib/commons-discovery-0.2.jar org.proteios.server.XMLRPCServer $*
  • trunk/src/org/proteios/core/CMain.java

    r787 r1343  
    2222import java.io.*;
    2323
    24 import net.sf.hibernate.Hibernate;
    25 import net.sf.hibernate.HibernateException;
    26 import net.sf.hibernate.Session;
    27 import net.sf.hibernate.SessionFactory;
    28 import net.sf.hibernate.cfg.Configuration;
    29 import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
     24import org.hibernate.HibernateException;
     25import org.hibernate.SessionFactory;
     26import org.hibernate.cfg.Configuration;
    3027
    3128import org.proteios.core.element.ProteiosElementFactory;
     
    5451    File[] propFiles;
    5552
    56     try
    57     {
    58       ProteiosElementFactory elementFactory = new ProteiosElementFactory();
    59 
    60       configuration = new Configuration();
    61       List classList = elementFactory.getAllClasses();
    62       for(int i=0; i<classList.size(); ++i)
     53    databaseNames = (new File("proteios/conf/hibernate/databases")).list();
     54    propFiles = (new File("proteios/conf/hibernate/databases")).listFiles();
     55
     56    // Fill up the list of all Proteios standard element classes.
     57    element_classes.addAll(ElementFactory.getAllClasses());
     58    // Any properties file is OK to set up MetaData - Only do it once.
     59    boolean done_meta_data = false;
     60
     61    // Make sure meta data is set up correctly before connecting to any db:s.
     62    for (int i = 0; !done_meta_data && i < databaseNames.length; ++i)
     63    {
     64      if(databaseNames[i].endsWith(".properties"))
    6365      {
    64         configuration.addClass((Class) classList.get(i));
     66        try
     67        {
     68          File propFile = propFiles[i];
     69          FileInputStream infile = new FileInputStream(propFile);
     70          Properties props = new Properties();
     71          props.load(infile);
     72          // Make sure our configuration is properly set up.
     73          configuration.setProperties(props);
     74          done_meta_data = setMetaData();
     75        }
     76        catch (FileNotFoundException e)
     77        {
     78          // Try next properties file.
     79        }
     80        catch (IOException e)
     81        {
     82          // Try next properties file.
     83        }
     84        catch (HibernateException e)
     85        {
     86          // Try next properties file.
     87        }
    6588      }
    66 
    67       Element.setMetaData(new MetaData(configuration.buildSessionFactory(), classList));
    68 
    69       connections = new ArrayList();
    70      
    71       databaseNames = (new File("proteios/conf/hibernate/databases")).list();
    72       propFiles = (new File("proteios/conf/hibernate/databases")).listFiles();
    73     }
    74     catch(HibernateException e)
    75     {
    76       throw new CoreException(e.getMessage());
    77     }
    78 
     89    }
     90
     91    if (!done_meta_data)
     92    {
     93      // No fun Proteios without elements...
     94      throw new CoreException("Unable to set up meta data.");
     95    }
     96   
     97    // Now we can connect to databases.
    7998    for(int i=0; i<databaseNames.length; ++i)
    8099    {
     
    85104        try
    86105        {
    87           SessionFactory sf = changeConfiguration(propFile);
     106          SessionFactory sf = setConfiguration(propFile);
    88107          DataConnection db = new SQLConnection(databaseName, sf);
    89108          connections.add(db);
     
    120139
    121140
    122   private SessionFactory changeConfiguration(File file)
     141  private SessionFactory setConfiguration(File file)
    123142    throws CoreException
    124143  {
     
    137156      throw new CoreException(e.getMessage());
    138157    }
    139     catch (IOException e)
    140     {
    141       throw new CoreException(e.getMessage());
    142     }
    143     catch (HibernateException e)
    144     {
    145       throw new CoreException(e.getMessage());
    146     }
     158    catch (IOException e)
     159    {
     160      throw new CoreException(e.getMessage());
     161    }
     162    catch (HibernateException e)
     163    {
     164      throw new CoreException(e.getMessage());
     165    }
    147166
    148167    return retval;
    149168  }
    150169
     170  /**
     171  * Add Hibernate metadata for Proteios elements to current configuration.
     172  *
     173  * @return true if meta data could be set up without problems.
     174  */
     175  private final boolean setMetaData()
     176  {
     177    boolean retval = false;
     178
     179    try
     180    {
     181      for(int i=0; i<element_classes.size(); ++i)
     182      {
     183        configuration.addClass((Class) element_classes.get(i));
     184      }
     185      Element.setMetaData(new MetaData(configuration.buildSessionFactory(), element_classes));
     186      retval = true;
     187    }
     188    catch(HibernateException e)
     189    {
     190      // TODO: Report mapping errors already here.
     191    }
     192    catch (CoreException e)
     193    {
     194      // TODO: Report mapping errors already here.
     195    }
     196
     197    return retval;
     198  }
     199
    151200  private List connections;
    152   private Properties props;
    153   private Configuration configuration;
     201  /** One configuration used to set up all connections. */
     202  private Configuration configuration = new Configuration();
     203  /** Element factory to set up all elements - all connections same mapping. */
     204  private final ProteiosElementFactory element_factory = new ProteiosElementFactory();
     205  /** Proteios has one single specific set of element classes. */
     206  private final List element_classes = new ArrayList(100);
    154207}
  • trunk/src/org/proteios/core/Element.java

    r1256 r1343  
    11// $Id$
    2 // Copyright (C) 2005 Per G�rd�n, Jari H�kkinen, Rikard Alm - proteios.org
     2// Copyright (C) 2005 Per Gärdén, Jari Häkkinen, Rikard Alm - proteios.org
    33//
    44// This program is free software; you can redistribute it and/or
     
    295295    throws CoreException
    296296  {
    297     synchronized (getDataConnection())
     297    synchronized (dataConnection)
    298298    {
    299299      List children;
     
    302302      if (parent != null && parent instanceof Element)
    303303      {
    304         parent_class.add(parent.getClass());
     304        parent_class.add(ElementFactory.getElementClass(((Element) parent).getElementName()));
    305305      }
    306306       
     
    349349      // Stupid Hibernate always renames its entities to begin with lower case!
    350350      cs = Character.toLowerCase(cs.charAt(0)) + cs.substring(1);
    351       List children = meta_data.getAssociations(getClass());
     351      Class elt_class = ElementFactory.getElementClass(element_name);
     352      List children = meta_data.getAssociations(elt_class);
    352353      // Is the child on the one side in many-to-one?
    353354      retval = children.contains(cs);
    354355      // Is the child on the many side in a one-to-many?
    355       children = meta_data.getCollections(getClass());
     356      children = meta_data.getCollections(elt_class);
    356357      for (int i = 0; !retval && i < children.size(); ++i)
    357358      {
     
    374375      {
    375376        // Don't add ancestor Analyte, i.e. proposed child is an ancestor..
    376         retval = !(isAncestor(child, child));
     377        retval = !(isAncestor(child, child, 0));
    377378      }
    378379      catch (CoreException e)
     
    396397  * @param parent parent to give tree direction in the graph - may be null.
    397398  * @param ancestor the Element to look out for.
     399  * @param level level during recursion.
    398400  * @return true if ancestor could be located anywhere in the tree. else false.
    399401  */
    400   public boolean isAncestor(Object parent, Element ancestor)
     402  public boolean isAncestor(Object parent, Element ancestor, int level)
    401403    throws CoreException
    402404  {
    403405    boolean retval = false;
    404406
    405     List children = getChildren(parent);
    406     Element child = null;
    407     for (int i = 0; !retval && i < children.size(); i++)
    408     {
    409       child = (Element) children.get(i);
    410       retval = ancestor.equalElement(child);
    411       if (!retval)
    412       {
    413         // Next level.
    414         retval = child.isAncestor(this, ancestor);
     407    if (level < MAX_ANCESTOR_DEPTH)
     408    {
     409      List children = getChildren(parent);
     410      Element child = null;
     411      for (int i = 0; !retval && i < children.size(); i++)
     412      {
     413        child = (Element) children.get(i);
     414        retval = ancestor.equalElement(child);
     415        if (!retval)
     416        {
     417          // Next level.
     418          retval = child.isAncestor(this, ancestor, ++level);
     419        }
    415420      }
    416421    }
     
    430435  {
    431436    List retval = new ArrayList();
    432     List connected = meta_data.getCollections(getClass());
     437    Class elt_class = ElementFactory.getElementClass(element_name);
     438    List connected = meta_data.getCollections(elt_class);
    433439    List related = new ArrayList();
    434440 
     
    450456 
    451457    // Add all associated element names
    452     related.addAll(meta_data.getAssociations(getClass()));
     458    related.addAll(meta_data.getAssociations(elt_class));
    453459 
    454460    // Cater for Hibernate naming mess up
     
    639645      DataConnection.setCurrentDataConnection(dataConnection);
    640646      reconnect();
    641       boolean b = meta_data.hasEntityName(this.getClass(), name);
     647      boolean b = meta_data.hasEntityName(ElementFactory.getElementClass(this.element_name), name);
    642648      disconnect();
    643649      return b;
     
    724730      DataConnection.setCurrentDataConnection(dataConnection);
    725731      reconnect();
    726       List list = meta_data.getEntityNames(this.getClass());
     732      List list = meta_data.getEntityNames(ElementFactory.getElementClass(this.element_name));
    727733      disconnect();
    728734      return list;
     
    779785  }
    780786
    781 
    782   //* generator-class="native"
    783   //* generator-class="hilo"
    784787
    785788  /**
     
    900903    catch (Exception e)
    901904    {
    902       throw new CoreException("Element copy error: " + e.getMessage());
     905      String elt_name = "Element";
     906      if (c != null)
     907      {
     908        elt_name = ((Element) c).getElementName();
     909      }
     910      throw new CoreException(elt_name + " copy error: " + e.getMessage());
    903911    }
    904912    disconnect();
     
    941949  /**
    942950  * Compare two elements entity by entity. Elements are considered equal if
    943   * they are instences of the same element class and all their entities are
     951  * they are instances of the same element class and all their entities are
    944952  * exactly the same.
    945953  * <P>Elements can differ in any other respects than class and
     
    954962  {
    955963    // Might be equal if class is the same.
    956     boolean retval = elt.getClass().getName().equals(getClass().getName());
     964    boolean retval = elt.getClass().getName().equals(ElementFactory.getElementClass(element_name).getName());
    957965
    958966    if (retval)
     
    12221230    if(parent!=null)
    12231231    {
    1224       parent_class.add(parent.getClass());
     1232      parent_class.add(ElementFactory.getElementClass(parent.getElementName()));
    12251233    }
    12261234    reconnect();
     
    12391247      // Many-to-one or many-to-many connection between this and child? <=>
    12401248      // child has a collection if this' type
    1241       if (meta_data.hasCollection(child.getClass(), this.getClass()))
     1249      if (meta_data.hasCollection(ElementFactory.getElementClass(child.getElementName()), ElementFactory.getElementClass(this.element_name)))
    12421250      {
    12431251        // Many-to-many connection between this and child?
     
    13031311  /** OK to edit entity values? Recomendation, not enforced in this class.*/
    13041312  protected boolean editable = false;
    1305   private String element_name;
     1313  protected String element_name;
    13061314  private String identifier_name;
    13071315  /** Ability to dynamically connect elements demands a data model */
     
    13091317  /** Date format to base XML schema date time string on. */
    13101318  private static SimpleDateFormat date_time_format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     1319  /** Depth at which bail out during recursion in Proteios cyclic graph. */
     1320  private final static int MAX_ANCESTOR_DEPTH = 18;
    13111321}
  • trunk/src/org/proteios/core/ElementFactory.java

    r1340 r1343  
    290290  }
    291291
     292
     293  /**
     294  * Fetch CLass object, corresponding to a root class creatable by this
     295  * factory.
     296  *
     297  * @param element_name whose class we wish to retrieve.
     298  * @return element class.
     299  */
     300  static Class getElementClass(String element_name)
     301  {
     302    Class retval = null;
     303
     304    Object element_class = nameClassMap.get(element_name);
     305    if (element_class != null)
     306    {
     307      retval = (Class) element_class;
     308    }
     309
     310    return retval;
     311  }
     312
     313
    292314  /**
    293315  * Recursively create elements from nodes (not all nodes may have
  • trunk/src/org/proteios/core/EntityChoiceElement.java

    r969 r1343  
    156156    try
    157157    {
    158       entity_names = new ArrayList(getMetaData().getEntityNames(this.getClass()));
     158      entity_names = new ArrayList();
     159      List md_ent_names = getMetaData().getEntityNames(ElementFactory.getElementClass(this.element_name));
     160      if (md_ent_names != null)
     161      {
     162        entity_names.addAll(md_ent_names);
     163      }
    159164    }
    160165    catch (CoreException e)
  • trunk/src/org/proteios/core/InitDatabase.java

    r787 r1343  
    2121import java.util.*;
    2222import java.io.*;
     23import java.sql.DriverManager;
    2324import java.sql.Connection;
    2425import java.sql.Statement;
    2526import java.sql.SQLException;
    2627
    27 import net.sf.hibernate.Hibernate;
    28 import net.sf.hibernate.HibernateException;
    29 import net.sf.hibernate.Session;
    30 import net.sf.hibernate.cfg.Configuration;
    31 import net.sf.hibernate.tool.hbm2ddl.SchemaExport;
     28import org.hibernate.HibernateException;
     29import org.hibernate.Session;
     30import org.hibernate.cfg.Configuration;
     31import org.hibernate.tool.hbm2ddl.SchemaExport;
    3232
    3333
     
    5555        Configuration configuration = new Configuration();
    5656 
    57         List classList = elementFactory.getAllClasses();
     57        List classList = ElementFactory.getAllClasses();
    5858        for(int i=0; i<classList.size(); ++i)
    5959        {
     
    9595      {
    9696        System.out.println(e.getMessage());
     97        e.printStackTrace(System.out);
    9798      }
    9899    }
     
    125126    db_creator.drop(dump, !dump);
    126127
    127     Session sess = configuration.buildSessionFactory().openSession();
     128    org.hibernate.SessionFactory session_factory = configuration.buildSessionFactory();
     129    Session sess = session_factory.openSession();
    128130    // Resort to JDBC - Hibernate only allows its own SQL!!!
    129     Connection jdbc_conn = sess.connection();
     131    Connection jdbc_conn  = sess.connection();
    130132    Statement stmt = jdbc_conn.createStatement();
    131133    try
     
    138140      while  ((s = br.readLine()) != null)
    139141      {
    140         if (!(s.endsWith("hibernate_unique_key")))
     142        // SchemaExport gone haywire with Hibernate3 - make sure only drop!
     143        if ((s.startsWith("drop table")) && !(s.endsWith("hibernate_unique_key")))
    141144        {
    142145          // Execute all drop statements set up by Hibernate.
     
    156159      throw new HibernateException(e.getMessage());
    157160    }
     161    catch (Exception e)
     162    {
     163      throw new HibernateException(e.getMessage());
     164    }
    158165    finally
    159166    {
    160167      // Done!
    161       jdbc_conn.close();
     168      if (jdbc_conn != null)
     169      {
     170        jdbc_conn.close();
     171      }
    162172    }
    163173  }
     174
    164175}
  • trunk/src/org/proteios/core/MetaData.java

    r1256 r1343  
    11// $Id$
    2 // Copyright (C) 2005 Per G�rd�n, Jari H�kkinen, Rikard Alm - proteios.org
     2// Copyright (C) 2005 Per Gärdén, Jari Häkkinen, Rikard Alm - proteios.org
    33//
    44// This program is free software; you can redistribute it and/or
     
    2020import java.util.*;
    2121
    22 import net.sf.hibernate.metadata.ClassMetadata;
    23 import net.sf.hibernate.type.Type;
    24 import net.sf.hibernate.SessionFactory;
    25 import net.sf.hibernate.HibernateException;
    26 import net.sf.hibernate.LazyInitializationException;
     22import org.hibernate.EntityMode;
     23import org.hibernate.metadata.ClassMetadata;
     24import org.hibernate.type.Type;
     25import org.hibernate.SessionFactory;
     26import org.hibernate.HibernateException;
     27import org.hibernate.LazyInitializationException;
    2728
    2829
     
    112113    throws CoreException
    113114  {
     115    org.hibernate.type.Type type = null;
    114116    try
    115117    {
     
    119121        try
    120122        {
     123          type = cm.getPropertyType(entityName);
    121124          cm.setPropertyValue(element, entityName,
    122125                    cm.getPropertyType(entityName).
    123126                    getReturnedClass().
    124127                    getDeclaredConstructor(new Class[]{String.class}).
    125                     newInstance(new Object[]{value}));
     128                    newInstance(new Object[]{value}), EntityMode.POJO);
    126129        }
    127130        catch(NoSuchMethodException e)
     
    145148      else
    146149      {
    147         cm.setPropertyValue(element, entityName, value);
    148       }
    149     }
    150     catch(net.sf.hibernate.HibernateException e)
     150        cm.setPropertyValue(element, entityName, value, EntityMode.POJO);
     151      }
     152    }
     153    catch(org.hibernate.HibernateException e)
    151154    {
    152155      throw new CoreException(e.getMessage());
     
    167170    try
    168171    {
    169       res = getClassMetadata(element.getClass()).getPropertyValue(element, entityName);
     172      res = getClassMetadata(element.getClass()).getPropertyValue(element, entityName, EntityMode.POJO);
    170173    }
    171174    catch (HibernateException e)
     
    236239  public boolean hasCollection(Class elementClass, Class collectionClass)
    237240  {
    238     return ((Map) assCollectionMap.get(elementClass)).containsKey(collectionClass);
     241    boolean retval = false;
     242
     243    if (elementClass != null && collectionClass != null)
     244    {
     245      Map ass_collection_map = (Map) assCollectionMap.get(elementClass);
     246      retval = (ass_collection_map != null && ass_collection_map.containsKey(collectionClass));
     247    }
     248
     249    return retval;
    239250  }
    240251
     
    258269      {
    259270        String propName = (String) ((Map) assCollectionMap.get(element.getClass())).get(toBeRemoved.getClass());
    260         Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, propName);
     271        Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, propName, EntityMode.POJO);
    261272        status = coll.remove(toBeRemoved);
    262         getClassMetadata(element.getClass()).setPropertyValue(element, propName, coll);
    263       }
     273        getClassMetadata(element.getClass()).setPropertyValue(element, propName, coll, EntityMode.POJO);
     274      }
     275    }
     276    catch (LazyInitializationException e)
     277    {
     278      throw new CoreException(e.getMessage());
    264279    }
    265280    catch (HibernateException e)
    266     {
    267       throw new CoreException(e.getMessage());
    268     }
    269     catch (LazyInitializationException e)
    270281    {
    271282      throw new CoreException(e.getMessage());
     
    293304      {
    294305        String propName = (String) ((Map) associationMap.get(element.getClass())).get(toBeRemoved.getClass());
    295         getClassMetadata(element.getClass()).setPropertyValue(element, propName, null);
     306        getClassMetadata(element.getClass()).setPropertyValue(element, propName, null, EntityMode.POJO);
    296307        status = true;
    297308      }
     
    326337      {
    327338        String propName = (String) ((Map) assCollectionMap.get(element.getClass())).get(toBeAdded.getClass());
    328         Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, propName);
     339        Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, propName, EntityMode.POJO);
    329340        coll.add(toBeAdded);
    330         getClassMetadata(element.getClass()).setPropertyValue(element, propName, coll);
     341        getClassMetadata(element.getClass()).setPropertyValue(element, propName, coll, EntityMode.POJO);
    331342//       System.out.println(toBeAdded.getElementName() + " was added to " + element.getElementName() + "'s collection");
    332343        status = true;
     
    366377      {
    367378        String propName = (String) ((Map) associationMap.get(element.getClass())).get(toBeAdded.getClass());
    368         getClassMetadata(element.getClass()).setPropertyValue(element, propName, toBeAdded);
     379        getClassMetadata(element.getClass()).setPropertyValue(element, propName, toBeAdded, EntityMode.POJO);
    369380        status = true;
    370381        // System.out.println(toBeAdded.getElementName() + " was added to " + element.getElementName() + "'s association");
     
    426437    try
    427438    {
    428       if (parent != null)
    429       {
    430         Map classAssName = (Map) associationMap.get(element.getClass());
    431         Class keyClass = parent.getClass();
     439      if (parent != null && parent instanceof Element)
     440      {
     441        Class elt_class = ElementFactory.getElementClass(element.getElementName());
     442        Map classAssName = (Map) associationMap.get(elt_class);
     443        Class keyClass = ElementFactory.getElementClass(((Element) parent).getElementName());
    432444        if ((classAssName != null) && (classAssName.containsKey(keyClass)))
    433445        {
    434           Element child = (Element) getClassMetadata(element.getClass()).getPropertyValue(element, (String) classAssName.get(keyClass));
     446          Element child = (Element) getClassMetadata(elt_class).getPropertyValue(element, (String) classAssName.get(keyClass), EntityMode.POJO);
    435447          // OK to add a child that exists and is not of parent type
    436           if ((child != null) && (!(child.getClass().isInstance(parent))))
     448          if ((child != null) && (!(ElementFactory.getElementClass(child.getElementName()).isInstance(parent))))
    437449          {
    438450            children.add(child);
     
    441453      }
    442454    }
    443     catch(net.sf.hibernate.HibernateException e)
     455    catch(org.hibernate.HibernateException e)
    444456    {
    445457      throw new CoreException(e.getMessage());
     
    467479      if (parent != null)
    468480      {
    469         Map classCollName = (Map) assCollectionMap.get(element.getClass());
     481        Class elt_class = ElementFactory.getElementClass(element.getElementName());
     482        Map classCollName = (Map) assCollectionMap.get(elt_class);
    470483        Class keyClass = parent.getClass();
    471         if(classCollName.containsKey(keyClass))
    472         {
    473           Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, (String) classCollName.get(keyClass));
    474           for(Iterator childIt=coll.iterator(); childIt.hasNext();)
     484        if (classCollName != null && classCollName.containsKey(keyClass))
     485        {
     486          Collection coll = (Collection) getClassMetadata(elt_class).getPropertyValue(element, (String) classCollName.get(keyClass), EntityMode.POJO);
     487          Iterator childIt=coll.iterator();
     488          while (childIt.hasNext())
    475489          {
    476490            Element child = (Element) childIt.next();
     
    480494      }
    481495    }
    482     catch(net.sf.hibernate.HibernateException e)
     496    catch(org.hibernate.HibernateException e)
    483497    {
    484498      throw new CoreException(e.getMessage());
     
    506520    try
    507521    {
    508       Map classCollName = (Map) assCollectionMap.get(element.getClass());
     522      Class elt_class = ElementFactory.getElementClass(element.getElementName());
     523      Map classCollName = (Map) assCollectionMap.get(elt_class);
    509524      if (classCollName != null)
    510525      {
     
    513528        {
    514529          Class keyClass = (Class) it.next();
     530          // System.out.println("Proposed child is: " + keyClass);
    515531          if(!unwanted.contains(keyClass))
    516532          {
    517             Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, (String) classCollName.get(keyClass));
     533            String class_coll_name = (String) classCollName.get(keyClass);
     534            ClassMetadata clsmd = getClassMetadata(elt_class);
     535            Collection coll = (Collection) clsmd.getPropertyValue(element, class_coll_name, EntityMode.POJO);
     536            // Collection coll = (Collection) getClassMetadata(element.getClass()).getPropertyValue(element, (String) classCollName.get(keyClass), EntityMode.POJO);
    518537
    519538            Iterator childIt = coll.iterator();
     
    527546      }
    528547    }
    529     catch(HibernateException e)
    530     {
    531       throw new CoreException(e.getMessage());
    532     }
    533548    catch(LazyInitializationException e)
    534549    {
    535550      // This is the most likely cause.
    536551      throw new CoreException("Database unreachable or incompatible with Proteios metadata.");
     552    }
     553    catch(HibernateException e)
     554    {
     555      throw new CoreException(e.getMessage());
    537556    }
    538557
     
    561580      if (classAssName != null)
    562581      {
    563 //        System.out.println(element.getElementName() + ":");
    564 //        ClassMetadata cm = getClassMetadata(element.getClass());
    565 //        String[] properties = cm.getPropertyNames();
    566 //        for (int i = 0; i < properties.length; ++i)
    567 //        {
    568 //          System.out.print("\t" + properties[i] + "=" + cm.getPropertyValue(element, properties[i]));
    569 //        }
    570 //        System.out.println();
    571 
    572582        Iterator it=classAssName.keySet().iterator();
    573583        while (it.hasNext())
     
    576586          if (!unwanted.contains(keyClass))
    577587          {
    578             Element child = (Element) getClassMetadata(element.getClass()).getPropertyValue(element, (String) classAssName.get(keyClass));
     588            Element child = (Element) getClassMetadata(ElementFactory.getElementClass(element.getElementName())).getPropertyValue(element, (String) classAssName.get(keyClass), EntityMode.POJO);
    579589            if (child != null)
    580590            {
     
    585595      }
    586596    }
    587     catch(net.sf.hibernate.HibernateException e)
     597    catch(org.hibernate.HibernateException e)
    588598    {
    589599      throw new CoreException(e.getMessage());
     
    614624
    615625
    616 
    617   /**
    618   * Fetch the Hibernate metadata as net.sf.hibernate.metadata.ClassMetadata for
     626  /**
     627  * Fetch the Hibernate metadata as org.hibernate.metadata.ClassMetadata for
    619628  * a specific element class.
    620629  *
     
    657666        if(propertyTypes[i].isAssociationType())
    658667        {
    659           if(propertyTypes[i].isPersistentCollectionType())
     668          if(propertyTypes[i].isCollectionType())
    660669          {
    661670            Class keyClass = sess.getCollectionMetadata(elementClass.getName() + "." + propertyNames[i]).getElementType().getReturnedClass();
     
    696705      assCollectionMap.put(elementClass, classCollName);
    697706    }
    698     catch(net.sf.hibernate.HibernateException e)
     707    catch(org.hibernate.HibernateException e)
    699708    {
    700709//      throw new CoreException(e.getMessage());
     
    728737   Experiment can have several Samples. */
    729738  private Map assCollectionMap;
     739  /** Storage mode for all our objects is "Plain old Java Objects", POJO. */
     740  // private final static EntityMode EntityMode.POJO = new EntityMode("pojo");
    730741}
    731742
  • trunk/src/org/proteios/core/SQLConnection.java

    r1256 r1343  
    2222import java.io.*;
    2323
    24 import net.sf.hibernate.Hibernate;
    25 import net.sf.hibernate.HibernateException;
    26 import net.sf.hibernate.FlushMode;
    27 import net.sf.hibernate.Session;
    28 import net.sf.hibernate.SessionFactory;
    29 import net.sf.hibernate.Transaction;
     24import org.hibernate.Hibernate;
     25import org.hibernate.HibernateException;
     26import org.hibernate.FlushMode;
     27import org.hibernate.Session;
     28import org.hibernate.SessionFactory;
     29import org.hibernate.Transaction;
    3030
    3131import org.proteios.core.element.ProteiosElementFactory;
     
    4747      currentSession = sessionFactory.openSession();
    4848      // Don't flush before query. Only at end of transaction.
    49       currentSession.setFlushMode(FlushMode.COMMIT);
     49      // currentSession.setFlushMode(FlushMode.AUTO);
    5050      tx = currentSession.beginTransaction();
    5151      currentSession.disconnect();
     
    101101    try
    102102    {
    103       roots = currentSession.find("from " + rootType);
     103      roots = (currentSession.createQuery("from " + rootType)).list();
    104104    }
    105105    catch (Exception e)
     
    160160      tx.commit();
    161161      currentSession.flush();
     162      tx = currentSession.beginTransaction();
    162163    }
    163164    catch(HibernateException e)
     
    186187    throws CoreException
    187188  {
     189    // getRootElements();
    188190    reconnect();
    189191    try
     
    192194      tx.rollback();
    193195      currentSession.flush();
     196      tx = currentSession.beginTransaction();
    194197    }
    195198    catch(HibernateException e)
  • trunk/src/org/proteios/core/XMLConnection.java

    r1256 r1343  
    11// $Id$
    2 // Copyright (C) 2005 Per G�rd�n, Jari H�kkinen, Rikard Alm - proteios.org
     2// Copyright (C) 2005 Per Gärdén, Jari Häkkinen, Rikard Alm - proteios.org
    33//
    44// This program is free software; you can redistribute it and/or
     
    1919package org.proteios.core;
    2020
    21 
    2221import java.io.*;
    2322import java.util.*;
    24 
    25 import net.sf.hibernate.Databinder;
    26 import net.sf.hibernate.Hibernate;
    27 import net.sf.hibernate.HibernateException;
    28 import net.sf.hibernate.Session;
    29 import net.sf.hibernate.SessionFactory;
    30 import net.sf.hibernate.cfg.Configuration;
    31 import net.sf.hibernate.Transaction;
    32 import net.sf.hibernate.metadata.ClassMetadata;
    33 import net.sf.hibernate.metadata.CollectionMetadata;
    34 import net.sf.hibernate.type.Type;
    3523
    3624import org.proteios.core.element.ProteiosElementFactory;
  • trunk/src/org/proteios/core/element/AbstractParam.java

    r989 r1343  
    1414// You should have received a copy of the GNU General Public License
    1515// along with this program; if not, write to the Free Software
    16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
     16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
    1717
    1818package org.proteios.core.element;
    1919
     20import java.util.List;
     21
    2022import org.proteios.core.ProteiosElement;
     23import org.proteios.core.SQLConnection;
     24import org.proteios.core.CoreException;
    2125
    2226
     
    2529 * section of the proteios data model.
    2630 * @hibernate.class
    27  *  table="`ProcessingParam`"
     31 *  table="`ProcessingParam`"
    2832 */
    2933public abstract class AbstractParam
     
    3741    super(element_name, "name");
    3842  }
    39  
     43
     44
    4045  /**
    4146   * @hibernate.property
    42    *  column="`name`"
     47   *  column="`name`"
    4348   */
    4449  public String getName()
     
    5358  /**
    5459   * @hibernate.property
    55    *  column="`value`"
     60   *  column="`value`"
    5661   */
    5762  public String getValue()
  • trunk/src/org/proteios/core/element/GelItem.java

    r1297 r1343  
    3838  public int compareTo(Object o)
    3939  {
    40     return id - ((GelItem) o).getId();
     40    // Hibernate 3 refuses to accept id as "int" => voodo.
     41    return (int) (id - ((GelItem) o).getId());
    4142  }
    4243
     
    213214
    214215  /**
    215    * @hibernate.property
    216    *  column="`id`"
    217    */
    218   public int getId()
     216  * Hibernate 3 refuses to accept id as "int" => voodo.
     217  *
     218  * @hibernate.property
     219  * column="`id`"
     220  */
     221  public long getId()
    219222  {
    220223    return id;
    221224  }
    222   private void setId(int id)
     225  private void setId(long id)
    223226  {
    224227    this.id = id;
    225228  }
    226229
    227 
    228230  /**
    229231   * @hibernate.property
     
    421423  }
    422424
    423   protected int id;
     425  protected long id;
    424426  protected double area;
    425427  protected double intensity;
  • trunk/src/org/proteios/core/element/Peak.java

    r1190 r1343  
    11// $Id$
    2 // Copyright (C) 2005 Per G�rd�n, Jari H�kkinen, Rikard Alm - proteios.org
     2// Copyright (C) 2005 Per Gärdén, Jari Häkkinen, Rikard Alm - proteios.org
    33//
    44// This program is free software; you can redistribute it and/or
     
    4141  private Double ion_current;
    4242  private Double signal_to_noise;
    43   private Double max_intensity;
    44   private Double min_intensity;
    45   private Double accumulated_intensity;
    46   private Double fwhm_mass;
    47   private Double max_mass;
    48   private Double min_mass;
    49   private Double cluster_score;
    50   private Boolean calibration_point;
    51   private Integer cluster_count;
    5243  private Set peakSpecificChromatogramIntegrationCollection;
    5344  private Set chromatogramPointCollection;
     
    9081
    9182    // Defer graph cycles by not adding any children already in connection.
    92     if (retval)
     83    if (retval && (dataConnection == child.getDataConnection()))
    9384    {
    9485      try
     
    243234 
    244235  /**
    245    * @hibernate.property
    246    *  column="`max_intensity`"
    247    */
    248   public Double getMax_intensity()
    249   {
    250     return max_intensity;
    251   }
    252   private void setMax_intensity(Double max_intensity)
    253   {
    254     this.max_intensity = max_intensity;
    255   }
    256  
    257   /**
    258    * @hibernate.property
    259    *  column="`min_intensity`"
    260    */
    261   public Double getMin_intensity()
    262   {
    263     return min_intensity;
    264   }
    265   private void setMin_intensity(Double min_intensity)
    266   {
    267     this.min_intensity = min_intensity;
    268   }
    269  
    270   /**
    271    * @hibernate.property
    272    *  column="`accumulated_intensity`"
    273    */
    274   public Double getAccumulated_intensity()
    275   {
    276     return accumulated_intensity;
    277   }
    278   private void setAccumulated_intensity(Double accumulated_intensity)
    279   {
    280     this.accumulated_intensity = accumulated_intensity;
    281   }
    282 
    283   /**
    284    * @hibernate.property
    285    *  column="`fwhm_mass`"
    286    */
    287   public Double getFwhm_mass()
    288   {
    289     return fwhm_mass;
    290   }
    291   private void setFwhm_mass(Double fwhm_mass)
    292   {
    293     this.fwhm_mass = fwhm_mass;
    294   }
    295 
    296  
    297   /**
    298    * @hibernate.property
    299    *  column="`max_mass`"
    300    */
    301   public Double getMax_mass()
    302   {
    303     return max_mass;
    304   }
    305   private void setMax_mass(Double max_mass)
    306   {
    307     this.max_mass = max_mass;
    308   }
    309  
    310   /**
    311    * @hibernate.property
    312    *  column="`min_mass`"
    313    */
    314   public Double getMin_mass()
    315   {
    316     return min_mass;
    317   }
    318   private void setMin_mass(Double min_mass)
    319   {
    320     this.min_mass = min_mass;
    321   }
    322  
    323   /**
    324    * @hibernate.property
    325    *  column="`cluster_score`"
    326    */
    327   public Double getCluster_score()
    328   {
    329     return cluster_score;
    330   }
    331   private void setCluster_score(Double cluster_score)
    332   {
    333     this.cluster_score = cluster_score;
    334   }
    335  
    336   /**
    337    * @hibernate.property
    338    *  column="`calibration_point`"
    339    */
    340   public Boolean getCalibration_point()
    341   {
    342     return calibration_point;
    343   }
    344   private void setCalibration_point(Boolean calibration_point)
    345   {
    346     this.calibration_point = calibration_point;
    347   }
    348  
    349   /**
    350    * @hibernate.property
    351    *  column="`cluster_count`"
    352    */
    353   public Integer getCluster_count()
    354   {
    355     return cluster_count;
    356   }
    357   private void setCluster_count(Integer cluster_count)
    358   {
    359     this.cluster_count = cluster_count;
    360   }
    361  
    362   /**
    363236   * @hibernate.set
    364237   *  inverse="true"
  • trunk/src/org/proteios/core/element/PeakList.java

    r1280 r1343  
    9090
    9191    // Defer graph cycles by not adding any non Peak children already in conn.
    92     if (retval && !(child instanceof Peak))
     92    if (retval && !(child instanceof Peak) && (dataConnection == child.getDataConnection()))
    9393    {
    9494      try
  • trunk/src/org/proteios/core/element/Protein.java

    r1339 r1343  
    264264      try
    265265      {
    266         retval = new URL("http://www.expasy.org/uniprot/" + identifier + ".txt");
     266        retval = new URL("http://www.expasy.org/cgi-bin/niceprot.pl/printable?ac=" + identifier);
    267267      }
    268268      catch (Exception e)
     
    271271      }
    272272    }
     273
    273274    return retval;
    274275  }
  • trunk/src/org/proteios/core/element/Sample.java

    r1263 r1343  
    4949  }
    5050 
    51 //  /**
    52 //   * @hibernate.id
    53 //   *  generator-class="native"
    54 //   *  column="`sid`"
    55 //   */
    56 //  public Long getAuto_id()
    57 //  {
    58 //    return auto_id;
    59 //  }
    60 // 
    61 //  private void setAuto_id(Long id)
    62 //  {
    63 //    this.auto_id = id;
    64 //  }
    6551 
    6652  /**
  • trunk/src/org/proteios/core/element/Spectrum.java

    r1287 r1343  
    4646  This element represents an individual spectrum. The spectrum consists of an
    4747  array of acquisitions. Peak list are in Proteios stored as peaks under PeakList.
    48   Upon MzData export the mass to charge and intensities are base64 encoded and
     48  Upon MzData export the mass to charge and intensities are base64 encoded and
    4949  and exported in the MzArrayBinary and IntenArrayBinary elements. These are never
    50   stored in the Proteios database. In addition to
     50  stored in the Proteios database. In addition to
    5151  this data, a spectrum element may also contain an arbitrary number of
    5252  supplementary data, stored in supDataArray and supDataArrayBinary elements.
     
    6666  public int compareTo(Object o)
    6767  {
    68     Integer id2 = ((Spectrum)o).getId();
    69     return id.compareTo(id2);
     68    int retval = 0;
     69
     70    if ((o instanceof Spectrum) && (o != null))
     71    {
     72      retval = (int) (id - ((Spectrum) o).getId());
     73    }
     74    return retval;
    7075  }
    7176 
    72     /**
    73     Get children by type. If mzArrayBinaary or IntenArrayBinary are
    74     asked for they are generated by this function.
    75     @param type Name of the children
    76     @param parent The parent of this object
    77     @return List of elements.
     77  /**
     78  Get children by type. If mzArrayBinaary or IntenArrayBinary are
     79  asked for they are generated by this function.
     80  @param type Name of the children
     81  @param parent The parent of this object
     82  @return List of elements.
    7883  */
    7984  public List getChildren( String type, Object parent )
     
    291296
    292297  /**
    293     Get the id for this element.
    294     @hibernate.property column="`id`"
    295   */
    296   public Integer getId()
     298  * Hibernate 3 refuses to accept id as "int" => voodo.
     299  *
     300  * @hibernate.property
     301  * column="`id`"
     302  */
     303  public long getId()
    297304  {
    298305    return id;
    299306  }
    300   private void setId(Integer id)
     307  private void setId(long id)
    301308  {
    302309    this.id = id;
     
    309316  private Set sup_data_array_binarys = new HashSet();
    310317  private Set sup_descs = new HashSet();
    311   private Integer id = new Integer(0);
     318  private long id;
    312319}
  • trunk/src/org/proteios/core/element/SupDataArray.java

    r787 r1343  
    6262
    6363  /**
    64     Get the id for this element.
    65     @hibernate.property column="`id`"
    66   */
    67   public Integer getId()
     64  * Hibernate 3 refuses to accept id as "int" => voodo.
     65  *
     66  * @hibernate.property
     67  * column="`id`"
     68  */
     69  public long getId()
    6870  {
    6971    return id;
    7072  }
    71   private void setId(Integer id)
     73  private void setId(long id)
    7274  {
    7375    this.id = id;
     
    234236
    235237  private Spectrum spectrum;
    236   String array_name = "";
    237   Integer id = new Integer(0);
    238   Integer length = new Integer(0);
    239   Integer offset;
    240   Boolean indexed = new Boolean(false);
    241 
    242   List float_collection = new LinkedList();
    243   List boolean_collection = new LinkedList();
    244   List double_collection = new LinkedList();
    245   List int_collection = new LinkedList();
    246   List string_collection = new LinkedList();
    247   List uri_collection = new LinkedList();
    248   List time_collection = new LinkedList();
     238  private long id;
     239  private String array_name = "";
     240  private Integer length = new Integer(0);
     241  private Integer offset;
     242  private Boolean indexed = new Boolean(false);
     243
     244  private List float_collection = new LinkedList();
     245  private List boolean_collection = new LinkedList();
     246  private List double_collection = new LinkedList();
     247  private List int_collection = new LinkedList();
     248  private List string_collection = new LinkedList();
     249  private List uri_collection = new LinkedList();
     250  private List time_collection = new LinkedList();
    249251}
  • trunk/src/org/proteios/core/element/SupDataArrayBinary.java

    r787 r1343  
    6060
    6161  /**
    62     Get the id for this element.
    63     @hibernate.property column="`id`"
     62  * Hibernate 3 refuses to accept id as "int" => voodo.
     63  *
     64  * @hibernate.property
     65  * column="`id`"
    6466  */
    65   public int getId()
     67  public long getId()
    6668  {
    6769    return id;
    6870  }
    69   private void setId(int id)
     71  private void setId(long id)
    7072  {
    7173    this.id = id;
     
    9496  private Spectrum spectrum;
    9597  private String array_name = new String();
    96   private int id;
     98  private long id;
    9799}
  • trunk/src/org/proteios/gui/importer/GImport.java

    r1342 r1343  
    11// $Id$
    2 // Copyright (C) 2005 Per G�rd�n, Jari H�kkinen, Rikard Alm - proteios.org
     2// Copyright (C) 2005 Per Gärdén, Jari Häkkinen, Rikard Alm - proteios.org
    33//
    44// This program is free software; you can redistribute it and/or
     
    6464* This class provides a graphical user interface to Proteios data import
    6565*
    66 * @author Per G�rd�n
     66* @author Per Gärdén
    6767* @version September 2004.
    6868*
     
    7474{
    7575  /** Creates new form GImport */
    76   public GImport(GImportParent parent, CMain main)
     76  public GImport(GImportParent parent)
    7777  {
    7878    super();
    7979    // Keep track of which GMain we're contained in
    8080    this.parent = parent;
    81     this.importer = main;
    8281    initComponents();
    8382  }
     
    225224  * - Initialise the source tree view with database resources and file import
    226225  *  option
     226  * <BR>
     227  * - Create and connect to a CMain in an underlying proteios core layer
    227228  */
    228229  public void init()
     
    260261    try
    261262    {
     263      importer = new CMain();
    262264      // Get connected resources from CMain
    263265      List resources = importer.getConnections();
     
    388390
    389391  /** The import API should be thread safe, so we only need one object */
    390   private CMain importer;
     392  private CMain importer = null;
    391393  /** The most recently started import thread */
    392394  // private GImportThread importThread;
  • trunk/src/org/proteios/gui/main/GMain.java

    r1342 r1343  
    2626import java.util.Properties;
    2727
     28import java.awt.Dimension;
     29
    2830import javax.swing.JFrame;
    2931import javax.swing.JPanel;
     32import javax.swing.SwingUtilities;
    3033import javax.swing.JFileChooser;
    31 import javax.swing.JDialog;
    32 import javax.swing.border.EtchedBorder;
    33 import java.awt.*;
    34 import java.awt.event.*;
    35 import javax.swing.*;
     34import javax.swing.filechooser.FileFilter;
    3635
    3736import org.apache.log4j.Logger;
     
    4039import org.apache.log4j.RollingFileAppender;
    4140
    42 import org.proteios.core.CoreException;
    43 import org.proteios.core.CMain;
    4441import org.proteios.core.Element;
    4542import org.proteios.core.ProteiosElement;
     
    6966    props = new Properties();
    7067    initLogging();
    71    
    72     // Prompt user for login data
    73     Properties defaultProps = new Properties();
    74     try
    75     {
    76       FileInputStream defaultStream = new FileInputStream(USER_PROPERTIES_FILE);
    77       defaultProps.load(defaultStream);
    78       defaultStream.close();
    79     }
    80     catch (Exception e)
    81     {
    82       // If no default properties could be loaded, just ignore it
    83     }
    84     LoginData loginData = new LoginData();
    85     if (defaultProps.getProperty("username") != null)
    86     {
    87       loginData.username = defaultProps.getProperty("username");
    88     }
    89     if (defaultProps.getProperty("url") != null)
    90     {
    91       loginData.url = defaultProps.getProperty("url");
    92     }
    93    
    94     JDialog login = new LoginDialog(this, loginData);
    95     login.setVisible(true);
    96     // Save user login data
    97     if (loginData.username != null)
    98     {
    99       defaultProps.setProperty("username", loginData.username);
    100     }
    101     if (loginData.url != null)
    102     {
    103       defaultProps.setProperty("url", loginData.url);
    104     }
    105     try
    106     {
    107       FileOutputStream defaultsOut = new FileOutputStream(USER_PROPERTIES_FILE);
    108       defaultProps.store(defaultsOut, "### Proteios login user properties ###");
    109       defaultsOut.close();
    110     }
    111     catch (Exception e)
    112     {
    113       // If unable to save default login data, just ignore it
    114     }
    115 
    116     // Use login data to fetch database connection info from login server
    117     System.out.println("Connecting to " + loginData.url);
    118    
    119     CMain main = null;
    120     try
    121     {
    122       main = new CMain();
    123     }
    124     catch (CoreException e)
    125     {
    126       LOGGER.error(e.getMessage());
    127       getLog().addMessage(GMainLog.ERROR, e.getMessage());
    128     }
    129     sourcePanel = new GImport(this, main);
    13068    initComponents();
    13169    initProperties();
    13270  }
    133  
    13471 
    13572
     
    525462  }
    526463 
    527   /**
    528    * This dialog window is shown at startup of GMain, and will query
    529    * the user for login info.
    530    * @author linus
    531    */
    532   private class LoginDialog extends JDialog
    533   {
    534     LoginDialog (JFrame parent, LoginData indata)
    535     {
    536       super(parent, "Proteios login", true);
    537      
    538       loginData = indata;
    539      
    540       ActionListener listener = new MyActionListener();
    541 
    542       setBackground(new java.awt.Color(102, 204, 255));
    543       setSize(new java.awt.Dimension(320, 350));
    544       setResizable(false);
    545         setLocation(430, 300);
    546       setLayout(new java.awt.GridLayout(1, 1));
    547       Container cp = getContentPane();
    548      
    549       /* The main panel containing all other panels */
    550       JPanel main = new JPanel();
    551       main.setLayout(new java.awt.GridLayout(3, 1));
    552       main.setBackground(new java.awt.Color(255, 255, 255));
    553       cp.add(main);
    554    
    555      
    556       /* Logo panel */
    557       JPanel logoPanel = new JPanel();
    558       logoPanel.setBackground(new java.awt.Color(102, 204, 255));
    559       ImageIcon icon = new ImageIcon(PROTEIOS_LOGO_PATH);
    560       JLabel iconLabel = new JLabel("Proteios 1.0", icon, JLabel.CENTER);
    561       logoPanel.add(iconLabel);
    562       main.add(logoPanel); 
    563      
    564       /* The input panel */
    565       JPanel inputPanel = new JPanel();
    566       inputPanel.setLayout(new java.awt.GridLayout(2, 1));
    567       inputPanel.setBackground(new java.awt.Color(102, 204, 255));
    568       main.add(inputPanel);
    569      
    570       /* The username panel */
    571       JPanel usernamePanel = new JPanel();
    572       usernamePanel.setBackground(new java.awt.Color(102, 204, 255));
    573       usernamePanel.add(new JLabel("Username:     "));
    574       usernameField = new JTextField(13);
    575       usernameField.setText(loginData.username);
    576       usernamePanel.add(usernameField);   
    577       inputPanel.add(usernamePanel);
    578 
    579       /* The password panel */
    580       JPanel passwordPanel = new JPanel();
    581       passwordPanel.setBackground(new java.awt.Color(102, 204, 255));
    582       passwordPanel.add(new JLabel("Password:     "));
    583       passwordField = new JTextField(13);
    584       passwordPanel.add(passwordField);
    585       inputPanel.add(passwordPanel);
    586      
    587       /* URL and button panel */
    588       JPanel urlAndButtonPanel = new JPanel();
    589       urlAndButtonPanel.setLayout(new java.awt.GridLayout(2, 1));
    590       urlAndButtonPanel.setBackground(new java.awt.Color(102, 204, 255));
    591       main.add(urlAndButtonPanel);
    592      
    593       /* The login server URL panel */
    594       JPanel urlPanel = new JPanel();
    595       urlPanel.setBackground(new java.awt.Color(102, 204, 255));
    596       urlPanel.add(new JLabel("URL for login:"));
    597       urlField = new JTextField(13);
    598       urlField.setText(loginData.url);
    599       urlPanel.add(urlField);   
    600       urlAndButtonPanel.add(urlPanel);
    601      
    602       /* The button panel */
    603       JPanel buttonPanel = new JPanel();
    604       buttonPanel.setBackground(new java.awt.Color(102, 204, 255));
    605       JButton cancel = new JButton("Cancel");
    606       cancel.setActionCommand("cancel");
    607       cancel.addActionListener(listener);
    608       buttonPanel.add(cancel);
    609       buttonPanel.add(new JLabel("          "));
    610       JButton accept = new JButton("Login");
    611       accept.setActionCommand("accept");
    612       accept.addActionListener(listener);
    613       buttonPanel.add(accept);
    614       urlAndButtonPanel.add(buttonPanel);
    615      
    616       this.pack();
    617       if (loginData.username != null)
    618       {
    619         passwordField.requestFocusInWindow();
    620       }
    621     }
    622    
    623     /**
    624      * A listener that puts login data from the dialog fields
    625      * into a loginData object.
    626      * @author linus
    627      *
    628      */
    629     private class MyActionListener implements ActionListener
    630     {
    631       public void actionPerformed(ActionEvent event)
    632       {
    633         if ("cancel".equals(event.getActionCommand()))
    634         {
    635           loginData = null;
    636           dispose();
    637         }
    638         if ("accept".equals(event.getActionCommand()))
    639         {
    640           loginData.username = usernameField.getText();
    641           loginData.password = passwordField.getText();
    642           loginData.url = urlField.getText();
    643           dispose();
    644         }
    645       }
    646     };
    647    
    648    
    649     final String PROTEIOS_LOGO_PATH = "proteios" + File.separator + "icons" + File.separator + "proteios.png";
    650     private JTextField usernameField, passwordField, urlField;
    651     private LoginData loginData;
    652   }
    653  
    654   /**
    655    * A data container for login data.
    656    * @author linus
    657    *
    658    */
    659   private class LoginData
    660   {
    661     String username, password, url;
    662   }
    663464 
    664465  public static Logger LOGGER;
    665   private JPanel sourcePanel;
     466  private final JPanel sourcePanel = new GImport(this);
    666467  private final JPanel dataPanel = new ViewerController(this);
    667468  private final JPanel workspace = new Workspace(this);
    668469  private final JPanel logPanel = new GMainLog();
    669   private final String USER_PROPERTIES_FILE = "proteios" + File.separator + "conf" + File.separator + "user.properties";
    670470// Variables declaration - do not modify//GEN-BEGIN:variables
    671471  private final javax.swing.JMenu adminMenu = new javax.swing.JMenu();
  • trunk/src/org/proteios/importer/ImporterUtil.java

    r1260 r1343  
    11package org.proteios.importer;
    22
    3 import net.sf.hibernate.*;
     3import org.hibernate.*;
    44import org.proteios.core.ImportException;
    55import org.proteios.core.SQLConnection;
  • trunk/src/org/proteios/query/ProteinHitsReportQuery.java

    r1273 r1343  
    224224                  throw new org.proteios.core.CoreException("Could not parse id_date: " + currentDBSearch.getId_date() + " is not a valid XML dateTime format.");
    225225                }
    226                 row.spotId = currentGelItem.getId();
     226                row.spotId = (int) currentGelItem.getId();
    227227                row.MPId = currentGelItem.getMPId();
    228228                row.MPLabel = currentGelItem.getMPLabel();
Note: See TracChangeset for help on using the changeset viewer.