Friday, October 11, 2013

Installing and Starting Adobe Experience Manager as a Windows Service

 

Note:

  1. Your need to login as Administrator or start/run these steps using Run As Administrator command prompt. 
  2. If you don’t follow the above instruction, you will get Access denied error while completing steps.

Steps:

  1. Open the crx-quickstart\opt\helpers\instsrv.bat file in a text editor.
  2. If you are configuring a 64-bit Windows server, replace all instances of prunsrv with one of the following commands, according to your operating system:
    prunsrv_amd64
    prunsrv_ia64
    This command invokes the appropriate script that starts the Windows service daemon in 64-bit Java instead of 32-bit Java. 
  3. To prevent the process from forking into more than one process, increase the maximum heap size and the PermGen JVM parameters. Locate the set jvm_options command and set the value as follows:

    set jvm_options=-XX:MaxPermSize=256M;-Xmx1792m

  4. Open Command Prompt, change the current directory to the crx-quickstart/opt/helpers folder of the AEM installation, and enter the following command to create the service:

    instsrv.bat cq5

    To verify that the service is created, open Services in the Administrative Tools control panel or type start services.msc in Command Prompt. The cq5 service appears in the list.

  5. Start the service by doing one of the following:
    1. In the Services control panel, click cq5 and click Start.
      StartServices
    2. In the command line, type net start cq5
      StartCommandprompt
  6. Windows indicates that the service is running. AEM starts and the prunsrv executable appears in Task Manager.

    prunsrv

  7. Note: The property values in the instsrv.bat file are used when creating the Windows service. If you edit the property values in instsrv.bat, you must uninstall and then re-install the service.

  8. To uninstall the service, either click Stop in the Services control panel or in the command line, navigate to the folder and type instsrv.bat -uninstall cq5. The service gets removed from the list in the Services control panel or from the list in the command line when you type net start.

Ref: http://dev.day.com/docs/en/cq/current/getting_started/download_and_startworking.html#Installing%20and%20Starting%20Adobe%20Experience%20Manager%20as%20a%20Windows%20Service

Sunday, September 15, 2013

How to get Service in JSP?

Below are the two easiest ways to get Service:

1. Using the slingScriptHelper     

<sling:defineObjects />

<%

      ServiceType service = sling.getService(ServiceType.class);

%>

2. Using adaptTo()

adaptTo() method that will translate the object to the class type being passed as the argument.

Example:

Node node = resource.adaptTo(Node.class);

More Info on Adaptors: http://dev.day.com/docs/en/cq/current/developing/sling-adapters.html

Handy URLs–AEM 5.6

URLs

/crx/explorer/index.jsp  - CRX explorer

/crx/de/index.jsp – CRXDE Lite url

/damadmin     - DAM

/libs/cq/search/content/querydebug.html – Query debug tool

/libs/granite/security/content/admin.html – New user manager standalone ui  [5.6 only?]

/libs/cq/contentsync/content/console.html – Content sync console

/system/console/bundles – Felix web admin console

/system/console/jmx/com.adobe.granite.workflow%3Atype%3DMaintenance - Felix web admin console JMX / Workflow maintenance tasks

/system/console/jmx/com.adobe.granite%3Atype%3DRepository - Felix web admin console JMX / Repository maintenance tasks

/system/console/depfinder – This new 5.6 tool will help you figure out what package exports a class and also prints a Maven Dependency for the class.

/libs/granite/ui/content/dumplibs.rebuild.html?rebuild=true – Helpful link for debugging caching problems. Wipes the clientlibs and designs and forces it to rebuild it. Thanks to Mark Ellis for this link.

/system/console/adapters – This link shows you the Adapters are registered in the system. This helps you figure out what you can adaptTo() from resource to resource.

Params

wcmmode=DISABLED - This handy publisher parameter turns off CQ authoring features so you can preview a page cleanly

Thursday, September 5, 2013

How to get Administrative Resource Resolver in jsp?

 

Generic Code to get service from the OSGI service registry:

================================================================

If you are in a JSP Script you can do

<cq:defineObjects />

<%

      ServiceType service = sling.getService(ServiceType.class);

   %>

==================================================================

Get Administrative Resource Resolver :

<%!

      /**
           @Parms: ResourceResolverFactory
          returns ResourceResolver , Admin resource resolver will be return
    */
    public ResourceResolver getRR(ResourceResolverFactory resolverFactory)
    {

        ResourceResolver rr=null;
        try{

            rr= resolverFactory.getAdministrativeResourceResolver(null);
        }catch(Exception e)
        {
            System.out.println("RRF Exception:"+e.getMessage());
        }
        return rr;
    }

%>

<%

//Get ResourceResolverFactory service from OSGI service Registry

org.apache.sling.api.resource.ResourceResolverFactory  rrFactory = sling.getService(org.apache.sling.api.resource.ResourceResolverFactory.class);

          Resource r = getRR(rrFactory);  

%>

Wednesday, July 31, 2013

How to get Resource?

In OSGI Service/Compoment
You can access a resource through the JcrResourceResolverFactory service:

@Reference
private SlingRepository repository;

@Reference
private JcrResourceResolverFactory resolverFactory;

public void myMethod() {
    Session adminSession = null;   
    try {       
         String resourcePath = "path/to/resource";       
         adminSession = repository.loginAdministrative(null);       
         ResourceResolver resourceResolver = resolverFactory.getResourceResolver(adminSession);       
         Resource res = resourceResolver.getResource(resourcePath);    
    } catch (RepositoryException e) {
        log.error("RepositoryException: " + e);   
    } finally {       
        if (adminSession != null && adminSession.isLive()) {
           adminSession.logout();          
                adminSession = null;       
         }    
     }
}
In JSP

<sling:defineObjects>
<%
String resourcePath = "path/to/resource";
Resource res = resourceResolver.getResource(resourcePath);
%>