Mainly due to the new namespaces introduced in version 0.0.8, along with the minimization of the datatypes used by the Porcupine desktop, a direct upgrade is not feasible. This means that you have to follow a standard procedure in order to migrate your existing Porcupine applications.
It is now possible to gather your application's files in a single folder tree instead of having them scattered inside the "schemas", "pubdir" and "resources" folder trees. This way the development process gets significally faster.
- Before installing the new release, you must first gather all of your application's files in a single folder. Thus, create a new folder tree with the following structure (feel free to replace "MyApplication" with the real name of your application):
- If your application defines new types of Porcupine Objects, then copy the file(s) that define these new types inside the "schema" folder. Do not forget to create a blank "__init__.py" file to make this directory a Python module. If your application's schema is a single Python file, then it is usually a good idea to remove the "schema" folder, and rename your Python file to "schema.py".
- Next copy any new images, required by your application inside the "images" folder.
- Almost every Porcupine application has its own published directory, under the "pubdir" folder. Copy all the files contained inside this folder inside the "MyApplication" folder.
- Copy your applications servlets, string resources and QuiX UIs inside the "MyApplication" folder.
from org.innoscript.filetrack.strings import resources
sLang = request.getLang()
sYes = resources.getResource('YES', sLang)
sNo = resources.getResource('NO', sLang)
sInfo = resources.getResource('INFO', sLang)
- Extract your application's interface to a single QuiX file. Locate your application's object ID on the properties dialog. Open a browser and type "http://PORCUPINE_SERVER_NAME/porcupine.py/YOUR_APPLICATION_ID?cmd=run". Copy the XML displayed and paste it into a new QuiX file named "MyApplication.quix". Again this file should be inside the "MyApplication" folder. Likewise, if your initial interface definition file contains localized strings, convert this file to a PSP file, that imports and outputs the required strings, based on the preferred language of the client.
<context path="myapplication.quix" method=".*" client=".*" lang=".*" action="myapplication.quix"/>
<context path="myapplication.js" method=".*" client=".*" lang=".*" action="myapplication.js"/>
- Before installing Porcupine 0.0.8, keep a copy the "package" node of your application's registrations inside the "conf/store.xml" file, in order to restore this node to the new installation.
- Install Porcuine 0.0.8 and restore your application's package node inside the new "store.xml" configuration file.
- Copy the new folder tree inside the Porcupine installation. One good approach is to create Python packages based on the name of your company's/personal website domain name. Therefore, if your web site's domain is something.com, create the "com.something" Python package and paste your application's folder inside the "something" folder.
- If your new object definitions derive from objects other than the system objects, update your inheritance chain from "schemas.org.innoscript.XXXX" to "org.innoscript.desktop.schema.XXXX"
- Add your application's published directory by adding a new node to the "pubdir.xml" configuration file (the folder must be published with the same name).
<dir name="myapplication" path="com/something/`MyApplication"/>
- Ensure that the "config.xml" file located inside "com/something/MyApplication" folder, has all the required registrations (including those of the images).
- Re-create all the objects required for your application to operate including the application object, security groups, policies and containers. Notice that the application object schema has changed. All you need is to define its icon and its QuiX UI definition file. In our case, this URL is "myapplication/myapplication.quix".
- If you have constants referencing these objects in your code do not forget to make the required replacements.
- Restart Porcupine.
- Test and debug your application.