Archive for the 'Books' Category
Jan 23, 2012 in Books, Cloud_Computing

Cloud Computing Bible
By: Barrie Sosinsky
Publisher: John Wiley & Sons
Pub. Date: January 11, 2011
Print ISBN: 978-0-470-90356-8
Web ISBN: 0-470903-56-2
Pages in Print Edition: 525
Comments Off on Notes on book “Cloud Computing Bible” ..
Jul 02, 2009 in Books, Java, Software, WebServices
This book is a bit old.. 2002..


- — SOA – Service Oriented Architecture
— 3 major roles: Provider, Registry (Broker) and Requester.
— SOA is based on web services.
- — SOAP – Simple Object Access Protocol
— 2 major methods: Message-based Document Exchange AND RPC
(Remote Procedure Calls).
— All structures based on XML.
— A SOAP message contains an Envelope and a Header.
— A SOAP message may contain (MIME) attachments.
— Main transport protocol is HTTP(S).
— Providers (Receivers) are usually based on Servlets.
- — SOAP-RPC
— Method signatures contain a single SOAP structure.
— SOAP service methods must match info in deployment descriptor.
— Errors and Faults: VersionMismatch, MustUnderstand, DTDNotSupported, etc..
- — WSDL – Web Services Description Language
— WSDL is an XML grammar for describing a web service
as a collection of access end-points capable of exchanging
messages in a procedure- or document-oriented fashion (p. 72)
— The reasonable flow is to create service methods and
than generate WSDL from code using tools.
— Best practices: web service is (functionally) coarse-grained
and messages are more business-oriented than programmatic.
- — UDDI – Universal Description, Discovery and Integration
— Similar to an Internet search engine for businesses.
— UBR – UDDI Business Registry (the Public Cloud).
— Designed for B2B mostly.
— 2 APIs: inquiry and publishing API.
— JAXR = Java API for XML Registries.
— Some details: Categorization (NAICS, ISO, etc..),
Identifier (DUNS, Thomas Reg, etc),
tModel (web service metadata)
- — JAX-RPC and JAXM
— JAXM = Java API for XML Messaging.
— JAX-RPC = Java API for XML-based RPC.
— JAXM may be used as a frontend to SOAP-based messaging
frameworks through the use of “profiles”.
— JAX-RPC covers code generation for client and server parts,
dynamic SOAP, creating services within J2EE and J2SE environments,
bindings, serialization, mapping of datatypes between WSDL and Java,
etc..
- — The Java Web Service (JWS) Standard
— Proposed by BEA, using templates to create simple web services.
— Example (HelloWorld.jws <- note the .jws extension)
Note the annotations @operation, @conversation ..
import com.bea.jws.*
public class HelloWorld extends Service {
/**
* @operation
* @conversation stateless
*/
public String getHelloWorld() {
return "Hello, World!";
}
}
Other values for @conversation are ‘start’, ‘continue’ or
‘finish’. The ‘start’ directive, for example, starts a session.
- — Security notes
— Use of SSL (HTTPS), encryption, signing and secure hashing.
— Security Assertion Markup Language (SAML) – used with Single Sign-On (SSO).
- — Resources
http://aws.amazon.com/
http://seekda.com/
http://www.programmableweb.com/
http://www.webservices.org/
http://xmethods.com/
Colophon – European (Alpine) Ibex – a wild goat.
Comments Off on Notes on “Java Web Services” ..
Jun 18, 2009 in Books, Java, JavaUsage
SOAP – Simple Object Access Protocol
WSDL – Web Services Description Language
UDDI – Universal Discovery, Description and Integration
Major characteristics:
— XML-Based
— Loosely coupled – interfaces may change without loss of service.
— Coarse-grained – provide high-level business functions.
— Both synchronous and Asynchronous
— Supports RPC (Remote Procedure Calls)
— Supports document exchange
Comments Off on Notes from ‘Java Web Services’ book ..
Sep 07, 2008 in Books, Java, lucene

Lucene in Action
ERIK HATCHER
OTIS GOSPODNETIC
MANNING
Greenwich
Ch. 1 – Introduction
- Lucene is a high performance, scalable Information Retrieval (IR) library.
- Lucene’s creator is Doug Cutting.
- Creating an index – see ‘Indexer.java’ (in ‘Files’, top right tabs)
- Indexing API:
— IndexWriter
— Directory (RAMDirectory)
— Analyzer
— Document
— Field
- Searching an index – see ‘Searcher.java’ (in ‘Files’, top right tabs)
- Searching API:
— IndexSearcher
— Term
— Query
— TermQuery
— Hits
Ch. 2 – Indexing
Comments Off on Notes from ‘Lucene in Action’ ..
May 14, 2005 in Books, Java, Uncategorized


- — Basic network read pattern:
Socket socket = new Socket("someserver.com", 5000);
InputStreamReader isr = new InputStreamReader(socket.getInputStream());
BufferedReader reader = new BufferedReader(isr);
String message = reader.readLine();
— Basic network write pattern:
Socket socket = new Socket("someserver.com", 5000);
PrintWriter writer = new PrintWriter(socket.getOutputStream());
writer.println("message to send");
- — Basic thread pattern
public class RunnableJob implements Runnable {
public void run() {
...
}
}
RunnableJob rj = new RunnableJob();
Thread thread = new Thread(rj);
thread.start();
- — Thread data access synchronization
— If we synchronize two static methods in a single
class, a thread will need the class lock to enter either
of the methods.
- — Collections
— ArrayList
— TreeSet – elements sorted, no duplicates.
— HashMap – name/value pairs.
— LinkedList – better performance for insert and delete of elements.
(better for large data sets)
— HashSet – no duplicates, fast search by key.
— LinkedHashMap – same as HashMap plus preserves order of addition.
- — Basic sorting pattern:
ArrayList slist = new ArrayList();
slist.add("a string");
slist.add("...");
Collections.sort(slist);
New classes to be used with ArrayList must implement
“Comparable” (self compare).
See the use of a comparator (call it MyCompare) which
implements the compare(MyObject, MyObject)
method, like this:
Collections.sort(theList, new MyCompare());
- — Collection types summary:
— List – sequence.
— Set – uniqueness.
— Map – key search.
- — HashSet duplicate check methods:
hashCode(), equals().
- — Control on polymorphic ‘collection type’ usage..
public void takeAnimals(ArrayList<? extends Animal> animals) {
...
animals.add(someAnimal); // <-- add is forbidden by the '?' wildcard
}
- -- Static nested classes have access to static variables
of the enclosing class.
-- Anonymous nested classes have peculiar syntax capabilities:
button.addActionListener(new ActionListener() {
public void actionPerformed() {
System.exit(0);
}
}
);
ActionListener is not a class, is an interface but in
this context the 'new' instruction means 'create an
anonymous class and implement the ActionListener
interface'.
- -- Access levels and modifiers:
-- public - access by anybody.
-- protected - same package + subclasses in or out of
the same package.
-- default - same package only.
-- private - same class only.
- -- Enumerations - a set of constant values that
represent the only valid values for a variable.
public enum Members { JERRY, BOBBY, PHIL };
public Members bandMember;
...
if (bandMember == Members.JERRY) {
...
}
Comments Off on Notes (Part 3) from HeadFirst Java..
May 08, 2005 in Books, Java, Software


- — Some methods of class Object
equals(), getClass(), hashCode(), toString().
- — A way of thinking about superclasses vs interfaces:
Superclasses implement types, interfaces implement roles.
- — About the Constructor
— It is used to initialize the state of a new object.
— If none is written, the compiler will create a default one (with no args.)
— If one is written (any one) the compiler will not supply the default one.
.. ergo ..
— If a no-arg one is wanted and there is at least another one, the default
one must be written.
— It is good to always supply a default one with default values.
— Overloaded ones must have different arguments (just like any other method).
— Argument list concept includes order and/or type of arguments.
— If the nature of the class is such that the object MUST be initialized
(such as the Color class), do not write a default one.
- — Every constructor can call super() or this() but never both.
- — To prevent a class from being instantiated into objects,
mark the constructor ‘private’. For example, many ‘utility’
classes have only ‘static’ methods and they should not be
instantiated.
- — Finals..
— A final variable cannot have its value changed.
— A final method cannot be overriden.
— A final class cannot be extended.
- — Serialization..
— Write object basic pattern:
.. class SomeClass implements Serializable ..
SomeClass sc = new SomeClass();
try {
FileOutputStream fs = new FileOutputStream("sc.ser");
ObjectOutputStream oos = new ObjectOutputStream(fs);
oos.writeObject(sc);
oos.close();
}
catch(Exception exc) {
...
}
— If a variable in a ‘Serializable’ class cannot (or should not)
be serialized, it must be marked ‘transient’.
— Read object(s) basic pattern:
FileInputStream fis = new FileInputStream("foo.ser");
ObjectInputStream ois = new ObjectInputStream(fis);
Object one = ois.readObject();
Object two = ois.readObject();
...
SomeClass sc = (SomeClass) one;
SomeOtherClass soc = (SomeOtherClass) two;
...
ois.close();
— Static variables are not serialized.
— Class changes (versions) may break serialization.
- — Java new IO (nio) features
— IO performance improvements by using
native IO facilities.
— Direct control of buffers.
— Non-blocking IO capabilities.
— Existing ‘File[Input|Output]Stream classes
use NIO internally. Some NIO features may be
accessed via the ‘channels’.
Comments Off on Notes (Part 2) from HeadFirst Java..
Apr 08, 2005 in Books, Java, language
Notes from HeadFirst Java by Kathy Sierra & Bert Bates


- — A method uses parameters. A caller passes arguments.
- — All arguments are passed by value. References too
but, as opposed to primitive parameters, references
may be dereferenced and values in objects pointed to
by the references can be changed.
- — Instance variables are declared inside a class (not in a method).
Instance variables get default values.
- — Local variables are declared within a method.
They must be initialized.
- — crossword puzzle p.162
1a. I can’t behave – primitive
6a. Or, in the courtroom – object
7a. Where it’s at, baby – indexof
9a. A forks’ origin – if
21a. 19’s counterpart (?) (Arrays extent) – length
2d. Where the Java action is (What’s overridable?) – method
3d. Addressable unit – element
15d. As If – Virtual
- — Inheritance tree design guidelines
1. Look for objects that have common attributes and behaviors.
2. Design a class that represents the common state and behavior.
3. Decide if a subclass needs behaviors (method implementations)
that are specific to that particular subclass type.
4. Look for more opportunities to use abstraction, by finding
two or more subclasses that might show common behavior.
5. Finish the class hierarchy.
- — The ‘Is-a’ and ‘has-a’ tests.
- — DO use inheritance if:
— A class is a more specific type of a superclass.
— There is common behavior shared among classes.
- — DO NOT use inheritance:
— Just to reuse code from another class.
— If the subclass does not pass the IS-A test with the superclass.
- — An abstract class is a class that is declared abstract—it may
or may not include abstract methods.
- — Abstract classes cannot be instantiated, but they can be subclassed.
- — An abstract method is a method that is declared without an
implementation (without braces, and followed by a semicolon)
.. In Other Words ..
- — An abstract class can only be used to be extended.
- — An abstract method can only be used to be overridden .
- — An abstract method does not have a body .
- — A single method marked ‘abstract’ forces the class to become ‘abstract’.
- — An abstract class may have both abstract and non-abstract methods.
- — All abstract methods must be implemented by subclasses.
- — Non-abstract classes are “Concrete” and can be instantiated.
Abstract Classes versus Interfaces
From http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html
- — Unlike interfaces, abstract classes can contain fields that are not static and final,
- — and they can contain implemented methods.
- — Such abstract classes are similar to interfaces, except that they provide a
partial implementation, leaving it to subclasses to complete the implementation.
- ** If an abstract class contains only abstract method declarations,
it should be declared as an interface instead.
- — Multiple interfaces can be implemented by classes anywhere
in the class hierarchy, whether or not they are related to one
another in any way. Think of Comparable or Cloneable, for example.
- — By comparison, abstract classes are most commonly subclassed
to share pieces of implementation. A single abstract class is subclassed
by similar classes that have a lot in common (the implemented parts of
the abstract class), but also have some differences (the abstract methods).
Comments Off on Notes (Part 1) from HeadFirst Java..