Universidad de Chile - Tupper 2007, Santiago - Fono: 678 4888 - Fax: 698 8427 - Módulo 9: Desarrollo de Aplicaciones.

Slides:



Advertisements
Presentaciones similares
Verb Conjugations Easier than you think.
Advertisements

Talking about weather Discussing the weather is a very human thing to do, and every language has its own way of doing it. If you think about it, the weather.
WALT: talking about dates and saying when your birthday is WILF: To be able to write & understand months and dates in Spanish to get to a Level 2 To be.
Programación orientada a objetos
Los verbos regulares – ar What is an infinitive? An infinitive in both Spanish and English is the base form of the verb. In English, the infinitive.
Stem-changing verbs.
VOCABULARIO #2.4 ¡Aprenda! Forming Questions Señora Sequin.
Spanish –er and –ir verbs. Verbs in General English and Spanish both conjugate verbs. They can be organized as 1rst, 2 nd, and 3 rd person. If you need.
Verbs Like Gustar GUSTAR Y VERBOS SIMILARES. Hoy vamos a hablar sobre los intereses, las preferencias y las actividades en la vida de… Señor Mock.
Telling Time.
Objective: I can recognize and accurately use gender agreement. Do Now: Match the following Spanish and English words: 1. Pelirroja a. Good-looking 2.
IRREGULAR VERBS. Remember how regular verbs are formed? You drop the –ar, -er, or –ir and add the appropriate ending.
Notes #18 Numbers 31 and higher Standard 1.2
-AR Verbs In Spanish, there are three classes (or conjugations) of verbs: those that end in –AR, those that end in –ER, and those that end in –IR. This.
How to Conjugate Regular –AR Verbs in the Present Tense.
DIRECT OBJECT PRONOUNS. DIRECT OBJECTS The object that directly receives the action of the verb is called the direct object. Mary kicked the ball. "Ball"
How to Conjugate Regular –AR – Er - IR Verbs in the Present Tense.
La hora. The traditional way to tell time in Spanish is by dividing the clock in half. The right side uses “y” to add minutes to the hour. Once the minute.
Quasimodo: (son las doce)
What has to be done today? It can be done in any order. Make a new ALC form Do the ALC Get two popsicle sticks Get 16 feet of yarn. That is 4 arms width.
Page 114 En español 2 Reflexive Verbs Do you remember your Indirect Object Pronouns?
Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones.
Los verbos reflexivos Objective:
DIRECT OBJECT PRONOUNS. DIRECT OBJECTS The object that directly receives the action of the verb is called the direct object. Mary kicked the ball. "Ball"
Español 1 7 de octubre de La Campana Hoy es lunes el 7 de octubre de Escribe en español: 1. It is 2: I have brown eyes. 3. He likes.
Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones.
Servlets Servlets son módulos que extienden a servidores orientados a request/response, como por ejemplo Servidores Web “java-enabled”. Un servlet puede.
ALC #7 Do the math problems and write the answer in Spanish.
Español 1 18 – 19 DE MARZO Get your city map and have it on your table, you can study the vocab on your own creation!
First Grade – High Frequency Word Reading Competition Classroom Competition Created by: Malene Golding School Improvement Officer: Kimberly Fonteno.
Definition
Definite & indefinite articles
ALC 155 miércoles el 25 de mayo. Bienvenida Sientense SS – lado a lado Uno lee las preguntas en voz alta la otra persona contesta.
Digital Photography: Selfie Slides By: Essence L. Thomas.
¿Qué haces en la escuela? Question words, objects, yo-go’s.
Digital Photography: Selfie Slides Your Name Date Class Period.
Indirect Object Pronouns
Talking about weather Discussing the weather is a very human thing to do, and every language has its own way of doing it. If you think about it, the weather.
Vámonos Write how many of each object appears in each picture Example: dos lápices Hoy es el dieciocho de septiembre.
Digital Photography: Selfie Slides Your Name Date Class Period.
Introducción Nivel 4. Modelo OSI Propiedades Nivel 4 Entrega de mensajes garantizada. Entrega de mensajes en el mismo orden en el que fueron enviados.
1. Escribe la fecha y el objetivo. 2. Saca la tarea! 3. Translate the following sentences from Spanish to English. 1. Me gustan los deportes porque son.
Time Telling time is rather easy. You only need to know the numbers up to 59 to be able to tell the time.
Digital Photography: Selfie Slides Ana Hernandez 10/23/14 5th.
Digital Photography: Selfie Slides
Digital Photography: Selfie Slides Caidyn Tanton 10/23/14 Period: 1.
Empecemos: Tell your friend to do the following… 1.Set the table 2.Wash the clothes 3.Vacuum 4.Sweep the floor 5.Clean the mirror.
Spanish Sentence Structure How can we make better sentences?
Hagan ahora 1. Necesita una hoja de papel. 2. Escribe tu nombre en el papel. 3. Escribe la fecha en el papel 4. Escribe el titulo: “Items for Quiz and.
Expresiones Lección 1 Presentaciones con el verbo “llamarse”
JUEVES, EL 10 DE SEPTIEMBRE LT: I WILL RECOGNIZE SOME NEW VOCABULARY WORDS. Go over tests & retake procedures Interpretive Assessment: numbers & alphabet.
ALC 59 Hoy es martes el 28 de febrero de Escribe 10 formas de transportación Thank you for having your ALC out and ready to get started.
Learning Target: I will be able to determine the Difference between different ecosystems around the world.
ON YOUR DESK Documento Today’s notes Homework. ¡Hola! Conjugate the following verbs: 1. Yo / comer 2. Él / bailar 3. Nosotros / vivir 4. Ellos / abrir.
Indirect Object Pronouns Original PowerPoint was by Ms. Martin of Tri-Center Community Schools.
Double Object Pronouns What happens when we have both direct and indirect object pronouns in the same sentence? What goes where? Information for this lesson.
How would you spell the following word out loud in Spanish? Abuelito.
DO NOW: Write 3 different ways to greet someone (say hello):
Essential question: How do I say what I like and what interests/bores me?
LOS VERBOS REFLEXIVOS. WRITE: What is a reflexive verb? A reflexive verb describes when a person doing an action is also receiving the action.
Forming Questions ¡Aprenda! Forming Questions By Patricia Carl October 2013.
English Language II (2). English Language I (2) Warm-up.
¡BIENVENIDOS! ALPHABET, COGNATES.. DO NOW Take five minutes to Silently and Independently fill out the calendar on your desk. Every Calendar should have:
Verbs like Gustar Notes/ Examples.
The imperfect tense. Look at the following 3 sentences. We ate at two every day The hotel was very big I used to live with my grandparents What do they.
Esponja 1.Nosotros _____ despertamos temprano. 2.Tu _____levantas tarde. 3.Yo _____ me lavo los dientes todos los dias. 4.Por lo general, Chuy no _____.
UNIVERSIDAD AUTÓNOMA DEL ESTADO DE HIDALGO ESCUELA SUPERIOR DE ZIMAPÁN Licenciatura en Derecho Logros y experiencias. Lengua extranjera. L.E.L.I. Paulina.
First Grade Dual High Frequency Words
Quasimodo: Tienes que hacer parte D de la tarea..
Transcripción de la presentación:

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 1 Java Spaces

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 2 Definition according to sun  JavaSpacesTM technology is a simple unified mechanism for dynamic communication, coordination, and sharing of objects between JavaTM technology-based network resources like clients and servers. In a distributed application, JavaSpaces technology acts as a virtual space between providers and requesters of network resources or objects. This allows participants in a distributed solution to exchange tasks, requests and information in the form of Java technology-based objects. JavaSpaces technology provides developers with the ability to create and store objects with persistence, which allows for process integrity.

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 3 JavaSpaces is part of the Jini spec.  Jini is a collection of service specifications  They help services to find each other on the network  The most common notion people have from Jini is that enables jini powered machines to be attached to the network and automatically find out which services are available, as well as post its own services to the rest  Jini based machines are servers and client at the same time

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 4 Example ? ?

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 5 Services provided by Jini Lookup Services (reggie) rmid HTTP-Server (tools.jar) Transaction Services (mahalo.jar) JavaSpace (outriggger) Fiddler Mercury Norm

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 6 What does JavaSpaces provides  A space in which objects can be stored in, retrieved from, copied from.  A set of methods: write, read, take, (readIfExists, takeIfExists)  A mechanism to ensure completeness of transactions  An event notify mechanism

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 7 The write and read write Space read A copy

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 8 The take X write Space take Exists only here

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 9 How can I create a JavaSpace in a host  A JavaSpace can be created by starting the outrigger service of Jini with a certain name as parameter. This will be the name of the space.  Before starting the outrigger it is necessary to start:  The http server tools.jar  An rmid  The lookup server rigger  The transaction server mahalo

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 10 How can I write objects into a Space  User defined object classes must declare they implement the interface Entry.  This does not mean it has to implement any methods. It is just a tag to tell the system an object of this class can be written in a JavaSpace  Fields (variables) in this class should be objects. If primitives are needed (such as integers) use wrappers  Integer i = new Integer(4)

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 11 Example of an Entry class import net.jini.core.entry.Entry; public class Message implements Entry { public String content; public Integer counter; public Message() { //this is mandatory !!!!! } public Message(String content, int initVal) { this.content = content; counter = new Integer(initVal); } public String toString() { return content + counter + " times."; } public void increment() { counter = new Integer(counter.intValue() + 1); }

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 12 Storing objects in a space import net.jini.core.lease.Lease; import net.jini.space.JavaSpace; import java.io.*; public class WriteMessages { public static void main(String[] args) { try { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); JavaSpace space = SpaceAccessor.getSpace(); System.out.print("Message ? "); String m = in.readLine(); Message2 msg = new Message2(m,0); space.write(msg, null, Lease.FOREVER); } catch (Exception e) {e.printStackTrace(); } }

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 13 The write sentence space.write(msg, null, Lease.FOREVER);  The Parameters: an Entry object (the Message), a transaction object (null for now) and a long (leasing time in milliseconds, Lease.FOREVER is the value to make it permanent).

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 14 Retrieving objects in a space import java.io.*; import net.jini.core.lease.Lease; import net.jini.space.JavaSpace; public class ReadMessage { public static void main(String[] args) { try { Message2 template; JavaSpace space = SpaceAccessor.getSpace(); BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); System.out.print("Message (**=null)? "); String m = in.readLine(); template = new Message2(m); Message2 result = (Message2)space.read(template,null,Long.MAX_VALUE); System.out.println("Got "+result.toString()); } catch (Exception e) {e.printStackTrace(); }

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 15 Rules for retrieving objects  The object must match the template according to the class and the content  Null references in the template act as wildcards  There is no rule for deciding which of all the matching objects in the space matching the template will be retrieved  The parameters: a template object, a transaction (null) and a waiting time before the read sentence gives up if it does not find an object which matches the template. Long.MAX_VALUE is for waiting forever

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 16 Taking objects  It works just like read but the object is deleted from the space  In order to avoid deadlocks or waiting, it is possible to use readIfExists and takeIfExists  Their structure is the same as read and take, but they will return immediately if they do not find any matching object in the space  The SpaceAccessor class with the getSpace method is not standard, see SpaceAccessor.java

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 17 Synchronizing clients Ticket Dispenser number Customer 1- takes a number, 2- increments Ticket Disp. 3- takes the service object when it has this number 4- waits for being served 5-Increments service number A client will be served Only if it has the service number Service Number number See: TicketInit.java Customer.java

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 18 And of course…Chatting position A Tail object indicates which is the number of the last message Every message has a content And a number The channel identifies a „chat.-thred“ Tail MessageChat number Channel MessageChat number Channel MessageChat number Channel See: Tail.java, MessageChannel.java, CreateChannel.java, ChatSpace.java

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 19 Distributed Events 1- Create a Listener object 2- Notify space about interest With a template 3- an object matching the template enters the space 4- the listener is nofied

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 20 How to write a listener import java.rmi.server.*; import java.rmi.RemoteException; import net.jini.core.event.*; import net.jini.space.JavaSpace; public class Listener implements RemoteEventListener { private JavaSpace space; public Listener(JavaSpace space) throws RemoteException { this.space = space; UnicastRemoteObject.exportObject(this); } public void notify(RemoteEvent ev) { Message template = new Message(); try { Message result = (Message)space.read(template, null, Long.MAX_VALUE); System.out.println(result.content); } catch (Exception e) { e.printStackTrace(); }

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 21 A program that listens import net.jini.core.lease.Lease; import net.jini.space.JavaSpace; public class HelloWorldNotify { public static void main(String[] args) { JavaSpace space = SpaceAccessor.getSpace(); try { Listener listener = new Listener(space); Message template = new Message(); space.notify(template, null, listener, Lease.FOREVER, null); } catch (Exception e) { e.printStackTrace(); }

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 22 Calling the notify method  After this, if any program writes a message (no matter the content) the Listener object of the HelloWorldNotify program will be „notified“, this means, the notify method will be called Message msg = new Message(); msg.content = "Hello World"; space.write(msg, null, Lease.FOREVER);

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 23 Transactions  A transaction is a set of instructions which should be all executed atomically or none at all.  In JavaSpaces this refers to write, read, and take instructions that can be scheduled to be performed in this way.  For this, a transaction object should be created and passed as an argument in every instruction which belongs to the transaction  After all write, read, take, etc.instructions with (the same) transaction are “executed”, a commit statement will either perform all the operations or no one.  In the latter case, an exception is thrown

Universidad de Chile - Tupper 2007, Santiago - Fono: Fax: Módulo 9: Desarrollo de Aplicaciones en Redes de Computadores 24 An example JavaSpace space = SpaceAccessor.getSpace(); TransactionManager mgr = TransactionManagerAccessor.getManager(); //get a reference to the transaction manager service Try { Transaction.Created trc = TransactionFactory.create(mgr, 3000); Transaction txn = trc.transaction; SharedVar template = new SharedVar(url); SharedVar counter = (SharedVar) space.take(template, txn, Long.MAX_VALUE); counter.increment(); space.write(counter, txn, Lease.FOREVER); txn.commit(); } catch (Exception e) { System.err.println("Transaction failed"); return; }