From b719d810acaaab271c115e1e45d2868199a47548 Mon Sep 17 00:00:00 2001 From: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br> Date: Wed, 1 Jul 2015 14:26:22 -0300 Subject: [PATCH] Remove webservice, whose job is done by SIMMC now Signed-off-by: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br> --- webservice/.gitignore | 5 - webservice/DataSID.java | 527 ------------------------------ webservice/Makefile | 37 --- webservice/collected-data.xsd | 93 ------ webservice/net-collected-data.xsd | 67 ---- webservice/services.xml | 15 - webservice/spawn.sh | 12 - webservice/webservice | 57 ---- webservice/webservice.properties | 8 - 9 files changed, 821 deletions(-) delete mode 100644 webservice/.gitignore delete mode 100644 webservice/DataSID.java delete mode 100644 webservice/Makefile delete mode 100644 webservice/collected-data.xsd delete mode 100644 webservice/net-collected-data.xsd delete mode 100644 webservice/services.xml delete mode 100644 webservice/spawn.sh delete mode 100644 webservice/webservice delete mode 100644 webservice/webservice.properties diff --git a/webservice/.gitignore b/webservice/.gitignore deleted file mode 100644 index f1d2a26..0000000 --- a/webservice/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -classes -generated -pkg -*.aar -postgresql* diff --git a/webservice/DataSID.java b/webservice/DataSID.java deleted file mode 100644 index e6af44f..0000000 --- a/webservice/DataSID.java +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Copyright (C) 2004-2011 Centro de Computacao Cientifica e Software Livre - * Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR - * - * This file is part of datasid - * - * This program 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. - */ -package br.ufpr.c3sl.datasid; - -import java.io.*; -import java.util.*; -import java.util.regex.*; -import java.text.SimpleDateFormat; -import java.text.ParseException; -import java.math.BigInteger; - -import java.sql.Timestamp; -import java.sql.SQLException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.Types; - -import javax.naming.InitialContext; -import javax.sql.DataSource; -import javax.xml.bind.*; -import javax.xml.bind.util.ValidationEventCollector; -import javax.xml.bind.helpers.DefaultValidationEventHandler; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.transform.stream.StreamSource; - -public class DataSID { - // enum does not work as expected inside an axis web service - // using simple constants instead - private static final int LINUX = 0; - private static final int WINDOWS = 1; - - private static final int ERROR = 0; - private static final int WARNING = 1; - private static final int INFO = 2; - private static final int DEBUG = 3; - - private Properties prop; - - private File xml_inventory_schema; - private File xml_net_usage_schema; - - private String linux_agent_version; - private String linux_agent_update_link; - - private String windows_agent_version; - private String windows_agent_update_link; - - public DataSID() throws IOException { - try { - this.prop = new Properties(); - this.prop.load(new FileInputStream("../conf/webservice.properties")); - } - catch (IOException e) { - System.err.println("Failed to load webservice.properties."); - throw e; - } - - this.xml_inventory_schema = new File(this.prop.getProperty("xml_inventory_schema", - "../conf/collected-data.xsd")); - this.xml_net_usage_schema = new File(this.prop.getProperty("xml_net_usage_schema", - "../conf/net-collected-data.xsd")); - - this.linux_agent_version = this.prop.getProperty("linux_agent_version", "1.0.0"); - this.linux_agent_update_link = this.prop.getProperty("linux_agent_update_link", - "http://bisimmcdev.c3sl.ufpr.br/download/datasid-1.0.0-update.run"); - - this.windows_agent_version = this.prop.getProperty("windows_agent_version", "1.0.0"); - this.windows_agent_update_link = this.prop.getProperty("windows_agent_update_link", - "http://bisimmcdev.c3sl.ufpr.br/download/datasid-1.0.0-update.exe"); - } - - - /** - * Returns the name of the log level - * - * @author Eduardo Luis Buratti - * @param level Log level - */ - private static String logLevelName(int level) { - if (level == ERROR) return "ERROR"; - else if (level == WARNING) return "WARNING"; - else if (level == INFO) return "INFO"; - else if (level == DEBUG) return "DEBUG"; - else return "NULL"; - } - - /** - * Write messages to the log - * - * @author Eduardo Luis Buratti - * @param level Log level - * @param msg Message - */ - private static void log(int level, String msg) { - System.out.println(getTimestamp() + " [DataSidWS][" + logLevelName(level) + "]: " + msg); - } - - /** - * Returns a string representing the current date - * - * @author Eduardo Luis Buratti - * @return String - */ - private static String getDate() { - Calendar date = Calendar.getInstance(); // gets current date - - int year = date.get(Calendar.YEAR); - int month = date.get(Calendar.MONTH); - int day = date.get(Calendar.DATE); - - /* NOTE: Calendar.MONTH field value is 0-based. e.g: 0 is January */ - month++; - - return year + "-" + month + "-" + day; - } - - /** - * Returns current timestamp - * - * @author Eduardo Luis Buratti - * @return String - */ - private static String getTimestamp() { - // gets the current time - java.util.Date date = new java.util.Date(); - long milisecs = date.getTime(); - - // generates timestamp string - Timestamp timestamp = new Timestamp(milisecs); - return timestamp.toString(); - } - - /** - * Return a string with current agent version. - * - * @author Eduardo Luis Buratti - * @param OS Integer of OS Type - * @return String - */ - public String getAgentVersion(int OS) { - switch(OS){ - case LINUX: - return this.linux_agent_version; - case WINDOWS: - return this.windows_agent_version; - default: - return "ERROR: invalid OS"; - } - - } - - /** - * Return a string that contains a link to download the newest version of - * agent. - * - * @author Eduardo Luis Buratti - * @param OS Integer of OS Type - * @return String - */ - public String getUpdateLink(int OS) - { - switch(OS){ - case LINUX: - return this.linux_agent_update_link; - case WINDOWS: - return this.windows_agent_update_link; - default: - return "ERROR: invalid OS"; - } - } - - /** - * Receive an XML string which has the inventory data to be parsed and - * inserted into database. Return "Success" string if insertion operation - * is successful. Any other errors will throw exceptions. - * - * @author Eduardo Luis Buratti - * @param xmlData XML string of inventory - * @return String - */ - public String setInventory(String xmlData) { - Connection con = null; - String status = "Success"; - try { - InitialContext cxt = new InitialContext(); - DataSource ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/simmc"); - if (ds == null) - throw new Exception("Data source not found!"); - - SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); - Schema schema = factory.newSchema(this.xml_inventory_schema); - - JAXBContext context = JAXBContext.newInstance(CollectedData.class); - Unmarshaller unmarshaller = context.createUnmarshaller(); - unmarshaller.setSchema(schema); - - // Strip spaces in the beginning of the xml - xmlData = xmlData.replaceAll("^\\s+", ""); - - // transform the xml string into a InputStream - InputStream is = new ByteArrayInputStream(xmlData.getBytes()); - - // Decode the XML into a Java Object - JAXBElement<CollectedData> element = (JAXBElement<CollectedData>) unmarshaller.unmarshal(new StreamSource(is), CollectedData.class); - CollectedData collected = element.getValue(); - // contact_date = current date - Calendar cal = Calendar.getInstance(); - java.sql.Date contactDate = new java.sql.Date(cal.getTimeInMillis()); - - con = ds.getConnection(); - if (con == null) - throw new Exception("Failed to get a database connection!"); - - PreparedStatement st = createInventoryStatement(con, collected, contactDate); - st.executeUpdate(); - - List<User> users = collected.getUserHistory().getUser(); - int idpoint = collected.getPointInfo().getIdpoint().intValue(); - List<Interface> interfaces = collected.getInterfaces().getInterface(); - org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject(); - macaddr.setType("macaddr"); - macaddr.setValue(interfaces.get(0).getMacAddress()); - - for(User user: users) { - st = createUserHistoryStatement(con, contactDate, idpoint, - macaddr, user.getName(), user.getLogin(), user.getLogout()); - st.executeUpdate(); - } - log(INFO, "setInventory(idpoint=" + collected.getPointInfo().getIdpoint() + - ", macaddr=" + interfaces.get(0).getMacAddress() + ")"); - - } catch (Exception e) { - log(ERROR, e.getMessage() + " " + xmlData); - e.printStackTrace(); - status = "ERROR: " + e.getMessage(); - } finally { - try{ - if (con != null) - con.close(); - } catch (SQLException se) { - log(ERROR, se.getMessage()); - se.printStackTrace(); - return "ERROR: " + se.getMessage(); - } - - return status; - } - } - - private PreparedStatement createInventoryStatement(Connection con, CollectedData collectedData, java.sql.Date contactDate) throws SQLException, ParseException { - final String query = "INSERT INTO telecenter_inventory " + - "(contact_date, machine_type, id_point, macaddr, agent_version, " + - " os_type, os_distro, os_kernel, " + - " processor, memory, " + - " disk1_model, disk1_size, disk1_used, " + - " disk2_model, disk2_size, disk2_used, " + - " extra_hds, mirror_timestamp, amount_users " + - ") VALUES " + - "(?, ?, ?, ?, ?, " + - " ?, ?, ?, " + - " ?, ?, " + - " ?, ?, ?, " + - " ?, ?, ?, " + - " ?, ?, ? " + - " );"; - - PreparedStatement st = con.prepareStatement(query); - - List<Interface> interfaces = collectedData.getInterfaces().getInterface(); - - Inventory inventory = collectedData.getInventory(); - List<Disk> disks = inventory.getDisks().getDisk(); - PointInfo pointInfo = collectedData.getPointInfo(); - - // contact_date - st.setDate(1, contactDate); - - // machine_type - if(collectedData.getMachineType().compareTo("client") == 0) - st.setInt(2, 0); - else - st.setInt(2, 1); - - // idpoint - st.setInt(3, pointInfo.getIdpoint().intValue()); - - // macaddr - org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject(); - macaddr.setType("macaddr"); - macaddr.setValue(interfaces.get(0).getMacAddress()); - st.setObject(4, macaddr); - - // versao - st.setString(5, collectedData.getAgentVersion()); - - // os_type - st.setString(6, inventory.getOs()); - - // os_distro - st.setString(7, inventory.getDistro()); - - // os_kernel - st.setString(8, inventory.getKernel()); - - // processor - st.setString(9, inventory.getProcessor()); - - // memory - st.setInt(10, inventory.getMemory().intValue()); - - // disk1_model - st.setString(11, disks.get(0).getModel()); - - // disk1_size - st.setInt(12, disks.get(0).getSize().intValue()); - - // disk1_used - st.setInt(13, disks.get(0).getUsed().intValue()); - - if (disks.size() > 1) { - // disk2_model - st.setString(14, disks.get(1).getModel()); - - // disk2_size - st.setInt(15, disks.get(1).getSize().intValue()); - - // disk2_used - st.setInt(16, disks.get(1).getUsed().intValue()); - } - else { - // disk2_model - st.setNull(14, Types.VARCHAR); - - // disk2_size - st.setNull(15, Types.INTEGER); - - // disk2_used - st.setNull(16, Types.INTEGER); - } - - // extra_hds - st.setInt(17, (disks.size() > 2) ? (disks.size() - 2) : 0); - - - // mirrors_timestamp - if(collectedData.getMirrorsTimestamp().compareTo(" ") == 0) - st.setTimestamp(18, null); - else { - SimpleDateFormat dt = new SimpleDateFormat("EEE MMM dd hh:mm:ss zzz yyyy", Locale.US); - Date ts = dt.parse(collectedData.getMirrorsTimestamp()); - st.setTimestamp(18, new java.sql.Timestamp(ts.getTime())); - } - - // user_count - st.setInt(19, pointInfo.getUserCount().intValue()); - - return st; - } - - private PreparedStatement createUserHistoryStatement(Connection con, java.sql.Date contactDate, - int id_point, Object macaddr, String name, String login, String logout) throws SQLException { - final String query = "INSERT INTO telecenter_user " + - "(contact_date, id_point, macaddr, name, login, logout) VALUES " + - "(?, ?, ?, ?, ?, ?);"; - - PreparedStatement st = con.prepareStatement(query); - - st.setDate(1, contactDate); - - st.setInt(2, id_point); - - st.setObject(3, macaddr); - - st.setString(4, name); - - try { - st.setTime(5, java.sql.Time.valueOf(login)); - } catch (Exception e) { - st.setTime(5, null); - } - - try { - st.setTime(6, java.sql.Time.valueOf(logout)); - } catch (Exception e) { - st.setTime(6, null); - } - - return st; - } - - /** - * Receive an XML string which has the inventory data to be parsed and - * inserted into database. Return "Success" string if insertion operation - * is successful. Any other errors will throw exceptions. - * - * @author Eduardo Luis Buratti - * @param xmlData XML string of inventory - * @return String - */ - public String setNetUsage(String xmlData) - { - Connection con = null; - String status = "Success"; - try { - InitialContext cxt = new InitialContext(); - DataSource ds = (DataSource) cxt.lookup("java:/comp/env/jdbc/simmc"); - if (ds == null) - throw new Exception("Data source not found!"); - - SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); - Schema schema = factory.newSchema(this.xml_net_usage_schema); - - JAXBContext context = JAXBContext.newInstance(NetCollectedData.class); - Unmarshaller unmarshaller = context.createUnmarshaller(); - unmarshaller.setSchema(schema); - - // Strip spaces in the beginning of the xml - xmlData = xmlData.replaceAll("^\\s+", ""); - - // transform the xml string into a InputStream - InputStream is = new ByteArrayInputStream(xmlData.getBytes()); - - // Decode the XML into a Java Object - JAXBElement<NetCollectedData> element = (JAXBElement<NetCollectedData>) unmarshaller.unmarshal(new StreamSource(is), NetCollectedData.class); - NetCollectedData netCollectedData = element.getValue(); - - List<Interface> interfaces = netCollectedData.getInterfaces().getInterface(); - - // contact_date = current date - Calendar cal = Calendar.getInstance(); - java.sql.Date contactDate = new java.sql.Date(cal.getTimeInMillis()); - // macaddr - org.postgresql.util.PGobject macaddr = new org.postgresql.util.PGobject(); - macaddr.setType("macaddr"); - macaddr.setValue(interfaces.get(0).getMacAddress()); - - List<NetUse> netUses = netCollectedData.getBandwidthUsage().getNetuse(); - - con = ds.getConnection(); - if (con == null) - throw new Exception("Failed to get a database connection!"); - - for(NetUse netUse : netUses) { - PreparedStatement st = createNetUsageStatement(con, contactDate, - netCollectedData.getIdPoint(), (Object)macaddr, - netUse.getDate(), netUse.getTime(), netUse.getRx().getRxBytes(), - netUse.getRx().getRxPackets(), netUse.getTx().getTxBytes(), - netUse.getTx().getTxPackets()); - st.executeUpdate(); - } - - log(DEBUG, "setNetUsage(idpoint=" + netCollectedData.getIdPoint() + - ", macaddr=" + interfaces.get(0).getMacAddress() + ")"); - status = "Success"; - } catch (Exception e) { - log(ERROR, e.getMessage() + " " + xmlData); - e.printStackTrace(); - status = "ERROR: " + e.getMessage(); - } finally { - try{ - if (con != null) - con.close(); - } catch (SQLException se) { - log(ERROR, se.getMessage()); - se.printStackTrace(); - return "ERROR: " + se.getMessage(); - } - - return status; - } - } - - private PreparedStatement createNetUsageStatement(Connection con, java.sql.Date contactDate, - BigInteger idpoint, Object macaddr, String collect_date, String collect_time, long down_bytes, - BigInteger down_packages, long up_bytes, BigInteger up_packages) throws SQLException { - final String query = "INSERT INTO net_usage " + - "(contact_date, id_point, macaddr, collect_date, collect_time, " + - "down_bytes, down_packages, up_bytes, up_packages, ip, city_code) VALUES " + - "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);"; - - PreparedStatement st = con.prepareStatement(query); - - st.setDate(1, contactDate); - - st.setInt(2, idpoint.intValue()); - - st.setObject(3, macaddr); - - st.setDate(4, java.sql.Date.valueOf(collect_date)); - - st.setTime(5, java.sql.Time.valueOf(collect_time)); - - st.setLong(6, down_bytes); - - st.setInt(7, down_packages.intValue()); - - st.setLong(8, up_bytes); - - st.setInt(9, up_packages.intValue()); - - st.setObject(10, null); - - st.setString(11, null); - - return st; - } -} diff --git a/webservice/Makefile b/webservice/Makefile deleted file mode 100644 index a4f57ec..0000000 --- a/webservice/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -JDBC_VER = 9.2-1003 -JDBC = postgresql-$(JDBC_VER).jdbc4.jar -JDBC_URL = http://jdbc.postgresql.org/download/postgresql-$(JDBC_VER).jdbc4.jar - -all: DataSID.aar - -DataSID.aar: classes/br/ufpr/c3sl/datasid/DataSID.class collected-data.xsd net-collected-data.xsd services.xml - @mkdir -p pkg/META-INF - cp collected-data.xsd services.xml pkg/META-INF/ - cp net-collected-data.xsd services.xml pkg/META-INF/ - cp -r classes/* pkg/ - jar cvf $@ -C pkg . - -classes/br/ufpr/c3sl/datasid/DataSID.class: DataSID.java classes/br/ufpr/c3sl/datasid/CollectedData.class $(JDBC) - javac -source 6 -target 6 -classpath $(JDBC):classes -d classes $< - -classes/br/ufpr/c3sl/datasid/CollectedData.class: generated/br/ufpr/c3sl/datasid/CollectedData.java generated/br/ufpr/c3sl/datasid/NetCollectedData.java - @mkdir -p classes - javac -source 6 -target 6 -sourcepath generated -d classes generated/br/ufpr/c3sl/datasid/*.java - -generated/br/ufpr/c3sl/datasid/CollectedData.java: collected-data.xsd - @mkdir -p generated - xjc -d generated -p br.ufpr.c3sl.datasid $< - -generated/br/ufpr/c3sl/datasid/NetCollectedData.java: net-collected-data.xsd - @mkdir -p generated - xjc -d generated -p br.ufpr.c3sl.datasid $< - -$(JDBC): - wget -O "$(JDBC)" "$(JDBC_URL)" - -clean: - rm -rf generated - rm -rf classes - rm -rf pkg - rm -f DataSID.class - rm -f DataSID.aar diff --git a/webservice/collected-data.xsd b/webservice/collected-data.xsd deleted file mode 100644 index 84b2ac2..0000000 --- a/webservice/collected-data.xsd +++ /dev/null @@ -1,93 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <xsd:element name="collected-data" type="CollectedData" /> - - <xsd:complexType name="CollectedData"> - <xsd:all> - <xsd:element name="agent-version" type="Version" minOccurs="1" /> - <xsd:element name="point-info" type="PointInfo" minOccurs="1" /> - <xsd:element name="interfaces" type="Interfaces" minOccurs="1" /> - <xsd:element name="machine-type" minOccurs="1"> - <xsd:simpleType> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="client|server"/> - </xsd:restriction> - </xsd:simpleType> - </xsd:element> - <xsd:element name="inventory" type="Inventory" minOccurs="1" /> - <xsd:element name="user-history" type="UserHistory" minOccurs="1" /> - <xsd:element name="mirrors-timestamp" type="xsd:string" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - - <xsd:simpleType name="Version"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[0-9]+.[0-9]+.[0-9]+" /> - </xsd:restriction> - </xsd:simpleType> - - <xsd:complexType name="Interfaces"> - <xsd:sequence> - <xsd:element name="interface" type="Interface" minOccurs="1" maxOccurs="unbounded" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="Interface"> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="mac-address" type="MacAddress" use="required" /> - </xsd:complexType> - - <xsd:simpleType name="MacAddress"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}" /> - </xsd:restriction> - </xsd:simpleType> - - <xsd:complexType name="Inventory"> - <xsd:all> - <xsd:element name="processor" type="xsd:string" minOccurs="1" /> - <xsd:element name="memory" type="xsd:integer" minOccurs="1" /> - <xsd:element name="os" type="xsd:string" minOccurs="1" /> - <xsd:element name="distro" type="xsd:string" minOccurs="1" /> - <xsd:element name="kernel" type="xsd:string" minOccurs="1" /> - <xsd:element name="disks" type="Disks" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - - <xsd:complexType name="Disks"> - <xsd:sequence> - <xsd:element name="disk" type="Disk" minOccurs="1" maxOccurs="unbounded" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="Disk"> - <xsd:all> - <xsd:element name="id" type="xsd:integer" /> - <xsd:element name="model" type="xsd:string" /> - <xsd:element name="size" type="xsd:integer" /> - <xsd:element name="used" type="xsd:integer" /> - </xsd:all> - </xsd:complexType> - - <xsd:complexType name="UserHistory"> - <xsd:sequence> - <xsd:element name="user" type="User" minOccurs="0" maxOccurs="unbounded" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="User"> - <xsd:all> - <xsd:element name="id" type="xsd:integer" /> - <xsd:element name="name" type="xsd:string" /> - <xsd:element name="login" type="xsd:string" /> - <xsd:element name="logout" type="xsd:string" /> - </xsd:all> - </xsd:complexType> - - <xsd:complexType name="PointInfo"> - <xsd:all> - <xsd:element name="idpoint" type="xsd:integer" /> - <xsd:element name="user_count" type="xsd:integer" /> - </xsd:all> - </xsd:complexType> -</xsd:schema> diff --git a/webservice/net-collected-data.xsd b/webservice/net-collected-data.xsd deleted file mode 100644 index afefe00..0000000 --- a/webservice/net-collected-data.xsd +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> - <xsd:element name="net-collected-data" type="NetCollectedData" /> - - <xsd:complexType name="NetCollectedData"> - <xsd:all> - <xsd:element name="agent-version" type="Version" minOccurs="1" /> - <xsd:element name="id-point" type="xsd:integer" minOccurs="1" /> - <xsd:element name="interfaces" type="Interfaces" minOccurs="1" /> - <xsd:element name="bandwidth-usage" type="BandwidthUsage" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - - <xsd:simpleType name="Version"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[0-9]+.[0-9]+.[0-9]+" /> - </xsd:restriction> - </xsd:simpleType> - - <xsd:complexType name="Interfaces"> - <xsd:sequence> - <xsd:element name="interface" type="Interface" minOccurs="1" maxOccurs="unbounded" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="Interface"> - <xsd:attribute name="name" type="xsd:string" use="required" /> - <xsd:attribute name="mac-address" type="MacAddress" use="required" /> - </xsd:complexType> - - <xsd:simpleType name="MacAddress"> - <xsd:restriction base="xsd:string"> - <xsd:pattern value="[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}" /> - </xsd:restriction> - </xsd:simpleType> - - <xsd:complexType name="BandwidthUsage"> - <xsd:sequence> - <xsd:element name="netuse" type="NetUse" minOccurs="1" maxOccurs="unbounded" /> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="NetUse"> - <xsd:all> - <xsd:element name="id" type="xsd:integer" minOccurs="1"/> - <xsd:element name="rx" type="Rx" minOccurs="1" /> - <xsd:element name="tx" type="Tx" minOccurs="1" /> - <xsd:element name="date" type="xsd:string" minOccurs="1" /> - <xsd:element name="time" type="xsd:string" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - - <xsd:complexType name="Rx"> - <xsd:all> - <xsd:element name="rx-packets" type="xsd:integer" minOccurs="1" /> - <xsd:element name="rx-bytes" type="xsd:long" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - - <xsd:complexType name="Tx"> - <xsd:all> - <xsd:element name="tx-packets" type="xsd:integer" minOccurs="1" /> - <xsd:element name="tx-bytes" type="xsd:long" minOccurs="1" /> - </xsd:all> - </xsd:complexType> - -</xsd:schema> diff --git a/webservice/services.xml b/webservice/services.xml deleted file mode 100644 index 0704ca6..0000000 --- a/webservice/services.xml +++ /dev/null @@ -1,15 +0,0 @@ -<service> - <parameter name="ServiceClass" locked="false">br.ufpr.c3sl.datasid.DataSID</parameter> - <operation name="setInventory"> - <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> - </operation> - <operation name="getAgentVersion"> - <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> - </operation> - <operation name="getUpdateLink"> - <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> - </operation> - <operation name="setNetUsage"> - <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> - </operation> -</service> diff --git a/webservice/spawn.sh b/webservice/spawn.sh deleted file mode 100644 index fc95021..0000000 --- a/webservice/spawn.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -trap cleanUp EXIT - -function cleanUp() { - kill $pids -} - - cd /home/datasid/apache-tomcat/bin/ - sh catalina.sh run >> /home/datasid/apache-tomcat/logs/catalina.out 2>&1 & pids=$! - -wait $pids \ No newline at end of file diff --git a/webservice/webservice b/webservice/webservice deleted file mode 100644 index 5264461..0000000 --- a/webservice/webservice +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -### BEGIN INIT INFO -# Provides: datasid -# Required-Start: $local_fs $named $network -# Required-Stop: $local_fs $named $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: start datasid web portal -# Description: Script to start datasid at boot -### END INIT INFO - -set -e - -DATASID_USER="datasid" -NAME="datasid" -DATASID_PIDFILE="/var/run/$NAME.pid" -DATASID="/home/datasid/spawn.sh" -DATASID_OPTS="" - -do_start () { - printf "Starting WebService datasid\n" - - start-stop-daemon --start --quiet --chuid $DATASID_USER --background \ - --make-pidfile --pidfile $DATASID_PIDFILE --exec $DATASID -- $DATASID_OPTS -} - -do_stop () { - printf "WebService datasid dead\n" - start-stop-daemon --stop --oknodo --pidfile $DATASID_PIDFILE -} - -case "$1" in - start) - do_start - ;; - restart) - do_stop - do_start - ;; - stop) - do_stop - ;; - status) - printf "%-50s" "Checking $NAME..." - if [ -f $DATASID_PIDFILE ]; then - PID=`cat $DATASID_PIDFILE` - if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then - printf "%s\n" "Process dead but pidfile exists" - else - echo "Running" - fi - else - printf "%s\n" "Service not running" - fi - ;; -esac \ No newline at end of file diff --git a/webservice/webservice.properties b/webservice/webservice.properties deleted file mode 100644 index 67ab7ad..0000000 --- a/webservice/webservice.properties +++ /dev/null @@ -1,8 +0,0 @@ -xml_inventory_schema=../conf/collected-data.xsd -xml_net_usage_schema=../conf/net-collected-data.xsd - -linux_agent_version=1.0.2 -linux_agent_update_link=http://bisimmcdev.c3sl.ufpr.br/download/datasid-1.0.2-update.run - -windows_agent_version=1.0.0 -windows_agent_update_link=http://bisimmcdev.c3sl.ufpr.br/download/datasid-1.0.0-update.exe -- GitLab