cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ZongoZongo <nroe...@gmx.net>
Subject Problem with Java and Flowscript
Date Wed, 29 Nov 2006 10:09:48 GMT

Hi

I have a Problem to import a javaclass in flowscript. The poblem doesnt
arise with simple javaclasses. The code is tested and works in the eclipse
enviroment. 
Ok, now the sourcecode:

##########################
package de.doccollector.binding;

import de.doccollector.*;
import java.sql.*;
import java.util.Vector;
import java.util.Iterator;

public class ManageObjects{
	
	public static Objects load(Objects objects){
		Vector vector = new Vector();
		//create DB connection
		JDBCConnection  conn = new JDBCConnection();
		try{
			Statement stat = conn.getStatement();
			ResultSet rset = stat.executeQuery("SELECT name FROM Object WHERE
entrance=0");
			while(rset.next()){
				vector.add(rset.getString("name"));
			}
			
		}
		catch (SQLException sqle){
			System.err.println(sqle);
		}
		conn.close();
		objects.setObjectList(vector);
		return objects;
	}
	
	public static void save(Objects objects){
		Vector vector = objects.getObjectList();
		JDBCConnection conn = new JDBCConnection();
		try{
			Statement stat = conn.getStatement();
			stat.executeUpdate("UPDATE Objects SET entrance=0");
			
			Iterator iterator = vector.iterator();
			while(iterator.hasNext()){
				String objectName = (String)iterator.next();
				stat.executeUpdate("UPDATE Objects SET entrance=1 WHERE name=\"" +
objectName +"\"");
			}
		}
		catch (SQLException sqle){
			System.err.println(sqle);
		}
	}
}
###################

This class takes a javabean and loades and saves the fields respectively. I
call this in flowscript as follows:

###################
var objectBean = new Packages.de.doccollector.binding.Objects();
	
	importClass(Packages.de.doccollector.binding.ManageObjects);
	objectBean = ManageObjects.load(objectBean);
###################

Following error occurs

##################

org.mozilla.javascript.EvaluatorException: "file:/C:/Programme/Apache
Software Foundation/Tomcat
5.5/webapps/cocoon/doccollector/flows/configuration.js", line 13: Failed to
compile Java class de.doccollector.binding.ManageObjects$load:
file:/C:/Programme/Apache Software Foundation/Tomcat
5.5/webapps/cocoon/javaClasses/de/doccollector/binding/ManageObjects.java:
Line 3: The import de.doccollector is never used
file:/C:/Programme/Apache Software Foundation/Tomcat
5.5/webapps/cocoon/javaClasses/de/doccollector/binding/ManageObjects.java:
Line 4: The import java.sql is never used
file:/C:/Programme/Apache Software Foundation/Tomcat
5.5/webapps/cocoon/javaClasses/de/doccollector/binding/ManageObjects.java:
Line 5: The import java.util.Vector is never used
file:/C:/Programme/Apache Software Foundation/Tomcat
5.5/webapps/cocoon/javaClasses/de/doccollector/binding/ManageObjects.java:
Line 6: The import java.util.Iterator is never used
file:/C:/Programme/Apache Software Foundation/Tomcat
5.5/webapps/cocoon/javaClasses/de/doccollector/binding/ManageObjects.java:
Line 8: The public type ManageObjects must be defined in its own file

##########################

I really dont understand this. All importet classes ARE used. Besides the
type ManageObjects IS defined it its own file.

So please help me. I already spent so much time to solve this problem.

Thanks

Niclas


-- 
View this message in context: http://www.nabble.com/Problem-with-Java-and-Flowscript-tf2724087.html#a7596606
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message