Thursday, April 28, 2011

Including resources in OSGi bundle

you can has:

                        <Include-Resource>
                            {maven-resources}, {maven-dependencies},
                            templates=src/resources/templates
                        </Include-Resource>


inside  maven-bundle-plugin

            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.0.1</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                         ...
                        <Include-Resource>
                            {maven-resources}, {maven-dependencies},
                            templates=src/resources/templates
                        </Include-Resource>
                          ...
                    </instructions>
                </configuration>
            </plugin>


You need {maven-resources} and {maven-dependencies} or mvn packages fails.

And it is dst-pat-in-the-jar=src  (templates=src/resources/templates)

Wednesday, April 27, 2011

sling mapping /etc/map

You can test jcr resolving stuff under http://localhost:4502/system/console/jcrresolver

  1. make /etc/map nt:unstructured so that you can order  stuff there in crxde lite (sling:match regexes are applied from top to bottom)
  2. I use only one level deep (/etc/map/foo, /etc/map/bar)
  3. The string matched against sling:match regexes have the following format: <protocol>/<host>.<port><path>   (for example,  http/example.com.4502/content/mcdonalds/en.html)
  4. you can use it to redirect /foo/bar/ to /content/site/en/foo/bar.html
  5. not sure how short paths like /foo/bar/  will work with replication :P

sling:OsgiConfig for multiple run modes

You can have multiple run modes and have CQ (or Sling.. I don't know) select proper sling:OsgiConfigs.

For example,  if your run modes are a,b config.a.b are applied:

  • author,production
    • /apps/<foo>/config.author.production/*
  • author,staging
    • /apps/<foo>/config.author.staging/*
  • publish,production
    • /apps/<foo>/config.publish.production/*

Probably order of run modes are important. And I'm not sure if more than two run modes will work.

TODO:

  • author,production,foo,bar
    • /apps/<foo>/config.author.production.foo.bar/*
    • /apps/<bar>/config.author.production.foo.bar/*
    • /apps/<foo>/config/config.author.production.foo.bar/*
    • /apps/<foo>/config.production.bar.foo.author/*

test what configuration is selected...

in place upgrade to CQ 5.4 GA

  1. turn off replication agents
  2. back up (snapshot or online backup.. in case something goes wrong)
  3. remove /etc/workflow/instances
  4. create /etc/workflow/instances :: sling:Folder
  5. remove /var/eventing/jobs
  6. create /var/eventing/jobs :: sling::OrderedFolder
  7. change admin password to "admin" (for CRX.. probably for other things too)
  8. shutdown CQ
  9. cp crx-quickstart/server/serverctl ~/backup/  (back up other stuff too if you want to)
  10. rm -rf crx-quickstart/launchpad
  11. rm -rf crx-quickstart/server
  12. rm -rf crx-quickstart/logs
  13. mv ~/Downloads/cq-quickstart-5.4.0.jar /opt/cq/
  14. sudo su day (MAKE SURE you are the same user CQ runs as)
  15. java -XX:MaxPermSize=256m -Xmx1024m -Dsling.run.modes=author,production -jar cq-quickstart-5.4.0.jar -v -p 4502
  16. deploy.sh <build-number> (launchpad is wiped out.. so need to redeploy stuff)
  17. enable replication agents
  18. test
  19. restart CQ using serverctl

CQ upgrade gotchas:

  1. admin password should be changed to "admin" or bad things happen.
  2. empting out /etc/workflow/instances saves time for upgrade.
  3. removing crx-quickstart/launchpad does you many good. otherwise, OSGi bundles don't get fully upgraded.
  4. make sure you restart CQ for upgrade as a proper user. Otherwise, crx-quickstart/repository  will be messed up.