plug-in development environment. session outline tools installation configuration new project basic...

34
Plug-in Development Environment

Upload: jean-snow

Post on 31-Dec-2015

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Plug-in Development Environment

Page 2: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Session Outline

• Tools

• Installation

• Configuration

• New Project

• Basic Debugging

• Remote Debugging

Page 3: 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

Page 4: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Installation

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

Page 5: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 6: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Installation

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

Page 7: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Configuration

• Start Eclipse (eclipse/eclipse.exe).

• Choose a workspace.

Page 8: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Configuration

• Go to the workbench.

Page 9: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Configuration

• Select Preferences from the Window menu.

Page 10: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Configuration

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

Page 11: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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).

Page 12: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

New Project

• Select Java Project from the drop-down.

Page 13: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

New Project

• Type the project name and click Finish.

Page 14: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

New Project

• Create a CenterView plug-in file– Configure the external JARs.– Create the package.– Create the new class.

Page 15: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 16: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

New Project

• Create a new package by expanding the project, right-clicking src, then clicking New > Package.

Page 17: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

New Project

• Type the package name and click Finish.

Page 18: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 19: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 20: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote 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.

Page 21: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Basic Debugging

• Alternately, you can set up an External Tool Configuration.

Page 22: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 23: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Basic Debugging

• Start Tomcat by selecting the Tomcat Start button on the tool bar.

Page 24: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 25: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Basic Debugging

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

Page 26: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 27: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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

Page 28: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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

Page 29: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Remote Debugging

• Select Debug Configurations from the Debug tool bar drop-down.

Page 30: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

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.

Page 31: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Remote Debugging

Page 32: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging 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.

Page 33: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging

Additional Resources

• Corda Connection – Visual Evolution 2008 – Go to portal.corda.com– Login– Resources– Visual Evolution 2008

• Other VE topics

Page 34: Plug-in Development Environment. Session Outline Tools Installation Configuration New Project Basic Debugging Remote Debugging