After you create a custom project as explained in Step 1: Implementing the VarPack, you must deploy it to the portal using Dynamic Discovery. For detailed information and instructions, see ALI Development Environment : Deploying Custom Code Using Dynamic Discovery. To deploy a VarPack, use Jar or DLL-Based Dynamic Discovery.
The example below deploys the Hello World VarPack sample code on the previous page. Once you have deployed your code, confirm that it was deployed correctly as explained in Viewing Your Customization in the Portal at the bottom of this page.
These instructions use Visual Studio in .NET and Ant scripts in Java to deploy your custom code. For details on requirements for using Ant scripts, see ALI Development Environment: Setting Up the Development Portal.
First, add the library containing the new HelloWorld VarPack class to the CustomVarPacks.xml file so it can be deployed by Dynamic Discovery as explained below.
Navigate to PT_HOME\settings\portal and open CustomVarPacks.xml in a text editor.
Add the name of your new VarPack (e.g., HelloWorldVarPack) to the existing XML as shown below. Make sure that the spelling and capitalization is exactly the same as the full class name.
<root>
<interface name="IVarPack"/> <interfaceassembly name="httpmemorymanagement"/> <class name="com.plumtree.sampleui.application.varpacks.HelloWorldVarPack"/>
</root>
Create the new XML file that will be read by HelloWorldVarPack: open a text editor and create a new file named helloworld.xml and save it in PT_HOME\settings\portal.
Add the xml describing the data as shown below and save the file.
<?xml version="1.0"?> <HelloWorldConfig> <HelloWorldData> <Hello value="World"/> <HelloWorld value="Hello World!"/> <HelloWorldCellWidth value="50"/> <HelloWorldFolderID value="1"/> </HelloWorldData> </HelloWorldConfig>
Once you have created the required files, you must run a clean build to deploy the custom code, as explained below. (The process is different for Java and .NET; if you cannot see the instructions you need, reset the language filter at the top of the page. No VB sample code is provided in this example.)
Java:
Open a command prompt and change the directory to the \ptwebui directory where you installed the UICI.
Run a clean build using the following Ant script: ant build
ant build
Generate a new WAR file for the application server using the following Ant script: ant install Note: This target deletes and rebuilds all jar files associated with all the UI source projects (as well as the custom projects in the ptwebui folder). See Creating a Custom Project (Java) for details on adding your projects to the build script.
ant install
C#:
Build the project in Visual Studio.
Visual Studio should copy the samplevarpack.dll file from SOURCE_HOME\samplevarpack\dotnet\prod\bin to PORTAL_HOME\webapp\portal\bin for you. If there are problems with Dynamic Discovery on startup, you might need to do this step manually. This is necessary to allow Dynamic Discovery to find the new library.
Once you have deployed your code, view the changes in the portal to confirm that they were loaded correctly. Use ALI Logging Spy (formerly called Plumtree Logging Spy) to catch any obvious errors.
Click Start | Programs | plumtree | PT Logging Utilities | Logging Spy or navigate to PORTAL_HOME\ptlogging\6.0\bin to open ALI Logging Spy. For details on using ALI Logging Spy, see Configuring ALI Logging Utilities.
Click the Set Filters button to open the Filter Settings dialog. Make sure the Debug checkbox is checked. (You will not be able to see the customization run if this logging level is not enabled.)
Start the portal and view ALI Logging Spy. During startup, ALI Logging Spy should display a message regarding loading Custom VarPacks, as shown in the image below. Earlier in the startup process, standard VarPacks are loaded from VarPacks.xml. Be careful not to get these two confused. If no Custom VarPacks were loaded, check the spelling and capitalization of HelloWorldVarPack in the CustomVarPacks.xml file.
Open a new browser window and navigate to the portal. Log in as Administrator.
Go to the following URL in your browser: http://portal.sample.plumtree.com/portal/server.pt?space=MemoryDebug (replace portal.sample.plumtree.com is replaced with your portal address).
Scroll down to the Variable Packages section; you should see the HelloWorldVarPack listed as shown below.
Click the View button next to HelloWorldVarPack to view the data stored in the VarPack.
If you were unable to view the HelloWorldVarPack, see the next page for debugging instructions.
Next: Step 3: Debugging and Troubleshooting