1 / 23

TRAP/J: Transparent Grid Enablement using By Luis Atencio & Tatiana Soldo

Explore TRAP/J, a system enabling adaptable Java programs for mobile environments, supporting legacy code without modifications. Learn about aspect-oriented programming, transparent grid enablement, and behavioral reflection for adaptive applications.

adamsam
Download Presentation

TRAP/J: Transparent Grid Enablement using By Luis Atencio & Tatiana Soldo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TRAP/J Transparent Grid Enablement using By Luis Atencio & Tatiana Soldo

  2. Sources • Sadjadi, Masoud S., McKinley, Phillip K., Cheng, Betty H.C., Stirewalt, Kurt.: TRAP/J: Transparent Generations of Adaptable Java Programs. • Sadjadi, Masoud S.: TRAP: Transparent Reflective Aspect Programming. (presentation) • Yang, Z., Cheng, Betty H.C., Stirewalt, R.E.K., Sowell, J., Sadjadi, MasoudS., McKinley, P.K.: An Aspect-Oriented Approach to Dynamic Adaptation.

  3. Main Topics • Motivation • Background Information • Current Progress • Plans for the future

  4. Motivation • Adaptability • Many distributed applications being ported to mobile computing environments were not designed to adapt to changing conditions. • Provide adaptability to component failures for longing and critical applications. • Separation of concerns • Functional Decomposition: separate the business logic from program logic. • Support for legacy code • There is no attempt to modify existing code

  5. Main Topics • Motivation • Background Information • Current Progress • Plans for the future

  6. BackgroundInformation • Behavioral Reflection and RMI • Aspect-Oriented Programming • Transparent Grid enablement T R A P / J

  7. Behavioral Reflection • Reflection: • A technique that allows a program to perform a self examination of itself and its software environment . • Behavioral reflection: the ability of an application to alter its behavior

  8. Aspect-Oriented Programming • Common Uses: • Debugging • Tracing • Aspect = Advice + Pointcut • Types of Advice: • Before • After • Around

  9. Java RMI • Java API for RPC • RPC: remote method invocation: This allows a programmer to call procedures on another computer to be executed seamlessly as though the procedure resided locally on the computer. • Methods are accessed via an “rmi registry” which stores remote method object references.

  10. Main Topics • Motivation • Background Information • Current Progress • Plans for the future

  11. Working Example: ASA RECEIVER SENDER RECEIVER WIRELESS NETWORK RECEIVER AUDIO STREAM PATH

  12. Absorbing_ MulticastSocket .aj Microphone .java Microphone .class Java.net. MulticastSocket MetaLevel_ MulticastSocket .java BaseLevel_ MulticastSocket .java Architecture: Compile-time Model TRAP/J Generating Reflective Classes Generating Aspect Class Name List Application Source in Java Files AspectJ Compiler (ajc) Adapt-Ready Application

  13. Architecture: Runtime Model del 1 Del 1 Delegate Level del 3 Del 3 Del 2 del 2 ms MetaLevel_MulticastSocket Meta Level ms BaseLevel_MulticastSocket Base Level ms MulticastSocket Mic mic Application Level Heap Class Library

  14. Diagram Application Layer public class Microphone { //private fields private MulticastSocket ms; private AudioRecorder audioRecorder; private DatagramPacket packetToSend; public void Run() { . . . multicastSocket = new MulticastSocket(); audioRecorder = new AudioRecorder(); . . . while(audioRecorder.read(packetRead, 0, packetRead.length) ! = -1) { packetToSend = new DatagramPacket(packetRead, packetReadf.length, target_adress, target_port); multicastSocket.send(packetToSend); } // end while . . . Heap Class Library Microphone class Mic object Java.net.MulticastSocket class ms Code: ASA developed by Dr. Sadjadi

  15. Diagram Base-Level Layer CONSTRUCTOR // Generated Base Level Class CONSTRUCTOR public class BaseLevel_MulticastSocket extends MulticastSocket implements BaseLevel_Interface { private MetaLevel_Interface metaObject; public BaseLevel_MulticastSocket()throws java.io.IOException { super(); initMetaObject(); // creates instance of MetaLevel_MulticastSocket // passes this base level object as a parameter, // initializes metaObject. } Code: ASA developed by Dr. Sadjadi

  16. Base-Level Layer SEND METHOD public void send(java.net.DatagramPacket p0)throws java.io.IOException { if(metaObject == null) { super.send(p0); return; } . . . Class[] paramType = new Class[1]; paramType[0] = java.net.DatagramPacket.class; Method method = null; method = BaseLevel_MulticastSocket.class.getMethod("send", paramType); Object[] tempArgs = new Object[1]; tempArgs[0] = p0; ChangeableBoolean isReplyReady = new ChangeableBoolean(false); try { metaObject.invokeMetaMethod(method, tempArgs, isReplyReady); } catch (MetaMethodIsNotAvailable e) . . . Code: ASA developed by Dr. Sadjadi

  17. Diagram Meta-Level Layer public class MetaLevel_MulticastSocket extends UnicastRemoteObject implements MetaLevel_Interface,DelegateManagement { private BaseLevel_Interface baseObject; private Vector<Delegate_Interface> delegates = new Vector<Delegate_Interface>(); public MetaLevel_MulticastSocket(BaseLevel_MulticastSocket baseObject) throws RemoteException { super(); // reference to baseObject is initialized this.baseObject = baseObject; String name = GlobalConfig.instance().getAppName() + "_MetaLevel_MulticastSocket_" + counter++; // Bind this object instance to the name and store in RMI registry Naming.rebind(name, this); Vector<Integer> delegateLocations = new Vector<Integer>(0); Vector<String> delegateNames = new Vector<String>(0); // checks whether any delegates were implemented by //composer for this particular metaObject name if(Config.instance().check4DefaultDelagetes(name, delegateLocations, delegateNames)) { // if delegates were found they are stored in delegates vector for (int i = 0; i < delegateNames.size(); i++) { int loc = ((delegateLocations.get(i))).intValue(); String delegateName = delegateNames.get(i); insertDelegate(loc, delegateName); Code: ASA developed by Dr. Sadjadi

  18. Meta-Level Layer public synchronized Object invokeMetaMethod(Method method,Object[] args, ChangeableBoolean isReplyReady) throws Throwable { . . . if (delegates.size() == 0) throw new MetaMethodIsNotAvailable(method.toString()); Method newMethod = null; . . . int i = 0; boolean delegateFound = true; do { delegateFound = true; try { newMethod = delegates.get(i).getClass().getDeclaredMethod(method.getName(), newParamType); } catch (NoSuchMethodException e) { delegateFound = false; } i++; // if a delegate is found, delegatefound will not be set to false and we jump out of the loop } while((i < delegates.size()) && !delegateFound); if(!delegateFound) // No meta-level method available for specifications given throw new MetaMethodIsNotAvailable(method.toString()); else // if delegatefound = true return newMethod.invoke(delegates.get(i-1), tempArgs); // invokes newMethod method on delegates.get(i-1) object with tempArgs as parameters Code: ASA developed by Dr. Sadjadi

  19. Diagram Generated Aspects // Generated Aspect public aspect Absorbing_MulticastSocket_aj { // Pointcuts and advices around the public constructors pointcut MulticastSocket() :call(java.net.MulticastSocket.new()) && !within(edu.msu.cse.sens.reflect.generated..*); java.net.MulticastSocket around() throws java.io.IOException : MulticastSocket() { System.out.println("Aspects are present!"); System.out.flush(); return new BaseLevel_MulticastSocket(); } // Pointcuts and advices around static public and final public methods . . . } Code: ASA developed by Dr. Sadjadi

  20. Main Topics • Motivation • Background Information • Current Progress • Plans for the future

  21. Plans for the future • Currently: pervasive or ubiquitous • Grid Programming: Investigates techniques and tools to simplify the process of grid enablement • Autonomic Computing

  22. Proposal To grid-enable existing applications transparently using TRAP/J. Goal: Design a simple test application and make it adaptable to a Grid environment. Expected Output: methodologies and tools that enable easy implementation of Grid Applications

  23. The End

More Related