Examples of RepositoryContext


Examples of org.apache.jackrabbit.core.RepositoryContext

     * @param target target node store
     * @throws RepositoryException if the copy operation fails
     */
    public static void copy(RepositoryConfig source, NodeStore target)
            throws RepositoryException {
        RepositoryContext context = RepositoryContext.create(source);
        try {
            new RepositoryUpgrade(context, target).copy();
        } finally {
            context.getRepository().shutdown();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.RepositoryContext

            System.exit(1);
        }
    }

    private static void upgrade(String olddir, String newdir) throws Exception {
        RepositoryContext source = RepositoryContext.create(
                RepositoryConfig.create(new File(olddir)));
        try {
            FileStore store = new FileStore(
                    new File(newdir), 256 * 1024 * 1024, true);
            try {
                NodeStore target = new SegmentNodeStore(store);
                new RepositoryUpgrade(source, target).copy();
            } finally {
                store.close();
            }
        } finally {
            source.getRepository().shutdown();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.RepositoryContext

     * @param target target node store
     * @throws RepositoryException if the copy operation fails
     */
    public static void copy(RepositoryConfig source, NodeStore target)
            throws RepositoryException {
        RepositoryContext context = RepositoryContext.create(source);
        try {
            new RepositoryUpgrade(context, target).copy();
        } finally {
            context.getRepository().shutdown();
        }
    }
View Full Code Here

Examples of org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext

     
      log.info("Initializing git context.");
     
      int tenantId = Integer.parseInt(repositoryInformation.getTenantId());
      String gitLocalRepoPath = repositoryInformation.getRepoPath();
        RepositoryContext gitRepoCtx = new RepositoryContext();
        String gitRemoteRepoUrl = repositoryInformation.getRepoUrl();
        boolean isMultitenant = repositoryInformation.isMultitenant();
       
        log.info("local path " + gitLocalRepoPath);
        log.info("remote url " + gitRemoteRepoUrl);
        log.info("tenant " + tenantId);
       
        gitRepoCtx.setTenantId(tenantId);
        gitRepoCtx.setGitLocalRepoPath(getRepoPathForTenantId(tenantId,gitLocalRepoPath,isMultitenant));       
        gitRepoCtx.setGitRemoteRepoUrl(gitRemoteRepoUrl);
   
    gitRepoCtx.setRepoUsername(repositoryInformation.getRepoUsername());
    gitRepoCtx.setRepoPassword(repositoryInformation.getRepoPassword());

        try {
      if(isKeyBasedAuthentication(gitRemoteRepoUrl, tenantId)) {
          gitRepoCtx.setKeyBasedAuthentication(true);
          initSSHAuthentication();
      }
      else
          gitRepoCtx.setKeyBasedAuthentication(false);
    } catch (Exception e1) {
      log.error("Exception occurred.. " + e1.getMessage(), e1);
    }

        FileRepository localRepo = null;
        try {
            // localRepo = new FileRepository(new File(gitLocalRepoPath + "/.git"));
            // Fixing STRATOS-380
            localRepo = new FileRepository(new File(gitRepoCtx.getGitLocalRepoPath() + "/.git"));

        } catch (IOException e) {
            e.printStackTrace();
        }

        gitRepoCtx.setLocalRepo(localRepo);
        gitRepoCtx.setGit(new Git(localRepo));
        gitRepoCtx.setCloneExists(false);

        cacheGitRepoContext(tenantId, gitRepoCtx);
    }
View Full Code Here

Examples of org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext

        .entrySet()) {

      int tenantId = tenantMap.getKey();
      //log.info("map count has values..tenant Id : " + tenantId);
     
      RepositoryContext gitRepoCtx = retrieveCachedGitContext(tenantId);
      if (gitRepoCtx == null) {
       
          log.info("No git repository context information found for tenant "
              + tenantId);

        return false;
      }

      Git git = gitRepoCtx.getGit();
      StatusCommand statusCmd = git.status();
      Status status = null;
      try {
        status = statusCmd.call();

      } catch (GitAPIException e) {
        log.error(
            "Git status operation for tenant "
                + gitRepoCtx.getTenantId() + " failed, ", e);
        return false;
      }
      //log.info("status : " + status.toString());
      if (status.isClean()) {// no changes, nothing to commit
       
View Full Code Here

Examples of org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext

      // if context for tenant is not initialized
      if(tenantToRepoContextMap.get(tenantId) == null)
        initGitContext(repositoryInformation);
     
       
    RepositoryContext gitRepoCtx = retrieveCachedGitContext(tenantId);
        if(gitRepoCtx == null) { //to handle super tenant scenario
           // if(log.isDebugEnabled())
                log.info("No git repository context information found for deployment synchronizer");

            return true;
        }

        synchronized (gitRepoCtx) {
            if(!gitRepoCtx.cloneExists())
                cloneRepository(gitRepoCtx);

            return pullArtifacts(gitRepoCtx);
        }
    }
View Full Code Here

Examples of org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext

   
    public void scheduleSyncTask (RepositoryInformation repoInformation, long delay) {

        int tenantId = Integer.parseInt(repoInformation.getTenantId());

        RepositoryContext repoCtxt = tenantToRepoContextMap.get(tenantId);
        if (repoCtxt == null) {
            log.error("Unable to schedule artifact sync task, repositoryContext null for tenant " + tenantId);
            return;
        }

        if (repoCtxt.getArtifactSyncSchedular() == null) {
           synchronized (repoCtxt) {
               if (repoCtxt.getArtifactSyncSchedular() == null) {
                   // create a new ScheduledExecutorService instance
                   final ScheduledExecutorService artifactSyncScheduler = Executors.newScheduledThreadPool(1,
                           new ArtifactSyncTaskThreadFactory(repoCtxt.getGitLocalRepoPath()));

                   // schedule at the given interval
                   artifactSyncScheduler.scheduleAtFixedRate(new ArtifactSyncTask(repoInformation), delay, delay, TimeUnit.SECONDS);
                   // cache
                   repoCtxt.setArtifactSyncSchedular(artifactSyncScheduler);

                   log.info("Scheduled Artifact Synchronization Task for path " + repoCtxt.getGitLocalRepoPath());

               } else {
                   log.info("Artifact Synchronization Task for path " + repoCtxt.getGitLocalRepoPath() + " already scheduled");
               }
           }
        }
    }
View Full Code Here

Examples of org.apache.stratos.cartridge.agent.artifact.deployment.synchronizer.git.internal.RepositoryContext

      // if context for tenant is not initialized
      if(tenantToRepoContextMap.get(tenantId) == null)
        initGitContext(repositoryInformation);
     
       
    RepositoryContext gitRepoCtx = retrieveCachedGitContext(tenantId);
        if(gitRepoCtx == null) {
            return false;
        }

        /*if(gitRepoCtx.getTenantId() == GitDeploymentSynchronizerConstants.SUPER_TENANT_ID)
            return true;  */
        return gitRepoCtx.cloneExists();
    }
View Full Code Here

Examples of org.jboss.dna.graph.connector.RepositoryContext

                }
            }
        };

        // Create a new RepositoryContext that uses our observer and connection factory ...
        final RepositoryContext newContext = new RepositoryContext() {
            /**
             * {@inheritDoc}
             *
             * @see org.jboss.dna.graph.connector.RepositoryContext#getConfiguration(int)
             */
 
View Full Code Here

Examples of org.jboss.dna.graph.connector.RepositoryContext

    }


    PathRequestProcessor createRequestProcessor( ExecutionContext context,
                                                 PathRepositorySource source ) {
        RepositoryContext repositoryContext = source.getRepositoryContext();
        Observer observer = repositoryContext != null ? repositoryContext.getObserver() : null;
        boolean updatesAllowed = source.areUpdatesAllowed();

        /**
         * Read-only implementations can use a NOP transaction.
         */
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.