diff --git a/trunk/SIPRPSoft/.classpath b/trunk/SIPRPSoft/.classpath
index 6d7e206d..f4875632 100644
--- a/trunk/SIPRPSoft/.classpath
+++ b/trunk/SIPRPSoft/.classpath
@@ -35,7 +35,6 @@
-
diff --git a/trunk/SIPRPSoft/lib/cayenne-server-3.0.jar b/trunk/SIPRPSoft/lib/cayenne-server-3.0.jar
deleted file mode 100644
index 7637a746..00000000
Binary files a/trunk/SIPRPSoft/lib/cayenne-server-3.0.jar and /dev/null differ
diff --git a/trunk/SIPRPSoft/src/siprp/Main.java b/trunk/SIPRPSoft/src/siprp/Main.java
index bd8d6a32..4f41e575 100644
--- a/trunk/SIPRPSoft/src/siprp/Main.java
+++ b/trunk/SIPRPSoft/src/siprp/Main.java
@@ -22,13 +22,6 @@ import javax.swing.plaf.ColorUIResource;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.MutableTreeNode;
-import org.apache.cayenne.access.DataDomain;
-import org.apache.cayenne.access.DataNode;
-import org.apache.cayenne.conf.DefaultConfiguration;
-import org.apache.cayenne.conn.DriverDataSource;
-import org.apache.cayenne.dba.AutoAdapter;
-import org.apache.cayenne.map.DataMap;
-
import siprp.clientes.AvisosPanel;
import siprp.companydataloaders.SIPRPDataLoader;
import siprp.companydataloaders.SIPRPPropertiesLoader;
@@ -173,7 +166,8 @@ public class Main implements com.evolute.utils.ui.window.Connector
new ORMInitializer().initializeORM( url, user, passwd );
Singleton.setInstance( Singleton.TODAY, new Date() );
- initializeCayenne( url, user, passwd );
+// initializeCayenne( url, user, passwd);
+
}
catch( Exception ex )
{
@@ -241,18 +235,4 @@ public class Main implements com.evolute.utils.ui.window.Connector
return siprpTracker.getRoot();
}
- public void initializeCayenne(String url, String user, String password) throws SQLException
- {
- DataDomain domain = DefaultConfiguration.getSharedConfiguration().getDomain();
- DataMap map = domain.getMap( "SIPRPMap" );
- DriverDataSource dataSource = new DriverDataSource((String) Singleton.getInstance( SingletonConstants.LOCAL_DRIVER_NAME ), url, user, password );
- DataNode node = new DataNode("SIPRPNode");
- node.setDataSource( dataSource );
- node.setAdapter( new AutoAdapter(dataSource) );
- node.addDataMap( map );
- node.setEntityResolver( domain.getEntityResolver() );
- domain.reset();
- domain.addNode( node );
- }
-
}
diff --git a/trunk/SIPRPSoft/src/siprp/ORMInitializer.java b/trunk/SIPRPSoft/src/siprp/ORMInitializer.java
index 334afb1a..84bd15d5 100644
--- a/trunk/SIPRPSoft/src/siprp/ORMInitializer.java
+++ b/trunk/SIPRPSoft/src/siprp/ORMInitializer.java
@@ -73,13 +73,10 @@ public class ORMInitializer
ConnectionIdentity conn = new ConnectionIdentity( url, user );
conn.setPassword( password );
ProviderRegistry.registerDefaultConnection( conn );
- ProviderInterface provider = ProviderRegistry.getDefaultProvider( conn );
+ ProviderInterface< ?, ? > provider = ProviderRegistry.getDefaultProvider( conn );
- //FIXME : remover pelo menos o JDO ... (daqui e do resto do codigo)
Singleton.setInstance( Singleton.DEFAULT_OBJECT_PROVIDER, provider );
- Singleton.setInstance( Singleton.DEFAULT_JDO_PROVIDER, provider );
Singleton.setInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER, provider );
-
}
}
diff --git a/trunk/SIPRPSoft/src/siprp/SHSTLogger.java b/trunk/SIPRPSoft/src/siprp/SHSTLogger.java
new file mode 100644
index 00000000..10cfbc11
--- /dev/null
+++ b/trunk/SIPRPSoft/src/siprp/SHSTLogger.java
@@ -0,0 +1,134 @@
+/*
+ * SIPRPLogger.java
+ *
+ * Created on 15 de Marco de 2005, 15:31
+ */
+
+package siprp;
+
+import com.evolute.project.ProjectTools;
+import com.evolute.utils.Singleton;
+import com.evolute.utils.db.DBManager;
+import com.evolute.utils.db.Executer;
+import com.evolute.utils.db.SQLRetriever;
+import com.evolute.utils.error.Logger;
+import com.evolute.utils.sql.Assignment;
+import com.evolute.utils.sql.Field;
+import com.evolute.utils.sql.Insert;
+
+/**
+ *
+ * @author lflores
+
+ * MySQL
+CREATE TABLE errors
+(
+ id INT NOT NULL AUTO_INCREMENT,
+ PRIMARY KEY( id ),
+ date TIMESTAMP NOT NULL DEFAULT 'now()',
+ type VARCHAR(20),
+ environment VARCHAR( 255 ),
+ description TEXT
+);
+ *
+ *PostgreSQL
+CREATE TABLE errors
+(
+ id SERIAL,
+ PRIMARY KEY( id ),
+ date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ type VARCHAR(20),
+ environment VARCHAR( 255 ),
+ description VARCHAR( 256000 )
+)
+
+ */
+public class SHSTLogger implements Logger
+{
+ private final String java = System.getProperty( "java.version" )
+ + "-" + System.getProperty( "java.vm.version" );
+ private final String os = System.getProperty( "os.name" ) + " - " +
+ System.getProperty( "os.version" );
+ private final String user = ( String )Singleton.getInstance( Singleton.USERNAME );
+ private final String ENV = "Java: " + java + " \nOS: " + os + " \nUser: " + user
+ + "\n Software: " + ( String )Singleton.getInstance( SingletonConstants.SOFTWARE_NAME )
+ + "\n Version: " + ProjectTools.getInstance().getVersion();
+ private final Executer executer;
+
+ /** Creates a new instance of SIPRPLogger */
+ public SHSTLogger()
+ throws Exception
+ {
+ DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
+ executer = dbm.getExclusiveExecuter( this );
+ }
+
+ @Override
+ public void log( String str )
+ {
+ String mem = "(" + Runtime.getRuntime().freeMemory() + "/" +
+ Runtime.getRuntime().maxMemory() + ")";
+ if( str.length() > 254000 )
+ {
+ str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated.";
+ }
+ try
+ {
+ executer.executeQuery( new Insert( "errors", new Assignment[] {
+ new Assignment( new Field( "type" ), "LOG" ),
+ new Assignment( new Field( "environment" ), ENV + mem ),
+ new Assignment( new Field( "description" ), str )
+ } ), null );
+ }
+ catch( Exception ex )
+ {
+ logException( ex );
+ }
+ }
+
+ @Override
+ public void logException( Throwable ex )
+ {
+ StackTraceElement ste[] = ex.getStackTrace();
+ StringBuffer sb = new StringBuffer();
+ for( int i = 0; i < ste.length; ++i )
+ {
+ sb.append( ste[ i ].toString() );
+ }
+ String str = "Exception Message: " + ex.getMessage() + "\nStack Trace: " + sb.toString();
+ String mem = "(" + Runtime.getRuntime().freeMemory() + "/" +
+ Runtime.getRuntime().maxMemory() + ")";
+ if( str.length() > 254000 )
+ {
+ str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated.";
+ }
+ try
+ {
+ executer.executeQuery( new Insert( "errors", new Assignment[] {
+ new Assignment( new Field( "type" ), "ERROR" ),
+ new Assignment( new Field( "environment" ), ENV + mem ),
+ new Assignment( new Field( "description" ), str )
+ } ), new SQLRetriever() );
+ }
+ catch( Exception ex1 )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ @Override
+ public void close() {
+
+ }
+
+ @Override
+ public void log(String str, java.util.logging.Level level) {
+
+ }
+
+ @Override
+ public void logException(Throwable ex, java.util.logging.Level level) {
+
+ }
+
+}
diff --git a/trunk/SIPRPSoft/src/siprp/clientes/AvisosPanel.java b/trunk/SIPRPSoft/src/siprp/clientes/AvisosPanel.java
index 6e0ae256..0f7c7446 100644
--- a/trunk/SIPRPSoft/src/siprp/clientes/AvisosPanel.java
+++ b/trunk/SIPRPSoft/src/siprp/clientes/AvisosPanel.java
@@ -45,8 +45,9 @@ import com.evolute.utils.ui.DialogException;
*
* @author fpalma
*/
-public class AvisosPanel extends JPanel implements ActionListener, ControllableComponent, AvisosPanelInterface
+public class AvisosPanel extends JPanel implements ActionListener, ControllableComponent< Object >, AvisosPanelInterface
{
+ private static final long serialVersionUID = 1L;
private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT );
private ProviderInterface JDO;
private FichaDataProvider provider;
@@ -80,7 +81,7 @@ public class AvisosPanel extends JPanel implements ActionListener, ControllableC
// setupComponents();
buttonHash = new Hashtable();
buttonTypeHash = new Hashtable();
- JDO = (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
+ JDO = (ProviderInterface) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
// System.out.println( "public AvisosPanel() JDO: " + JDO );
}
@@ -337,7 +338,7 @@ public class AvisosPanel extends JPanel implements ActionListener, ControllableC
// avisosEmpresa = new AvisosData[ ids.length ];
// if( JDO == null )
// {
-// JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
+// JDO = ( JDOProvider ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
// }
//// System.out.println( "JDO: " + JDO );
// for( int n = 0; n < avisosEmpresa.length; n++ )
@@ -475,7 +476,7 @@ public class AvisosPanel extends JPanel implements ActionListener, ControllableC
{
if( JDO == null )
{
- JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
+ JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
}
Object source = e.getSource();
if( source instanceof JButton )
diff --git a/trunk/SIPRPSoft/src/siprp/clientes/ClientesWindow.java b/trunk/SIPRPSoft/src/siprp/clientes/ClientesWindow.java
index da2869ba..d637a6c7 100644
--- a/trunk/SIPRPSoft/src/siprp/clientes/ClientesWindow.java
+++ b/trunk/SIPRPSoft/src/siprp/clientes/ClientesWindow.java
@@ -154,7 +154,7 @@ public class ClientesWindow extends SIPRPEditorWindow
super( permissions );
this.avisos = avisos;
webAware = ( ( Boolean ) Singleton.getInstance( SingletonConstants.WEB_AWARE ) ).booleanValue();
- JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
+ JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_EVO_DATA_PROVIDER );
clientesProvider = ( ClientesDataProvider ) ClientesDataProvider.getProvider();
setEditorManagerHierarchy( hierarchy );
setupComponents();
diff --git a/trunk/SIPRPSoft/src/siprp/clientes/ContactoPanel.java b/trunk/SIPRPSoft/src/siprp/clientes/ContactoPanel.java
index 7f53d204..e8606112 100644
--- a/trunk/SIPRPSoft/src/siprp/clientes/ContactoPanel.java
+++ b/trunk/SIPRPSoft/src/siprp/clientes/ContactoPanel.java
@@ -26,7 +26,7 @@ import com.evolute.utils.ui.text.CopyPasteHandler;
*
* @author fpalma
*/
-public class ContactoPanel extends JPanel implements ControllableComponent