Design question - implementing permissions

We have to implement permissions in our application. Which method do you gurus suggest?
a) Checking if a user has the permissions to do a certain action and enabling/disabling/hiding the input control accordingly.
The drawback i see in this approach is that a user who want to hack the application can invoke the servlet directly(assuming i am not repating the permissions check in the servlet too).
b) Checking if a user has the permission to do a certain action in servlets. My view is that this does not conform to the MVC architecture.
As always your views will be appreciated.
Regards

Thanks for the responses. I did go through some
articles regarding FrontController pattern but am
still not 100% sure how to implement them.
From the articles i went through this is how i
designed my application. Please let me know if this
does follow the FrontController pattern.
FrontController is simple, all or most requests are at least initially handled by a central class. This could be a Servlet or a ServletFilter. Or if the interactions are getting complex and/or you do not want to deal with inheritance, make a dedicated Controller class and have the Servlet or Filter invoke its methods.
I have a BaseServlet class and all my other servlets
derive from this class. All the baseservlets have the
basic methods like verify(which verifies if all the
information in the jsp/html page is valid),
process(which gets the data from the view page and
does the processing accordingly).
Totally fine. Though I would encourage you to implement doGet() and doPost() in the BaseServlet and then provide an abstract protected method such as handleRequest(request, response) so that the BaseServlet can enforce workflow (e.g., you authenticate and authorize the request, then call handleRequest()).
This design doesn't eliminate my need for checking if
a user has the required permission to enhance user
experience. My intention is to do the following.
That always remains. If you want security, you need to define its constraints and principals.
Say there is a textfield "description" and there are
other controls in the page in addition to the
username textfield. I would like to display the
textfield "description" based on a permission p1.
So i have add something like the following in the jsp
page
<% if (permission) { %>
<input type= text name="description" value="test"
size=20 maxlength="50">
<% } %>
This will work. Another option is to put a Login or User object into HttpSession. It would have methods such as isDisplayAllowed() isAddAllowed() etc. This works for relatively simple situations. When you need more, then move on to full-blown User/Group/Role access control.
This works but i would like to know if this is the
standard way or is there a better way to achieve the
same.
Yes. However, you will need to either use J2EE's JAAS (Java Authorization and Authentication Service) and/or a web framework (such as Spring, Struts, Tapestry, etc.) The former is a standard J2EE way to provide security. You still need to define the protected resources and what roles exist to access them. However, JAAS takes over from there. The latter web framework option will depend on what convenience features the framework in question has chosen to offer you.
Thanks in advanceYou are welcome.
- Saish

Similar Messages

  • Question on figure 3-4 of SNASw Design and Implementation guide

    Hello,
    on figure 3-4 on page 3-7 of the SNASw Design and Implementation guide there is an example code of SNASw port and links for Upstream Hosts.
    There is one port statement and two link statements, one for each host.
    However, assume I have one host with two OSA interfaces, can I use the same coding (two links, one for each OSA), as a redundancy mechanism of the OSAs? How can I choose the primary link?
    Or if I do this configuration I will achieve also load-balancing? (both links active)
    Regards, Apostolos.

    HPR is built on top of APPN with respect to path determination. In APPN the session path is determined by the Topology and Routing Services (TRS) component in the Network Node serving the device originating the session. TRS calculates this path by looking at the characteristics associated with each possible Transmission Group (TG a.k.a. link) that can be used for the session. In the case you are talking about where you have parallel TGs (two or more links) between two nodes, and unless you do some customizing of the TG profiles, they will have equal weight (desireability). This means that over time (and with enough sessions) you would see the load balanced over the two links. If you customize the TG profile (on snaswitch you use the tgp keyword), you can achieve the result of all sessions on a primary link and no sessions on a backup link until the primary link fails. - Ray

  • Design question: Scheduling a Variable-timeslot Resource

    I originally posted this in general java programming, because this seemed like a more high-level design descussion. But now I see some class design questions. Please excuse me if this thread does not belong here (this is my first time using the forum, save answering a couple questions).
    Forum,
    I am having trouble determining a data structure and applicable algorithm (actually, even more general than the data structure -- the general design to use) for holding a modifiable (but more heavily read/queried than updated), variable-timeslot schedule for a given resource. Here's the situation:
    Let's, for explanation purposes, say we're scheduling a school. The school has many resources. A resource is anything that can be reserved for a given event: classroom, gym, basketball, teacher, janitor, etc.
    Ok, so maybe the school deal isn't the best example. Let's assume, for the sake of explanation, that classes can be any amount of time in length: 50 minutes, 127 minutes, 4 hours, 3 seconds, etc.
    Now, the school has a base operation schedule, e.g. they're open from 8am to 5pm MTWRF and 10am to 2pm on saturday and sunday. Events in the school can only occur during these times, obviously.
    Then, each resource has its own base operation schedule, e.g. the gym is open from noon to 5pm MTWRF and noon to 2pm on sat. and sun. The default base operation schedule for any resource is the school which "owns" the resource.
    But then there are exceptions to the base operation schedule. The school (and therefore all its resources) are closed on holidays. The gym is closed on the third friday of every month for maintenance, or something like that. There are also exceptions to the available schedule due to reservations. I've implemented reservations as exceptions with a different status code to simplify things a little bit: because the basic idea is that an exception is either an addition to or removal from the scheduleable times of that resource. Each exception (reservation, closed for maintenance, etc) can be an (effectively) unrestricted amount of time.
    Ok, enough set up. Somehow I need to be able to "flatten" all this information into a schedule that I can display to the user, query against, and update.
    The issue is complicated more by recurring events, but I think I have that handled already and can make a recurring event be transparent from the application point of view. I just need to figure out how to represent this.
    This is my current idea, and I don't like it at all:
    A TimeSlot object, holding a beginning date and ending date. A data structure that holds list of TimeSlot objects in order by date. I'd probably also hold an index of some sort that maps some constant span of time to a general area in the data structure where times around there can be found, so I avoid O(n) time searching for a given time to find whether or not it is open.
    I don't like this idea, because it requires me to call getBeginningDate() and getEndDate() for every single time slot I search.
    Anyone have any ideas?

    If I am correct, your requirement is to display a schedule, showing the occupancy of a resource (open/closed/used/free and other kind of information) on a time line.
    I do not say that your design is incorrect. What I state below is strictly my views and should be treated that way.
    I would not go by time-slot, instead, I would go by resource, for instance the gym, the class rooms (identified accordingly), the swimming pool etc. are all resources. Therefore (for the requirements you have specified), I would create a class, lets say "Resource" to represent all the resources. I would recommend two attributes at this stage ("name" & "identifier").
    The primary attribute of interest in this case would be a date (starting at 00:00hrs and ending at 24:00hrs.), a span of 24hrs broken to the smallest unit of a minute (seconds really are not very practical here).
    I would next encapsulate the availability factor, which represents the concept of availability in a class, for instance "AvailabilityStatus". The recommended attributes would be "date" and "status".
    You have mentioned different status, for instance, available, booked, closed, under-maintainance etc. Each of these is a category. Let us say, numbered from 0 to n (where n<128).
    The "date" attribute could be a java.util.Date object, representing a date. The "status", is byte array of 1440 elements (one element for each minute of the day). Each element of the byte array is populated by the number designation of the status (i.e, 0,1,2...n etc.), where the numbers represent the status of the minute.
    The "Resource" class would carry an attribute of "resourceStatus", an ordered vector of "ResourceStatus" objects.
    The object (all the objects) could be populated manually at any time, or the entire process could be automated (that is a separate area).
    The problem of representation is over. You could add any number of resources as well as any number of status categories.
    This is a simple solution, I do not address the issues of querying this information and rendering the actual schedule, which I believe is straight forward enough.
    It is recognized that there are scope for optimizations/design rationalization here, however, this is a simple and effective enough solution.
    regards
    [email protected]

  • Ask the Expert: Plan, Design, and Implement Mobile Remote Access, the Cisco Collaboration Edge Architecture

    Welcome to the Cisco® Support Community Ask the Expert conversation. This is an opportunity to learn and ask questions about planning, designing, and implementing mobile remote access (Cisco Collaboration Edge Architecture) with Cisco subject matter experts Aashish Jolly and Abhijit Anand.
    Cisco Collaboration Edge Architecture is an architecture that provides VPN-less access of Cisco Unified Communications resources to Cisco Jabber® users. This discussion is dedicated to addressing questions about design best practices while implementing mobile remote access.
    For more information, refer to the Unified Communications Mobile and Remote Access via Cisco VCS deployment guide. 
    Aashish Jolly is a network consulting engineer who is currently serving as the Cisco Unified Communications consultant for the ExxonMobil Global account. Earlier at Cisco, he was part of the Cisco Technical Assistance Center (TAC), where he helped Cisco partners with installation, configuring, and troubleshooting Cisco Unified Communications products such as Cisco Unified Communications Manager and Manager Express, Cisco Unity® solutions, Cisco Unified Border Element, voice gateways and gatekeepers, and more. He has been associated with Cisco Unified Communications for more than seven years. He holds a bachelor of technology degree as well as Cisco CCIE® Voice (#18500), CCNP® Voice, and CCNA® certifications and VMware VCP5 and Red Hat RHCE certifications.
    Abhijit Singh Anand is a network consulting engineer with the Cisco Advanced Services field delivery team in New Delhi. His current role involves designing, implementing, and optimizing large-scale collaboration solutions for enterprise and defense customers. He has also been an engineer at the Cisco TAC. Having worked on multiple technologies including wireless and LAN switching, he has been associated with Cisco Unified Communications technologies since 2006. He holds a master’s degree in computer applications and multiple certifications, including CCIE Voice (#19590), RHCE, and CWSP and CWNP.
    Remember to use the rating system to let Aashish and Abhijit know if you have received an adequate response. 
    Because of the volume expected during this event, our experts might not be able to answer every question. Remember that you can continue the conversation on the Cisco Support Community Collaboration, Voice and Video page, in the Jabber Clients subcommunity, shortly after the event. This event lasts through June 20, 2014. Visit this forum often to view responses to your questions and the questions of other Cisco Support Community members.

    Hi Marcelo,
       Yes, there are some requirements for certificates in Expressway.
    Expressway Core (Exp-C)
    - Can be signed by either External or Internal CA
    - Better to use a cluster name even if you start with 1 peer in Exp-C cluster. In the future, if more peers are added, changes would be minimal.
    - Better to use FQDN of cluster as CN of certificate, this way the traversal zone configuration on Expressway-E won't require any change even if new peers are added to Exp-C cluster.
    - If CUCM is mixed mode, include security profile names (in FQDN format) as Subject Alternate Names
    - The Chat Node Aliases that are configured on the IM and Presence servers. They will be required only for Unified Communications XMPP federation deployments that intend to use both TLS and group chat. (Note that Unified Communications XMPP federation will be supported in a future Expressway release). The Expressway-C automatically includes the chat node aliases in the CSR, providing it has discovered a set of IM&P servers.
    - For TLS b/w CUCM, IM-P & Exp-C
      + If using self-signed certificates on CUCM, IM/P. Load Cisco Tomcat, cup, cup-xmpp certificates from IM-P on Exp-C. Load callmanager, Cisco Tomcat certificates from CUCM on Exp-C.
      + If using Internal CA signed certificates on CUCM, IM/P. Load Root CA certificates on Exp-C.
      + Load CA certificate under tomcat-trust, cup-trust, cup-xmpp-trust on IM-P.
      + Load CA certificate under tomcat-trust, callmanager-trust on CUCM.
    Expressway Edge (Exp-E)
    - Signed by External CA
    - Configured Unified Communications domain as Subject Alternate Name
    - If using a cluster, select FQDN of this peer as CN and FQDN of Cluster + this peer as Subject Alternate Name.
    - If XMPP federation is being deployed, enter the same Chat Node Aliases as entered in Exp-C.
    For more details, please refer to the Certificate Creation Guide for Cisco Expressway x8.1.1
    http://www.cisco.com/c/dam/en/us/td/docs/voice_ip_comm/expressway/config_guide/X8-1/Cisco-Expressway-Certificate-Creation-and-Use-Deployment-Guide-X8-1.pdf
    - Aashish

  • Logical design to implementation & vise versa?

    Does Designer support transfering logical design to implementation...and vise versa?
    Does Designer support transfering logical design to implementation...and vise versa?
    Is Oracle Designer a pure modeling tool doesn't support transferring logical design to implementation...and vise versa?
    Or there's a way to pull existing oracle database table structure into Oracle Designer and shown as diagram? The database and designer are same version 9i.
    And the other way around...to make the design of table structure from Designer model diagram becomes the real tables in database?
    I've asked this question in Meta link, funny they never reply.
    Thanks,
    Jess

    Designer supports transferring logical design to technical design to implementation and retrofitting implementation (an existing database structure) to technical design and retrofitting technical design to logcal design.
    So the answer to all your questions is YES.

  • LDAP design question for multiple sites

    LDAP design question for multiple sites
    I'm planning to implement the Sun Java System Directory Server 5.2 2005Q1 for replacing the NIS.
    Currently we have 3 sites with different NIS domains.
    Since the NFS over the WAN connection is very unreliable, I would like to implement as follows:
    1. 3 LDAP servers + replica for each sites.
    2. Single username and password for every end user cross those 3 sites.
    3. Different auto_master, auto_home and auto_local maps for three sites. So when user login to different site, the password is the same but the home directory is different (local).
    So the questions are
    1. Should I need to have 3 domains for LDAP?
    2. If yes for question 1, then how can I keep the username password sync for three domains? If no for question 1, then what is the DIT (Directory Infrastructure Tree) or directory structure I should use?
    3. How to make auto map work on LDAP as well as mount local home directory?
    I really appreciate that some LDAP experta can light me up on this project.

    Thanks for your information.
    My current environment has 3 sites with 3 different NIS domainname: SiteA: A.com, SiteB:B.A.com, SiteC:C.A.com (A.com is our company domainname).
    So everytime I add a new user account and I need to create on three NIS domains separately. Also, the password is out of sync if user change the password on one site.
    I would like to migrate NIS to LDAP.
    I want to have single username and password for each user on 3 sites. However, the home directory is on local NFS filer.
    Say for userA, his home directory is /user/userA in passwd file/map. On location X, his home directory will mount FilerX:/vol/user/userA,
    On location Y, userA's home directory will mount FilerY:/vol/user/userA.
    So the mount drive is determined by auto_user map in NIS.
    In other words, there will be 3 different auto_user maps in 3 different LDAP servers.
    So userA login hostX in location X will mount home directory on local FilerX, and login hostY in location Y will mount home directory on local FilerY.
    But the username and password will be the same on three sites.
    That'd my goal.
    Some LDAP expert suggest me the MMR (Multiple-Master-Replication). But I still no quite sure how to do MMR.
    It would be appreciated if some LDAP guru can give me some guideline at start point.
    Best wishes

  • Design question for database connection in multithreaded socket-server

    Dear community,
    I am programming a multithreaded socket server. The server creates a new thread for each connection.
    The threads and several objects witch are instanced by each thread have to access database-connectivity. Therefore I implemented factory class which administer database connection in a pool. At this point I have a design question.
    How should I access the connections from the threads? There are two options:
    a) Should I implement in my server class a new method like "getDatabaseConnection" which calls the factory class and returns a pooled connection to the database? In this case each object has to know the server-object and have to call this method in order to get a database connection. That could become very complex as I have to safe a instance of the server object in each object ...
    b) Should I develop a static method in my factory class so that each thread could get a database connection by calling the static method of the factory?
    Thank you very much for your answer!
    Kind regards,
    Dak
    Message was edited by:
    dakger

    So your suggestion is to use a static method from a
    central class. But those static-methods are not realy
    object oriented, are they?There's only one static method, and that's getInstance
    If I use singleton pattern, I only create one
    instance of the database pooling class in order to
    cionfigure it (driver, access data to database and so
    on). The threads use than a static method of this
    class to get database connection?They use a static method to get the pool instance, getConnection is not static.
    Kaj

  • SOA real-time design question

    Hi All,
    We are currently working with SOA Suite 11.1.1.4. I have a SOA application requirement to receive real-time feed for six data tables from an external third party. The implementation consists of five one-way operations in the WSDL to populate the six database tables.
    I have a design question. The organization plans to use this data across various departments which requires to replicate or supply the data to other internal databases.
    In my understanding there are two options
    1) Within the SOA application fork the data hitting the web-service to different databases.
    My concern with this approach is what if organizations keep coming with such requests and I keep forking and supplying multiple internal databases with the same data. This feed has to be real-time, too much forking with impact the performance and create unwanted dependencies for this critical link for data supply.2) I could tell other internal projects to get the data from the populated main database.
    My concern here is that firstly the data is pushed into this database flat without any constraints and it is difficult to query to get specific data. This design has been purposely put in place to facilitate real-time performance.Also asking every internal projects to get data from main database will affect its performance.
    Please suggest which approach should I take (advantage/disadvantage. Apart from the above two solutions, is there any other recommended solution to mitigate the risks. This link between our organization and external party is somewhat like a lifeline for BAU, so certainly don't want to create more dependencies and overhead.
    Thanks

    I had tried implementing the JMS publisher/subscriber pattern before, unfortunately I experienced performance was not so good compared to the directly writing to the db adapter. I feel the organization SOA infrastructure is not setup correctly to cope with the number of messages coming through from external third party. Our current setup consists of three WebLogic Servers (Admin, SOA, BAM) all running on only 8GB physical RAM on one machine. Is there Oracle guideline for setting up infrastructure for a SOA application receiving roughly 600000 messages a day. I am using SOA 11.1.1.4. JMS publisher/subscriber pattern just does not cope and I see significant performance lag after few hours of running. The JMS server used was WebLogic JMS
    Thanks
    Edited by: user5108636 on Jun 13, 2011 4:19 PM
    Edited by: user5108636 on Jun 13, 2011 7:03 PM

  • Design patterns implemented in java API

    Hi,
    I have some questions on design patterns implemented in core java class or in general in java API.
    1)Whether
    java.util.Collections, the checkedXXX(), synchronizedXXX() and unmodifiableXXX() methods.
    can be considered as a decorator pattern?
    2) Whether
    LinkedHashMap(LinkedHashSet<K>, List<V>) which returns an unmodifiable linked map which doesn't clone the items, but uses them
    can be considered as a Bridge pattern?
    3) Whether Facade pattern is implemented in java ? If so which API uses it?
    4) Whether
    •     All non-abstract methods of java.io.InputStream, java.io.OutputStream, java.io.Reader and java.io.Writer.
    •     All non-abstract methods of java.util.AbstractList, java.util.AbstractSet and java.util.AbstractMap
    can be considered as a Template method pattern?
    5) Whether
    •     java.util.Comparator#compare(), executed by among others Collections#sort()
    can be considered as a Stratergy pattern?
    6)
    Whether State pattern is implemented in java ? If so which API uses it?
    7)
    All implementations of java.lang.Runnable are considered as a Command pattern.
    8)
    Whether
    •     java.io.InputStreamReader(InputStream) (returns a Reader)
    •     java.io.OutputStreamWriter(OutputStream) (returns a Writer)
    can be considered as an Adapter pattern?
    Please clarify.
    Thanks.

    What do you think, and why?

  • Why would you need a database design before implementing?

    Why would you need a database design before implementing?

    977222 wrote:
    Why would you need a database design before implementing?It appears from the 4 questions you put up ina 2 hour period
    help me with this
    Why would you need a database design before implementing?
    Re: answer these quesions pls
    answer these quesions pls
    That you have put off doing your homework and now expect this forum of volunteers to do your research for you ....

  • BC4J + Struts: Design questions!

    OK, I'm wanting to use Struts with BC4J and have a design question for you BC4J users and gurus.
    Here's how I think things would work:
    1. User requests page
    2. Struts ActionServlet calls perform() on Struts ActionForm
    3. Struts ActionForm instantiates BC4J AppModule and calls business method
    4. BC4J AppModule instantiates necessary BC4J ViewObjects and performs business operations which return data
    5. Struts ActionForm receives value objects from BC4J AppModule
    6. Struts ActionForm populates Struts FormBean
    7. Struts ActionForm forwards to Struts JSP which displays Struts FormBean
    I prefixed the components with Struts/BC4J to keep things clear where things belong.
    Now, here are my questions:
    In step 3, what's the best method of doing this? Do I need to do JNDI lookups every time? What's the performance overhead of this? Anyone have any best-practice code that does this?
    Is this the accepted way of doing things? Is there a better way of designing this system?
    Thanks!

    In Step3 you should use the ApplicationModule pooling framework, especially if you are trying to work in stateful mode because the pooling automatically handle the AM activation/passivation.
    There are different way to go at it.
    If you are using the BC4J custom tag library and have an ApplicationModule tag in your jsp, the pooling is already initialize. By the time your action is trigger you just need to retrieve the am using the application id:
    in your jsp:
    <jbo:ApplicationModule id="myAM" ... />
    in your Action implementation:
    HttpContainer container = HttpContainer.getInstanceFromSession(request.getSession());
    SessionCookie cookie = container.getSessionCookie("myAM");
    ApplicationModule am = null;
    if (cookie != null)
    am cookie.useApplicationModule();
    This AM id can be passed as URL parameter...
    If you do have a JSP with an AM tag you need to create the pool with findSessionCookie call.
    For more info about AM pooling look at the end of this thread for Steve resources:
    http://forums.oracle.com/forums/message.jsp?id=912431&gid=513211
    This is what we are currently doing for to provide support for BC4J in Struts for our next release.
    Charles.

  • Design questions on using JMX

    I have been reading about JMX and trying to understand it
    I have some specific design realted questions and wanted some opinions to validate my understanding
    Assume a simple j2ee application that exposes 2 webservices .
    I would like to find out how many times each service is called and the total number of success/faults/errors
    encountered for each service along with params like starttime etc
    From what I have understood , I will have to first create a Bean , say "StatsCollector"
    and then creae a StatsCollectorMBean interface.
    The StatsCollector will provide the methods to set/update the above values and those will also be exposed by the StatsCollectorMBean interface
    1) I have trouble understanding how to create and maintain the MBean Resource...
    Shouldnt there be always 1 instance of this resource ? ie shouldnt there be only one StatsCollector ?
    Most of the examples create a simple class "Hello implements HelloMBean" and that makes it a MBean
    but they create Hello hello = new Hello() and then register it with the MBean server
    What if we create multiple objects of Hello? Wouldnt that defeat the porpose of the MBean ?
    I think that we need to make sure that this resource is always created once only.
    Is that correct ?
    2) Is it the right practice to separate your MBean and your "managed" resource ?
    ie in the above case , should there be a Singleton StatsCollector POJO that stores the Appliction
    statistics and another StatsMBean that will be the MBean that will access the POJO ? This makes sure that your Resource does not have
    dependency management classes.
    3) How does the application update the values in the MBean ?
    In the above example , how do you update the success and failure counts in the MBean from the application ?
    Can I update the singleton StatsCollector directly or do I have to go through the MBean Server to update
    any value in the MBean ?
    If I update them directly , will they be "visible" thru the MBean server ?
    4) Assuming that the above app gets deployed in a appserver like WebSphere and in a Clustered environment ,
    how to ensure that statisitcs are collected for all the services on all servers cummulativly ?
    Is this something that the appserver should provide ? Do we register the MBean with the Appserver
    MBean server ?
    Any ideas/suggestions will be helpful !
    thanks
    Pat

    Hello pat,
    very interesting questions. You are covering the main JMX design questions there.
    You should have a look (if you not already did) to the JMX best practices : http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/best-practices.jsp
    This document summarize common JMX design patterns.
    Answers to your questions:
    1) The resources you want to manage/monitor are Web Services. The life cycle of these services is handled by the J2EE container itself. As you say, the tricky part is to link the WebService resource life cycle to the MBean resource
    The MBean leaves inside its own container, the MBeanServer.
    You should identify an initialization phase in which you create your MBeans and register them inside the MBeanServer once.
    In your case, you can go for a single collector that monitors the 2 Web Services or a collector per Web Service. It seems that you want to track each service independently. Having 2 MBeans should offer a more flexible solution.
    If you go for 1 MBean, you should name it "<your management domain>:type=StatsCollector". This name identify an MBean for which you have a single instance. Once the collector registered with this name, the MBeanServer will guarantee that no MBean with the same name can be registered.
    If you go for 2 MBeans, you should add the Web Service name to each MBean ObjectName. For example:
    MBean 1 : "<your management domain>:type=StatsCollector,name=MyWebService1"
    MBean 2 : "<your management domain>:type=StatsCollector,name=MyWebService2"
    Example of MBean creation and registration code :
    StatsCollector collector1 = new StatsCollector();
    ManagementFactory.getPlatformMBeanServer().registerMBean(collector1,
    new ObjectName("com.foo.bar:type=StatsCollector,name=WebService1");
    At this point you have an MBean registered inside the platform MBeanServer.
    2) A Standard MBean is formed of a java interface and a class. Generally the interface and the class are not separated. They could be but I don't see a strong reason in your case to have the POJO and interface not being the same object.
    3) You shouldn't expose the methods to set the values in your MBean interface. Only getters should be visible. It means that you will have to keep a direct reference to the collectors to update the statistics. During your initialization phase, you could use JNDI to register the collector instances. The WebServices will then use JNDI to retrieve the collectors.
    An example of a simplified StatsCollector class and StatsCollectorMBean interface
    public interface StatsCollectorMBean {
    public int getNumRequests();
    public class StatsCollector implements StatsCollectorMBean {
    private int numRequests.
    public int getNumRequests() {
    return average;
    public serviceCalled() {
    numRequests++;
    In the above example, serviceCalled is not part of the management interface and is called by the Web Service.
    4) Difficult question for which I can't provide you with a reply. JMX doesn't offer such cumulative service in a standard way. In some appserver (glassfish for instance), MBeans are cascaded inside the domain server. There is no cumulative representation offered, but you could implement your own by defining new MBeans linked to the StatsCollector ones.
    To conclude, Appservers are offering some "out of the box" management and monitoring features . For example glassfish relies on the AMX framework (that is JMX based) . AMX (https://glassfish.dev.java.net/javaee5/amx/) allows you to monitor and manage your services. A possible solution would be to rely on this infrastructure to build your own management and monitoring.
    Hope this help.
    Regards.
    Jean-Francois Denise

  • Design question: Link data between JFrames

    Dear all,
    I have a design question. I have this form in a JFrame where you can set an icon as a property. To achieve this, I have a "Set" button on the form which will open a new window with all the available icons. When you click an icon, I want the "icon" frame to be closed and the selected icon to be send to the original form. This is the way I do it now:
    Interface :
    public interface IconUpdate
    public void updateIcon(Icon icon);
    }Main frame with the "Set" button:
    public class Test extends JFrame implements IconUpdate, ActionListener
        private Icon icon = null;
        public Test()
            // add button and actionlistener and that kind of stuff
        public void actionPerformed(ActionEvent e)
            if(e.getSource() == btnSetIcon)
                new IconFrame(this);
        public void updateIcon(Icon icon)
            this.icon = icon;
    }The Icon frame:
    public class IconFrame extends JFrame implements ActionListener
        IconUpdate parent = null;
        public IconFrame(IconUpdate parent)
            this.parent = parent;
            // Initialize table,"Pick" button etc.
        public void actionPerformed(ActionEvent e)
            if(e.getSource() == btnPick)
                parent.updateIcon((Icon)list.getSelectedValue());
                this.dispose();
    }Maybe I made some spelling faults, but this is the way I implement it. Now my question is: is there another way to achieve my goal? If I have to create an interface for every "popup choose dialog" in my program, I have to create many of them. I know using a combobox in the main frame is an option, but I just want to use it this way. Can anyone tell me how I can rewrite this code to make it better / more professional?
    Tx in advance!!!
    Peter

    I can think of a couple options:
    1) Let IconFrame's constructor accept a Test parameter, instead of creating an interface.
    2) Make IconFrame into a modal dialog & have it store the user's selection in a variable. Then when you show the dialog, your action listener will block until the user selects an icon. Then you can call "getSelectedIcon()" to retrieve his/her selection. This would be much like the JOptionPane.showXXX() methods, and probably the cleaner solution.

  • Design question about when to use inner classes for models

    This is a general design question about when to use inner classes or separate classes when dealing with table models and such. Typically I'd want to have everything related to a table within one classes, but looking at some tutorials that teach how to add a button to a table I'm finding that you have to implement quite a sophisticated tablemodel which, if nothing else, is somewhat unweildy to put as an inner class.
    The tutorial I'm following in particular is this one:
    http://www.devx.com/getHelpOn/10MinuteSolution/20425
    I was just wondering if somebody can give me their personal opinion as to when they would place that abstracttablemodel into a separate class and when they would just have it as an inner class. I guess re-usability is one consideration, but just wanted to get some good design suggestions.

    It's funny that you mention that because I was comparing how the example I linked to above creates a usable button in the table and how you implemented it in another thread where you used a ButtonColumn object. I was trying to compare both implementations, but being a newbie at this, they seemed entirely different from each other. The way I understand it with the example above is that it creates a TableRenderer which should be able to render any component object, then it sets the defaultRenderer to the default and JButton.Class' renderer to that custom renderer. I don't totally understand your design in the thread
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=680674
    quite yet, but it's implemented in quite a bit different way. Like I was saying the buttonClass that you created seem to be creating an object of which function I don't quite see. It looks more like a method, but I'm still trying to see how you did it, since it obviously worked.
    Man adding a button to a table is much more difficult than I imagined.
    Message was edited by:
    deadseasquirrels

  • Workflow design questions: FM vs WF to call FM

    Hereu2019s a couple of workflow design questions.
    1. We have Workitem 123 that allow user to navigate to a custom transaction TX1. User can make changes in TX1.  At save or at user command of TX1, the program will call a FM (FM1) to delete WI 123 and create a new WI to send to a different agent. 
    Since Workitem 123 is still open and lock, the FM1 cannot delete it immediately, it has to use a DO loop to check if the Workitem 123 is dequeued before performing the WI delete.
    Alternative: instead of calling the FM1, the program can raise an event which calls a new workflow, which has 1 step/task/new method which call the FM1.  Even with this alternative, the Workitem 123 can still be locked when the new workflowu2019s task/method calls the FM1.
    I do not like the alternative, which calls the same FM1 indirectly via a new workflow/step/task/method.
    2. When an application object changes, the user exit will call a FMx which is related to workflow.  The ABAP developer do not want to call the FMx directly, she wants to raise an event which call a workflow .. step .. task .. method .. FMx indirectly.  This way any commit that happens in the FMx will not affect the application objectu2019s COMMIT.
    My recommendation is to call the FMx using u2018in Update tasku2019 so that the FMx is only called after the COMMIT of the application object.
    Any recommendation?
    Amy

    Mike,
    Yes, in my first design, the TX can 1. raise a terminating event for the existing workitem/workflow and then 2. raise another event to call another workflow.   Both 1 and 2 will be in FM1. 
    Then the design question is: Should the FM1 be called from TX directly or should the TX raise an event to call a new workflow which has 1 step/task, which calls a method in the Business object, and the method calls the FM1?
    In my second design question, when an application object changes, the user exit will call a FMx which is related to workflow.  The ABAP developer do not want to call the FMx directly, she wants to raise an event which call a workflow, which has 1 step/task, which calls a method, which calls the FMx indirectly.  This way any commit that happens in the FMx will not affect the application objectu2019s COMMIT.
    My recommendation is either call the FMx using u2018in Update tasku2019 so that the FMx is only called after the COMMIT of the application object or raise an event to call a receiver FM (FMx).
    Thanks.
    Amy

Maybe you are looking for