Development documentation

Schema location

The schema is located in the folder: src/main/resources.

Adding the schemas to the main project web site

During the site phase the schema is copied to the main site in the pineapple-project. The schema is copied to the directory: /ns/plugin.

This is implemented in the pom.xml for the pineapple-ssh-plugin project.

Generation of classes from XML schemas

The project uses JAXB through the Maven plugin cxf-xjc-plugin to generate classes from XML schema.

Customized package names

The generated classes are mapping into the package com.alpha.pineapple.plugin.ssh.model using the JAXB bindings file at: src/main/resources/bindings.xjb.

Customized type names

The JAXB bindings file also defines mappings of Schema type into Java types. The applied rule is to remove the postfixed Type from the Schema type in the corresponding Java types, i.e. from the schema type named NiceType a Java type named Nice is generated by JAXB.

Internal configuration

Logging

The plugin uses Log4j for logging. Each project which links to this project must provide a Log4j configuration which is accessible at runtime as a result of the build process.

The plugin component does not provide a Log4j configuration as part of its production build. A log4j configuration file is defined in the project in the directory src/test/resources/log4.properties for testing.

The test configuration configures Log4j to write to the log file to ${user.home}/.pineapple/logs/pineapple.log.

Spring configuration file

The plugin contains a configuration file which defines a Spring application context. The Spring application context defines the input unmarshalling for the plugin. The file is located in src/main/resources/com.alpha.pineapple.plugin.ssh-config.xml.

Internationalization (I18N) configuration file

The report generator uses internationalization. Messages used by classes in the project are located in the file src/main/resources/com.alpha.pineapple.plugin.ssh-messages.properties.

JAXB binding file

JAXB bindings file used during generation of model objects from the plugin schema is located at src/main/resources/bindings.xjb.

Test

Pineapple continuous integration

The integration test fot the plugin uses the Pineapple Continuous Integration to provide test servers for tests. The test infrastructure is used to provide a test server which is accessed for to validate the distributed functionality of the plugin.

Unit test

The package com.alpha.testutils contains helper classes for testing the plugin:

  • ObjectMotherContent is a helper class used to create content for operations and initialize directories shared between test guest and hosts.
  • ObjectMotherSshSession provides helper functions for unit testing SSH sessions.
    • SshTestConstants define constants for tests.

Implementation

Plugin class

The package com.alpha.pineapple.plugin.ssh is the root package of the plugin and contains the plugin class PluginImpl.

Session class

The package com.alpha.pineapple.plugin.ssh.session contains the session classes for the plugin:

  • SshSession defines interface for SSH sessions.
  • SshSessionImpl extends the SshSession interface.
  • SilentUserInfoImpl implement the UserInfo interface from the Jsch API which provides credentials to SSH sessions.

Operation classes

The package com.alpha.pineapple.plugin.ssh.operation contains the operation classes for the plugin:

The plugin implement these default operations:

  • DefaultOperation implements the wildcard operation.

Model helper classes

None implemented, as the model is very small.

Helper classes

The package com.alpha.pineapple.plugin.ssh.utils contains helper classes for the plugin:

  • JSchLog4JLogger implements the JSCH Logger which bridges log events to Log4j.
  • SshHelper defines interface for common functionality used by the plugin.
  • SshHelperImpl implements the SshHelper interface.