Commit 1d19c268 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci

Merge remote branch 'server/master'

Signed-off-by: default avatarErik Alexandre Pucci <eap08@c3sl.ufpr.br>
parents 26814a4c ece31aa7
# SEED2 SERVER
C3SL - Centro de Computacao Cientifica e Software Livre
Agtha Cristina de Nadai
Bruno Cesar Ribas
Carlos Carvalho
Daniel Weingaertner
Danilo Kiyoshi Simizu Yorinori
Diego Giovane Pasqualin
Edson Ramiro Lucas Filho
Eduardo Cunha de Almeida
Erik Alexandre Pucci
Fabiano Silva
Jorge Augusto Meira
Josiney de Souza
Juliana Bueno
Lucio Foltran da Silva
Luis Carlos Erpen de Bona
Marcos Castilho
Renan Franca De Miranda
Ricardo Tavares De Oliveira
Rubens Massayuki Suguimoto
Thiago Henrique Dos Santos Picharski
Tiago Rodrigo Kepe
Vinicius Kwiecien Ruoso
This diff is collapsed.
SEED2 SERVER ChangeLog
v1.0.0:
- initial release
Installation Steps
==================
Dependencies:
apache-tomcat-6.0.20
axis-1_4
Before installation, be sure you have installed at $CATALINA_HOME/lib the
following packages:
* postgresql-*.jar (http://jdbc.postgresql.org/);
* xercesImpl.jar (http://xerces.apache.org/mirrors.cgi);
* jdom.jar (http://www.jdom.org/index.html).
After, move Seed2.jws file to $AXIS_HOME/webapps/axis/, copy the version file
to the same directory and write its full path in Seed2.jws (line 453)
=============================================================================
Prerequisite:
To install these web services you need JAVA (+1.6, we don't recommend GCJ);
Apache ANT (to compile Java code automatically);
Apache AXIS and Apache TOMCAT to deploy services
Set environment variables:
- CATALINA_HOME -> Tomcat home directory
- AXIS_HOME -> Axis home directory
- AXIS_CLASSPATH -> Axis lib directory
Compiling:
To compile our JAVA code you can use ANT in the same directory where
"build.xml" can be found:
#ant
or
#ant compile
To copy the classes, copy configuration files and deploy services in Axis, do:
#ant install
The deploy step service needs Tomcat (with Axis) initialization. To deploy, do:
#ant deploy
By default, the deploy mechanism use port 8888. You can change this port
number in "build.xml" file.
!!!Be sure to set environment variables correctly, otherwise the !!!
!!! installation process will fail !!!
To check if your service has been deployed correctly, go to the axis web page
and check the services list:
http://localhost:8888/axis/
Configuration:
The configuration file should be in $CATALINA_HOME/bin/seed2 directory. You
need to change database informations and links. All fields are explained above:
Database configuration:
- Database host
<host>localhost</host>
- Database port
<port>5432</port>
- Database pgpool port
<sa_port>9999</sa_port>
- Database schema
<schema>db_schema</schema>
- Database user
<user>user</user>
- Database user's password
<passwd>password</passwd>
Document service configuration:
- Documents information file path
<doc_path>/path/to/docFile.xml</doc_path>
Install service configuration:
- Database table used to find school id
<table_school>school_table</table_school>
- Package generator script path
<package_gen>/path/to/pkgGenerator.sh</package_gen>
- Package generator script output path (agent package)
<package_dest>/path/to/pkgGeneratedDir</package_dest>
- Host used to create agent package
<host>host.local.net</host>
Seed service configuration:
- Database table used to find school id
<table_school>school_table</table_school>
- Database table used to insert informations sent by agents
<table_sa>stagin_area_table</table_sa>
- Version file path
<version_file>/path/to/versionFile</version_file>
- Update URL base link
<update_link_base_url>http://local.net/dir/</update_link_base_url>
- Update package name
<update_link_pkg_name>updatePackage_version</update_link_pkg_name>
- Update package extension
<update_link_ext>.run</update_link_ext>
Dump service configuration:
- Dump file path
<dump_path>Path/to/dumpFile</dump_path>
- Dump update file path
<dump_update_date>path/to/dumpUpdateDate/file</dump_update_date>
=============================================================================
For more information about installation of components
see the Tomcat, Axis, Ant and JAVA installation guide.
########################################################
# SEED2 SERVER
########################################################
SEED2 SERVER provides services for validation,
availabitity and version.
For installation support read "INSTALL".
For changes read "ChangeLog".
For new features and other news read "NEWS".
For credits read "AUTHORS".
For copyright information read "COPYING".
- Store inventory
- Check bugs
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<general>
<db_config>
<host>localhost</host>
<port>5432</port>
<sa_port>9999</sa_port>
<schema>db_schema</schema>
<user>user</user>
<passwd>password</passwd>
</db_config>
<doc_config>
<doc_path>/path/to/docFile.xml</doc_path>
</doc_config>
<install_config>
<table_school>school_table</table_school>
<package_gen>/path/to/pkgGenerator.sh</package_gen>
<package_dest>/path/to/pkgGeneratedDir</package_dest>
<host>host.local.net</host>
</install_config>
<seed_config>
<table_school>school_table</table_school>
<table_sa>stagin_area_table</table_sa>
<version_file>/path/to/versionFile</version_file>
<update_link_base_url>http://host.local.net/pkg/dir/</update_link_base_url>
<update_link_pkg_name>updatePackage_version</update_link_pkg_name>
<update_link_ext>.run</update_link_ext>
</seed_config>
<dump_config>
<dump_path>Path/to/dumpFile</dump_path>
<dump_update_date>path/to/dumpUpdateDate/file</dump_update_date>
</dump_config>
</general>
<?xml version="1.0" encoding="utf-8"?>
<documents>
<document>
<name>User's manual</name>
<desc>This is the user's manual</desc>
<size>189324</size>
<date>22/12/2009</date>
<url>http://local.host.net/doc/user_man.pdf</url>
</document>
<document>
<name>Use manual</name>
<desc>System's use manual</desc>
<size>9302831</size>
<date>09/11/2009</date>
<url>http://local.host.net/doc/system_man.pdf</url>
</document>
<document>
<name>Admin's manual</name>
<desc>This is a administrator's manual</desc>
<size>149283</size>
<date>09/11/2009</date>
<url>http://local.host.net/doc/admin_man.pdf</url>
</document>
</documents>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Seed2DocService" provider="java:RPC">
<parameter name="className" value="Seed2Doc"/>
<parameter name="allowedMethods" value="getDocuments"/>
<parameter name="wsdlTargetNamespace" value="http://seed2Doc.c3sl"/>
<typeMapping
xmlns:ns="http://seed2Doc.c3sl"
qname="ns:Seed2Document"
type="java:Seed2Document"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
<typeMapping
xmlns:ns="http://seed2Doc.c3sl"
qname="ns:Seed2DocumentArray"
type="java:Seed2Document[]"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
<operation name="getDocuments" qname="test:getDocuments"
xmlns:test="http://seed2Doc.c3sl"
returnQName="getDocumentsReturn"
xmlns:ns="http://seed2Doc.c3sl"
returnType="ns:Seed2DocumentArray">
</operation>
</service>
</deployment>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Seed2DumpService" provider="java:RPC">
<parameter name="className" value="Seed2Dump"/>
<parameter name="allowedMethods" value="getDump getLastDumpDate"/>
<parameter name="wsdlTargetNamespace" value="http://seed2Dump.c3sl"/>
<operation name="getDump" qname="seed2:getDump"
xmlns:seed2="http://seed2Dump.c3sl"
returnQName="seed2:getDumpReturn"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
returnType="xsd:string">
</operation>
<operation name="getLastDumpDate" qname="seed2:getLastDumpDate"
xmlns:seed2="http://seed2Dump.c3sl"
returnQName="seed2:getLastDumpDateReturn"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
returnType="xsd:string">
</operation>
</service>
</deployment>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Seed2InstallService" provider="java:RPC">
<parameter name="className" value="Seed2Install"/>
<parameter name="allowedMethods" value="getINEPInfo makePackage verifyId"/>
<parameter name="wsdlTargetNamespace" value="http://seed2Install.c3sl"/>
<typeMapping
xmlns:ns="http://seed2Install.c3sl"
qname="ns:Seed2SchoolType"
type="java:Seed2School"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
<typeMapping
xmlns:ns="http://seed2Install.c3sl"
qname="ns:Seed2PackageType"
type="java:Seed2Package"
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
/>
<operation name="getINEPInfo" qname="test:getINEPInfo"
xmlns:test="http://seed2Install.c3sl"
returnQName="test:getINEPInfoReturn"
xmlns:ns="http://seed2Install.c3sl"
returnType="ns:Seed2SchoolType">
<parameter qname="pns:INEP" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<operation name="makePackage" qname="test:makePackage"
xmlns:test="http://seed2Install.c3sl"
returnQName="http://seed2Install.c3sl"
xmlns:ns="http://seed2Install.c3sl"
returnType="ns:Seed2PackageType">
<parameter qname="pns:INEP" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
<parameter qname="pns:Host" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
<parameter qname="pns:Port" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
<parameter qname="pns:User" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
<parameter qname="pns:Passwd" xmlns:pns="http://seed2Install.c3sl"
type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<operation name="verifyId" qname="seed2:verifyId"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:verifyId"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:string">
<parameter qname="pns:INEP" xmlns:pns="http://seed2.c3sl" type="xsd:string" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</operation>
</service>
</deployment>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Seed2Service" provider="java:RPC">
<parameter name="className" value="Seed2"/>
<parameter name="allowedMethods" value="setInventory getAgentVersion verifyId setAvailability getUpdateLink"/>
<parameter name="wsdlTargetNamespace" value="http://seed2.c3sl"/>
<operation name="setInventory" qname="seed2:setInvetory"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:setInventoryReturn"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:string">
<parameter qname="pns:Inventary" xmlns:pns="http://seed2.c3sl" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<operation name="getAgentVersion" qname="seed2:getAgentVersion"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:getAgentVersion"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:string">
</operation>
<operation name="verifyId" qname="seed2:verifyId"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:verifyId"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:boolean">
<parameter qname="pns:INEP" xmlns:pns="http://seed2.c3sl" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<operation name="setAvailability" qname="seed2:setAvailability"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:setAvailability"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:string">
<parameter qname="pns:INEP" xmlns:pns="http://seed2.c3sl" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
<parameter qname="pns:MacAddress" xmlns:pns="http://seed2.c3sl" type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema"/>
</operation>
<operation name="getUpdateLink" qname="seed2:getUpdateLink"
xmlns:seed2="http://seed2.c3sl"
returnQName="seed2:getUpdateLink"
xmlns:ns="http://www.w3.org/2001/XMLSchema"
returnType="ns:string">
</operation>
</service>
</deployment>
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
/* Database libs */
import java.sql.*;
import org.postgresql.Driver;
/* File libs */
import java.io.*;
public class DBConnection {
/* Attributes */
Statement stmt = null;
public Connection myConnection;
/**
* Database constructor.
*
* @author Rubens Massayuki Suguimoto
* @return void
*/
public DBConnection() {
super();
}
/**
* Creates a new instance of data base connection.
*
* @author Rubens Massayuki Suguimoto
* @return boolean
*/
public boolean connect()
throws ClassNotFoundException, SQLException, Exception {
XmlUtil config = new XmlUtil("./seed2/conf.xml");
String dbTag = "db_config";
/* Get information from configuration file */
String host = config.getTextValue(config.getTag(dbTag), "host");
String port = config.getTextValue(config.getTag(dbTag), "port");
String schema = config.getTextValue(config.getTag(dbTag), "schema");
String user = config.getTextValue(config.getTag(dbTag), "user");
String passwd = config.getTextValue(config.getTag(dbTag), "passwd");
Driver.class.newInstance();
System.out.println("DB: Driver Initialized.");
/* Open connection to data base */
myConnection = DriverManager.getConnection("jdbc:postgresql://" + host +
":" + port + "/" + schema, user, passwd);
System.out.println("DB: Connected to Database.");
stmt = myConnection.createStatement();
return true;
}
/**
* Close connection with data base.
*
* @author Rubens Massayuki Suguimoto
* @return void
*/
public void close() throws SQLException {
stmt.close();
myConnection.close();
}
/**
* Execute query in data base.
*
* @author Rubens Massayuki Suguimoto
* @param pSql String
* @return ResultSet
*/
public ResultSet executeQuery(String pSql) throws SQLException {
System.out.println("DB: Query: " + pSql);
return stmt.executeQuery(pSql);
}
/**
* Execute update query in data base.
*
* @author Rubens Massayuki Suguimoto
* @param pSql String
* @return int
*/
public int executeUpdate(String pSql) throws SQLException {
System.out.println("DB: Update: " + pSql);
return stmt.executeUpdate(pSql);
}
}
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
/* File libs */
import java.io.File;
public class FileUtil {
/**
* Get file size using file path.
*
* @author Rubens Massayuki Suguimoto
* @param filename String
* @return long
*/
public long getFileSize(String filename) {
File file = new File(filename);
if ((!file.exists()) || (!file.isFile())) {
System.out.println("File doesn\'t exist");
return -1;
}
/* Here we get the file size */
return file.length();
}
}
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
/* XML Parser libs */
import org.apache.xerces.parsers.*;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
/* File libs */
import java.io.IOException;
public class Seed2Doc {
/* Attributes */
private String docFile;
/**
* Seed2Doc service constructor.
*
* @author Rubens Massayuki Suguimoto
* @return void
*/
public Seed2Doc() {
XmlUtil docConf = new XmlUtil("./seed2/conf.xml");
String docTag = "doc_config";
/* Get information from configuration file */
docFile = docConf.getTextValue(docConf.getTag(docTag),"doc_path");
}
/**
* Return documents array.
*
* @author Rubens Massayuki Suguimoto
* @return Seed2Document array
*/
public Seed2Document[] getDocuments() {
int i;
System.out.println("Doc: Opening:" + docFile);
/* TODO - document array more flexible */
Seed2Document [] docs = new Seed2Document[10];
System.out.println("Doc: Parsing file.");
XmlUtil docXml = new XmlUtil(docFile);
System.out.println("Doc: Parse done.");
NodeList docElements = docXml.getTags("document");
for (i = 0; i < docElements.getLength(); i++) {
Element docElement = (Element)docElements.item(i);
docs[i] = getDocInfo(docElement);
}
return docs;
}
/**
* Get document element information.
*
* @author Rubens Massayuki Suguimoto
* @param docNode Element (dom element)
* @return Seed2Document item
*/
private Seed2Document getDocInfo(Element docNode) {
Seed2Document doc = new Seed2Document();
XmlUtil parse = new XmlUtil();
doc.Name = parse.getTextValue(docNode, "name");
doc.Size = parse.getTextValue(docNode, "size");
doc.Date = parse.getTextValue(docNode, "date");
doc.URL = parse.getTextValue(docNode, "url");
doc.Description = parse.getTextValue(docNode, "desc");
return doc;
}
}
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
public class Seed2Document {
/* Attributes */
/* TODO: Change attributes to lower case */
public String Name;
public String Size;
public String URL;
public String Date;
public String Description;
}
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
public class Seed2Package {
/* Attributes */
/* TODO: Change attributes to lower case */
public String URL;
public String Size;
public String PackageName;
public int MessageCode;
public String MessageError;
}
/*
* Copyright (C) 2004-2010 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
*
* This file is part of server
*
* server is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.