Skip to content

Commit

Permalink
More logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJitianu committed Apr 22, 2019
1 parent b6ee785 commit afc9773
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public boolean isCheckedOut() {
if (logger.isDebugEnabled()) {
Property<Object> property = doc.getProperty("cmis:isVersionSeriesCheckedOut");
if (property != null) {
logger.debug("Checked out=" + property.getValuesAsString());
logger.debug(getDisplayName() + " is checked out=" + property.getValuesAsString());
}
}
Boolean versionSeriesCheckedOut = doc.isVersionSeriesCheckedOut();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.apache.chemistry.opencmis.client.api.CmisObject;
import org.apache.chemistry.opencmis.client.api.Document;
import org.apache.chemistry.opencmis.client.api.Folder;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
import org.apache.log4j.Logger;

Expand All @@ -30,6 +31,8 @@
import com.oxygenxml.cmis.core.model.impl.FolderImpl;
import com.oxygenxml.cmis.core.urlhandler.CmisURLConnection;

import ro.sync.exml.workspace.api.PluginWorkspaceProvider;

/**
* Describes how the folders and documents are: displayed, rendered, their
* actions.
Expand Down Expand Up @@ -134,21 +137,32 @@ public void setContentProvider(ContentSearcher contentProvider) {
*/
@Override
public void presentResources(URL connectionInfo, String repositoryID) {
if (logger.isDebugEnabled()) {
logger.debug("Present resources from server: " + connectionInfo + ", repository id: " + repositoryID);
}
try {
// Get the instance
CMISAccess instance = CmisAccessSingleton.getInstance();

connectToRepository(connectionInfo, repositoryID, instance);
// Get the rootFolder and set the model
Folder rootFolder = instance.createResourceController().getRootFolder();

if (logger.isDebugEnabled()) {
logger.debug("Root folder " + rootFolder);
}

final FolderImpl origin = new FolderImpl(rootFolder);
setFolder(origin);
} catch (UserCanceledException e1) {
// The user canceled the process.
logger.error("Error ", e1);

}
} catch (CmisRuntimeException e) {
// Unexpected exception
logger.debug(e, e);

PluginWorkspaceProvider.getPluginWorkspace().showErrorMessage("Unable to retrieve repositories because of: " + e.getMessage(), e);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.swing.JPanel;

import org.apache.chemistry.opencmis.client.api.Repository;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
import org.apache.log4j.Logger;

Expand All @@ -24,6 +25,8 @@
import com.oxygenxml.cmis.plugin.Tags;
import com.oxygenxml.cmis.plugin.TranslationResourceController;

import ro.sync.exml.workspace.api.PluginWorkspaceProvider;

/**
* Describes how the repositories a shown and their behaviors
*
Expand Down Expand Up @@ -110,6 +113,10 @@ public RepoComboBoxView() {
* @param repositoryID
*/
protected void fireRepositoryChangedEvent(URL serverURL, String repositoryID) {
if (logger.isDebugEnabled()) {
logger.debug("Notify repository changed event. Server url: " + serverURL + ", repository id: " + repositoryID);
}

for (RepositoryListener repositoryListener : listeners) {
repositoryListener.repositoryConnected(serverURL, repositoryID);
}
Expand Down Expand Up @@ -152,6 +159,7 @@ public void presentRepositories(URL serverURL) {
try {
// Get the repositories
serverReposList = CmisAccessSingleton.getInstance().connectToServerGetRepositories(serverURL, userCredentials);

connected = true;
} catch (CmisUnauthorizedException e) {
// Will try again.
Expand Down Expand Up @@ -180,7 +188,12 @@ public void presentRepositories(URL serverURL) {
if (logger.isDebugEnabled()) {
logger.debug(e, e);
}
}
} catch (CmisRuntimeException e) {
// Unexpected exception
logger.debug(e, e);

PluginWorkspaceProvider.getPluginWorkspace().showErrorMessage("Unable to retrieve repositories because of: " + e.getMessage(), e);
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ public void keyPressed(KeyEvent e) {

// Try presentRepositories using the URL
Object selectedItem = serverItemsCombo.getSelectedItem();

if (logger.isDebugEnabled()) {
logger.debug("Connect to URL: " + selectedItem);
}

if (selectedItem != null) {
try {
Expand Down Expand Up @@ -172,6 +176,10 @@ public void keyPressed(KeyEvent e) {
private void presentRepositories(RepositoriesPresenter repoPresenter, SearchPresenter searchPresenter,
URL serverURL) {
try {

if (logger.isDebugEnabled()) {
logger.debug("Present repositories for: " + serverURL);
}

repoPresenter.presentRepositories(serverURL);
searchPresenter.activateSearch();
Expand Down

0 comments on commit afc9773

Please sign in to comment.