tijiebo.comtijiebo.com/material/is2103/is2103 - summary.docx · web viewinterface and enterprise...
TRANSCRIPT
QUICK REFERENCE GUIDE
Chapter 2 – Distributed Computing
Remote Method Invocation (RMI)
Use: RMI is a mechanism for enabling an object in one JVM to communicate remotely with an object in another JVM. With RMI, objects can be called remotely, resources can be shared and processing load distributed over a number of computers. RMI also promotes location transparency
Execution:
1. Server binds an object to a name via Naming.rebind(“AddServer”, addServerImpl);2. Generate stub and skeleton (definitions in Lecture 1 pg 14)3. Start RMI registry via start rmiregistry in the command prompt4. Client looks up AddServer in registry via
Naming.lookup(“rmi://<IP of server, 127.0.0.1 for local>/AddServer”);
Imports
java.rmi.Naming To call Naming class methodsjava.rmi.Remote public interface AddServer extends Remote { … java.rmi.RemoteException To allow throwing of RemoteExceptionJava.rmi.server.UnicastRemoteObject Defines a non-replicated remote object whose references are valid
only while server process is alivepublic class AddServerImpl extends UnicastRemoteObject implements AddServer {
Reference: Textbook pg 16 – 18
Java Naming Directory Interface (JNDI)
Use: Allow Java based clients to access any naming and directory services with a common API
Execution:
1. Server creates initial context: Properties props = new Properties(); props.put(ServerApp.FACTORY, ServerApp.FACTORY_NAME); props.put(ServerApp.PROVIDER, ServerApp.PROVIDER_URL);
2. Bind object to initial context: InitialContext ic = new InitialContext(props); ic.rebind(“AddServer”, addServerImpl);
3. Client uses context path provided as to call object AddServer addServer = (AddServer) PortableRemoteObject.narrow(ic.lookup(“AddServer”), AddServer.class);
Imports
javax.naming.Context To create initial context as in Context(or InitialContext) ic = new InitialContent(props);javax.naming.InitialContext
javax.naming.NamingException To catch problems looking for server IPjava.util.Properties To set path urljavax.naming.NamingEnumerationjavax.rmi.PortableRemoteObject Used instead of UnicastRemoteObject in rmi
Reference: Textbook pg 27 – 29
1
Used as a market by JVM to indicate AddServer as a remote object
QUICK REFERENCE GUIDE
Chapter 3 – RMI-IIOP
Definitions:
- CORBA (Common Object Request Broker Architecture): distributed-objects programming model implemented to support remote method invocation among objects written in different language
- IIOP (Internet Inter0Object-Request-Broker Protocol): client apps need not be written in Java to call a Java written server
Use: Objects in RMI-IIOP communicate via CORBA 2.3-compliant ORB, using the IIOP to communicate between servers and clients. Makes use of the JNDI API to register and locate objects
Execution:
1. Server creates initial context: Properties props = new Properties(); props.put(ServerApp.FACTORY, ServerApp.FACTORY_NAME); props.put(ServerApp.PROVIDER, ServerApp.PROVIDER_URL);
2. Bind object to initial context: InitialContext ic = new InitialContext(props); ic.rebind(“AddServer”, addServerImpl);
3. Generate Stub and Tie classes that supports the IIOP protocol: rmic –iiop <package.implFile>4. Start Transient Name Server via start tnameserv5. Client uses context path provided as to call object
AddServer addServer = (AddServer) PortableRemoteObject.narrow(ic.lookup(“AddServer”), AddServer.class);
Imports
javax.naming.Context To create initial context as in Context(or InitialContext) ic = new InitialContent(props);javax.naming.InitialContext
javax.naming.NamingException To catch problems looking for server IPjava.util.Properties To set path urljavax.naming.NamingEnumerationjavax.rmi.PortableRemoteObject Used instead of UnicastRemoteObject in rmi
Reference: Textbook pg 32 – 36
2
QUICK REFERENCE GUIDE
Chapter 4 – Enterprise JavaBeans
An Enterprise Bean is a server side component that encapsulates all the business methodsUse javax.ejb to define an enterprise bean
- The EJB standard is a specification and not a product- It defines the rules on how to structure and write components - It also defines the agreement between components and application servers so that developed
components can run in any vendor-produced application server- Full definition refer to Lecture: Enterprise JavaBeans pg 3
Middleware takes care of other services that are essential for the execution of beans. These services include database integrity checks, security, transactions, etc. with middleware, the design of enterprise beans does not have to explicitly take care of these services since they are now delegated to the middleware.
- Implicit: Usage of middleware services is declared through a separate descriptor text-file, or coded within an enterprise bean using annotation
- Explicit: Write every middleware yourself
Further examples Textbook pg 40
EJB Component Types:
1. Client Objects e.g. servlets, JSP pages2. Server Objects e.g. message driven beans, manager beans, session beans collectively Enterprise
Beans3. EJB Container: responsible for managing enterprise beans
o Does a lot of middleware services for the beans o Securityo Transaction managemento Remote accessibilityo Resource and life cycle managemento Clustering and load balancingo Concurrent requests support
RMI-IIOP vs EJB Application Development ProcessRMI-IIOP EJBRemote interface for the server object Local/Remote business interface for enterprise beanImplement remote interface Write a deployment annotated enterprise bean class that
implements business interface.Interface and enterprise bean class forms EJB component
Client app to invoke server object’s methods Client app to invoke enterprise bean’s methodsGenerate stub and skeletons Container provides middleware service that creates stub
and skeletonServer application Component developed forms server applicationStart registry Start Application Server (i.e. Glassfish)Run Server application Deploy EJB component in the Application ServerRun Client application Run Client application
Refer to Textbook pg 129 for implementation of JNDI lookup in EJB
3
QUICK REFERENCE GUIDE
Chapter 5 – Session Beans or Enterprise Beans
Definitions:
- Passivation of Stateful Session Beans: In situations where memory is limited, the pushing aside of session beans to secondary memory is known as passivation
- Business interface: An interface that only exposes methods in the enterprise bean which the client can call
o Remote: allows clients from different processors to access methods in the enterprise beano Local: only clients residing in the same JVM can call the methods
Session Beans A session bean is a server-side object representing work to be done on behalf of the client calling it. It implements business logic, algorithm, business rules or workflow. For example, performing order entry, withdrawing funds from bank account, producing price quotes, etc. are typical business processes that we can use session beans for. Stateful Keep the data specific to the client they are serving and allow the passing of data between
method callsStateless
Do not maintain any data associated with clients they are serving internally, no passing of parameters across method calls therefore all stateless session beans instances are equivalent and indistinguishable to any client
Message Driven BeansMessage driven beans can only be called to send messages. MDB doesn’t have an interface, hence, cannot be called like in a session bean. Typical use is sending/receipt of trade messages such as credit card info. MDB may send messages to other MDB or invoke methods directly on EJBs when a message is received.
Execution:
1. Write the (local or remote) business interface for the enterprise beans@Remotepublic interface AddServerBeanRemote {
2. Write a deployment annotated enterprise bean class that implements the business interface@Statelesspublic class AddServerBean implements AddServerBeanRemote {
3. Write a client application that invokes the enterprise bean’s methodspublic class AddClient {
@EJBprivate static AddServerBeanRemote addServerBean
4. Start Application Server e.g. Glassfish5. Deploy EJB component6. Run client application
Imports:
javax.ejb.Remote @Remote annotationjavax.ejb.Local @Local annotationjavax.ejb.Stateless @Statelessjavax.ejb.Stateful @Statefuljavax.ejb.EJB @EJB
Reference: Textbook pg 47
4
import ejb.AddServerBeanRemote
QUICK REFERENCE GUIDE
Life Cycle of Session Beans
Life Cycle Callback MethodsAnnotation import javax. What is it for? Applicable Session type
@PostConstruct annotation.PostConstruct Called after container has created session bean instancePerforms initialization on bean instance such as initializing instance variables with argument values passed in
Stateful and Stateless session beans
@PrePassivate ejb.PrePassivate Called when too many instantiated beans and no space in memory to accommodate all bean instance
Stateful session beans ONLY
@PostActivate ejb.PostActivate Called when a client needs to invoke a method in the bean
Stateful session beans ONLY
@PreDestroy annotation.PreDestroy Called immediately after any @Remove method has completed right before bean instance is destroyed
Stateful and Stateless session beans
Reference: Textbook pg 62
Limitations of Stateful Session Beans
When a new application client is executed, a new session bean is instantiated and previously created customer is no longer available. Hence Stateful session beans are not suitable for persisting object data beyond an application run.
Using a Stateful session bean to represent a customer merely stores the customer’s data in computer memory. When the session is terminated, the business data are also destroyed.
5
QUICK REFERENCE GUIDE
Chapter 6 – Persistence Management
Entities:
- Persistent data object in the Java Persistence specification- Entity classes are Plain Old Java Objects not enterprise beans- Entities are local objects that cannot be directly accessed from a remote location =/= session beans- Entities possess Persistent identity that distinguishes one entity from another- Entity is an in-memory Java object that represents persistent data stored in permanent data storage
Entity Instance State
- Managed: The manager tracks state changes to the entity and synchronizes those changes to the database whenever the entity manager decides to flush its state
- Unmanaged: o Any state changes to an entity that is detached are not tracked by the entity manager. o Entity instance becomes unmanaged and detached when a transaction scope or extended
persistence context endso A detached entity instance can be serialized and sent across network to a remote client. The
client can make changes remotely and send it back to be merged back and synchronized
Persistence Context
- A persistence context is a set of managed entity object instances- A persistence context is managed by an Entity Manager- Entity Manager tracks all entity objects within a persistence context and flushes these changes to DB
using the flush mode ruleso AUTO: default behavioro COMMIT: changes flushed only when transaction commits, not before any query
EntityManager
Use: Defines an entity manager whose responsibilities include tracking managed entity instances and synchronizing their states with the database
API: Refer to Textbook pg 81
Public Interface Usepersist(Object entity) : void Insert an entity as a record in the DBfind(Class entityClass, Object key) : <T> t Locate objects in DB. No exception thrownmerge(T Entity) : <T> t Put a detached entity back into persistence context remove(Object entity) : void Remove entity from DBflush() : void Synchronize changes done on entity instance in persistence
context with DBcreateQuery(String name) : Query Create an instance of Query
Imports
javax.persistence.Entity @Entity(name = “<something>”javax.persistence.table @Table(name = “<table name>”javax.persistence.EntityManager @PersistenceContext
6
QUICK REFERENCE GUIDE
EntityManager em;javax.persistence.PersistenceContextChapter 7 – Implementing Business Object Persistence
Imports:
java.io.Serializable public class GiftEntity implements Serializable {javax.persistence.Entity @Entityjavax.persistence.EntityListeners @EntityListeners (OPTIONAL)javax.persistence.GeneratedValue @GeneratedValue(strategy=GenerationType.AUTO)javax.persistence.GenerationTypejavax.persistence.Id @Idjavax.persistence.SequenceGenerator @SequenceGenerator (OPTIONAL)
7
package entities;
import java.io.Serializable;import javax.persistence.Entity;import javax.persistence.EntityListeners;import javax.persistence.GeneratedValue;import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.SequenceGenerator;
@Entity(name = "Gift")@EntityListeners(CustomerEntityCallbacks.class)@SequenceGenerator(name="seq", initialValue=1, allocationSize=1000)public class GiftEntity implements Serializable { private static final long serialVersionUID = 1L; @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="seq") @Id private Long id;
private String giftName; private String description; private int cost;
public GiftEntity() { } public void create(String giftName, String description, int cost) { this.setGiftName(giftName); this.setDescription(description); this.setCost(cost); } public Long getId() { return id; } public void setId(Long id) { this.id = id;
}
Refer to Textbook pg 93 for CustomerEntirtyCallBack.class
implementation
QUICK REFERENCE GUIDE
DDL to Java
import javax.persistence.Column;import javax.persistence.Entity;import javax.persistence.Id;import javax.persistence.Table;
@Entity@Table(name="CUSTOMER_TABLE")public class CustomerEntity implements java.io.Serializable { private Long Id; private String name; private String title; @Id @Column(name="PASSENGER_ID", nullable=false, columnDefinition="interger") public Long getId() { return Id; } public void setId(Long Id) { this.Id = Id; }
@Column(name="PASSENGER_NAME", length=30, nullable=false) public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(length=10) public String getTitle() { return title; } public void setTitle(String title) { this.title = title; }
@interface Column
public @interface Column { String name() default ""; String table() default ""; boolean unique() default false; boolean nullable() default true; boolean insertable() default true; boolean updatable() default true; String columnDefinition() default ""; int length() default 255; int precision() default 0; int scale() default 0;}
8
Change table name from CustomerEntity (default) to CUSTOMER_TABLE
1. Rename column Id to PASSENGER_ID2. Field NOT NULL3. Database type INTEGER
VARCHAR(30)
The @interface keyword is used to declare a new annotation type.
name: specifies column name. Defaults to field name
table: used for multitable mappings
unique and nullable: define constraints on column
insertable and updatable: specify whether this column to be included in SQL INSERT or UPDATE
columnDefinition: define column type (VARCHAR / INTEGER)
length: length of VARCHAR
scale and precision: determines length of numeric fields
QUICK REFERENCE GUIDE
javax.persistence.IdClass javax.persistence.EmbeddedId + javax.persistence.EmbeddablePr
imar
y Ke
y Cl
ass
public class PassengerPK implements Serializable {private String name;private String passportNo;
public PassengerPK() {}public PassengerPK(String name, String passportNo) {
this.name = name;this.passportNo = passportNo;
}… GETTER … SETTER …
public boolean equals(Object obj) {if(obj == this) return true;if(!(obj instanceof PassengerPK)) return false;if(!(name.equals(pk.name)) return false;if(!(passportNo.equals(pk.passengerNo)) return false;return true;
}public int hash() { return name.hashCode() + passportNo.hashCode(); }
}
@Embeddablepublic class PassengerPK implements Serializable {
private String name;private String passportNo;public PassengerPK() {}public PassengerPK(String name, String passportNo) {
this.name = name;this.passportNo = passportNo;
}@Column(name=”PASSENGER_NAME”)public String getName() { return name; }public void setName(String name) { this.name = name; }
@Column(name=”PASSENGER_PASSPORT_NUMBER”)public String getPassportNo() { return passportNo; }public void setPassportNo(String pNo) { this.passportNo = pNo}
public Boolean equals(Object obj) { …public int hashCode() { …
Pass
enge
r Enti
ty C
lass
@Entity@IdClass(PassengerPK.class)public class PassengerEntity implements Serializable {
private String name;private String passportNo;private String title;
@Idpublic String getName() { return name; }@Idpublic String getPassportNo() { return passportNo; }
@Entitypublic class PassengerEntity implements Serializable {
private PassengerPK pk;private String title;
@EmbededId@AttributeOverrides({
@AttributeOverride(name=”name”, column=@Column(name=”PASSENGER_NAME”), … ) })
public PassengerPK getPk() { return pk; }public void setPk(PassengerPK pk) ( this.pk = pk; )
Passenger pk = new PassengerPk(“Phua Chu Kang”, “S1234567H”);PassengerEntity p = em.find(PassengerEntity.class, pk);
Passenger pk = new PassengerPk(“Phua Chu Kang”, “S1234567H”);PassengerEntity p = em.find(PassengerEntity.class, pk);
9
javax.persistence.AttributeOverride;javax.persistence.AttributeOverrides;
Override Primary Key Class
QUICK REFERENCE GUIDE
10
QUICK REFERENCE GUIDE
Chapter 8 – Transactions
A transaction must be atomic, consistent, isolated and durable (ACID).
Atomic: Tasks in the transaction execute completely or not at all. If any task fail, all previous work or changes to the data must be undone
Consistent: Data written into the DB is in harmony with the real world it representsIsolated: Transaction allowed to execute without interference from other processes or transactionDurable: All data changes made during transaction are written to some physical storage before
transaction is successfully completed
Transaction Attribute
Effects
NOT_SUPPORTED Method will halt the transaction when called and resume the transaction when the method terminates
SUPPORTS Methods will be included in the transaction scope when calledREQUIRED Method must be included within the scope of a transactionREQUIRES_NEWMANDATORYNEVER Method is never within the scope of transaction
Reference Textbook pg 107
Imports
javax.ejb.TransactionAttribute @Stateful@TransactionAttribute(TransactionAttributeType.SUPPORT)public class ManagerBean implements ManagerBeanRemote { …
javax.ejb.TransactionAttributeType
11
QUICK REFERENCE GUIDE
Chapter 9 – Entity Relationships
The link between two entity classes can be defined by its Cardinality and Direction
Type Entity Alpha (Owner) Entity Bravo1-1 Uni
Pg 121
public class AlphaEntity {@OneToOne(cascade={..})private BravoEntity b;…
public class BravoEntity {<Nothing special>…
1-1 Bi
Pg 133
public class AlphaEntity {@OneToOne(cascade={..})private BravoEntity b;…
Side that contains the foreign key is the owning side
public class BravoEntity {@OneToOne(mappedBy=”b”, cascade={..})private AlphaEntity a;…
1-M Uni
Pg 141
public class AlphaEntity {@OneToMany(cascade={..})private Set<BravoEntity> b =
new HashSet<BravoEntity>();…
public class BravoEntity {<Nothing Special>…
M-1 / 1-M Bi
Pg 153
public class AlphaEntity {@ManyToOneprivate BravoEntity b;…
The Many side is the owning side
public class BravoEntity {@OneToMany(mappedBy=”b”, cascade={})private Set<AlphaEntity> a =
new HashSet<AlphaEntity>();…
M-1 Uni
Pg 165
public class AlphaEntity {@ManyToOne(cascade={})private BravoEntity b;…
public class BravoEntity {<Nothing Special>…
M-M Uni
Pg 177
public class AlphaEntity {@ManyToMany(cascade={})@JoinTable(name=”blah blah”)private Set<BravoEntity> b =
new HashSet<BravoEntity>();…
public class BravoEntity {<Nothing Special>…
M-M Bi
Pg 189
public class AlphaEntity {@ManyToMany(cascade={})@JoinTable(name=”blah blah”)private Set<BravoEntity> b =
new HashSet<BravoEntity>();…
public class BravoEntity {@ManyToMany(mappedBy=”b”, cascade={})private Set<AlphaEntity> a =
new HashSet<AlphaEntity>();…
Either side can be owning side
Imports:
javax.persistence.OneToOne @OneToOnejavax.persistence.OneToMany @OneToManyjavax.persistence.ManyToMany @ManyToManyjavax.persistence.ManyToOne @ManyToOnejavax.persistence.CascadeType cascade={CascadeType.PERSIST}} + MERGE + REMOVE + REFRESH + ALLjavax.persistence.JoinTable @JoinTable(name=”<someName>” pg 145
12
QUICK REFERENCE GUIDE
Chapter 10 – Web-based Clients
.jsp result.jsp Client Layer cart.jsp
submit ISBN = input returns list with
stored data quantity = input
ServletHttpServletRequest request = localhost… Business Logic Layerpage = request.getPathInfo().substring(1)∴ page == cart
request.setAttribute(“data”, list); shoppingCart(request) : List(String)
ISBN = request.getParameter(“ISBN”)quantity = request.getParameter(“quantity”)
BRSMBean.shoppingCart(..) : List
Manager Bean + Entityb = em.find(BookEntity.class, ISBN); Data Layer return list with quantityb.get…
list stores relevant book info
Imports in servlet
javax.servlet.RequestDispatcher RequestDispatcher dispatcher; ServletContext servletContext = getServletContext();dispatcher = servletContext.getNamedDispatcher(page)
javax.servlet.ServletContext
javax.servlet.ServletException Required for doGet and doPost which are default methodsjavax.servlet.http.HttpServlet public class BRSServlet extends HttpServlet {javax.servlet.http.HttpServletRequestjavax.servlet.http.HttpServletResponse
Must always import Remote interface class if we need to call manager bean
.jsp
13
<% ArrayList bookList = (ArrayList)request.getAttribute("data"); for(Object o: bookList) { String book = (String)o; StringTokenizer st = new StringTokenizer(book, "#"); %>
<tr> <td><%= st.nextToken()%></td> <td><%= st.nextToken()%></td> <td>$<%=st.nextToken()%></td> <td><%= st.nextToken()%></td> </tr><% }%>
QUICK REFERENCE GUIDE
Chapter 11 – Java Message Service
A JMS application is an enterprise system that has one or more JMS clients that engage in the services of a JMS provider. A JMS application has 4 parts:
- Messages: Objects that communicate between JMS clients- JMS Clients: Java components or applications that use JMS. Can be a producer or consumer- JMS Provider: Messaging system that implements the JMS interface and manages routing and
delivery of messages- Connection Factories and Destination: A connection factory is a resource a client uses to create
connection to a JMS provider. A destination is the object a client sends its messages to or receives messages from.
Execution:
1. Inject Connection Factory via @Resource(mappedName=”jms/ConnectionFactory”)private static ConnectionFactory connectionFactory;
2. Inject One or more destinations @Resource(mappedName=”jms/Queue”)private static Queue queue;
3. Use Connection Factory to create connectionConnection connection = connectionFactory.createConnection();
4. Use connection to create One or more SessionsSession session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
5. Use Sessions to create producer, message, and consumerMessageProducer producer = session.createProducer(queue);Producer.send(message);MessageConsumer consumer = session.createConsumer(queue); (For two-way)
6. Register Message ListenerQueueListener queueListener = new QueueListener();Consumer.setMessageListener(queueListener);
Two types of messaging domains:
- Point-to-point: Queue- Publish/Subscribe: Topic
Messages can be consumed in two ways:
- Synchronously: A receiver explicitly fetches the message from the destination by calling the receive() method. The receive() method can block until a message arrives or can time out if a message does not arrive within a specified time limit
- Asynchronously: A client can register a message listener with a consumer. Whenever a message arrives at the destination, the JMS provider delivers the message by calling the listener’s onMessage() method which acts on the contents of the message
Reference: Textbook Pg 245
14
QUICK REFERENCE GUIDE
Chapter 12 – Message Driven Beans
A message driven bean is a stateless, server-side enterprise bean capable of processing messages based on the JMS API.
Main
Session Bean
Refer to printed sample
MessageDrivenBean
Refer to printed sample
Imports for Session Bean
javax.annotation.Resource @Resource(mappedName = "jms/TopicConnectionFactory")private ConnectionFactory topicConnectionFactory;topicConnection = topicConnectionFactory.createConnection();
javax.jms.ConnectionFactoryjavax.jms.Connectionjavax.jms.Session Session session = topicConnection.createSession(false,
Session.AUTO_ACKNOWLEDGE);javax.jms.MessageProducer MessageProducer producer = session.createProducer(topic);javax.jms.MapMessage Can also import jms.TextMessage / jms.ByteMessage / jms.StreamMessage /
jms.ObjectMessage / jms.Message
Imports for MessageDrivenBean
javax.ejb.MessageDriven @MessageDrivenjavax.ejb.ActivationConfigProperty @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),javax.jms.MessageListener public class SSSMessageDrivenBean implements MessageListener {javax.jms.Message public void onMessage(Message inMessage) {javax.jms.MapMessage Must match producer message type
Reference: Textbook Pg 253
15
import ejb.SSSMessageSessionBeanRemote;import javax.ejb.EJB;
public class Main { @EJB private static SSSMessageSessionBeanRemote ss; public static void main(String[] args) { ss.sendMessage(name, email, content);}
QUICK REFERENCE GUIDE
SecurityInvolves:
1. Authentication: validating identity of entity in computer system2. Authorization: Where user is allowed to execute certain methods3. Confidentiality and Integrity protection: Data transfer encrypted e.g. SSL (secure socket layer)
Execution:
Declarative Programmaticimport javax.annotation.security.PermitAll;import javax.annotation.security.RolesAllowed;import javax.ejb.Stateless;
@Stateless@RoleAllowed("AUTHORIZED_PERSONNEL")public class PaymentBean implements PaymentRemote { ... @PermitAll
public boolean payByCash(Customer customer, double amount) throws PaymentException { ... }
@RolesAllowed("CHEQUE_FRAUD_ENABLED") public boolean payByCheque(Customer customer, ChequeDO cheque, double amount) throws PaymentException { ... } public boolean payByCredit(Customer customer, CreditCardDO card, double amount) throws PaymentException { ... }}
Refer to slides
import java.lang.annotation.Retention;import java.lang.annotation.Target;
@Target({TYPE, METHOD}) @Retention(RUNTIME)public @interface RolesAllowed { String[] value;}
16
QUICK REFERENCE GUIDE
Port Number
RMI / Default Port: 1099JNDI / Transient Name Server: 900HTTP (Hypertext Transfer Protocol): 80HTTP Alternate: 8008HTTP alternate—commonly for running a Web server as a non-root user: 8080HTTPS (Hypertext Transfer Protocol over TLS/SSL): 443Domain Name System (DNS): 53SSH (Secure Shell): 22FTP data transfer: 20FTP control (command): 21
Generic imports
java.io.BufferedReader BufferedReader br = new BufferedReader(new InputStreamReader(System.in));java.io.InputStreamReader
java.util.ArrayListjava.util.Collection Collection<BookEntity> b = new Collection<BookEntity>()java.util.HashSet; HashSet<BookEntity> b = new Set<BookEntity>()java.util.Set;java.util.Date Date d = new Date()
DateFormat df = new SimpleDateFormat("MM/dd/yyyy");String str = df.format(d);
java.text.DateFormatjava.text.SimpleDateFormatjava.util.Temporal @Temporal(value = TemporalType.DATE)
private Date date;java.util.TemporalTypejava.util.StringTokenizer Refer to pg 12
Model-View-Controller Model
Based on the Separation of Concerns principle. Separate the client tier, business logic tier and data tier from each other. This enhances maintainability of individual components so changes to one wouldn’t affect others
Model: Includes data and business logic components. E.g. enterprise beans and entities
View: Display of business data. JSP pages
Controller: Brain of the web application. Receives client requests, processes them, forwards them to components that process data, and directs results of the processing to View components. E.g. servlets
Object-Relational Mapping
O/R Mapping refers to the mapping of an entity’s state to relational database table and columns
System Infrastructure Considerations
Refer to Textbook pg 2
17