Support

Forums

Contact Me

Posts Tagged 'framework'

Framework

Framework may refer to: [http://en.wikipedia.org/wiki/Framework]

Send created pdf with javamail

public void testSendPDWithJavamail() {
String host = "mailhost.xxxxx.com";
String from = "
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 ";
String to = "
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 ";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getInstance(props, null);
try {
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject("Hello JavaMail Attachment subject");
Multipart multipart = new MimeMultipart();
// Part one is a text
MimeBodyPart textMessageBodyPart = new MimeBodyPart();
textMessageBodyPart.setText("Hi hello this is the msg in mail");
multipart.addBodyPart(textMessageBodyPart);
// Part two is attachment
MimeBodyPart attachmentMessageBodyPart = new MimeBodyPart();
byte[] pdf = new Resource("A1U0E0.pdf").getRawContent();
attachmentMessageBodyPart.setDataHandler(new DataHandler(new ByteArrayDataSource(pdf, "application/pdf")));
multipart.addBodyPart(attachmentMessageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send(message);
} catch (MessagingException e) {
Assert.fail(e.getMessage());
} catch (IOException e) {
Assert.fail(e.getMessage());
}
System.out.println("sent msg");
}
Articles tagged

Status of the ContinuousBuild4Joomla framework

I put some effort the last few days in this new framework.

Done:

  • I did document some part of it at http://wiki.waltercedric.com/index.php?title=ContinuousBuildforJoomla
  • TeamCity is installed/configured/documented (windows only)
  • XAMPP is installed/configured/documented (windows only)
  • I also at the same time configured a Puppy Linux VMWare image that will permit to anybody to have a running environment in no time.
  • I am able to unpack all Joomla! versions that are committed in any repository (CVS, SVN, Clearcase)
  • They can be unpacked anywhere on file system (config in setEnv.xml), ideally they are unpacked in the root htdocs of XAMPP
  • Code is committed at Joomla forge in SVN http://joomlacode.org/gf/project/continbuild4j/

Issues

Selenium test suite do not accept a baseurl (or only a part of it) so I have a full path like /Joomla1.5.7/installation/index.php in a selenium test case instead of /installation/index.php in test case and baseurl= http://localhost/Joomla1.5.7)

Architecture

3rd Party

  • I use antelope for some advance ANT operations: substring, indexof, loop
  • I use selenium java server on port 4444 (default)

Cluster

All cluster operations are in cluster.xml these basic functions are

  • cluster.init
    • cluster.remove        remove all instances of Joomla! in checkout directory
    • joomla.unpack.all    unpack all Joomla! versions that are checked in another SVN root
    • joomla.install.all      run the same selenium test case joomla.install.html on all Joomla! instance
    • joomla.remove.all.installation   remove all Joomla! installation directories
    • joomla.check.all     check all Joomla! installations for correctness
  • cluster.start
  • cluster.remove
  • cluster.stop

Joomla!

All Joomla specific operations are in joomla.library.xml

  • Unpack a Joomla! version
  • Remove the installation directory form a version
  • Apply a selenium test suite install.joomla.html that can use the regular Joomla! installer
  • Is also able to do all of the above on all Joomla! versions found (regular expression) in checkout directory

Selenium

  • All selenium operations are in selenium.xml
  • All test suite and test cases are in /selenium/joomla/

PHPUnit

All PHPUnit operation are in phpunit.xml

Settings

Settings are in setEnv.xml, in future I will lazy load a file if it exist as environment variable

 

If you know ANT, the code is quite readable...

Future review of Joomla!® 1.5 Development Cookbook and Build and Manage Applications with Maven, Continuum, and Archiva

apache_maven

Packt publishing has offered me to make a review of two of their new books (Thanks to them). I should receive free samples for review beginning of next week. Since it is two of my favorite subjects (Maven and Joomla!® ), I think it may also interest you. A review will follow in some days.

ApacheMaven2EffectiveImplementation  

Build and Manage Applications with Maven, Continuum, and Archiva

  • Install Apache Maven and follow the sample application to build up your project as quickly as possible
  • Test your applications to ensure maximum stability using Maven's inbuilt tools
  • Use Maven's report and checking tools to ensure the health of your projects
  • Explore Apache Continuum which will help you to ensure the health of your source code
  • Improve your team builds with the powerful combination of Maven, Archiva and Continuum
  • Install and run the repository manager Apache Archiva
  •  

 

Joomla!1.5DevelopmentCookbook

Joomla!® 1.5 Development Cookbook 

  • Make your extensions extensible, add extensions points to allow third parties to customize your extension
  • Create international extensions by enabling multilingual capabilities
  • Build more than just HTML pages - create PDF documents, Atom Feeds, and more!
  • Improve the user experience by adding Ajax
  • Create Atom and RSS feeds to keep users up-to-date
  • Utilize the power of Subversion to maintain your source code
  • Execute database queries and handle returned data in order to access and modify your data
  • Dynamically extend your database tables using JParameter to make your extensions more flexible
  • Keep your gremlins at bay by handling errors the Joomla! way
  • Work with the file system, interrogate existing files and folders and store data in the file system
  • Take control of your workflows by using www.JoomlaCode.org to manage your Joomla! projects

Tomcat 7 and Apache Maven

Here is 3 different way to control the lifetime a local Tomcat 7 container using Apache Maven. A typical scenario would be to start a servlet container prior to running integration tests (Selenium, SAHI or using any other framework you can think of )

With the following examples, you will be able to start an instance of Tomcat 7 running your web application in the pre-integration-test phase and stop the instance in the post-integration-test phase. You can also decide to use an embedded container like Jetty instead.

Read more: Tomcat 7 and Apache Maven

Harmony: a new apache project in incubator

The Apache  software fundation has put a new project in it's incubator line: Harmony

A free open source Java virtual machine and classes librairies!!!

Right now it is only a thread, and a FAQ...an interesting discussion has start on Slashdot.org  

Purpose of this project is to create and use an open source, compatible implementation of J2SE
5, the latest version of the Java 2 Standard Edition specification.

"The Apache Software Foundation provides support for the Apache community of open-source software projects. The Apache projects are characterized by a collaborative, consensus based development process, an open and pragmatic software license, and a desire to create high quality software that leads the way in its field. We consider ourselves not simply a group of projects sharing a server, but rather a community of developers and users."

Update: Sun executives have endorsed the project, and the company might even participate. found at www.informationweek.com

Articles tagged

AJAX for Java developer

IBM has put an interesting online article about  DWR (Direct Web remoting) technology...

In the simplest terms, DWR is an engine that exposes methods of server-side Java objects to JavaScript code. Effectively, with DWR, you can eliminate all of the machinery of the Ajax request-response cycle from your application code. This means your client-side code never has to deal with an XMLHttpRequest object directly, or with the server's response. You don't need to write object serialization code or use third-party tools to turn your objects into XML. You don't even need to write servlet code to mediate Ajax requests into calls on your Java domain objects.
Read more at IBM developerworks

Impact of Zend Optimizer on PHP Performance

Impact of Zend Optimizer on PHP Performance

The Zend Optimizer FAQ answers the question "Why use the Zend Optimizer?" with this statement: "The standard Zend run-time compiler used by PHP is indeed extremely fast, generating code that is usually 2 to 10 times faster. But an application that uses the Zend Optimizer typically executes another 40% to 100% faster."

Read the results of the load test HERE.

Apache Maven copy local file to a remote server server using SSH

I will show you in an Apache Maven configuration file how to copy files to server each time the package phase is executed.

Solution with Ant SCP task

This snippet of code is a ready to use code that make use of Apache Ant task scp, Just put this snippet of code in your Maven module where the assembly is executed or anywhere else to push all tar.gz files to a server just run a maven mvn package, you can add as many ant task and push to many server the same file during the reactor build.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
    <id>server-copy</id>
    <goals>
        <goal>run</goal>
    </goals>
    <phase>package</phase>
    <configuration>
        <target>
            <echo message="Push to server/home/"/>
            <scp trust="yes"
                todir="user:password@server:/home/">
                <fileset dir="${basedir}/target">
                    <include name="**/*.tar.gz"/>
                </fileset>
            </scp>
        </target>
    </configuration>
</execution>
</executions>
<dependencies>
<dependency>
    <groupId>org.apache.ant</groupId>
    <artifactId>ant-jsch</artifactId>
    <version>1.8.2</version>
</dependency>
</dependencies>
</plugin>

Solution with maven-deploy-plugin

The maven-deploy-plugin allows you to configure the deploy phase to deploy to a server using scp. There is a page in the documentation that describes how it can be done.

Deploy maven artifact using Maven Wagon SCP

Another alternative would be to use Maven Wagon SCP like described in this post for example

Applying Code Generation Techniques to the J2EE Development

Some samples chapter which discusses the different approaches to code generation and looks at best practices for applying code generation techniques to the development of enterprise software for the J2EE platform. From the Book  Rapid J2EE™ Development: An Adaptive Foundation for Enterprise Applications (Prentice Hall PTR)
Code generation methods offer a means of delivering enterprise solutions extremely rapidly by reducing the mundane, repetitive tasks developers face.
www.eclipse.org is also hosting Eclipse Modeling Framework (EMF)  EMF is a modeling framework and code generation facility for building tools and other applications based on a structured data model. From a model specification described in XMI, EMF provides tools and runtime support to produce a set of Java classes for the model, a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor. Models can be specified using annotated Java, XML documents, or modeling tools like Rational Rose, then imported into EMF. Most important of all, EMF provides the foundation for interoperability with other EMF-based tools and applications.

The Web Tools Platform (WTP)

The Web Tools Platform (WTP) project's mission is to provide a common framework for building Web tools for Eclipse and to provide both standard and Java Web tools that build upon the common framework.

Donations

Thank You for supporting my work