Academic Tutorials



English | French | Portugese | German | Italian
Home Advertise Payments Recommended Websites Interview Questions FAQs
News Source Codes E-Books Downloads Jobs Web Hosting
Chats

ILU
Ilu Introduction
ILU Fixing the Implementation
ILU ISL Types
ILU Info
ILU with ANSI C
ILU with Java
ILU Exceptions
ILU OMG IDL
ILU General Info
ILU with Java Part - 2
ILU with Python
ILU Network Service
ILU OMG IDL Part - 2
ILU with Python - Part 2
ILU with Python - Part 3

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting
Network Sites


Using ILU With Java


Previoushome Next






Tutorial2Server.java



A D V E R T I S E M E N T

/*
 * Run this like
 * java Tutorial2.Tutorial2Server servername
 */ 
 
package Tutorial2;

import xerox.ilu.Ilu;
import xerox.ilu.IluSystemException;
import xerox.ilu.IluServer;


class Factory2Impl implements Tutorial2.Factory {
    
    public Factory2Impl() {
    }
    
    public Tutorial.Calculator CreateCalculator() 
                        throws xerox.ilu.IluSystemException {
        System.out.println("Factory2Impl: request for a simple calculator");
        return new Tutorial2.TapeCalculatorImpl();
    } //CreateCalculator
    
    public Tutorial2.TapeCalculator CreateTapeCalculator() 
                throws xerox.ilu.IluSystemException {
        System.out.println("Factory2Impl: request for a tape calculator");
        return new Tutorial2.TapeCalculatorImpl();
    } //CreateTapeCalculator
    
} //Factory2Impl


public class Tutorial2Server {
    static Factory2Impl factory;
    static xerox.ilu.IluServer trueServer;
    
    public static void main(String argv[]) {
        String serverId;
        if (argv.length != 1) {
            System.err.println("usage: java Tutorial2.Tutorial2Server servername");
            System.exit(1);
        }
        System.out.println("Create the server");
        try {
            //Create a server with appropriate server id (which is
            //taken from the first argument) 
            serverId = argv[0];
            trueServer = xerox.ilu.IluServer.createServer(serverId);
        } catch (xerox.ilu.IluSystemException e) {
            System.err.println("Failed creating server: " + e);
            System.exit(1);
        }
        System.out.println("Create the factory");
        try {
            //Now create an instance of a Factory object on the server
            //with an instance handle "theFactory"
            factory = new Factory2Impl();
            Tutorial2.FactoryStub.registerTrueObject( 
                "theFactory", 
                factory, 
                trueServer
                );
            //Make the factory well known by publishing it
            xerox.ilu.IluSimpleBinding.publish(factory);
        } catch (xerox.ilu.IluSystemException e) {
            System.err.println("Failed creating Factory: " + e);
            System.exit(1);
        }
        //Now we print the string binding handle (the object's name
        //plus its location) of the new Factory instance
        System.out.println("Factory instance published");
        System.out.println("Its SBH is '" + Ilu.sbhOfObject(factory) + "'");
        //the program doesn't terminate because the server is still alive...
    } //main 
    
} //Tutorial2Server

 



simple4.java


 
/*
 * A simple client program that finds the TapeCalculator-Factory,
 * creates a calculator and executes the users input.
 */ 

/*
 * Run this like
 * java Tutorial2.simple4 serverId
 */ 

package Tutorial2;

public class simple4 {
    
    /* We define a new routine, "Get_Tutorial_Calculator", which 
     * finds the tutorial factory, then creates a new TapeCalculator
     * object for us.
     */
    public static Tutorial2.TapeCalculator 
    GetTutorialTapeCalculator(String serverId, String factoryId) {
        Tutorial2.Factory factory = null;
        Tutorial2.TapeCalculator calc = null;
        System.out.println("Looking up factory");
        try {
            /* We have to call lookup with the object ID of
             * the factory object, and the "type" of the object we're looking
             * for.
             */
            factory = (Tutorial2.Factory) 
                            xerox.ilu.IluSimpleBinding.lookup(
                    serverId, 
                    factoryId, 
                    Tutorial2.FactoryStub.iluClass()
                    );
        } catch (xerox.ilu.IluSystemException e) {
            System.err.println("Failed to get factory: " + e);
            System.exit(1);
        }
        if (factory==null) {
            System.err.println("Got null factory");
            System.exit(1);
        } 
        System.out.println("Got factory " + factory);
        System.out.println("Looking up TapeCalculator");
        try {
            calc = factory.CreateTapeCalculator();
        } catch (xerox.ilu.IluSystemException e) {
            System.err.println("Failed to get TapeCalculator: " + e);
            System.exit(1);
        }
        if (calc==null) {
            System.err.println("Got null TapeCalculator");
            System.exit(1);
        }
        System.out.println("Got TapeCalculator " + calc);
        return calc;
    } //GetTutorialTapeCalculator
     
     
    static String opNames[]
        = {"SetValue", "Add", "Subtract", "Multiply", "Divide"};
    
    static double argToDouble(String inputLine) {
        return Double.valueOf(inputLine.substring(1)).doubleValue();
    } //argToDouble


    public static void main(String argv[]) {
        Tutorial2.TapeCalculator calc;
        Tutorial2.Operation[] tape;
        boolean quitFlag = false;
        double value = 0.0;
        String line;
        java.io.DataInputStream sysIn = 
            new java.io.DataInputStream(System.in);

        if (argv.length < 1) {
            System.err.println("USAGE: java Tutorial2.simple4 serverid");
            System.exit(1);
        }
        //Find a calculator
        String serverId = argv[0];
        calc = GetTutorialTapeCalculator(serverId, "theFactory");
        if (calc==null) {
            System.err.println("Didn't get a calculator");
            System.exit(1);
        }
        System.out.println("Got tape calculator");
        try {
            //Clear the calculator before using it
            calc.SetValue(0.0);
            //Loop over user inputs and perform the requested operation
            while (!quitFlag) {
                value = calc.GetValue();
                System.out.print(value + "\n> "); System.out.flush();
                line = sysIn.readLine();
                if (line == null) line = "q";   
                switch (line.charAt(0)) {
                    case '\n':
                        break;
                    case '+':
                        value = argToDouble(line);
                        calc.Add(value);
                        break;
                    case '-':
                        value = argToDouble(line);
                        calc.Subtract(value);
                        break;
                    case '*':
                        value = argToDouble(line);
                        calc.Multiply(value);
                        break;
                    case '/':
                        try {
                            value = argToDouble(line);
                            calc.Divide(value);
                        } catch (Tutorial.DivideByZero e) {
                            System.out.println("** division by zero " + e);
                        }
                        break;
                    case 'q':
                        quitFlag = true;
                        break;
                    case 't':
                        tape = calc.GetTape();
                        for (int i = 0; i <  tape.length; i++) {
                           System.out.println("  " 
                                   + opNames[tape[i].op.value()]
                                   + "(" + tape[i].value + ") => "
                                   + tape[i].accumulator
                                   );
                        }
                        break;
                    case 'c':
                        calc.SetValue(0.0);
                        break;
                    default:
                        System.out.println("Invalid Operation <" + line + ">");
                        System.out.println("Valid ops are +, -, *, /, "
                            + "t (for tape),"
                            + "c (for clear),"
                            + "q (for quit),"
                            );
                }
            }
        } catch (java.io.IOException e) {
            System.err.println("Example raised IOException: " + e);
        } catch (xerox.ilu.IluSystemException e) {
            System.err.println("Example raised IluSystemException: " + e);
        }
    } //main
    
} //simple4

 



Tutorial.idl


module Tutorial {

  exception DivideByZero {};

  interface Calculator {
 
    // Set the value of the calculator to `v'
    void SetValue (in double v);
    // Return the value of the calculator
    double GetValue ();
    // Adds `v' to the calculator's value
    void Add (in double v);
    // Subtracts `v' from the calculator's value
    void Subtract (in double v);
    // Multiplies the calculator's value by `v'
    void Multiply (in double v);
    // Divides the calculator's value by `v'
    void Divide (in double v) raises (DivideByZero);
  };

  interface Factory {

    // Create and return an instance of a Calculator object
    Calculator CreateCalculator();
  };
};

 



Tutorial2.idl


#include "Tutorial.idl"

module Tutorial2 {

  enum OpType { SetValue, Add, Subtract, Multiply, Divide };

  struct Operation {
    OpType op;
    double value;
    double accumulator;
  };

  typedef sequence<Operation> RegisterTape;

  // A four function calculator with a register tape
  interface TapeCalculator : Tutorial::Calculator {

    RegisterTape GetTape ();
  };

  // A factory that produces TapeCalculators
  interface Factory : Tutorial::Factory {

    TapeCalculator CreateTapeCalculator ();
  };
};

 



Index of Concepts




Be the first one to comment on this page.




  ILU eBooks

No eBooks on ILU could be found as of now.

 
 ILU FAQs
More Links » »
 
 ILU Interview Questions
More Links » »
 
 ILU Articles

No ILU Articles could be found as of now.

 
 ILU News

No News on ILU could be found as of now.

 
 ILU Jobs

No ILU Articles could be found as of now.


Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • connotea
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Netvouz
  • RawSugar
  • Reddit
  • scuttle
  • Shadows
  • Simpy
  • Smarking
  • Spurl
  • TailRank
  • Wists
  • YahooMyWeb

Previoushome Next

Keywords: Using ILU with Java, ILU, ILU, ILU tutorial, ILU tutorial pdf, history of ILU, Custamizing Style Sheet, learn ILU

HTML Quizzes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizzes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizzes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizzes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizzes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizzes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building Quizzes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizzes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizzes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizzes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizzes
Oracle Quiz
MySQL Quiz
Operating System Quizzes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizzes
Testing Quiz
Firewalls Quiz
SAP Module Quizzes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizzes
Corba Quiz
Networking Quiz
Microsoft Office Quizzes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizzes
Financial Accounting Quiz
Managerial Accounting Quiz
Testimonials | Contact Us | Link to Us | Site Map
Copyright ? 2008. Academic Tutorials.com. All rights reserved Privacy Policies | About Us
Our Portals : Academic Tutorials | Best eBooksworld | Beyond Stats | City Details | Interview Questions | Discussions World | Excellent Mobiles | Free Bangalore | Give Me The Code | Gog Logo | Indian Free Ads | Jobs Assist | New Interview Questions | One Stop FAQs | One Stop GATE | One Stop GRE | One Stop IAS | One Stop MBA | One Stop SAP | One Stop Testing | Webhosting in India | Dedicated Server in India | Sirf Dosti | Source Codes World | Tasty Food | Tech Archive | Testing Interview Questions | Tests World | The Galz | Top Masala | Vyom | Vyom eBooks | Vyom International | Vyom Links | Vyoms | Vyom World | Important Websites
Copyright ? 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.