[exo-jcr-commits] exo-jcr SVN: r3382 - in jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp: client and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Nov 3 04:03:25 EDT 2010
Author: dkuleshov
Date: 2010-11-03 04:03:25 -0400 (Wed, 03 Nov 2010)
New Revision: 3382
Modified:
jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServer.java
jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServerImpl.java
jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
Log:
JCR-1494: now FTP server does show list of workspaces after repository restoring
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServer.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServer.java 2010-11-02 15:51:38 UTC (rev 3381)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServer.java 2010-11-03 08:03:25 UTC (rev 3382)
@@ -45,6 +45,10 @@
int getClientsCount();
+ /**
+ *
+ * @return {@link ManageableRepository} or <code>null</code> if repository can not be retrieved
+ */
ManageableRepository getRepository();
FtpCommand getCommand(String commandName);
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServerImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServerImpl.java 2010-11-02 15:51:38 UTC (rev 3381)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServerImpl.java 2010-11-03 08:03:25 UTC (rev 3382)
@@ -26,6 +26,8 @@
import org.exoplatform.services.ftp.config.FtpConfig;
import org.exoplatform.services.ftp.data.FtpDataChannelManager;
import org.exoplatform.services.ftp.data.FtpDataChannelManagerImpl;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -37,6 +39,9 @@
import java.net.Socket;
import java.util.ArrayList;
+import javax.jcr.RepositoryException;
+
+
/**
* Created by The eXo Platform SAS Author : Vitaly Guly <gavrik-vetal at ukr.net/mail.ru>
*
@@ -52,7 +57,7 @@
private Catalog commandCatalog;
- private ManageableRepository repository;
+ private RepositoryService repositoryService;
private FtpConfig configuration;
@@ -62,11 +67,11 @@
private ArrayList<FtpClientSession> clients = new ArrayList<FtpClientSession>();
- public FtpServerImpl(FtpConfig configuration, CommandService commandService, ManageableRepository repository)
+ public FtpServerImpl(FtpConfig configuration, CommandService commandService, RepositoryService repositoryService)
throws Exception
{
this.configuration = configuration;
- this.repository = repository;
+ this.repositoryService = repositoryService;
InputStream commandStream = getClass().getResourceAsStream(COMMAND_PATH);
@@ -153,7 +158,21 @@
public ManageableRepository getRepository()
{
- return repository;
+
+ try
+ {
+ return repositoryService.getDefaultRepository();
+ }
+ catch (RepositoryException e)
+ {
+ log.info("Repository exception. " + e.getMessage(), e);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ log.info("Repository configuration exception. " + e.getMessage(), e);
+ }
+
+ return null;
}
public FtpCommand getCommand(String commandName)
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2010-11-02 15:51:38 UTC (rev 3381)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/FtpServiceImpl.java 2010-11-03 08:03:25 UTC (rev 3382)
@@ -61,7 +61,7 @@
log.info("Start service.");
try
{
- ftpServer = new FtpServerImpl(config, commandService, repositoryService.getRepository());
+ ftpServer = new FtpServerImpl(config, commandService, repositoryService);
ftpServer.start();
}
catch (Exception e)
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2010-11-02 15:51:38 UTC (rev 3381)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/client/FtpClientSessionImpl.java 2010-11-03 08:03:25 UTC (rev 3382)
@@ -329,6 +329,10 @@
public Session getSession(String workspaceName) throws Exception
{
+ if (ftpServer.getRepository() == null)
+ {
+ throw new RepositoryException("Repository can not be retrieved.");
+ }
Session curSession = sessionFactory.getSession(workspaceName, ftpServer.getRepository());
curSession.refresh(false);
return curSession;
Modified: jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2010-11-02 15:51:38 UTC (rev 3381)
+++ jcr/branches/1.12.x/exo.jcr.component.ftp/src/main/java/org/exoplatform/services/ftp/command/FtpCommandImpl.java 2010-11-03 08:03:25 UTC (rev 3382)
@@ -111,6 +111,10 @@
{
if (newPath.size() == 0)
{
+ if (clientSession().getFtpServer().getRepository() == null)
+ {
+ throw new RepositoryException("Repository can not be retrieved.");
+ }
String[] workspaces = clientSession().getFtpServer().getRepository().getWorkspaceNames();
for (int i = 0; i < workspaces.length; i++)
{
More information about the exo-jcr-commits
mailing list