Plug-in Development Environment

nutmegactΛογισμικό & κατασκευή λογ/κού

10 Νοε 2012 (πριν από 4 χρόνια και 9 μήνες)

180 εμφανίσεις

Plug
-
in Development Environment

Session Outline


Tools


Installation


Configuration


New Project


Basic Debugging


Remote Debugging

Tools


Install a JDK (if needed)



J2SE downloads


Install Integrated Development Environment
(IDE)


Using Eclipse as an example


Free


Fully featured


Eclipse download


Other IDEs available


JBuilder


NetBeans


IntelliJ

Installation


Use an application that handles zip files, such as
WinZip or Windows Explorer, to extract the
Eclipse files into a folder.

Installation


Install Tomcat plug
-
in for Eclipse


Tomcat plug
-
in
.


Allows Tomcat to run in the context of the
IDE.


Configure the plug
-
in to use CenterView’s
Tomcat installation.

Installation


Unzip the Tomcat plug
-
in into the Eclipse
dropins folder.

Configuration


Start Eclipse (eclipse/eclipse.exe).


Choose a workspace.

Configuration


Go to the workbench.


Configuration


Select
Preferences

from the
Window

menu.

Configuration


Select the
Tomcat

preferences, set
Version 5.
x
, and browse to the Tomcat of
your CenterView installation. Then click
OK
.

New Project


Create a new project in Eclipse


Plug
-
in source code is part of this project.


Builds the CenterView plug
-
in (class files).


Set as a Tomcat project (if needed).

New Project


Select
Java Project

from the drop
-
down.

New Project


Type the project name and click
Finish
.

New Project


Create a CenterView plug
-
in file


Configure the external JARs.


Create the package.


Create the new class.

New Project


Select
Properties

>
Java Path

from the
Project
menu, then add the API JARs
using
Add External JARs

and navigating
to
CenterView folder
/Server/plugins/lib/api.

New Project


Create a new package by expanding the
project, right
-
clicking
src
, then clicking
New

>
Package
.

New Project


Type the package name and click
Finish
.

New Project


Two options with class file location


Local to Project


Already configured for it.


Must copy to another directory to use.


Local to CenterView


Advanced configuration.


No need to copy class files.

Basic Debugging


Start the database.


Start the Eclipse IDE.


Start Tomcat from the IDE.


Put a breakpoint in the plug
-
in code.


Display the dashboard item that is
associated with the plug
-
in (preview in
browser or select in Builder).


Control returns to the IDE to allow
debugging.

Basic Debugging


Since you are not using the batch file to
start CenterView Server, you need to start
the database separately.


To start Postgres separately:


Navigate to
CenterView folder
/Pgsql.


Run
postgresql start
.


If you are using another database, it needs
to be running.

Basic Debugging


Alternately, you can set up an External
Tool Configuration.

Basic Debugging


Browse the file system to locate the postgresql
script file, add
start

to the
Arguments

list, give it
a name, then click
Apply
.

Basic Debugging


Start Tomcat by selecting the Tomcat
Start

button on the tool bar.

Basic Debugging


Select a Java file in your package, then
double
-
click in the gray bar to add a breakpoint
at a specific line in the code.

Basic Debugging


The IDE switches to a Debug perspective when
a breakpoint is hit.

Remote Debugging


IDEs also have the ability to remotely
debug a process


Requires the JVM of the process to be
debugged to start with certain flags set
(Tomcat Startup script).


IDE needs to connect to this process to
debug.

Remote Debugging

Tomcat Startup (Windows version)



SET INSTALLDIR=C:
\
PDE
\
CenterView3

SET JAVA_HOME=%INSTALLDIR%
\
jre

SET CATALINA_HOME=%INSTALLDIR%
\
Tomcat

SET CATALINA_BASE=%INSTALLDIR%
\
Tomcat

SET JAVA_OPTS=
-
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-
Djava.util.logging.config.file=%CATALINA_BASE%
\
conf
\
logging.properties
-
Djava.endorsed.dirs=%CATALINA_HOME%
\
common
\
endorsed
-
Dcatalina.base=%CATALINA_BASE%
-
Dcatalina.home=%CATALINA_HOME%
-
Djava.io.tmpdir=%CATALINA_BASE%
\
temp

SET JAVA_DEBUG=
-
Xdebug
-
Xrunjdwp:transport=dt_socket,address=8787,suspend=n,server=y

%JAVA_HOME%
\
bin
\
java
-
cp
%CATALINA_HOME%
\
bin
\
bootstrap.jar;%CATALINA_HOME%
\
bin
\
commons
-
logging
-
api.jar %JAVA_OPTS% %JAVA_DEBUG%
org.apache.catalina.startup.Bootstrap

Remote Debugging


Optionally, you can modify the
CenterView3/Tomcat/TomcatLauncher.properties
file and add the following line:



Application.commandline.options=
-
Xdebug;
-
Xrunjdwp:transport=dt_socket,server=y,suspend=n,

address=8787

Remote Debugging


Select
Debug Configurations

from the
Debug

tool bar drop
-
down.

Remote Debugging


Select
Remote Java Application

from the
list.


Click the
New

button in the Content pane.


Change the configuration name and the
port, then browse for the current project.


Click
Apply

to save the changes.

Remote Debugging

Remote Debugging


When debugging remotely:


Start the database.


Start Tomcat using the script.


Start the IDE.


Select
Debug Configuration

from the
Debug

tool bar drop
-
down.


Set breakpoints in code.


Display the dashboard in the browser.


Additional Resources


Corda Connection


Visual Evolution 2008



Go to
portal.corda.com


Login


Resources


Visual Evolution 2008


Other VE topics