There are certain guidelines that you should follow regarding portlet-specific policies.
If a policy is used by a single portlet only, place the policy
into the portlet's project in
Mobile Portal Toolkit.
Each portlet's policies must be packaged in the
mcs-policies directory
of the portlet's WAR file.
Note: When the portlet has been created
using the Mobile Portal Toolkit,
everything under the WebContent directory of
the portlet project will be included in the portlet's WAR file.
Create a mcs-policies directory under the portlet
project's WebContent directory and create
your policies in that directory.
When policies in a portlet project are imported into the MCS database,
the (JDBC) PROJECT name in the database will be the portlet application
unique ID (uid) value from the portlet-app element in the portlet's
portlet.xml file.
See the bold highlighted text in the following code example.
<portlet-app uid="com.ibm.mwp.portlets.MWPweather:2" major-version="1" minor-version="0">
Note: This
unique ID is guaranteed to be unique. You cannot install a portlet
into WebSphere® Portal if its unique ID conflicts
with an already installed portlet.
The policies in a portlet's WAR file will be imported into
the MCS database when the portlet is installed into WebSphere Portal.
The portlet install code will look for the
mcs-policies directory
in the portlet's WAR file and automatically import any policies
it finds under that directory. Open the WebSphere Portal
log file and look at the most recent log entries in that file. The
following message displays:
2004.01.01 12:00:00.000 I com.ibm.mwp.util.MWPPPIPortletListener importPortletPolicies
CWMPU0005I: The results for importing MyPortlet application portlet policies are:
Commencing Transfer...
Transfering image component policies...
Commiting changes...
Transfer Complete.
The
CWMPU0005I message and the "Transfer Complete"
output indicate a successful import of the portlet policies. If the
import fails, an error is logged (message
CWMPU0006E)
in the latest WebSphere Portal log file and the portlet's
policies need to be imported manually. The
Importing policies
into the Multi-Channel Server database topic in this information
center describes how to import the policies.
Note: Put policy files
into the mcs-policies directory only.
When you test the portlet in the Mobile Portal Toolkit test
environment, the portlet policies do not need to be imported in a
MCS database. MCS is configured to use a XML repository and is able
to find the portlet policies in the portlet's mcs-policies directory
without any action required on your part.