Its a bird - PowerPoint PPT Presentation

1 / 54
About This Presentation
Title:

Its a bird

Description:

It's a bird. It's a plane *Now in Color. Brought to you by: It's a Super-Mug* Overview ... Djava.rmi.server.codebase=http://frustrum:8080/outrigger-dl.jar ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 55
Provided by: uysh
Category:
Tags: bird | outrigger

less

Transcript and Presenter's Notes

Title: Its a bird


1
Its a bird
Its a plane
Its a Super-Mug
Now in Color
2
Overview
  • Looking Back
  • Single-User mode
  • Current Status
  • Multi-Session Distributed Conceputual CAD
    Environment
  • Technology involved
  • JavaSpaces
  • What is involved (intro to distributed computing
    using JavaSpaces)
  • Example

3
Overview (cont)
  • Mug New features
  • Mug Internals

4
Looking Back
  • Single User mode
  • Local Modifications
  • Standard loading/saving

5
Multi-User Mode
  • Sharing CAD data with others in real time
  • Distributed modifications
  • Control sharing
  • Local saving is optional
  • Forced Save, in case of servers failure

6
Control Sharing
  • Synchronizing Virtual Environments
  • Sharing a Control Point
  • The one with best hand-eye coordination wins.
  • Others will have to wait
  • Multiple Control Points?
  • Keeping track
  • Classical Synchronizationproblems

7
Saving Data
  • Local Saving is optional
  • A software agent is present during an ongoing
    collaboration, and provides an occasional saving
  • Forced Save?
  • In the case of Agents expiration each client is
    forced to save the data, and will be questioned
    upon reentry
  • If agent expires no modifications will be allowed.

8
Multi-Session
  • One space multiple designs
  • Each session provides a separate agent
  • Agents keep track of
  • Back ups
  • Users
  • Control points
  • Agent Manager
  • Instantiates agents
  • Assigns them to sessions.

9
JavaSpaces
  • A Programming Paradigm

10
JavaSpaces
  • Anytime, Anyplace, Anyone!
  • Location, time, and ownership independent
  • Atomicity
  • Full synchronization
  • Self-recovery (healing)
  • Transactions

11
Objects
  • ntuple
  • ( 1 , alpha , 4.5 , fd )
  • ( 1 , beta , 2.3 , ar )
  • Request templates
  • ( ? , alpha , 4.5 , ? ) will match 1st n-tuple
  • ( 1 , ? , ? , ? ) will match either one

Axiom If you know what you want, you already
have it!
12
Java Objects
  • Must implement net.jini.core.entry.Entry
  • All member-variables must be public, non-basic
    type (e.i. extends java.lang.Object )
  • Must have a public no-arg constructor

public class MyMessage implements Entry
public String message int msg_num // wrong
!!!! public MyMessage() public
MyMessage(String m) messagem

13
Reading/Writing/Modifying
  • Reading
  • space.read(template,transaction,timeout)
  • Taking
  • space.take(template,transaction,timeout)
  • Writing
  • space.write(object,transaction,lease)
  • Modifying
  • objspace.take(template,transaction,timeout)
  • Change obj
  • space.write(obj,transaction,lease)

14
Java code
  • MyMessage tmplnew MyMessage()
  • tmpl(MyMessage)space.read(tmpl,null,Long.MAX_VALU
    E)
  • tmpl(MyMessage)space.take(tmpl,null,Long.MAX_VALU
    E)
  • space.write(tmpl,null,Lease.FOREVER)

15
Lease/Lease Maps
  • Lease
  • Temporary/permanent insurance of storage for
    objects
  • Lease Maps
  • Combination of leases for multiple objects
  • Simplifies lease changes, more efficient

16
Java code
// Using leases try space.write(tmpl,null,100
0) // tmpl will live 1 second
space.write(tmpl,null,Lease.FOREVER) // will not
die catch(Exception e)
// Using lease maps LeaseMap my_maplease.createLe
aseMap(60000) my_map.put(lease2,40000) . . . my_
map.renewAll()
17
Transactions
  • Provide implicit healing
  • all pass or all fail

Space
Transaction
18
Transactions cont.
  • readIfExists(template,txn,timeout)
    takeIfExists(template,txn,timeout)
  • will return immediately if no entries are found
    except when are called under transaction

19
Java code
  • TransactionManager mgr TransactionManagerAccesso
    r.getManager()
  • Transaction.Created trc null
  • trc TransactionFactory.create(mgr, 3000)
  • Transaction txn trc.transaction
  • SharedVar template new ShredVar(url)
  • try
  • resource (SharedVar)
  • space.take(template, txn, Long.MAX_VALUE)
  • resource.increment()
  • space.write(resource, txn, Lease.FOREVER)
  • catch (Exception e)
  • txn.abort()
  • return
  • txn.commit()

will last 3 seconds
Abort if unsuccessful
Transaction was successful
Note if more than 3 seconds laps from create
to commit transaction will abort, and resource
object will be restored to the space
20
JavaSpaces takes on Events
  • Event Model
  • RemoteEventListener
  • RemoteEvent

Client retrieves object
Listener
Register Listener with space
notify listener by calling notify method provided
by RemoteEventListener interface
Space
Client 1
Client 2
21
Java code ( HelloWorld )
Listener listener new Listener(space) Message
template new Message() space.notify(template,
null, listener, Lease.FOREVER, null) Message
msg new Message() msg.content "Hello
World" space.write(msg, null, Lease.FOREVER)
22
Listener code
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(templ
ate, null, Long.MAX_VALUE)
System.out.println(result.content)
catch (Exception e) e.printStackTrace()
23
JavaSpaces
  • Programming Patterns

24
Synchronizing Messages
  • Message meter is present, and is incremented by a
    client sending a message

Message i
Server
Clients
25
Java code
Resource resource new Resource() resource
(Resource)space.take(resource,null,Long.MAX_VALUE)
int jresource.getVal().intValue() resourcen
ew Resource(new Integer(j1)) space.write(resour
ce,null,Lease.FOREVER) space.write(new
Message(j,message),null,Lease.FOREVER)
Incrementing Message counter
Writing a new Message
26
Resource Meter
  • Resource Bag
  • Number of items in the bag specify the number
    of available resources
  • Semaphore
  • Semaphore object contains value that is
    decremented when resources are diminished, and
    incremented when resources become available

R1
R1
R1
R1
Semaphore Beta, 15
27
Resource bag code
Resource resource while(true) resourcenew
Resource() resource(Resource)
space.take(rtmpl,null,Long.MAX_VALUE) // take
resource if (resourcenull) countinue
//
wait if not there doSomething()
space.write(resource,null,Lease.FOREVER)
// return resource
28
Semaphore code
resource.P()
Resource resource Resource(null,new
Boolean(true)) resource (Resource)space.take(
resource , null , Long.MAX_VALUE ) int z
resource.getVal().intValue() 1 resourcenew
Resource(new Integer(z-1),new Boolean((z!0))) sp
ace.write( resource , null , Lease.FOREVER
) doSomething() Resource resource
Resource(null, null) resource
(Resource)space.take( resource , null ,
Long.MAX_VALUE ) int z resource.getVal().intVa
lue() 1 resourcenew Resource( new Integer(z),
new Boolean(true) ) space.write( resource , null
, Lease.FOREVER )
resource.V()
29
State-sharing of an ongoing modification
  • Using UDP model to view modifications

Modification 4
Modification 3
Modification 15
Modification 34
C1
C2
C2 take 3, take 34, drop 15, drop 4.
30
Java code
Sender
int j0 while( changing ) space.write(new
State(j, change),null,1000) j try
Thread.sleep(100) catch(Exception e)

Receiver
int j0 public void notify(RemoteEvent e)
State tmplnew State() tmpl(State)space.read(t
mpl,null,10) if (tmplnull) continue if
(tmpl.num.intValue()gtj)
jtmpl.num.intValue()1 showMod(tmpl)

31
Ex Ping-Pong
JavaSpace
Judge
Players
32
Ping-Pong Scenario
Before Message numbering
After Message numbering
Game 1
Point
Timeline
I won
You win
left
leaving
Game 2
Got point
33
Starting Services
34
Starting Server/Client
35
MUG
  • Features

36
MUG - interaface
  • Object properties
  • generic
  • Type specific

37
Load/Save
  • (.mug) Extension
  • Preview window
  • Data is compressed

38
ColorChooser
  • Modification
  • Materials
  • Polygons
  • Rendering
  • Textures
  • etc
  • Loading/Saving (.mapp)

39
Keyboard
  • Create new or modify old shortcuts
  • Shortcuts may consist of multiple keystrokes
  • Define modes

40
Process History
  • Multiple undo and redooperations
  • Ability to traverse toany node in processtree.

41
MUG
  • Internals

42
Mouse Event Architecture
Behavior Manager
MUG Mouse Event
J3D
Mouse Event
MUGMouseEventTrigger
MUGMouseListener
Component
Swing
Mouse Event
43
Shortcut model
  • All Leafs have actionsassociated with them,they
    have no siblings
  • Non-leafs haveat least onesibling, and
    noaction associatedwith them

M-a
f
C-x
h
z
d
C-s
r
p
d
44
Process History
Root
  • Represented by a tree with a variable branching
    factor.
  • Each node contains, redo/undo information, as
    well as an informal description, and a reference
    to the last visited sibling
  • In addition to the tree, a timeline is kept which
    can be used to replay a complete design process

45
MUGs Objects hierarchy
46
MUGs Transform hierarchy
47
Messages
48
Plug-ins
  • Search for all .jar files.
  • Run second app with all .jar in class-path
  • Search for all .jar in second app, pass it to the
    main program
  • Enforce attributes in Manifest
  • Enforce appropriate behavior onto plug-in classes

49
ClassPath (in MugStart)
  • File fnew File("plugins")
  • File gf.listFiles(new FileFilter()
  • public boolean accept(File n)
  • if (n.getName().endsWith(".jar"))
  • return true
  • return false
  • )
  • String unew String(".mug.jarCLASSPATH")
  • for(int i0iltg.lengthi)
  • unew String(gi.toString()""u)
  • unew String("java -Xmx192M -cp "u"
    MugInit")
  • rtRuntime.getRuntime()
  • try
  • prt.exec(u)
  • StreamPlugThread.plugTogether(p.getInputStream
    (),System.out)

50
.jar Revisited (in MugInit)
  • File fnew File("plugins")
  • File gf.listFiles(new FileFilter()
  • public boolean accept(File n)
  • if (n.getName().endsWith(".jar"))
  • return true
  • return false
  • )
  • String onew Stringg.length
  • for(int i0iltg.lengthi)
  • oigi.toString()
  • MUG.main(this,o)

51
Manifesto (in MUG)
.Jar
B
  • String man_arraynew Stringjar_array.length
  • JarFile jf
  • Manifest m
  • Attributes map
  • Object k,v
  • for(int i0iltjar_array.lengthi)
  • man_arrayimuginit.getClass().getResource(jar_a
    rrayi).getFile()
  • jar_arrayijar_arrayi.substring(jar_arrayi
    .indexOf('\\')1)
  • try
  • jfnew JarFile(man_arrayi)
  • mjf.getManifest()
  • MUGPluginLoader.load(jar_arrayi,m.getMainAttri
    butes())
  • catch(IOException iox)

A
52
Is it a plug-in?
Vector classesnew Vector() String
c(String)atr.getValue("Plugin-Class") StringToke
nizer stnew StringTokenizer(c) while(st.hasMoreT
okens()) classes.add(st.nextToken()) Class
cl for(int i0iltclasses.size()i) try
clClass.forName((String)classes.elementAt(i
)) if (ImportPlugin.class.isAssignableFrom(cl
)) addToImport(cl) else
System.out.println("Class is not of appropriate
form") catch(ClassNotFoundException cnfe)

Manifest-Version 1.0 Plugin-Class
vrmlimport.VrmlParser Created-By 1.3.0 (Sun
Microsystems Inc.)
53
Session Architecture
  • Current Scene isupdated every n cycles
  • Mug undo objects arenumbered and are usedin
    timeline and undo tree
  • Control semaphore

54
On-Line Info
  • MUG (APIs, this.talk, other info)
  • http//edge.mcs.drexel.edu/MUG
  • JavaSpaces
  • http//java.sun.com/products/javaspaces
  • Java3D
  • http//java.sun.com/products/java-media/3D
  • Java / Jini / JavaSpaces / APIs
  • http//edge.mcs.drexel.edu/docs
Write a Comment
User Comments (0)
About PowerShow.com