Monthly Archives: July 2011

database modeling with enterprise architect

so finally got an Spary Enterprise Architect 🙂 the “:)” is kinda relative, because i really dont care, which program i should use for modeling tables and creating ddl’s… but the project said: use ea… and so i did… installing software in a really big company (as i am working now) can be really a pain… but after a few days, i got it up and runing… finally… so its kinda “:)”

and i think its really good… had a few problems in the beginning, created a table and colums, but couldn’t set columntypes, but master this problem… the table needs to know, which database it is in… kinda clear, but i thought the definition should be somewhere on the project or on the schema… not directly on the table…

so currently “painting” my model 🙂

dependencies and repositories in maven

ok actually i didnt get the idea of dependencies and repositories in maven… it just worked… but know i do 🙂

instead of downloading and installing different jar files on your local maschine and on every other server, just tell maven to do it. with dipendencies maven knows which jars it should get and with repositories maven know where to get them… actually the mechanism stores an local copy of the jars in a local repository, and tries first to get it from there… and because of en unique jar version number, updating to new packages in the local repository is maven pom.xml driven.

with this mechanism it is really easy to guarantee the runability of an project… hmm… and when does maven install complete servers?

wsdl and maven

just created a contract-first wsdl… and actually its my first 😛 and yeah… there might be some errors… but those will be fixed at the end of the project… next year… 🙂

i created it in the frontend-clicky-thing of eclipse… kinda simple, but a bit random, how the wsdl will look like… lets just say, i hope for the best…

next task was to generate the java artifacts out of the wsdl file… with maven… and google really helped me: link

<plugin>
    <groupId>org.apache.cxf</groupId>
   <artifactId>cxf-codegen-plugin</artifactId>
   <version>${cxf.version}</version>
   <executions>
      <execution>
         <id>generate-sources</id>
         <phase>generate-sources</phase>
         <configuration>
            <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
            <wsdlOptions>
               <wsdlOption>
                  <wsdl>${basedir}/src/main/wsdl/myService.wsdl</wsdl>
               </wsdlOption>
            </wsdlOptions>
         </configuration>
         <goals>
            <goal>wsdl2java</goal>
         </goals>
      </execution>
   </executions>
</plugin>
is the plugin to generate the artifacts… but i m not so sure, that they really are and if they are really usable… but as i sead before… project end next year… enought of time to figure it out 🙂

apache cxf, tomcat and eclipse

apache cxf is my next stop… its a simple way to create webservices… and the tutorial is really hard… ok perhaps only for a for-a-long-time-no-java-developing developer, as i am… the main problem was, that the tutorial is based on your favorite ide… which in my case is eclipse, but without a little bit of help, my favorite ide is really confusing… but with a little help of other (unlinked) tutorials, a little bit of basic understanding of the (and some) concepts and a little bit luck i made it 🙂 ok not sure, but i see an autogenerated wsdl, which actually locks correct 🙂

so what did i do… setting up:

  1. downloaded apach cxf and added it to PATH (not sure if needed)
  2. in eclipse Windows–>Preferences–>Web Services–> CXF 2.x Preferences set the downloaded cxf folder
  3. intsalled a tomcat… its a lie, because it was installed before, but wth
  4. in eclipse Windows–>Preferences–>Server–>Runtime Environment added the tomact… lie again, was set already…

and now… project:

  1. New–>Dynamic Web Project (Name = CXFTest)
  2. Configured it with Target Runtime = Apache Tomcat and Configuration = CXF
  3. Then created all the files, based on the tutorial
  4. To Run: Right – clicked the web.xml and Run As–> Run on Server
  5. Access the WSDL: http://localhost:8080/CXFTest/HelloWorld?WSDL
  6. tada!

i acutally had really big problems to find the wsdl at first, but now its kinda logic 🙂

eclipse import cleanup

import other classes to a class is mainly a pain… a lot of imports are normally needed, a few are duplicated, and this is crap… based on PMD… ok it might be right, but in my point of view the compiler should clean the import… not that i have ever thought about it, but currently i do… 😛

and eclipse can clean the imports easyly….

Crtl+Shift+o

bah…

Eclipse is running in a JRE, but a JDK is required

this bug sucks… and its funny, because i get it from time to time… solution is kinda easy…

add following link in eclipse.ini

-vm
C:\java\jdk\bin\javaw.exe

before

-vmargs

mule imap:connector

ok tryed some things with the mule imap:connector and its kinda cool… and its kinda crap… a few functions are really cool, but dont work as expected…

imap:connector

  • checkFrequency: milliseconds to try getting new mails on the imap-server
  • deleteReadMessage: deletes the message, after read
  • backupEnabled / bachupFolder: backups the read mail to the folder… the folder is localy, not on the imap-server (partly crap)
  • moveToFolder: moves the mail to the given folder after processing. if deleteReadMessage is true, the moved message is flagged deleted too (crap), if deleteReadMessage is false, the move is a copy (crap)

imap:inbound-endpoint

  • user (is containing a @, use %40 instead)
  • password
  • host
  • port

all in all it is a really powerful connector, which reads the mailbox frequently and can be used as perfect flow starter…  additionally it returns an MimeMessage, with all the Headers and so on… but on the other hand, it cant handle the mails on the imap server… it looks like the handling on the server needs to be implemented with a POJO… if this is the way to go is a complete new question…

Verbal tennis

A game in which each player must respond with a question. Statements are out, repetition and rhetoric are not allowed.

Rosencrantz & Guildenstern Are Dead

imap

in my project at work we need to read a mail box… sounds not so easy, but actually is… mule imap:connector for the win 🙂

but testing this is a pain… first of all i needed a mail account with imap access… my company is really big an the processes to get such an email adress is huge… and yeah… we are an isp 😛 so just try to get a simple free email adress with imap… kinda hard… fastmail.fm is the solution…

could connect, but couldnt read or find directories… so had to connect with telnet, to find out everything…

in commandline:

  • telnet [host [port]] to connect
  • 1 LOGIN username password to log in (the 1 is important… imap needs numbers)
  • 1 LIST “*” “*” to list all mail boxes… no clue what the “*” are, but it has listed 🙂

this helped…

mule elements and flows

mule is a simple message router, which is configured in an .xml (mostly mule-config.xml)… following main elements can be found in it:

  • connectors: defining the class, which will be used for the connection (can be used by endpoint with connector_ref)
  • transformers: definig the class, which transforms the message to usable stuff (can be used by endpoints this transformer_ref)
  • inbound-endpoint: inbound-event for a flow
  • outbound-endpoint: outbound event for a flow, or message forwardpoint
  • component: class in a flow which will be called after inbound, before outbound

there are 2 types of flows… flows with an outgoing-endpoint and flows without… in a flow it is possible to define multiple entrypoints and it should be possible to define multiple endpoints… i think, only 1 component can be defined… a PoC will show…

so a normal flow will be as followed:

  • defined inbound-endpoint with a connector (to connect and wait for the incomming message) and a transformer(to handle the message and transform it into a format which the component expects)
  • defined component which will do something with the message
  • defined outgoing-endpoint to sent the message to other systems

additionally there is a model and services in the config file… couldn’t figure out, what the heck they are for…