Monday, August 04, 2008

How to define SOA services?


  • In this blog entry I try to collect my experience defining SOA services. (This blog entry will be under heavy changes). Feel free to post me any comments.


If you build a service, keep always in mind that you have a lot of stakeholders in mind:



(1) service consumers
- which are interested in only the functionality they have to provide
- focued on a specific programm language (e.g. Java)
(2) architecture, which is mainly focused on
- reusability
- continuity
- versioning
- accessibility of services (repository, registry)
(3) service providers
- which are focused in reducing complexitiy
- which are focued on a specific programm language (e.g. Cobol)
(4) Business, interested in
- bussiness value
- continuity


(1)The Service consumer View
Focused on their particular problem

(2)The architecture view:
- Lego approach, composable services
- Versioning
- Lifecycle

(3)The architecture view:
- Reducing complexity. Reducing input and building constraints to reduce complexity of programming and testing

(4) Business
- The business is mainly interested into shareholder value

The goals on a timeline looks like this
(1) Service Consumers (goals are within project time)
(2) Service Producers (Services should survive different projects)
(3) Business (mid term goals)
There are a lot of conflicts:
(1) and (3): How to find a naming
(4)Architecture (long term gols)

convention which fullfill different programming approaches
(1 - 4) How to fullfill the different time scopes? --> Versioning,


Distinguish between
(a) Bulk-Services (File-Import)
(b) Messaging Services (e.g. Webservices)

(a) Bulk Services (Func. and non func. req)
- Define Character Format
- Define Output Format (Fixed-Length, Comma-Separated, ....)
- Define all attributes precise (especially years, currency, ...) e.g. DDMMYYYY, XXXX.YYYY and Currency ISO 4217
- Specify timezones for dates
- Define Periodicity (Exportdates)
- Availability
- Security Classification
- Response Time
- Size of the Export (e.g. 10 GB)
- Destination/Protocol (e.g. ftp://myFileserver)
- Logging
- When should service go in to Integration Test, Production, ...
- Versioning

(b) Messaging Services (Func. and non func. req)
- Availability
- Response Time
- Invocation Frequency
- Specify timezones for dates
- Define all attributes precise (especially years, currency, ...) e.g. DDMMYYYY, XXXX.YYYY and Currency ISO 4217
- Peak
- Loggin
- Caller Auth.
- Security Classification
- When should service go in to Integration Test, Production, ...
- Versioning


Versioning of the servicedefinition is crucual. Important is that you write every change, ore even better also the reason (and responsible) for the change in the servicedefinition or a separate document.

Monday, June 30, 2008

Scale up vs. Scale Out

See http://weblogs.java.net/blog/malcolmdavis/archive/2006/07/scale_up_vs_sca.html

Reliability vs. Availability

Reliability: measured by time between system failures
o Distributed system should be more reliable than single system
o 5 machines with .95 probability of being up. 1 - .05*5 probability of
being up.

􀀂 Availability: fraction of time the system is usable.
o Redundancy improves it
o Need to maintain consistency
o Need to be secure
o Need to tolerate failures: mask failures, recover from errors.

http://www.cis.upenn.edu/~lee/07cis505/Lec/lec-ch7a-consistency-v3.pdf

Friday, June 06, 2008

Calculate in Google

Try the following search terms:

(120000+1500)*500 byte -> megabyte
(120 000 + 1 500) * 500 gram -> kilogram

Monday, April 28, 2008

sed / grep /awk and other useful commands

Here i'll post useful commands using sed grep & awk for OSX:

sed "s/SEARCHTERM/RESULTTERM/" result.txt

Convert Uppercase to lowercase
cat test.txt | tr [:upper:] [:lower:]

More information:SED onenliners

Delete your desired files:
find / -name "*\.eml" -exec rm -f {} \;

Thursday, April 17, 2008

Guidelines for developing an application in Ruby on Rails

Here I collect some guidelines how to develop in Ruby on Rails. Please feel free to comment on these guidelines. I would love to discuss them since I am quite new in Ruby on Rails

- Use an IDE (e.g. NetBeans)
- Use version control (e.g. SubVersion)
- Use the model to implement business logic
- The controller should be lean
- Don’t put business logic in to the view
- DRY: Use partials and helper-classes, …
- Use CSS for rendering your page
- Use migrations sequentially
- Consolidate migrations

Thursday, April 10, 2008

Rails cheat sheet

As follows I show you some rails commands, which are pretty useful. Read also the following document, which summarize the most useful Rails-commands:
byOnRails-Cheatsheet-BlaineKendall.pdf

Find first Order in the table
o = Order.find(1)

Find by SQL
Use o.findbySQL

Assume an order has n protocols:

order.rb
class Order < ActiveRecord::Base
has_many :protocols

end

class Protocol < ActiveRecord::Base
belongs_to :order
end

script/console
pp = Protocol.find(1)
oo = Order.find(1)
oo.protocols << pp
oo.protocols

Iterate trough oder-array

arrayorder = Order.find(:all)

arrayorder.each do |order|
p order
end

Access the session
session[:user_id]

In the view:
< %=h Protocol.find(order.id).orderinit_date % >

Access to params:
< %= params['controller'] % >

Wednesday, April 09, 2008

Ruby structures

If/then/else

order.order_date != nil ? order.order_date.strftime(" %d.%m.%Y %I:%M"):""

Friday, April 04, 2008

Ror: Redirecting

Redirect the form to a non default route:

# POST /customer_profiles.xml
def create
....
respond_to do |format|
if @customer_profile.save
flash[:notice] = 'CustomerProfile was successfully created.'
format.html { redirect_to new_customer_path }
format.xml { render :xml => @customer_profile, :status => :created, :location => @customer_profile }
else
...
end
end
end

Thursday, April 03, 2008

1:n relations in ROR

1. Generate a customer_profile which belongs to a customer
./script/generate scaffold customer_profile name:string customer_id:integer

2. Make migration:
rake db:migrate


3. In the model customer_prfoile.rb
class CustomerProfile < ActiveRecord::Base
belongs_to :customer
end


4. In the console you can test the 1:n relation (script/console):

>> customer = Customer.create(:name => "Dominik")
=> #
>> cprofile = CustomerProfile.create(:name => "myprofile")
=> #
>> cprofile.customer = customer
=> #
>> p cprofile.customer.name
"Dominik"
=> nil
>> p cprofile.customer
#
=> nil
>>

Ruby routes howto

http://localhost:3000/customers/32/client_profiles/new


in routes.rb:
map.resources :customers do |c|
c.resources :client_profiles
end


in client_profiles_controler.rb:

in method new:

# GET /client_profiles/new
# GET /client_profiles/new.xml
def new
@client_profile = ClientProfile.new
@client_profile.customer_id = params[:customer_id]
respond_to do |format|
....
end
end


in method create:
# POST /client_profiles
# POST /client_profiles.xml
def create
@client_profile = ClientProfile.new(params[:client_profile])
@client_profile.customer_id = params[:customer_id]
respond_to do |format|
if @client_profile.save
.....
end

Wednesday, April 02, 2008

Scaffolding types

-binary
-boolean
-date
-datetime
-decimal
-float
-integer
-primary_key
-string
-text
-time
-timestamp


See also: http://www.packtpub.com/article/Working-with-Rails-ActiveRecord-Migrations-Models-Scaffolding-and-Database-Completion

Tuesday, April 01, 2008

Usefull ruby commands

Create project with mysql:
rails bla --database=mysql

Create database:
In the Projectdirectory: "rake db:create:all"

Update tables:
In the Projectdirectory: "rake db:migrate"

Start Server:
In the Projectdirectory: "script/server"

Start documentation:
gem server -p 3333

Start console:
In the Projectdirectory: "script/console"

Scaffolding:
./script/generate scaffold person_profile name:string company:string organisation:string unit:string function:string role:string

After using command "rake db:migrate" you'll find the generated code here:
http://localhost:3000/profiles

Show all routes:
rake routes

Partials:
Comming soon

Migrations in Ruby:
1. Create migration: script/generate migration alter_client_profile
2. Alter migration, see example below:
class AlterClientProfile <>

3. rake db:migrate

New consistent database from migrations:
- rake db:drop
- rake db:create
- rake db:migrate

MySQL using terminal with OSX

Precondition:
Install MySQL-Binary from http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg

Start Server:
/usr/local/mysql/bin/mysqld_safe

Start DB-Client:
/usr/local/mysql/bin/mysql -u root
- Use Database: use langodem_development
- show tables;
- Delete Database: drop database langodem_development


Create DB langodem:
/usr/local/mysql/bin/mysqladmin -u root create langodem

Connect to DB langodem:
./mysql -u root langodem

Find all running mysql-server instances
ps -ef | grep mysqld

Kill all mysql-server instances
killall -TERM mysqld

Set Path in OSX / Linux

In bash_login

export PATH=/usr/local/mysql-max-5.0.27-osx10.4-powerpc/

Friday, March 28, 2008

Work with SVN from terminal

Work with a svn project:
svn chk https://my_svn_server

svn update: "Update from SVN-Server"
svn add

Install Ruby on Rail in 5 steps (Mac)

1. Install Xcode
2. Install MacPorts
3. Install MySql-DB using command line tool ports: ports install mysql5 +server
4. Update Rails using command line tool gem: "sudo gem update"
5. sudo gem install daemons gem_plugin mongrel mongrel_cluster --include-dependencies
6. sudo gem install mysql

Friday, January 18, 2008

Definitions

TCO (Total cost of ownership) Gesamtheit der Kosten einer Investition, die über ihren kompletten Lebenszyklus hinweg anfallen

Thursday, January 17, 2008

Routing unter OSX

Routingtabelle anzeigen

netstat -rn -f inet

Bsp:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 172.16.0.1 UGSc 19 6 en1
10/24 10.0.0.2 UGSc 0 0 en1


Route hinzufügen:
wotruba@mac:~$ sudo route add -net 10.0.0.0 10.0.0.2 255.255.255.0
add net 10.0.0.0: gateway 10.0.0.2


Routen löschen

route delete -net 10.0.0.0 10.0.0.2 255.255.255.0