Software Project Lifecycle is a sample on how a user is able to make use of the "Lifecycle status"
in a project development cycle. Initially an Architect designs 'Use case diagrams and other designs
which is then implemented by the Developers. After finishing the implementation task,
Developers promote the resource to the Testing state for further validation of the resource/product.
After passing all the tests, QA allows customers to deploy the product/project. Therefore,
altogether this has five states.
Design
Development
Testing
Production
Deprecated
Running the sample
Copy the org.wso2.carbon.governance.samples.lcm-3.0.0.jar and
org.wso2.carbon.governance.samples.lcm.notifications-3.0.0.jar bundles to
GREG_HOME/repository/components/dropins folder.
Start the server.
Log on to the Management Console and select Configure --> Lifecycles menu.
Add the following lifecycle configuration using 'Add New Lifecycle' option.<aspect name="Software Project Lifecycle" class="org.wso2.carbon.governance.samples.lcm.DistributedLCM">
<!-- Checklist can either be provided as a resource(type=resource) or as xml content(type=literal, default) as provided below. -->
<!-- <configuration type="resource">/workspace/configuration</configuration> -->
<!-- OR -->
<configuration type="literal">
<lifecycle>
<state name="Design" location="/environment/design" roles="arch">
<checkitem>Requirements Gathered</checkitem>
<checkitem>Architecture Finalized</checkitem>
<checkitem>High Level Design Completed</checkitem>
<js>
<console promoteFunction="doPromote">
<script type="text/javascript">
doPromote = function() {
window.location = "../resources/resource.jsp?path=/environment/development";
}
</script>
</console>
<server promoteFunction="doPromote">
<script type="text/javascript">
function doPromote() {
return "Promoted Resource/Collection to Development State";
}
</script>
</server>
</js>
</state>
<state name="Development" location="/environment/development" roles="dev">
<permissions>
<permission action="promote" roles="tmc"/>
</permissions>
<checkitem>Code Completed</checkitem>
<checkitem>WSDL, Schema Created</checkitem>
<checkitem>QoS Created</checkitem>
<js>
<console promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
doDemote = function() {
window.location = "../resources/resource.jsp?path=/environment/design";
}
doPromote = function() {
window.location = "../resources/resource.jsp?path=/environment/qa";
}
</script>
</console>
<server promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
function doDemote() {
return "Demoted Resource/Collection to Design State";
}
function doPromote() {
return "Promoted Resource/Collection to Testing State";
}
</script>
</server>
</js>
</state>
<state name="Testing" location="/environment/qa" roles="qa">
<checkitem>Effective Inspection Completed</checkitem>
<checkitem>Test Cases Passed</checkitem>
<checkitem>Smoke Test Passed</checkitem>
<js>
<console promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
doDemote = function() {
window.location = "../resources/resource.jsp?path=/environment/development";
}
doPromote = function() {
window.location = "../resources/resource.jsp?path=/environment/production";
}
</script>
</console>
<server promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
function doDemote() {
return "Demoted Resource/Collection to Development State";
}
function doPromote() {
return "Promoted Resource/Collection to Production State";
}
</script>
</server>
</js>
</state>
<state name="Production" location="/environment/production" roles="prod">
<checkitem>Project Item Deprecated</checkitem>
<js>
<console promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
doDemote = function() {
window.location = "../resources/resource.jsp?path=/environment/qa";
}
doPromote = function() {
window.location = "../resources/resource.jsp?path=/environment/deprecated";
}
</script>
</console>
<server promoteFunction="doPromote" demoteFunction="doDemote">
<script type="text/javascript">
function doDemote() {
return "Demoted Resource/Collection to Testing State";
}
function doPromote() {
return "Promoted Resource/Collection to Deprecated State";
}
</script>
</server>
</js>
</state>
<state name="Deprecated" location="/environment/deprecated" roles="arch, prod">
<js>
<console demoteFunction="doDemote">
<script type="text/javascript">
doDemote = function() {
window.location = "../resources/resource.jsp?path=/environment/production";
}
</script>
</console>
<server demoteFunction="doDemote">
<script type="text/javascript">
function doDemote() {
return "Demoted Resource/Collection to Production State";
}
</script>
</server>
</js>
</state>
</lifecycle>
</configuration>
</aspect>
Create a collection /environment/design.
Add a resource into that collection.
Navigate to the newly created resource.
At the Lifecycle panel, Add Software Project Lifecycle to the resource.
Add the current user to the role tmc (required to promote from the Development state).
Check all the options and Promote.
Go to /environment/design collection, where resource is stored with its new life cycle state.
Select that resource and promote. It can then be found in /environment/development collection
with the next state.
Your resource will be promoted in the following manner.
/environment/design
/environment/development
/environment/qa
/environment/production
/environment/Deprecated
Similarly your resource can be demoted in the reverse order.
Note:- You also can add lifecycle configurations on the registry.xml file. Such configurations
will be globally available to all users of this server instance.
WS-API Sample
The WS Registry API exposes a complete set of registry operations that can be accessed through Web Service calls.
This readme explains how to run the sample that uses the WS Registry client sample.
Pre - Requirements
Before getting the sample to work you have to run ant from GREG_HOME/bin. This copies all the necessary libraries to their respective locations.
Start the WSO2 Governance Registry by running the respective script (wso2server.sh or wso2server.bat) from GREG_HOME/bin.
Steps to get this sample to work
Execute the ant command (i.e. ant run) from the sample directory.
Each operation that occurred will be printed on the console.
A resource will be created in root by the name of abc (i.e. path = \abc).
This can be checked through the Resource Browser which can be accessed through the Management Console.
Exporting/importing a file to Remote registry
Introduction
This sample demonstrates how to export a local file system into a remote registry, and how to import
a remote registry into a local file system. We can build our content in the local file system with
the folder hierarchy we want, including any type of content. Then we can use the registry API to
export our local file system into the registry.
Once we upload a local file system into the registry we have socially enabled it.
We can comment on resources, we can tag, we can rate, etc...
We can also build our hierarchy in the Registry with the structure we want, and then we can download
or import the remote registry into our local file system. Then the registry will create the exact
same folder structure and download all the files in the registry.
Running the sample
Running the sample is just a matter of executing an ant file. If you don't
have ant, you can download it at http://ant.apache.org/.
Run ant at the GREG_HOME/bin folder of the distribution.
Exporting local file system into a remote registry
Run ant upload inside the GREG_HOME/samples/filesampleutils folder.
You will be asked for:
Key store file path: Provide GREG_HOME/resources/security/client-truststore.jks
Registry URL : Provide https://localhost:9443/registry
(If your registry is in somewhere else then give that path)
User name : If you have not changed the admin user then pass admin
Password : Use admin
FromPath : Location in the file system to export from. Enter the
full path to the resources folder (eg:- C:\test\test.txt)
ToPath : Where to put the resource. In this sample let's use
/sample/file
If you login to the management console you can see that all the files have been
moved and the registry has the same structure as the filesystem under
Resources listing.
Importing a file into the local file system
Now we go the other way. Again, run ant download first, and provide values:
Key store file path : GREG_HOME/resources/security/client-truststore.jks
Registry URL : Provide https://localhost:9443/registry
(If your registry is in somewhere else then give that path)
User name : If you have not changed the admin user then pass admin
Password : Use admin
FromPath : Resource path, such as /sample/file
ToPath : Where to put the resource in the local filesystem. For this
sample let's use C:\Documents and Settings\test
Once you run ant you will see a newly created folder hierarchy in the path you specified.
Note:- You should put all the required jars into the GREG_HOME/lib folder.
org.wso2.carbon.registry.core-3.0.0.jar and org.wso2.carbon.user.core-3.0.0.jar (Find at GREG_HOME/repository/components/plugins folder)
axis2-transport-base-1.0.0.wso2v1.jar (Find at GREG_HOME/repository/components/plugins folder)
Place all those jars in GREG_HOME/lib folder.
Project Proposal Handler Sample
Introduction
The idea of this sample is to demonstrate how to use media type handlers. The sample
application is to process project proposals, so we'll be using a component that intercepts
Registry put() requests with a particular "proposal" media-type. The Handler will read
the proposal and mark it as valid or not. In order to be a valid proposal there should be
a number of fields - if all of them are there then the handler will mark the proposal as
valid. If one or more fields are missing then the proposal would be invalid.
Build the distribution.
Copy the org.wso2.carbon.registry.samples.handler-3.0.0.jar into
GREG_HOME/repository/components/dropins.
Edit the registry.xml file which is in GREG_HOME/repository/conf folder with the following xml snippet.<handler class="org.wso2.carbon.registry.samples.handler.ProjectProposalMediaTypeHandler" methods="PUT">
<filter class="org.wso2.carbon.registry.core.jdbc.handlers.filters.MediaTypeMatcher">
<property name="mediaType">pp</property>
</filter>
</handler>
Start the server.
Go to admin console.
Go to Add a new resource window.
Select the Upload content from file from the drop down list.
Select your project proposal and type the media type as pp (you can use whatever the media type you prefer).
Note:- Sample project proposals are available in GREG_HOME/samples/handler/src/resources folder.
And Add it.
Browse to the added project proposal. You could see the Properties and the Tag have been added to the resource..
Custom UI Sample
This sample demonstrates how a simple custom UI can be created to add, view, and edit,
endpoints stored on the WSO2 Governance Registry. Please note that the Resource Name,
Endpoint Name and the Endpoint URI are mandatory fields, and The URI must be valid.
Adding an endpoint reference as a resource
Drop the following jars into GREG_HOME/repository/components/plugins.
Put the org.wso2.carbon.registry.samples.custom.topics-3.0.0.jar into the plugins folder.
Put the org.wso2.carbon.registry.samples.custom.topics.ui-3.0.0.jar into the plugins folder.
Add the following bundle info details that is in the bundles.info file which is located at
GREG_HOME/repository/components/configuration/org.eclipse.equinox.simpleconfigurator.
Restart the server and Log in to the admin console and go to the Resources menu.
Click Add Resource link to add a new resource and choose Create custom content from Method combo box.
A text box named Media type will be displayed, from which select other option from drop down button for media type.
Enter epr as the media type.
Click Create Content. A form to fill endpoint details will be displayed.
Fill the form and click Save. The resource will be added.
Browsing the resource
Browse the added resource from the Entries table and click on it.
The content of the resource will be shown in a custom view.
The content can be edited by clicking Edit endpoint.
Shutterbug Sample
The idea of this sample is to demonstrate how to use the WSO2 Governance Registry to build
real world applications. This sample is designed to be used to host a competition on the
WSO2 Governance Registry that will select 12 images out of several hundreds of images to
be published on a calendar. Each user will be allowed to upload up to 2 images, and can
vote for 12 images. Finally the administrators can browse the images with the highest
number of votes and decide on the winners.
Copy org.wso2.governance.samples.shutterbug.ui/src/main/resources/web/shutterbug/resources/crossdomain.xml
in to the tomcat's ROOT context.
Copy the jars found in GREG_HOME/samples/shutterbug/bin to GREG_HOME/repository/components/dropins.
Set the Index Page URL in GREG_HOME/repository/conf/carbon.xml as follows.<IndexPageURL>/carbon/shutterbug/shutterbug-ajaxprocessor.jsp</IndexPageURL>
Start the server.
Go to the admin console.
Cooliris 3D Embed Wall
This sample uses the Cooliris 3D Embed Wall (online), to display uploaded images. More
information on how to use the Cooliris 3D Embed Wall, and Terms and Conditions of usage
can be found at http://www.cooliris.com.