Proxy design pattern help

Hi,
Could please clarify my below doubts on proxy design pattern?
There are several cases where a Proxy can be useful:
*1. If the object is on a remote machine and loading it over the network may*
be slow, especially during peak network load periods.
so In this case how do we get the object which is in remote? By copying the jar files from the server to client
is that right?So we will get the object which is in the remote.
*2. If the object has limited access rights, the proxy can validate the access*
permissions for that user.
This how do we do?
Thanks
Bhanu

Hi Paratheosis ,
I almost got the point. But what I have heard about proxy pattern is, we use proxy to reduce the traffic between
client and server. In this case whenever we need any method on the server side we call isnt?..how trafic is being reduced here? Or is it storing somewhere client when we first time access the Object in Server side? for example
In Servicemanager getEmployeedetails.. So in client do we store the ServiceManager object so that next time we can access the that ServiceManager object in the client side.. Is it in this way? I dont think because any updation on the ServiceManager will not be able to get in the client side? I totally confused the implements for proxy.. :(
Thanks
Bhanu.

Similar Messages

  • Proxy design pattern

    Hey,
    I have jar that run in different enviroments (client,server,partners).
    In my jar i have some method that in case they called the action that executed is depend on the implementor.
    For example let say that i have method "updateXXX(long id,String name){
    Notify.notify(...)
    if this called in the client than it need to lookup to this service and send the class name, method name and the method parameters to the service.
    if it run in the server than it need to run XXX with the same parameters (this infrastrcture need to server some method with different parameters).
    Is the proxy design patterns is the solution for this?
    I thought to demand from each imlementor that want to use those kind of methods to implement a plugin with a given class name and in notify to load this class with class.forName, what are you say about this soultion?
    any other ideas will be more than welcome.

    The proxy pattern could help here, but isn't the simplest solution. You just want to define an interface that has those updateXXX methods declared on it, and have several classes implement those methods, such as one which executes some code in the same process, or one that does so over RMI, that sort of thing. Write your calling code against that interface, and configure at runtime which class they'll be calling
    interface Updater {
        void updateXXX(Object params);
    class LocalUpdater implements Updater {
         public void updateXXX(Object params) {
           // code to do work here
    class RemoteUpdater implements Updater {
    public void updateXXX(Object params) {
           // code to do remote work here
    class Client {
       Updater myUpdater;
       Client(Updater updater) { // constructor takes an instance of something which implements Updater
           myUpdater = updater;
        void doSomething() {
           myUpdater.updateXXX("params"); // see how this class is decoupled from your Updater implementations
    }How you inject your concrete dependencies is up to you.

  • Design Pattern help needed for MDI application

    Hi,
    I am writing an mdi application which contains a JSplitPane. The left pane contains a JTree and the right contains a JDesktopPane which houses n number of JInternalFrames. The JInternal Frames need access to the JTree. Also both panes (objects w/in) need access to elements of the JFrame. I am currently implemeting access by making most of the JFrame objects static and creating getter/setter methods for access. Does anyone know any desing patterns I might use to solve this dilemma?
    Thanks,
    John

    The observer design pattern causes the child objects to chage state when the parent changes state. The type of pattern I need would allow the child objects of the parent JFrame to be available globally without having to make them static. I am wrong in this? Would the observer pattern solve this issue.

  • Design pattern help need urgently please

    Hi I need you to tell me if the following code looks like its a facade or not?
    The method make the table calls another method in the class project4
    which contains instances of itself and student class and supervisor class and the method prints out data from these classes.
    Iv to hand this in tomorow and would like to know
    Is that a facade or not?
    Please help
    public class TableFacade
         TableFacade()
         System.out.println("This is the table of projects");
         public Project4 makeTheTable()
              Supervisor5 sup = new Supervisor5();
              Project4 project =new Project4();
              project.readRelevantProjectsFromFile(sup);
         return project;
    }

    Sorry to be continuously replying but desperate times call for desperate measures anyway
    Im trying to adapt from my project4 class
    is this in the adaptor pattern?
    class AdaptProject
         Project4 project;
         Supervisor5 supervisor;
         void readProjectDetails()
              project.readProjectDetails();
         void readRelevantProjectsFromFile(Supervisor5 v)
              project.readRelevantProjectsFromFile(supervisor);
         String projName()
              return project.projName;
         String projSubject()
              return project.projSubject;
    }

  • Is there a design pattern for splitting up files into smaller files?

    I am developing a project where I have to load very large files (upto 50 MB). Currently I am loading these files completely into (consecutive) memory. This has the advantage that I can very easily change bytes at certain locations, because I do not know the
    structure of all bytes.
    However, my intention is to also change the structure, e.g. removing/adding 'chunks'. Now I have the idea to remove the 'known' parts out of it, store them in classes with a data chunk only containing those parts and make a sort of reference list to those chunks.
    E.g.:
    Original file:
    Header
    ChunkA 1
    ChunkA 2
    Intermediate
    ChunkB 1
    Footer
    The result will be:
    ChunkA 1 and ChunkA 2 instance. ChunkB 1 instance
    'File' instance and a reference with base offsets + reference to all chunks.
    At the end I have to 'recreate' or write the original file (with changes) back.
    Is this in general a good idea or is there some design pattern helping me in this?

    50MB is not much in the modern era of 6GB+ machines. If you want to optimize memory then consider using a
    memory mapped file.
    But you mentioned making data structure changes. This is generally dangerous as you have to be concerned about things like disaster recovery. What happens if you are in the middle of saving the modified structure when the program dies? You just corrupted
    your file. A better solution is to stream the existing file using BinaryReader to read in the existing file in parts based upon the structure.  Write out the data to a new, temporary file using BinaryWriter. This may be the original data or your modifications
    depending upon need.  Once you've generated the new file replace the old file (with optional backup). So even if something catastrophic happens during saving you don't lose the original file.
    Michael Taylor
    http://blogs.msmvps.com/p3net

  • RE: design patterns involving EJBs and JDO

    Is the idea that you specify in some config file (xml?) the methods of
    your session bean, whether its stateful or stateless, the default bean
    transaction semantics, etc, then say "go" and it generates the home and
    remote interfaces and the skeletal session bean class?
    -----Original Message-----
    From: Eric Lindauer [mailto:[email protected]]
    Sent: Monday, June 25, 2001 8:26 AM
    To: JDO-ListServ
    Subject: Re: design patterns involving EJBs and JDO
    I don't think it's publicly available yet, I used to work there and was
    helping out a little with testing. I'll tell you in advance, it really
    works well. Much like the JDO implementation, the process of turning
    things into SesisonBeans is very transparent to the developer. I guess
    TT is going to make it available in another week or two, as time
    permits.
    ----- Original Message -----
    From: Matthew <mailto:[email protected]> Adams
    To: '[email protected]' <mailto:'[email protected]'>
    Sent: Monday, June 25, 2001 11:18 AM
    Subject: RE: design patterns involving EJBs and JDO
    IMHO, JDO replaces entity beans, but you'll have to decide for yourself.
    My recommendation would be to use session beans exclusively.
    Where do you get TechTrader's "SessionBean Creator"? What are its
    features? How do you use it?
    -----Original Message-----
    From: Eric Lindauer [mailto:[email protected]]
    Sent: Monday, June 25, 2001 8:12 AM
    To: JDO-ListServ
    Subject: design patterns involving EJBs and JDO
    Hi,
    I was just wondering, if you are using JDO for persistence, does it
    matter whether you wrap your objects with proxy EntityBeans or
    SessionBeans? I am currently demoing TechTrader's SessionBean creator,
    which makes means that for me creating SessionBeans is much easier than
    creating EntityBeans. I am currently using stateful SessionBeans to
    wrap the JDO objects, simply dropping them when the bean is passivated
    and refinding them ( they'll already be in the cache ) when the bean is
    activated.
    My main advantage in doing it this way is SessionBeans are so much
    easier to create. Do you see any problems looming, or any other
    advantages to this decision?
    Thanks in advance.
    Eric

    I don't think it's publicly available yet, I used to work there and was
    helping out a little with testing. I'll tell you in advance, it really
    works well. Much like the JDO implementation, the process of turning
    things into SesisonBeans is very transparent to the developer. I guess
    TT is going to make it available in another week or two, as time
    permits.
    ----- Original Message -----_
    From: Matthew <mailto:[email protected]> Adams_
    To: '[email protected]' <mailto:'[email protected]'>
    Sent: Monday, June 25, 2001 11:18 AM
    Subject: RE: design patterns involving EJBs and JDO
    IMHO, JDO replaces entity beans, but you'll have to decide for yourself.
    My recommendation would be to use session beans exclusively.
    Where do you get TechTrader's "SessionBean Creator"? What are its
    features? How do you use it?
    -----Original Message-----
    From: Eric Lindauer [mailto:[email protected]]
    Sent: Monday, June 25, 2001 8:12 AM
    To: JDO-ListServ
    Subject: design patterns involving EJBs and JDO
    Hi,
    I was just wondering, if you are using JDO for persistence, does it
    matter whether you wrap your objects with proxy EntityBeans or
    SessionBeans? I am currently demoing TechTrader's SessionBean creator,
    which makes means that for me creating SessionBeans is much easier than
    creating EntityBeans. I am currently using stateful SessionBeans to
    wrap the JDO objects, simply dropping them when the bean is passivated
    and refinding them ( they'll already be in the cache ) when the bean is
    activated._
    My main advantage in doing it this way is SessionBeans are so much
    easier to create. Do you see any problems looming, or any other
    advantages to this decision?
    Thanks in advance.
    Eric_

  • Common Design Patterns For Webservices

    Hi All,
    I am creating a webservice which generate the result by iterating multiple webservices serially(Workflow) or parallel(Aggregator).
    What are the common Design patterns I can apply here ? Currently my application flow is
    WebserviceEndpoint-> WebserviceDelegate(POJO) -> Helper Classes ->Aggregator/Workflow Impl which uses WSClients(JAX-WS Stub)
    Do we need to maintain separate DTO for passing Request to the Inner layers ?
    Please share your comments.
    Thanks,
    Paul

    Thanks for your valuable time
    I have 3 Webservices A(Provider),B,C. Service 'A' is a consumer of service 'B' and 'C'.
    A - is exposed to Consumers, A act as a proxy layer for service B and abstract 'C' from users ,Service 'A' only do the service orchestration .Service 'A' using data from Service 'B' and 'C'
    B – is of same specification as that of Service A (Service B contains All operation defined on A +Internal operation for service A).Internal Webservice which act as active datasource.Request and response structure is same as that of Service 'A'.
    C – is different external service ,requests for Invoking Service 'C' need to be generated from Consumer Request and operations exposed in Service 'B'. External Webservice act as active Data source. Enrich the service 'B' output using service 'C' ,This is done by Service 'A'
    I have done this using following components.
    WebserviceEndpoint-> WebserviceFacade(POJO) -> Helper Classes ->Aggregator/Workflow Impl which uses WSClients(JAX-WS Stub)
    It will be great If some of you can suggest a good logical separation for Service 'A' ? Is above logical separation is correct?
    Thanks,
    Paul

  • Design Pattern for Discussion Forum

    Hi all,
    We have to develop a application similar to our discussion forum. Which Design Pattern is more useful? Can u discuss the archietecture? We use J2EE except EJB.
    Thanks,
    Murali

    We expect people to at least make an attempt at the question and present a few ideas particularly college assignments / home-work questions. We dont expect everybody/thing to correct, you will receive little criticism for being wrong, if you show a willingness to put in some effort. You will be criticised for and likely receive no help if you simple expect members to do your work.
    Some patterns to be think about.
    The achitectural pattern of this forum is thin client, 3-tier, presentation, functionality and storage.
    Consider the following patterns.
    - Model View Controller
    - Facade and/or Proxy
    - Command
    - Composite
    - Memento

  • SERVICE LOCATOR ?? Is it really an interesting Design pattern??

    Hi everybody,
    i've a problem with the J2EE Design Pattern "Services locator" (it's a singleton).
    It is said that by making use of a Service Locator we can :
    - hide to the client the complexities of initial context creation, EJB home object lookup,and EJB objectre-creation.
    - multiple clients can reuse the Service Locator object to reduce code complexity, provide a single point of control, and improve performance by providing a caching facility.
    But i would like to understand at which side should that service locator object reside??!!??
    If it is at server side then the clients need well an initial context in order to make a lookup on that object.
    Conclusion :
    the service locator doesn't hide the complexities of initial context!!
    Furthermore the client has to perform a look-up on that service locator object!! The only advantage left is caching facility.
    If it is at client side, each client needs his own services locator object
    Conclusion :
    multiple client don't reuse the same service locator. What's the advantage to be a singleton ???
    There is certainly something that i don't understand so help me please!! Thanks.

    Hi Yves,
    But i would like to understand at which side should
    that service locator object reside??!!??
    If it is at client side, each client needs his own
    services locator object
    Conclusion :
    multiple client don't reuse the same service locator.
    What's the advantage to be a singleton ???The service locator resides on the client side and is implemented as
    a singleton. Since it is possible that there could be multiple
    class loaders/JVMs on the client side, and therefore, multiple
    instances of the "singleton" service locator. This is typical
    in a distributed environment (e.g. servlets/JSPs in a web-tier
    cluster using service locator). Thus service locator is not
    a truly "distributed singleton" object. But, the empahsis
    is to design the service locator such that it does not hold
    any state that needs to be replicated across multiple
    instances across different JVMs as mentioned. Thus, there
    is no need for multiple clients to use the "same" service locator,
    but still the benefits of implementing this pattern is realized.
    By making it a singleton, and keeping it from holding state
    that needs to be replicated, we realize the benefits of this pattern.
    You may also want to visit the J2EE Pattern interest list
    and see these relevant discussions :
    Topic: Service Locator and passivation
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=1026
    Topic: Caching EJBHome interfaces
    http://archives.java.sun.com/cgi-bin/wa?A2=ind0106&L=j2eepatterns-interest&F=&S=&P=9226
    Topic: Using Service Locator for Data Source caching
    http://archives.java.sun.com/cgi-bin/wa?A1=ind0106&L=j2eepatterns-interest#31
    hope this helps,
    thanks,
    -deepak

  • What is the best design pattern for this problem?

    No code to go with the question. I am trying to settle on the best design pattern for the problem before I code. I want to use an Object Oriented approach.
    I have included a basic UML diagram of what I was thinking so far. 
    Stated simply, I have three devices; Module, Wired Modem, and Wireless Modem.
    In the Device Under Test parent class, I have put the attributes that are variable from device to device, but common to all of them.
    In the child classes, I have put the attributes that are not variable to each copy of that device. The attributes are common across device types. I was planning to use controls in the class definition that have the data set to a default value, since it doesn't change for each serial number of that device. For example, a Module will always have a Device Type ID of 1. These values are used to query the database.
    An example query would be [DHR].[GetDeviceActiveVersions] '39288', 1, '4/26/2012 12:18:52 PM'
    The '1' is the device type ID, the 39288 is the serial number, and the return would be "A000" or "S002", for example.
    So, I would be pulling the Serial Number and Device Type ID from the Device Under Test parent and child, and passing them to the Database using a SQL string stored in the control of the Active Versions child class of Database.
    The overall idea is that the same data is used to send multiple queries to the database and receiving back various data that I then evaluate for pass of fail, and for date order.
    What I can't settle on is the approach. Should it be a Strategy pattern, A Chain of Command pattern, a Decorator pattern or something else. 
    Ideas?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Does any body have any design patterns of JSF Web Application Developping?

    Can any one answer me some questions?
    #1.I am an amatuar of people who develop Web Application.For some reason,We choose the JSF to develop our item.through some introduction,I know the UI component of JSF is resided in Server side,is it right?but I am a little confused that:if there are many users who are exploring our jsf website.(to simplify my question,image I had just one web page and just one button)How many UI components(buttons) will be there?How it(they?) works?
    #2.Does any body have the success experience (for example design pattern)to develop web applications?if We just concern about the Add,Delete,Modify,Query operations of some data.
    I just do my job according to my feeling.
    I will give every page a pagebean(backing bean),and I am not sure how to combine the business data with the pagebean.some one suggested that I should use delegate pattern to separate my business log and page logic.But I am still confused by following things:
    #2.1 does JSF have the same ability to help us construct the model dialog just like swing to
    help us control the operation flow?
    #2.2 If there is not,Does the following way work?I put every tabledata's property as corresponed component.if user choosed the row in the table,My Listener will syncronize the row data to the components.But
    #2.2.1 if JSF has the components according to the web users' number,how can My Listener tell which component should be update?Should I maintain the map?
    #2.2.2 If the problem I imaged above is false,Does any body can tell me how to custom      the ListDataModel,so I can use it like Swing?because now I can just use some view data to insert into ListDataModel,but after some selection operation,my business object must be find according to the selected data,it is not an interesting job!
         I am waiting for your advice!

    Ok I'll try to explain Step by step please correct me if I make any mistake because I have not played much with shared variables.
    To create a shared variable to an RT target go to the target if tou have already otherwise add an RT target by right clicking the Project>>Add targets and Devices
    Then in the target Right clikc and select the variable as shown below.
    Then once the Shared variable settings window opens Enter a variable name and then Select the type "Network Published"
    In the right side you can select the data type for the shared variable and even you can choose your custome controls.
    After selecting the data type go for the Network and select buffering if required else leave it if you are planning to use the variable just for display purpose.
    Then you can enable the RT FIFO if required (Not able to explain how it works and why it is used).
    Then after completing the Shared variable setup you can access the variable in the VI in both the Host and the RT.
    You can bind the variable to a control so that if any data from the RT is coming you can read the data from that control.
    Once you have placed your shared variable in the BD you can change the access typr to read or write depending on your need.
    This might not explain the complete shared variable concept but I believe that this would defenelty give you a kick off to start using the shared variable. Please correct or add more comments if anybody know better.
    Good luck.
    The best solution is the one you find it by yourself

  • Design Patterns/Best Practices etc...

    fellow WLI gurus,
    I am looking for design patterns/best practices especially in EAI / WLI.
    Books ? Links ?
    With patterns/best practices I mean f.i.
    * When to use asynchronous/synchronous application view calls
    * where to do validation (if your connecting 2 EIS, both EIS, only in WLI,
    * what if an EIS is unavailable? How to handle this in your workflow?
    * performance issues
    Anyone want to share his/her thoughts on this ?
    Kris

              Hi.
              I recently bought WROX Press book Professional J2EE EAI, which discusses Enterprise
              Integration. Maybe not on a Design Pattern-level (if there is one), but it gave
              me a good overview and helped me make some desig decisions. I´m not sure if its
              technical enough for those used to such decisions, but it proved useful to me.
              http://www.wrox.com/ACON11.asp?WROXEMPTOKEN=87620ZUwNF3Eaw3YLdhXRpuVzK&ISBN=186100544X
              HTH
              Oskar
              

  • Chain of Responsibility Design Pattern

    Is there any java api which helps in implementing Chain of Responsibility Design pattern by parsing a XML file?. Can I use XML file to do this in Apache Commons Chain API?

    A quick look at the javadocs for that project suggest that, yes, indeed they do provide a way to specify a chain of command using XML.
    In fact I'm kind of confused why you even asked this question, since you already seem to know the answer.
    I've never heard of such a thing in the standard API, if that's what you're asking, probably because it's a simple pattern to implement, and most of the pain of any implementation is likely to be due to details specific to the problem domain, not the pattern.
    If you're really eager to use XML, you might want to check out Spring. You could configure a bunch of beans in a chain, if you like.

  • How to create plug and play design pattern on a environment

    Hi All,
    Help me to get a best design for my problem statement.
    Problem Statement: I have to create a platform where I should be able to plug and play different components. explaining better with example
    Example:
    1. I have to create a platform for school
    2. In this school platform we have to plug in multiple components like "Student", "Teacher", "Subjects", "ClassPeriods" etc.,
    3. These components should be easily plug/unplug and play
    4. Like, the component "ClassPeriods" want to purchase from Vendor 1 and plug it to "School" platform it should work.
    5. Incase if we want to unplug the "ClassPeriod" component provided bfy Vendor 1 from "School" platform and want to plug the "ClassPeriod" from Vendor 2. then the Design should support without any extra effort.
    Suggest me the best design pattern for the problem
    This design pattern is for ASP.Net
    Thanks,
    S.Kannan

    Sounds like you're looking at 'Composition'. As a background, and possible solution, take a look at MEF;
    http://mef.codeplex.com/
    http://pauliom.wordpress.com

  • Choice of design pattern for data acquisition system

    Hello all
    I have a trouble about selecting the suitable design pattern / architecture for a data acquisition system. 
    Here is the details of the desired system:
    There is data acquisition hardware and I need to use it by observing parameters on User interface. 
    the data acquisiton period, channel list to scan should be chosen on User interface. Besides, there are many user interface interactions. e.g. if user selects a channel to add scanlist, then I need to enable and make visible some other parts on user interface. 
    When user completes the channel selection, then he will press the button to start data acquisition. Then I also need to show the scanned values on a graph in real time and log them in txt file.
    I know that I cannot use producer consumer pattern here. because the data acquisition loop should wait for parameters to scan channels. and it works in a given period by user. so the user interface loop performs higher rate then consumer loop (data acquisition loop). it means queue will be bigger bigger. if I use notifier it will loss some data come from user interface. 
    is there any idea about that ? is there any suitable design pattern for this case ? 
    Thanks in advance
    best regards 
    Veli BAYAR
    Embedded Systems Software and Hardware Engineer 
    "You live in a graphical world. Why not program in one?"
    Solved!
    Go to Solution.

    johnsold wrote:
    Veli,
    I recommend the Producer/Consumer model with some modifications.
    You might need three loops.  I cannot tell for sure from your brief description.
    The User Interface loop responds to the user inputs for configuration and start/stop of acquisition.  The parameters and commands are passed to the Data Acquisition loop via a queue. In this loop is a state machine which has Idle, Configuration, Acquisition, and Shutdown states (and perhaps others). The data is sent to the Processing loop via a different queue. The Processing loop performs any data processing, displays the data to the user, and saves it to file. A notifier can be used to send the Stop or shutdown command from the User Interface loop to the other loops.  If the amount of processing is minimal and the file write times are not too long, the Processing loop functions might be able to occur in the Timeout case of the UI loop Event structure.  This simplifies things somewhat but is not as flexible when changes need to be made.
    I am not sure that a Design Pattern for this exact setup exists but it is basically a combination of the Producer/Consumer (Events) and Producer/Consumer (Data) Design Patterns.
    Lynn
    Check out this thread: http://forums.ni.com/t5/LabVIEW/Multiple-poll-case-structures-to-event-help/td-p/2551309
    There are discussions there about a 3-loop architecture that may help you.
    Jeff
    Jeffrey Zola

Maybe you are looking for