Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring mvc #366

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
86702de
Merge pull request #4 from geonetwork/master
josegar74 Dec 17, 2012
734f5cd
Merge pull request #6 from geonetwork/master
josegar74 Feb 9, 2013
0649074
Merge remote-tracking branch 'upstream/develop' into develop
josegar74 Nov 12, 2013
e5d6099
Generic Spring MVC controller to replace JeevesServlet.
josegar74 Nov 12, 2013
c925817
Test to create specific Spring MVC controllers for GeoNetwork service…
josegar74 Nov 20, 2013
b055950
Get service migrated. Testing how to do it more easily. This is pure …
Delawen Nov 27, 2013
b5accfd
Merge branch 'develop' of https://github.com/geonetwork/core-geonetwo…
Delawen Nov 27, 2013
a200399
Adding contentNegotiation and basic beans
Delawen Dec 19, 2013
ad6c9dc
Return xml by default
Delawen Dec 19, 2013
a72a9ae
More spring MVC tweaks
Delawen Dec 19, 2013
d300fc4
Missing version on spring-oxm
Delawen Jan 23, 2014
fa435ea
Findbugs errors fixed
Delawen Jan 23, 2014
3308f83
Adding version for jackson
Delawen Jan 23, 2014
776fcf7
Removing tmp file
Delawen Jan 23, 2014
12be144
FindBugs fixes
Delawen Jan 23, 2014
69dd64a
Service config.Get.java done, but Jeeves still wants to work over Sp…
Delawen Jan 24, 2014
3ab7804
Fixing SettingManager error on compile (eclipse didn't notice??)
Delawen Jan 24, 2014
a8716f6
Adding json endpoint
Delawen Jan 27, 2014
bf8a263
Adding internacionalization filter on url /srv/{lang}/service
Delawen Jan 27, 2014
4b7b9bc
Merge branch 'develop' of https://github.com/geonetwork/core-geonetwo…
Delawen Jan 27, 2014
3de2d3a
Fixing merging
Delawen Jan 30, 2014
4a454b0
Merge branch 'develop' of https://github.com/geonetwork/core-geonetwo…
Delawen Jan 30, 2014
39990af
Solving findbug errors
Delawen Jan 30, 2014
905fea4
Merge branch 'develop' of https://github.com/geonetwork/core-geonetwo…
Delawen Jan 31, 2014
e3461c7
Simpler pom.xml for controllers
Delawen Jan 31, 2014
ec7f4ac
Simpler pom.xml dependencies
Delawen Jan 31, 2014
f8a3d2c
Removing "srv" from Locale Interceptor
Delawen Jan 31, 2014
b35193a
What happened with the other web.xml commit??
Delawen Jan 31, 2014
9aa5b2e
Small bugfixes, but jpa does not start
Delawen Feb 4, 2014
327184e
Replacing for autowired
Delawen Feb 4, 2014
b761122
Refactoring config-spring-geonetwork to not duplicate beans
Delawen Feb 5, 2014
07696b7
Spring now launches but does not find any mapping
Delawen Feb 5, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
2 changes: 2 additions & 0 deletions common/src/main/java/org/fao/geonet/NodeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.io.Serializable;

import javax.annotation.Resource;

/**
* Encapsulates informations about the current node such as the node id.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ public synchronized void setNumberOfConcurrentRequests(int numberOfConcurrentReq
this.numberOfConcurrentRequests = numberOfConcurrentRequests;
}

public synchronized int getNumberOfConcurrentRequests() {
return this.numberOfConcurrentRequests;
}
public synchronized HttpClientConnectionManager getNonShutdownableConnectionManager() {
return this.nonShutdownableConnectionManager;
}

/**
* Create a default XmlRequest.
*
Expand Down Expand Up @@ -151,7 +158,7 @@ public HttpClientBuilder getDefaultHttpClientBuilder() {
synchronized (this) {
if (connectionManager == null) {
connectionManager = new PoolingHttpClientConnectionManager();
connectionManager.setMaxTotal(this.numberOfConcurrentRequests);
connectionManager.setMaxTotal(this.getNumberOfConcurrentRequests());
nonShutdownableConnectionManager = new HttpClientConnectionManager() {
public void closeExpiredConnections() {
connectionManager.closeExpiredConnections();
Expand Down Expand Up @@ -189,7 +196,6 @@ public void closeIdleConnections(long idleTimeout, TimeUnit tunit) {
builder.setConnectionManager(nonShutdownableConnectionManager);
}


return builder;
}

Expand Down
35 changes: 29 additions & 6 deletions core/src/main/java/org/fao/geonet/kernel/AccessManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,50 @@

package org.fao.geonet.kernel;

import static org.fao.geonet.repository.specification.OperationAllowedSpecs.*;
import static org.fao.geonet.repository.specification.OperationAllowedSpecs.hasMetadataId;
import static org.fao.geonet.repository.specification.OperationAllowedSpecs.hasOperation;
import static org.springframework.data.jpa.domain.Specifications.where;
import java.util.*;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;

import jeeves.server.UserSession;
import jeeves.server.context.ServiceContext;

import org.fao.geonet.domain.*;
import org.fao.geonet.domain.Group;
import org.fao.geonet.domain.HarvesterSetting;
import org.fao.geonet.domain.Metadata;
import org.fao.geonet.domain.Operation;
import org.fao.geonet.domain.OperationAllowed;
import org.fao.geonet.domain.Pair;
import org.fao.geonet.repository.*;
import org.fao.geonet.domain.Profile;
import org.fao.geonet.domain.ReservedGroup;
import org.fao.geonet.domain.ReservedOperation;
import org.fao.geonet.domain.User;
import org.fao.geonet.domain.UserGroup;
import org.fao.geonet.domain.User_;
import org.fao.geonet.repository.GroupRepository;
import org.fao.geonet.repository.HarvesterSettingRepository;
import org.fao.geonet.repository.MetadataRepository;
import org.fao.geonet.repository.OperationAllowedRepository;
import org.fao.geonet.repository.OperationRepository;
import org.fao.geonet.repository.SortUtils;
import org.fao.geonet.repository.UserGroupRepository;
import org.fao.geonet.repository.UserRepository;
import org.fao.geonet.repository.specification.UserGroupSpecs;
import org.jdom.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
* Handles the access to a metadata depending on the metadata/group.
*/
@Service
public class AccessManager {

@Autowired
Expand Down
110 changes: 75 additions & 35 deletions core/src/main/java/org/fao/geonet/kernel/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,99 @@

import static org.fao.geonet.repository.specification.MetadataSpecs.hasMetadataUuid;

import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.fao.geonet.exceptions.JeevesException;
import org.fao.geonet.exceptions.ServiceNotAllowedEx;
import org.fao.geonet.exceptions.XSDValidationErrorEx;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import jeeves.server.UserSession;
import jeeves.server.context.ServiceContext;
import org.fao.geonet.utils.Log;
import org.fao.geonet.utils.Xml;
import org.fao.geonet.utils.Xml.ErrorHandler;
import jeeves.xlink.Processor;

import org.apache.commons.lang.StringUtils;
import org.eclipse.jetty.util.ConcurrentHashSet;
import org.fao.geonet.GeonetContext;
import org.fao.geonet.constants.Edit;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.constants.Geonet.Namespaces;
import org.fao.geonet.constants.Params;
import org.fao.geonet.domain.*;
import org.fao.geonet.domain.Constants;
import org.fao.geonet.domain.ISODate;
import org.fao.geonet.domain.Metadata;
import org.fao.geonet.domain.MetadataCategory;
import org.fao.geonet.domain.MetadataDataInfo;
import org.fao.geonet.domain.MetadataDataInfo_;
import org.fao.geonet.domain.MetadataHarvestInfo;
import org.fao.geonet.domain.MetadataRatingByIp;
import org.fao.geonet.domain.MetadataRatingByIpId;
import org.fao.geonet.domain.MetadataStatus;
import org.fao.geonet.domain.MetadataStatusId;
import org.fao.geonet.domain.MetadataStatusId_;
import org.fao.geonet.domain.MetadataStatus_;
import org.fao.geonet.domain.MetadataType;
import org.fao.geonet.domain.MetadataValidation;
import org.fao.geonet.domain.MetadataValidationId;
import org.fao.geonet.domain.MetadataValidationStatus;
import org.fao.geonet.domain.Metadata_;
import org.fao.geonet.domain.Operation;
import org.fao.geonet.domain.OperationAllowed;
import org.fao.geonet.domain.OperationAllowedId;
import org.fao.geonet.domain.OperationAllowedId_;
import org.fao.geonet.domain.Pair;
import org.fao.geonet.domain.Profile;
import org.fao.geonet.domain.ReservedGroup;
import org.fao.geonet.domain.ReservedOperation;
import org.fao.geonet.domain.User;
import org.fao.geonet.domain.UserGroup;
import org.fao.geonet.domain.UserGroupId;
import org.fao.geonet.exceptions.JeevesException;
import org.fao.geonet.exceptions.NoSchemaMatchesException;
import org.fao.geonet.exceptions.SchemaMatchConflictException;
import org.fao.geonet.exceptions.SchematronValidationErrorEx;
import org.fao.geonet.exceptions.ServiceNotAllowedEx;
import org.fao.geonet.exceptions.XSDValidationErrorEx;
import org.fao.geonet.kernel.schema.MetadataSchema;
import org.fao.geonet.kernel.search.SearchManager;
import org.fao.geonet.domain.Pair;
import org.fao.geonet.kernel.setting.SettingManager;
import org.fao.geonet.lib.Lib;
import org.fao.geonet.notifier.MetadataNotifierManager;
import org.fao.geonet.repository.*;
import org.fao.geonet.repository.MetadataCategoryRepository;
import org.fao.geonet.repository.MetadataRatingByIpRepository;
import org.fao.geonet.repository.MetadataRepository;
import org.fao.geonet.repository.MetadataStatusRepository;
import org.fao.geonet.repository.MetadataValidationRepository;
import org.fao.geonet.repository.OperationAllowedRepository;
import org.fao.geonet.repository.SortUtils;
import org.fao.geonet.repository.StatusValueRepository;
import org.fao.geonet.repository.Updater;
import org.fao.geonet.repository.UserGroupRepository;
import org.fao.geonet.repository.UserRepository;
import org.fao.geonet.repository.specification.MetadataSpecs;
import org.fao.geonet.repository.specification.MetadataStatusSpecs;
import org.fao.geonet.repository.specification.UserGroupSpecs;
import org.fao.geonet.repository.specification.UserSpecs;
import org.fao.geonet.util.ThreadUtils;
import org.fao.geonet.utils.Log;
import org.fao.geonet.utils.Xml;
import org.fao.geonet.utils.Xml.ErrorHandler;
import org.jdom.Attribute;
import org.jdom.Document;
import org.jdom.Element;
Expand All @@ -78,39 +135,22 @@
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.NoTransactionException;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.Vector;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;

/**
* Handles all operations on metadata (select,insert,update,delete etc...).
*
*/
@Controller
@Transactional(propagation = Propagation.REQUIRED, noRollbackFor = {XSDValidationErrorEx.class, NoSchemaMatchesException.class})
public class DataManager {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@

import jeeves.server.ServiceConfig;
import jeeves.server.sources.http.JeevesServlet;
import org.apache.commons.io.FileUtils;
import org.fao.geonet.Constants;

import org.fao.geonet.NodeInfo;
import org.fao.geonet.constants.Geonet;
import org.fao.geonet.utils.BinaryFile;
import org.fao.geonet.utils.IO;
import org.fao.geonet.utils.Log;

import org.fao.geonet.constants.Geonet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
* The GeoNetwork data directory is the location on the file system where
Expand All @@ -25,6 +23,7 @@
* used by GeoNetwork for various purposes (eg. Lucene index, spatial index,
* logos).
*/
@Service
public class GeonetworkDataDirectory {
/**
* The default GeoNetwork data directory location.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

import jeeves.server.context.ServiceContext;
import jeeves.server.overrides.ConfigurationOverrides;

import org.fao.geonet.kernel.GeonetworkDataDirectory;
import org.fao.geonet.utils.Log;
import org.fao.geonet.utils.Xml;

import org.apache.lucene.search.TopFieldCollector;
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.Version;
Expand All @@ -52,13 +52,15 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/**
* Lucene configuration class load Lucene XML configuration file.
*
* @author fxprunayre
*
*/
@Service
public class LuceneConfig {
public static final String USE_NRT_MANAGER_REOPEN_THREAD = "useNRTManagerReopenThread";
private static final int ANALYZER_CLASS = 1;
Expand Down
Loading