Problem in using ErrorHandler interface

Hi ,
I have a problem with Errorhandler interface.I use errorhandler class to handle the errors/warnings while parsing an XML file.Incase of an error,a JOptionPane pane is displayed to get user confirmation.If there is only one error while parsing my code is working fine. But if there are more then one error, it displays the JOptionPane for each error till the last error. I want the JOptionPane to be displayed only once.
Can anyone help me to fix this?
try {
          hErr = new MyErrorHandler1();
          DocumentBuilder builder = factory.newDocumentBuilder();
          // Set the Error handler
          builder.setErrorHandler(hErr);
          // Parse the XML Document
          document = builder.parse(f);
          if (Index.equals("T")){
          else{
catch(){
}If there is a Parsing error, then MyErrorHandler class is called
class MyErrorHandler1 implements ErrorHandler{
        public void error(SAXParseException exception)
             System.out.println("\n Error occured...."+ exception);
          try{
                 JOptionPane.showMessageDialog(null,"Parsing error occcured");
                 int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",     JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                                         if (response == JOptionPane.NO_OPTION)
                System.out.println("No button clicked");
                 System.exit(0);
                                        else if (response == JOptionPane.YES_OPTION)
                OrderFrame orderframe = new OrderFrame();
                                         else if (response == JOptionPane.CLOSED_OPTION)
                System.out.println("JOptionPane closed");
          catch(Exception e){
               System.out.println(e);
     public void warning(SAXParseException exception)
     public void fatalError(SAXParseException exception)
}

Rather than calling a dialog in your ErrorHandler, increment a counter. Then call a cleanup method. Example (this is pretty rough, but hopefully you get the idea):
try {
          hErr = new MyErrorHandler1();
          DocumentBuilder builder = factory.newDocumentBuilder();
          // Set the Error handler
          builder.setErrorHandler(hErr);
          // Parse the XML Document
          document = builder.parse(f);
          hErr.finish(); // NEW CODE HERE
          if (Index.equals("T")){
          else{
catch(){
class MyErrorHandler1 implements ErrorHandler{
     private int errorCount=0;
        public void error(SAXParseException exception)
             System.out.println("\n Error occured...."+ exception);
          try{
               errorCount++;
          catch(Exception e){
               System.out.println(e);
     public void warning(SAXParseException exception)
     public void fatalError(SAXParseException exception)
     public void finish() {
          if (errorCount > 0) {
                 JOptionPane.showMessageDialog(null, errorCount + "parsing error(s) occcured");
                 int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",     JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                                         if (response == JOptionPane.NO_OPTION)
                System.out.println("No button clicked");
                 System.exit(0);
                                        else if (response == JOptionPane.YES_OPTION)
                OrderFrame orderframe = new OrderFrame();
                                         else if (response == JOptionPane.CLOSED_OPTION)
                System.out.println("JOptionPane closed");
     public void warning(SAXParseException exception)
     public void fatalError(SAXParseException exception)
}Edited by: Hushpuppy on May 27, 2008 8:45 AM

Similar Messages

  • Problem while using Generic interface.Help!

    package cn.com.landstar.violet;
    import java.util.*;
    interface ITextContainer implements Iterable<String>
         void append(String newStr);
         void clear();
         Iterator<String> iterator();
    the error messages point out that
    Line3 and Line9 need "{"and "}",

    interfaces can't implement anything, they can extend other interfaces.

  • Problem in using SessionSynchronization Interface

    afterCompletion()....
    This method is called by the transaction manager after the transaction is committed or rolled back....
    I am confused what is exatly meant by transaction is committed, does it mean that resources transction is complete and what ever resources like entity beans or db rows locked by the transaction are released?????
    thank you in advance
    regards
    Hassan

    Transaction committed means that all changes are permanantly applied to data base by the Resource - manager.
    afterComplition() will return 'true' for successfull transaction.
    -Viren Jasani

  • Problem in using the Unreferenced interface

    I let my RemoteObject to implement the Unreferenced interface to handle with the unexpectly abort client. but I have a question about how to use such interface in my remote object.
    My first thought about it is simple :
    class RemoteObject extends UnicastRemoteObject implements Unreferenced {
        public long lock(final int recno) {
            this.lockedRecNo = recno;
            this.lockCookie = LockManager.getInstance().lock(recno);
            return lockcookie;
        public void unreferenced() {
            this.unlock(this.lockedRecNo, this.lockCookie);
    }I think it is absolutely wrong under such scenario, since the unreference does not take effect immediately and we surely have only one RemoteObject, during this time. someother client may lock on other records, When performing the unreferenced, we may work on the incorrect record number and cookie.
    Then I improved it as
    class RemoteObject extends UnicastRemoteObject implements Unreferenced {
        private HashMap lockedRecord = new HashMap();
        public long lock(final int recno) {
            this.lockedRecNo = recno;
            this.lockCookie = LockManager.getInstance().lock(recno);
            lockedRecord.put(new Integer(recno), new Long(lockCookie))
            return lockcookie;
        public void unlock(final int recno, final int cookie) {
            LockManager.getInstance().unlock(recno, cookie);
            lockedRecord.remove(new Integer(recno));
        public void unreferenced() {
            //get all that haven't released lock from the HashMap
            //do a loop
            **loop** {
            this.unlock(this.lockedRecNo, this.lockCookie);
        }There are still some problems. maybe when we are executing the unreference, there is a client who are holding a lock and doing the update action, then we may wrongly release his lock.
    I can not figure out a good enough way to handle this. can any one help me on this. thx in advance.

    Hi.. Actually, it is not part of the[b] real world problem, I just want to provide a way to clean up the staleness record. If considering this. do you guys thing the approach 2 of the first posting is a way(maybe not a good way), except I should change the hashmap to hashtable to avoid the concurrent accessing... appreciate for any reply from u.

  • I am facing problem regarding graphical user interface. I am using text box for editing files. I want to show the line numbers and graphical breakpoint​s along with text box. Can anybody help me in this? Thanks.

    I am facing problem regarding graphical user interface. I am using text box for editing files. I want to show the line numbers and graphical breakpoints along with text box. Can anybody help me in this? Thanks.

    Thanks for you reply.
    But actually I don't want to show the \ (backslashes) to the user in my text box. 
    Ok let me elaborate this problem little more. 
    I want to show my text box as it is in normal editors e.g. In Matlab editor. There is a text box and on left side the gray bar shows the line numbers corresponding to the text. Further more i want that the user should be able to click on any line number to mark specific line as breakpoint (red circle or any graphical indication for mark). 
    Regards,
    Waqas Ahmad

  • Problem importing two service interfaces using the same data types

    Hi,
    I've been playing around with BPM for a while. Now I wanted to add a custom service interface to my starting event. I created the interface in ESR of CE 7.11. After importing I get this error message and I can't use the interface:
    Cannot change XsdSimpleTypeDefinition AcademicTitleCodeContent by importing the document http://sap.com/xi/APPL/SE/Global::src/wsdl/TestInterface.wsdl, because it is already defined in the document http://sap.com/xi/APPL/SE/Global::src/wsdl/rootwsdl_CustomerERPByIDQueryResponse_InService.wsdl in this project. Importing into another project might be possible.
    Of course the problem is clear, but how can I achieve importing two service interfaces that use the same data type without changing the xsd source?
    Thanks in advance,
    Mane

    Sorry for the late answer, but I am really busy at the moment.
    Unfortunately I can't the Interface and data types are already changed.
    But this happened various times. Each time I already had imported a SAP Enterprise Service into NW BPM that contains a bunch of inline data types. While creating my own interface I referenced one of those data types that are stored in a SAP namespace. After import the error message appeared.
    In the wsdl of the created interface there is a import statement for the namespace where the referenced data types origin from. Additionally there is a namespace definition xmlns:p1="SAPnamespace". In the element the type is "p1:ReferencedType". Could this maybe cause the error, because one time it is with this leading p1 in my created wsdl and once without in the SAP Service wsdl?
    Thanks and I am looking forward to next EhP of NW BPM,
    Mane

  • Using empty interface -- is there a better way to do this?

    Hi,
    I have a set of classes in different projects that I'd like to be referenced together, although they have different methods depending on which project they're from. To do so, I've created an empty interface for each of these classes to implement, so I can return a similar type and then cast it however I need to based on which project I'm using.
    However, I feel the approach of creating an empty interface just isn't the best way to do this. I've looked into annotations, but I don't think they can solve my problem. I don't think I'm being too clear here, so let me give a brief example:
    Here is one of the interfaces I use:
    public interface IceClient {
         public IceOperations operations();
    }Here is the empty interface:
    public interface IceOperations {
    }I have a method which will return a type of IceOperations:
         public static synchronized IceOperations getOperations(String clientName) {
              if (clientMap.containsKey(clientName)) {
                   IceClient client = clientMap.get(clientName);
                   return client.operations();
              } else {
                   System.out.println("No client of that name is currently running.");
                   return null;
         }This is all fine and dandy. I need to instantiate a new IceOperations object in my client code as such, where operations is of type IceOperations:
    operations = new DiagOperations();And finally return it like this, where client.operations() returns a type of IceOperations:
         public DiagOperations operations() {
              return (DiagOperations)client.operations();
         }Anyway I hope that wasn't too confusing. I cannot think of a different way to do this. Is there some way I can do this with annotations? The only other thing I can think of is just returning Object, but that seems ... icky.
    If I need to be clearer, please let me know.
    Thanks

    JoachimSauer wrote:
    I didn't understand them to be trick questions, but rather serious invitations to question and verify your assumptions.
    It might be the fact that every current implementation implements Runnable for some reason (possibly because it starts a Thread on its own). But it's entirely possible that you can produce a completely different implementation that doesn't need the Runnable interface and still be conformant.
    If every implementation of X needs to implement Runnable, then it could be a sign of a slight design smell. Could you give an example where you think it's necessary?Every implementation of my "X" interface is basically a class that acts as a communicator/listener of sorts until it's stopped by the user, similar to a server socket. Sometimes, it has to sit there and wait for events, in which case it obviously must be in its own Thread. Other times it doesn't have to do this; however if I do not start it in its own Thread, I will have to continually stop and restart the communication to invoke operations on the server, which is inefficient.

  • Problems with Java AQ interface migrating 9i to 10g

    Hi!
    I've got problems with Java AQ Interface migrating from 9i DB, JDBC, AQ to 10g rel.2 DB, JDBC, AQ
    First, i started to occasionally receive NullPointerException in Oracle JDBC 9.2.0.8
    java.lang.NullPointerException
    at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:6439)
    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:6203)
    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1557)
    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1543)
    at gpnic.messaging.LDAPMessenger.messageFromRS(Unknown Source)
    We were using 9.2.0.8 JDBC and 9i and 10g databases.
    We decided to go up for 10g r2 JDBC Drivers, and 10.2 AQ but started to get the following errors:
    oracle.AQ.AQOracleSQLException: ORA-25216: invalid recipient, either NAME or ADDRESS must be specified
    ORA-06512: на "SYS.DBMS_AQIN", line 454
    ORA-06512: на line 1
         at oracle.AQ.AQOracleQueue.enqueue(AQOracleQueue.java:1267)
         at gpnic.comm.messaging.transport.AQTransportAdapter$AQDestanation.send(AQTransportAdapter.java:607)
         at gpnic.comm.messaging.transport.OutboundThread.run(OutboundThread.java:83)
    I'm specifying address of an agent, but oracle says I am not.
    I tried both native AQ and JMS interfaces, bot got the same error. I specify recipient the following way:
    'consumer' var contains name of AQ agent and is not null
    native AQ interface:
    aqSess = AQDriverManager.createAQSession(db_conn);
    AQQueue destQ = aqSess.getQueue(schema, queue);
    dequeueOptionsOut = new AQDequeueOption();
    dequeueOptionsOut.setWaitTime(AQDequeueOption.WAIT_NONE);
    dequeueOptionsOut.setConsumerName(consumer);
    dequeueOptionsOut.setDequeueMode(AQDequeueOption.DEQUEUE_REMOVE);
    dequeueOptionsOut.setNavigationMode(AQDequeueOption.NAVIGATION_FIRST_MESSAGE);
    AQMessageProperty mpOut = new AQMessageProperty();
    Vector vRecpt = new Vector();
    vRecpt.add(new AQAgent(consumer, null, 0));
    mpOut.setRecipientList(vRecpt);
    AQMessage aqMsg = null;
    AQEnqueueOption eOpt = null;
    //prepare message
    aqMsg = destQ.createMessage();
    CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
    chMsg.open(CLOB.MODE_READWRITE);
    chMsg.putString(1,msg);
    //creating oracle type message
    gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
    AQObjectPayload payload = aqMsg.getObjectPayload();
    payload.setPayloadData(oraMsg);
    //setting properties
    aqMsg.setMessageProperty(mpOut);
    //do enqueueOut
    eOpt = new AQEnqueueOption();
    destQ.enqueue(eOpt, aqMsg); //<- here AQOracleSQLException is thrown
    JMS interface to Oracle AQ:
    TopicSession session;
    TopicConnection connection;
    TopicPublisher publisher;
    AQjmsAgent[] recipientList;
    connection = AQjmsTopicConnectionFactory.createTopicConnection(db_conn);
         session = connection.createTopicSession(true, Session.CLIENT_ACKNOWLEDGE);
         connection.start();
         Topic topic = ((AQjmsSession) session).getTopic(schema, queue);
         publisher = session.createPublisher(topic);
         recipientList = new AQjmsAgent[1];
         recipientList[0] = new AQjmsAgent(consumer, null);
    CLOB chMsg = CLOB.createTemporary(db_conn, true, CLOB.DURATION_SESSION);
    chMsg.open(CLOB.MODE_READWRITE);
    chMsg.putString(1,msg);
    //creating oracle type message
    gpnic.db.SDSTypes.SdsMsgT oraMsg = new gpnic.db.SDSTypes.SdsMsgT(chMsg);
    AdtMessage adtMessage = ((AQjmsSession)session).createAdtMessage();
    adtMessage.setAdtPayload(oraMsg);
    ((AQjmsTopicPublisher) publisher).publish(adtMessage, recipientList); <- here Exception is thrown
    We tried the following combinations
    9i DB, 9i jdbc, 9i aq - enqueue ok
    10g DB, 9i jdbc, 9i aq - enqueue ok
    10g DB, 10g jdbc, 10g aq - exception is thrown
    Can anyone help?

    Duplicate post, please check Upgrade 9i to 10g

  • How to use local interface in my easy code ?

    hi everybody
    I work on an ejb project. My code is like that to test remote interface (and it works) :
    public class TestStudent {
       Properties properties;
       public TestStudent() {
          properties = new Properties();
          properties.put("java.naming.factory.initial",
          "org.jnp.interfaces.NamingContextFactory");
          properties.put("java.naming.factory.url.pkgs",
          "org.jboss.naming:org.jnp.interfaces");
          properties.put("java.naming.provider.url", "jnp://localhost:1099");
          properties.put("jnp.disableDiscovery", "true");
       public static void main(String[] args) {
          TestStudent beanStudent = new TestStudent();
          beanStudent.createBean();
       public void createBean() throws EJBException {
          try {
             InitialContext context = new InitialContext(properties);
             Object object = context.lookup(StudentHome.JNDI_NAME);
             StudentHome studentHome = (StudentHome) PortableRemoteObject.narrow(object,StudentHome.class);
             Student student = studentHome.create();
             student.setName("pirlouit");
             System.out.println(student.getId());
             System.out.println(student.getName());
          } catch (NamingException e) {
             throw new EJBException(e);
          } catch (RemoteException e) {
             throw new EJBException(e);
          } catch (CreateException e) {
             throw new EJBException(e);
    }Then I do quite the same thing to test local interface like in the following code but it doen't work :
    public class TestStudent {
       Properties properties;
       public TestStudent() {
          properties = new Properties();
          properties.put("java.naming.factory.initial",
          "org.jnp.interfaces.NamingContextFactory");
          properties.put("java.naming.factory.url.pkgs",
          "org.jboss.naming:org.jnp.interfaces");
          properties.put("java.naming.provider.url", "jnp://localhost:1099");
          properties.put("jnp.disableDiscovery", "true");
       public static void main(String[] args) {
          TestStudent beanStudent = new TestStudent();
          beanStudent.createBean();
       public void createBean() throws EJBException {
          try {
             InitialContext context = new InitialContext(properties);
             Object object = context.lookup(StudentLocalHome.JNDI_NAME);
             StudentLocalHome studentLocalHome = (StudentLocalHome)object;
             System.out.println("studentLocalHome is null ? "+studentHome.equals(null));
             StudentLocal student = studentLocalHome.create();
             student.setName("pirlouit");
             System.out.println(student.getId());
             System.out.println(student.getName());
          } catch (NamingException e) {
             throw new EJBException(e);
          } /*catch (RemoteException e) {
             throw new EJBException(e);
          }*/ catch (CreateException e) {
             throw new EJBException(e);
    }The print of "student local home is null ?" give me 'true' which is not the answer I want ... so here is the problem. How can I get my entity bean using local interface ?
    For the moment 've got the exception (which appears on instruction "StudentLocal student = studentLocalHome.create();") :
    Exception in thread "main" java.lang.NullPointerException
         at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
         at $Proxy0.create(Unknown Source)Please help !! Thank you very much !

    Write a JSP to test Local Interface. You cannot call Local Interface from a remote JVM.
    Jay
    http://www.javarss.com - Java News from around the world.
    Visit JavaRSS.com and add above signature to your messages. Thanks!

  • Problem setting up 2 interfaces against the same destination

    Hi,
    I've been trying to to configure one SunFire v240 with two extra ethernet interfaces. I can configure it but all traffic (at least outgoing) still uses only one of the interfaces.
    I can ping both interfaces from another machine. But if I unplug one cable both interfaces are unreachable.
    I did the following to setup the interfaces:
    ifconfig bge1 unplumb
    ifconfig bge1 plumb
    ifconfig bge1 192.168.10.101 netmask 255.255.255.0 broadcast 192.168.10.255 up
    ifconfig bge2 unplumb
    ifconfig bge2 plumb
    ifconfig bge2 192.168.10.102 netmask 255.255.255.0 broadcast 192.168.10.255 up
    netstat -rnRouting Table: IPv4
    Destination Gateway Flags Ref Use Interface
    192.168.10.0 192.168.10.101 U 1 698265 bge1
    192.168.10.0 192.168.10.102 U 1 0 bge2
    136.225.115.0 136.225.115.159 U 1 9602 bge0
    224.0.0.0 136.225.115.159 U 1 0 bge0
    default 136.225.115.2 UG 1 13026
    127.0.0.1 127.0.0.1 UH 301081627713 lo0
    uname -aSunOS v240x763 5.9 Generic_118558-14 sun4u sparc SUNW,Sun-Fire-V240
    ifconfig -alo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
    inet 127.0.0.1 netmask ff000000
    bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
    inet 136.225.115.159 netmask ffffff00 broadcast 136.225.115.255
    bge1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 7
    inet 192.168.10.101 netmask ffffff00 broadcast 192.168.10.255
    bge2: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 8
    inet 192.168.10.102 netmask ffffff00 broadcast 192.168.10.255
    >
    Is there any known problem with this setup?
    Best Regards,
    Christer

    This is due to the routing tables, which in your case
    specifies that all data that heads for the
    192.168.10.0 network will be sent out through bge1.Correct.
    If you want to use both interfaces when sending data,
    you have to trunk them.IPMP is also supported.
    It seems very strange that both interfaces gets
    unreachable if you disconnect one cable.As you mentioned. The interface itself isn't really unreachable. But the reply to any traffic tries to use the other interface so it isn't useable.
    Darren

  • Is JPA discourages use of interface?

    Hello,
    I am working in J2EE since last 3-4 months. Currently understanding (or i should say it learning) JPA.
    As per my knowledge, JPA does not support use of interface(as a persistent attribute) in entity classes. I tried to get information about it, but in vain. Few people suggested to have a look at EclipseLink, but i am against using any vendor specific features.
    And not using interface is bad practice, right?
    As Erich Gamma said Program to an interface not to an implementation. Now that is not possible with JPA right?
    So,
    Is there any workaround?
    What is your approach?
    Or
    People just accepted it.
    -Nachiket

    N_i_X wrote:
    Hello,
    I am working in J2EE since last 3-4 months. Currently understanding (or i should say it learning) JPA.
    As per my knowledge, JPA does not support use of interface(as a persistent attribute) in entity classes. What state does an interface have that needs to persist? I thought that interfaces were about behavior, not state. If we agree on that, how does it make sense to persist an interface?
    I tried to get information about it, but in vain. Few people suggested to have a look at EclipseLink, but i am against using any vendor specific features.You can use JPA-only features and still stick with EclipseLink as your implementation. You have to choose SOMEBODY'S implementation.
    And not using interface is bad practice, right?Depends. Overuse can be as bad as underuse. The trick is the getting the right usage for your problem. Any persistent class that needs inheritance should be concrete, in which case you have the usual choices for persistence: one table per hierarchy, one table per concrete subclass, etc.
    As Erich Gamma said Program to an interface not to an implementation. Now that is not possible with JPA right?I think it's dangerous to accept statements as dogma.
    Is there any workaround?See above. I think persistent classes need to be concrete. Programming to an interface is very good, but not in the case of a persistent class. Those with persistent state need to be concrete.
    %

  • Unusual use of interface defining static factory class with getInstance

    This question is prompted by a recent New to Java forum question ask about the differences between Interfaces and Abstract classes. Of course one of the standard things mentioned is that interfaces cannot actually implement a method.
    One of my past clients, one of the 500 group, uses interfaces as class factories. The interface defines a pubic static class with a public static method, getInstance, that is called to generate instances of a class that implements the interface.
    This architecture was very object-oriented, made good use of polymorphism and worked very well. But I haven't seen this architecture used anywhere else and it seemed a little convoluted.
    Here is a 'pseudo' version of the basic interface template and use
    -- interface that defines public static factory class and getInstance method
    public interface abc {
        public static class FactoryClass
            public static abc getInstance ()
                return (abc) FactoryGenerator(new abcImpl(), abc.class);
    -- call of interface factory to create an instance
    abc myABC = abc.Factory.getInstance();1. Each main functional area ('abc' in the above) has its own interface factory
    2. Each main functional area has its own implementation class for that interface
    3. There is one generator (FactoryGenerator) that uses the interface class ('abc.class') to determine which implementation class to instantiate and return. The generator class can be configured at startup to control the actual class to return for any given interface.
    I should mention that the people that designed this entire architecture were not novices. They wrote some very sophisticated multi-threaded code that rarely had problems, was high performance and was easy to extend to add new functionality (interfaces and implementing classes) - pretty much plug-n-play with few, if any, side-effects that affected existing modules.
    Is this a best-practices method of designing factory classes and methods? Please provide any comments about the use of an architecture like this.

    Thanks for the feedback.
    >
    I don't see how 'the generator class can be configured at startup to control the actual class to return for any given interface' can possibly be true given this pseudo-code.
    >
    I can see why that isn't clear just from what is posted.
    The way it was explained to me at the time is that the interface uses standard naming conventions and acts like a template to make it easy to clone for new modules: just change 'abc' to 'def' in three places and write a new 'defImpl' class that extends the interface and the new interface and class can just 'plug in' to the framework.
    The new 'defImpl' class established the baseline functionality that must be supported. This line
    return (abc) FactoryGenerator(new abcImpl(), abc.class);uses the initial version of the new class that was defined, 'abcImpl()', when calling the FactoryGenerator and it acted as a 'minimum version supported'. The generator class could use configuration information, if provided, to provide a newer class version that would extend this default class. Their reasoning was that this allowed the framework to use multiple versions of the class as needed when bugs got fixed or new functionality was introduced.
    So the initial objects would be an interface 'abc' and a class 'abcImpl'. Then the next version (bug fixes or enhancements) would be introduced by creating a new class, perhaps 'abcImpl_version2'. A configuration parameter could be passed giving 'abcImpl' as the base class to expect in the FactoryGenerator call and the generator would actually create an instance of 'abcImpl_version2' or any other class that extended 'abcImpl'.
    It certainly go the job done. You could use multiple versions of the class for different environments as you worked new functionality from DEV, TEST, QA and PRODUCTION environments without changing the basic framework.
    I've never seen any Java 'pattern' that looks like that or any pattern where an interface contained a class. It seemed really convoluted to me and seems like the 'versioning' aspect of it could have been accomplished in a more straightforward manner.
    Thanks for the feedback. If you wouldn't mind expanding a bit on one comment you made then I will mark this ANSWERED and put it to rest.
    >
    I don't mind interfaces containing classes per se when necessary
    >
    I have never seen this except at this one site. Would you relate any info about where you have seen or used this or when it might be necessary?

  • Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage -- Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.

    Adobe Reader XI (11.0.08) doesn't create thumbnail (bitmap) using Microsoft Interface IExtractImage --> Extract on Windows Server 2008 R2, when exe to generate thumbnail is launched from Windows service.
    But if exe is launched as standalone, then interface IExtractImage --> Extract, gives Bitmap to generate thumbnail of PDF document.
    Above problem occurs only for PDF documents, if we tried same with other software like CAD -CATIA it works without any problem.
    Is there any security concerns form PDF side, which doesn't allow to generate Bitmaps, if exe to generate it is launched form Windows service.

    It might be deliberate, Acrobat and Reader software is not intended to run in a service environment.

  • To use the interface creating a container

    Hello,
    I read around that is normal thing write Set<String> set = new HashSet<String>() in place of HashSet<String> set = new HasSet<String>(); I read the same with other containers too (Map = new HashMap, List = new ArrayList). I don't understand the real importance. Moreover, If I got something right, the interface "could" not have "few" method of the implementation......(and in this case I suppose I really can't use the interface.....)
    thanks.

    mickey0 wrote:
    I read around that is normal thing write Set<String> set = new HashSet<String>() in place of HashSet<String> set = new HasSet<String>();Just to add to George's good advice, the basic reason is that if you decide later on that your Set is better off as a TreeSet instead of a HashSet, you can simply change the assignement to
    Set<String> set = new TreeSet<String>();indeed, since all your methods will likely be coded to take Sets if you used the above method, you could probably change it to
    NavigableSet<String> set = new TreeSet<String>();without any problems.
    Moreover, If I got something right, the interface "could" not have "few" method of the implementation......(and in this case I suppose I really can't use the interface.....)The only method that HashSet has that Set doesn't is 'clone()'. Obviously, when choosing the interface, it should be as close as possible to to the capabilities you need.
    Winston

  • Idlj java compile problem from badly named interfaces in idl

    I am trying to build a java client to communicate with an application using corba interfaces.
    The large/complex idl I am using to build all the client stubs has interface names that seem to cause problems for the generated java. For example there is an interface in the idl called 'Device' as well as an interface called 'DeviceOperations'. This causes problems because idlj creates java interfaces with the word 'Operations' appended to it.
    So I get a bunch of weird results in my generated java which has many compiler errors.
    Unfortunately I cannot change the idl because it is not an application I work on directly.
    Any suggestions?
    Thanks!

    My guess is that you are between a rock and a hard place unless you can 1) change the IDL or 2) change how the IDL is compiled. You have said you can't do the former, so maybe you can influence the latter (unfortunately for you, I suspect not). On the change you can, keep reading.
    IDL only creates interfaces such as DeviceOperations if you compile the IDL using the Tie model. But you would definitely have a problems since 1) the IDL has an interface called Device and DeviceOperations and as a result will create java files Device.java and DeviceOperations.java and 2) the Tie model will want to create two interfaces, DeviceOperations.java and DeviceOperationsOperations.java. I suspect that the second interface compiled by the IDL compiler will be the winner the first one will be overwritten).
    If you can, change the IDL compilation to that you do not use the Tie model. However, you said you have no ability to change the IDL, so you also may not have the ability to change how it is compiled, so I am not sure if this is practical advice. I can't imagine that this application ever successfully used both interfaces.

Maybe you are looking for

  • Month display

    When iCal is in the month view, the current month is displayed. There is no option in which to display the current day position, it is simply whenever it occurs during the month. For instance, in the last week of the month, the current date is in the

  • Ipad mini 3 can't sync with microsoft exchange email (iphone 6 can)

    I have an iPhone 6 and iPad mini 3 (verizon). Both are set up the exact same. At work, I am able access Microsoft Exchange email using the iPhone mail app with wifi. (I work underground and have no access to cell service) However, the iPad Mini will

  • Photoshop problem after 1.5.1 update

    Since installing the Aperture 1.5.1 update and the Camera Raw update, Photoshop CS2 won't open a file if there is a disc in either my Superdrive or Firewire disc drive. I get the Application not responding message in Force Quit. As soon as I eject th

  • Vendor/customer for plants

    Hi! I always forget, where can I enter a vendor or a customer code for plants. It is a 4.6c R/3 SAP. Can anyone please help me out? Thank you Tamá

  • Inconsistent insert behavior

    Please help. 1. The following code snippet does not work properly: <td colspan="3">Contact relationship to peer educator</td> <td> </td> </tr> <tr> <td> <?php if (isset($_POST['Contact2Peer']) && is_array($_POST['Contact2Peer'])) { echo '$_POST[\'Con