import java.io.File;
import java.io.PrintStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import javax.jcr.AccessDeniedException;
import javax.jcr.InvalidItemStateException;
import javax.jcr.ItemExistsException;
import javax.jcr.ReferentialIntegrityException;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
import javax.jcr.version.VersionException;
import org.apache.jackrabbit.commons.JcrUtils;
import org.apache.log4j.Logger;
/**
* Connecting AEM server using below code
* @author Sailaxman R
*
*/
public class connectAEMServer{
private static Logger LOG = Logger.getLogger(connectAEMServer.class);
/**
* AEM SERVER DETAILS
*/
private static final String WORKSPACE ="crx.default";
private static final String LOGIN_USRNAME ="admin";
private static final String LOGIN_PASWRD ="admin";
private static final String SERVER_URL ="http://localhost:4502/crx/server";
System.out.println("###### CONNECTING AEM SERVER ######");
Repository repository = JcrUtils.getRepository(SERVER_URL);
session = repository.login(new SimpleCredentials(LOGIN_USRNAME, LOGIN_PASWRD.toCharArray()), WORKSPACE);
System.out.println("###### AEM CONNECTION SUCCESSFULL ######");
System.out.println("###### USER_ID connected : " + session.getUserID());
System.out.println("###### SESSION.GETREPOSITORY():"+session.getRepository());
import java.io.PrintStream;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import javax.jcr.AccessDeniedException;
import javax.jcr.InvalidItemStateException;
import javax.jcr.ItemExistsException;
import javax.jcr.ReferentialIntegrityException;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.nodetype.NoSuchNodeTypeException;
import javax.jcr.version.VersionException;
import org.apache.jackrabbit.commons.JcrUtils;
import org.apache.log4j.Logger;
/**
* Connecting AEM server using below code
* @author Sailaxman R
*
*/
public class connectAEMServer{
private static Logger LOG = Logger.getLogger(connectAEMServer.class);
/**
* AEM SERVER DETAILS
*/
private static final String WORKSPACE ="crx.default";
private static final String LOGIN_USRNAME ="admin";
private static final String LOGIN_PASWRD ="admin";
private static final String SERVER_URL ="http://localhost:4502/crx/server";
System.out.println("###### CONNECTING AEM SERVER ######");
Repository repository = JcrUtils.getRepository(SERVER_URL);
session = repository.login(new SimpleCredentials(LOGIN_USRNAME, LOGIN_PASWRD.toCharArray()), WORKSPACE);
System.out.println("###### AEM CONNECTION SUCCESSFULL ######");
System.out.println("###### USER_ID connected : " + session.getUserID());
System.out.println("###### SESSION.GETREPOSITORY():"+session.getRepository());
}
No comments:
Post a Comment