[[PageOutline]] = '''PLUGIN MODULE STRUCTURE''' = == Module Structure == The structure of Sophie 2 module can be seen on [wiki:PLATFORM_STRUCTURE] page, second table. === Proto Project === We created a proto project module so we can easily create new modules with the correct structure. It is stored in the [source:/trunk/sophie2-platform/dev-tools] in zip format. Its structure is just like the module structure described in [wiki:PLATFORM_STRUCTURE] except the target folder, which is created after the build process. [[BR]]` It contains the needed folders created and: * Hello.java simple class to prevent failing the build if the module creator forgets to put classes in his/her new module. * pom.xml sample file which must be edited with the new module information. === How to make a new module === This is important so be careful reading and doing the steps: * Extract the archive org.sophie2.proto.project(the .zip file doesn't contain .svn files for its subfolders so you don't have to deal with nasty svn issues later), located in [source:/trunk/sophie2-platform/dev-tools]. in the [source:/trunk/sophie2-platform/modules modules] folder. * Edit its pom.xml file, changing the 'artifactId'. All other occurencies of org.sophie2.proto.project (for example in the should be replaced with the new module name. You should also edit the and tags. You can look at the tag if your module requires a main class or a class, extending SophieModule. * Rename the org.sophie2.proto.project folder to the name of the new module(using the file system or Refactor->Rename in Eclipse). * Add the name of the new module to the [source:/trunk/sophie2-platform/pom.xml] - modules section. * In Eclipse - Select 'Import'->'Maven Projects'->Choose the 'Root Directory' to be sophie2-platform folder in the repo and select the new module shown in the 'Projects' box-> Click Finish. * The project is shown and it has errors because the package is not correct - rename the package to be your new module name and you are ready to go. == Sophie Modules == The current sophie2-platform modules are listed in [source:/trunk/sophie2-platform/modules] folder. === Diagram === Here is a diagram with all the current modules and the dependencies between them:[[BR]] [source:/trunk/sophie2-platform/doc/uml-design-diagrams/Plugin_Dependency_Diagram.png] === Functionality === The list of modules and their functionality in few words: * org.sophie2.author - It is one of the main sophie2 parts and represents the Author Sophie2 edition. For now provides main method for running the application under Eclipse. It has varous configuration files in resources folder - for log4j, runtime properties and file with modules to be loaded for the author edition. * org.sophie2.base.* - Contains classes which provides base functionally for persistence, scenes, model book and resource models, layouts, halos and dialogs. org.sophie2.base module will be decomposed more in the future. * org.sophie2.core - Provides the core functionality. Contains 'properties' implementation(See [wiki:PRO_LIB_CORE_TUTORIAL], mvc logic implementation and testing package with the testing help classes. It will be decomposed more. * org.sophie2.core.modularity - Provides classes for dealing with common modularity issues and has very good demonstration(in the test folder) using them. * org.sophie2.launcher - Module for launching the editions and loading the modules needed. Contains Main which runs the application under JavaWebStart. * org.sophie2.main.* - Contains the main implementation for sophie2 components. Provides the viewed part of the project. * org.sophie2.messy - For 'messy' things. Contain everything that isn't already decomposed. * org.sophie2.server.* - Contains the sophie2 server libraries and starting server configurations. === Extension/Extension Points === ==== Description ==== Extension points / extensions are what makes application extensible. Simply speaking, application extensibility is adding on to already existing functionality. [[BR]] An '''extension point''' is an opening that may be added to by later code. [[BR]] An '''extension''' is code that adds onto an existing extension point. [[BR]] ==== Examples ==== These are the JPF classes and concepts which are similar to the Sophie implementation of extensions and extension points: * [http://jpf.sourceforge.net/api/org/java/plugin/registry/ExtensionPoint.html Extension Point] * [http://jpf.sourceforge.net/api/org/java/plugin/registry/Extension.html Extension] Concrete implementations and tests for the Sophie implementations are located in the [source:/trunk/sophie2-platform/modules/org.sophie2.core.modularity] module. in the test folder there is very useful example how to use the core.modularity library. Good example in our project is also the module [source:/trunk/sophie2-platform/modules/org.sophie2.base.dialogs]. There is [source:/trunk/sophie2-platform/modules/org.sophie2.base.dialogs/BaseDialogsModule.java BaseDialogsModule] which is module class for the base dialogs and represents the extension point(static inner class) for the dialogs, called DialogExtensionPoint. The [source:/trunk/sophie2-platform/modules/org.sophie2.base.dialogs/Dialog.java Dialog] represents the abstract class to be extended by the dialog extensions. ==== Diagram ==== * The extensions and extension points defined in the project now are: [[Image(source:/trunk/sophie2-platform/doc/uml-design-diagrams/Extensions_And_Extension_Points.png)]] [[BR]] * Something like a legend for the upper diagram for clear understanding about the arrows and components: [[Image(source:/trunk/sophie2-platform/doc/uml-design-diagrams/ex_ep_relation.png)]] === Shared Resources === Because of the need of external resources for our jars, we decided to make an API for resource managing. It will be implemented soon. [[BR]] The resources, which need to be shared with other modules, are located in src/main/resources/distrib folder in the module which provides them.