Skip to content

Commit

Permalink
Merge branch 'formatter-functions' of github.com:jesseeichar/core-geo…
Browse files Browse the repository at this point in the history
…network into merge-path-develop

Conflicts:
	.gitignore
	bin/start.ps1
	core/src/main/java/jeeves/server/dispatchers/ServiceManager.java
	core/src/main/java/jeeves/server/dispatchers/guiservices/XmlCacheManager.java
	core/src/main/java/jeeves/server/overrides/ConfigurationOverrides.java
	core/src/main/java/jeeves/server/resources/ResourceListener.java
	core/src/main/java/jeeves/xlink/Processor.java
	core/src/main/java/org/fao/geonet/kernel/DataManager.java
	core/src/main/java/org/fao/geonet/kernel/mef/Importer.java
	core/src/main/java/org/fao/geonet/kernel/mef/MEF2Exporter.java
	core/src/main/java/org/fao/geonet/kernel/mef/MEFLib.java
	core/src/main/java/org/fao/geonet/kernel/schema/MetadataSchema.java
	core/src/main/java/org/fao/geonet/kernel/search/SearchManager.java
	core/src/main/java/org/fao/geonet/kernel/search/spatial/SpatialIndexWriter.java
	core/src/main/java/org/fao/geonet/util/LangUtils.java
	core/src/test/java/org/fao/geonet/AbstractCoreIntegrationTest.java
	core/src/test/java/org/fao/geonet/GeonetMockServletContext.java
	core/src/test/java/org/fao/geonet/kernel/mef/MEFLibIntegrationTest.java
	core/src/test/java/org/fao/geonet/kernel/search/LuceneQueryTest.java
	csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/CatalogSearcher.java
	csw-server/src/main/java/org/fao/geonet/kernel/csw/services/getrecords/SearchController.java
	domain/src/main/java/org/fao/geonet/domain/MetadataDataInfo.java
	domain/src/main/java/org/fao/geonet/domain/Setting.java
	harvesters/pom.xml
	harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/localfilesystem/LocalFilesystemHarvester.java
	harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/ogcwxs/Harvester.java
	healthmonitor/pom.xml
	jeeves/pom.xml
	schemas/iso19139/src/main/plugin/iso19139/formatter/groovy/iso19139/Handlers.groovy
	services/pom.xml
	services/src/main/java/org/fao/geonet/guiservices/metadata/GetRelated.java
	services/src/main/java/org/fao/geonet/services/mef/Export.java
	services/src/main/java/org/fao/geonet/services/metadata/BatchXslProcessing.java
	services/src/main/java/org/fao/geonet/services/metadata/GetAdminOper.java
	services/src/main/java/org/fao/geonet/services/metadata/Show.java
	services/src/main/java/org/fao/geonet/services/metadata/UpdateAdminOper.java
	services/src/main/java/org/fao/geonet/services/metadata/UpdateGroupOwner.java
	services/src/main/java/org/fao/geonet/services/metadata/XslProcessing.java
	services/src/main/java/org/fao/geonet/services/metadata/format/Resource.java
	services/src/main/java/org/fao/geonet/services/metadata/schema/SchematronCriteriaTypeService.java
	services/src/main/java/org/fao/geonet/services/relations/Get.java
	services/src/main/java/org/fao/geonet/services/reports/ReportUpdatedMetadata.java
	services/src/main/java/org/fao/geonet/services/statistics/SearchStatistics.java
	services/src/main/java/org/fao/geonet/services/thesaurus/GetKeywords.java
	services/src/main/java/org/fao/geonet/services/thesaurus/UpdateElement.java
	services/src/main/java/org/fao/geonet/services/user/Remove.java
	services/src/main/java/org/fao/geonet/services/user/Update.java
	services/src/test/java/org/fao/geonet/services/main/SearchSuggestionIntegrationTest.java
	web/pom.xml
	web/src/test/java/org/fao/geonet/wro4j/TestWro4jJsCssCompilation.java
	wro4j/src/test/java/org/fao/geonet/wro4j/GeonetLessCssImportTest.java
  • Loading branch information
Jesse Eichar committed Nov 21, 2014
2 parents 2ddaae9 + 38f109f commit 3819fd1
Show file tree
Hide file tree
Showing 623 changed files with 43,582 additions and 9,202 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ web-ui-docs/node_modules
out/
web/*.log*
docs/*/users/source/admin/*/
*.css.map
*.css.mapweb/src/main/webapp/WEB-INF/data/config/schema_plugins/schemaplugin-uri-catalog.xml
20 changes: 19 additions & 1 deletion code_quality/findbugs-excludes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,25 @@
<Bug pattern="OS_OPEN_STREAM" />
</Match>


<Match>
<Class name="org.fao.geonet.utils.NioPathAwareCatalogResolver" />
<Bug pattern="REC_CATCH_EXCEPTION" />
</Match>
<Match>
<Class name="org.fao.geonet.utils.Xml" />
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" />
</Match>
<Match>
<Class name="org.fao.geonet.services.thumbnail.Set" />
<Method name="getImage"/>
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE" />
</Match>
<Match>
<Class name="v280.MoveHarvesterSettingsToHigherNumber$HarvesterSetting" />
<Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" />
</Match>


<!-- The following bugs are hard to fix should be fixed because they can cause problems in servers with multiple geonetworks running -->
<Match>
<Or>
Expand Down
53 changes: 12 additions & 41 deletions common/src/main/java/org/fao/geonet/JeevesJCS.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@

package org.fao.geonet;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.jcs.access.GroupCacheAccess;
import org.apache.jcs.access.exception.CacheException;
import org.apache.jcs.engine.behavior.ICompositeCacheAttributes;
import org.apache.jcs.engine.control.CompositeCache;
import org.apache.jcs.engine.control.CompositeCacheManager;

import java.io.IOException;
import java.io.Reader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

/**
* @author jeichar
*/
Expand All @@ -43,7 +43,7 @@ public class JeevesJCS extends GroupCacheAccess

/** The manager returns cache instances. */
private static CompositeCacheManager cacheMgr;
private static String configFilename;
private static Path configFilename;

protected JeevesJCS(CompositeCache cacheControl)
{
Expand Down Expand Up @@ -108,39 +108,10 @@ private static void configure()

Properties props = new Properties();

InputStream is;
try {
is = new FileInputStream(configFilename);
} catch (FileNotFoundException e) {
is=null;
}

if ( is != null )
{
try
{
props.load( is );

}
catch ( IOException ex )
{
throw new IllegalStateException( "Unable to load cache configuration from: "+configFilename,ex );
}
finally
{
try
{
is.close();
}
catch ( Exception ignore )
{
// Ignored
}
}
}
else
{
throw new IllegalStateException( "Failed to load properties for name [" + configFilename + "]" );
try (Reader is = Files.newBufferedReader(configFilename, Constants.CHARSET)) {
props.load( is );
} catch (IOException e) {
throw new IllegalStateException( "Unable to load cache configuration from: "+configFilename, e);
}

cacheMgr.configure( props );
Expand All @@ -152,7 +123,7 @@ private static void configure()
* <p>
* @param configFilename
*/
public static void setConfigFilename( String configFilename )
public static void setConfigFilename( Path configFilename )
{
cacheMgr=null;
JeevesJCS.configFilename = configFilename;
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/org/fao/geonet/SystemInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SystemInfo {
private String buildJavaVendor;

public static SystemInfo createForTesting(String stagingProfile) {
return new SystemInfo(stagingProfile, "testing", "testing", "testing", "testing", "testing", "testing");
return new SystemInfo(stagingProfile, "testing", "3.0.0", "SNAPSHOT", "testing", "testing", "testing");
}

public SystemInfo(String stagingProfile, String buildDate, String version, String subVersion,
Expand Down
65 changes: 65 additions & 0 deletions common/src/main/java/org/fao/geonet/ZipUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.fao.geonet;

import org.fao.geonet.utils.IO;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;

/**
* Zip or unzip files
*/
public class ZipUtil {
public static void extract(Path zipFile, Path toDir) throws IOException, URISyntaxException {
try (FileSystem fs = openZipFs(zipFile)) {
extract(fs, toDir);
}
}

/**
* Extracts a zip file to a specified directory.
*
* @param zipFile the zip file to extract
* @param toDir the target directory
* @throws java.io.IOException
*/
public static void extract(FileSystem zipFile, Path toDir) throws IOException {
Files.createDirectories(toDir);

for (Path root : zipFile.getRootDirectories()) {
try (DirectoryStream<Path> paths = Files.newDirectoryStream(root)) {
for (Path path : paths) {
IO.copyDirectoryOrFile(path, toDir.resolve(path.getFileName().toString()), false);
}
}
}
}

/**
* FileSystem must be closed when done. This method should always be called in a try (resource) {} block
*/
public static FileSystem openZipFs(Path path) throws IOException, URISyntaxException {
URI uri = new URI("jar:" + path.toUri());
return FileSystems.newFileSystem(uri, Collections.singletonMap("create", String.valueOf(false)));
}

/**
* Delete path if it exists and create a new zip at the location.
* <p/>
* FileSystem must be closed when done.
* <p/>
* This method should always be called in a try (resource) {} block
*/
public static FileSystem createZipFs(Path path) throws IOException, URISyntaxException {
Files.deleteIfExists(path);

URI uri = new URI("jar:" + path.toUri());
return FileSystems.newFileSystem(uri, Collections.singletonMap("create", String.valueOf(true)));
}
}
Loading

0 comments on commit 3819fd1

Please sign in to comment.