Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/pom.xml
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/pom.xml	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/pom.xml	(revision 55508)
@@ -0,0 +1,46 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>eu.dnetlib</groupId>
+		<artifactId>dnet45-parent</artifactId>
+		<version>1.0.0</version>
+	</parent>
+	<scm>
+		<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1</developerConnection>
+	</scm>
+	<groupId>eu.dnetlib</groupId>
+	<artifactId>dnet-objectStore-ui</artifactId>
+	<version>2.0.1</version>
+	<dependencies>
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>cnr-resultset-client</artifactId>
+			<version>[2.0.0,3.0.0)</version>
+		</dependency>
+
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>dnet-modular-ui</artifactId>
+			<version>[3.0.0,4.0.0)</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>${javax.servlet.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>eu.dnetlib</groupId>
+			<artifactId>dnet-modular-objectstore-service</artifactId>
+			<version>[5.0.0.0,6.0.0)</version>
+		</dependency>
+
+	</dependencies>
+</project>
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/inspect.html
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/inspect.html	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/inspect.html	(revision 55508)
@@ -0,0 +1,193 @@
+
+    <div class="row">
+        <div class="col-md-6">
+            <h2>Inspect ObjectStore </h2>
+        </div>
+        <div class="col-md-6 text-right">
+            <a href="#/list" class="btn btn-primary btn-sm"><span
+                    class="glyphicon glyphicon-step-backward"></span>
+                Back</a>
+        </div>
+
+
+    </div>
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_format">
+                <b>ObjectStore Info</b>
+            </a>
+        </div>
+        <div objectStoreId="collapse_format" class="panel-collapse collapse in">
+            <div class="panel-body">
+                <table cellpadding="10">
+                    <tr>
+                        <td align="right">
+                            <b>objectStoreId: </b>
+                        </td>
+                        <td>
+                            <i style=" padding-left:10px">{{objectStoreInfo.objectStoreId}}</i>
+                        </td>
+                        <td style=" padding-left:10px">
+
+
+                            <a ng-hide="objectStoreInfo.missingProfile" style=" padding-left:10px"
+                               href="isManager.do#/profile/{{id}}"
+                               class="btn btn-primary btn-sm">
+                                <span class="glyphicon glyphicon-search"></span>
+                                View Profile
+                            </a>
+
+                            <a ng-show="objectStoreInfo.missingProfile" style=" padding-left:10px"
+                               class="btn btn-danger btn-sm">
+                                <span class="glyphicon glyphicon-remove"></span>
+                                Missing Profile
+                            </a>
+
+                        </td>
+                        <td style=" padding-left:10px">
+                            <a href="" class="btn btn-primary btn-sm" ng-click="loadInfo()"><span
+                                    class="glyphicon glyphicon-refresh"></span> Refresh Info</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td align="right">
+                            <b>interpretation: </b>
+                        </td>
+                        <td>
+                            <i style=" padding-left:10px">{{objectStoreInfo.interpretation}}</i>
+                        </td>
+                        <td></td>
+                    </tr>
+                    <tr>
+                        <td align="right">
+                            <b>last storage date: </b>
+                        </td>
+                        <td>
+                            <i style=" padding-left:10px">{{objectStoreInfo.lastStorageDate}}</i>
+                        </td>
+                        <td></td>
+                    </tr>
+                    <tr>
+                        <td align="right">
+                            <b>Number of Elements: </b>
+                        </td>
+                        <td>
+                            <i style=" padding-left:10px">{{objectStoreInfo.size}}</i>
+                        </td>
+                        <td></td>
+                    </tr>
+                    <tr>
+                        <td align="right">
+                            <b>Service URI: </b>
+                        </td>
+                        <td>
+                            <i style=" padding-left:10px">
+                                <a href="{{objectStoreInfo.serviceURI}}">{{objectStoreInfo.serviceURI}}</a>
+                            </i>
+                        </td>
+                        <td></td>
+                    </tr>
+
+                </table>
+
+            </div>
+        </div>
+    </div>
+
+
+    <div class="row">
+        <div class="col-md-12">
+
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_query">
+                        <b>ObjectStore Query</b>
+                    </a>
+                </div>
+                <div id="collapse_query" class="panel-collapse collapse in">
+                    <div class="panel-body">
+                        <table cellpadding="10">
+                            <tr>
+                                <td align="right" style="width:10%">
+                                    <b>Id: </b>
+                                </td>
+                                <td style=" padding-left:10px; width:90%">
+                                    <input type="text" class="form-control" ng-model="record_id"
+                                           placeholder="Enter an identifier to search (fast)">
+                                </td>
+                                <td style=" padding-left:10px" style="width:10%" align="right">
+                                    <a style=" padding-left:10px" ng-click="getRecordById()" href="objectstoreInspector.do#inspect.do/{{id}}/0/{{record_id}}"
+                                       class="btn btn-primary btn-sm">
+                                        <span class="glyphicon glyphicon-search"></span>
+                                        Search Id
+                                    </a>
+                                </td>
+                            </tr>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-md-12 ">
+            <h3>Number of results: {{searchResult.total}}</h3>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-2 text-left">
+            results from {{start + 1 }} to {{nextPage }}
+        </div>
+        <div class="col-md-9 text-center">
+            <ul class="pagination">
+                <li>
+                    <a href="#/inspect.do/{{id}}/{{previousPage}}" ng-click="prevPage()">&laquo;
+                    </a>
+                </li>
+                <li>
+                    <a href="#/inspect.do/{{id}}/{{nextPage}}">&raquo;
+                    </a>
+                </li>
+            </ul>
+        </div>
+    </div>
+
+    <div class="row" ng-repeat="item in objectStoreInfo.results">
+        <div class="col-md-12">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <a class="accordion-toggle" data-toggle="collapse" data-target="#collapse_{{$index}}">
+                        <b>{{$index+(1 + start)}}</b>
+                    </a>
+                </div>
+                <div id="collapse_{{$index}}" class="panel-collapse collapse in">
+                    <div class="panel-body">
+                        <div class="col-lg-3 text-right"><b>Object Identifier:</b></div>
+                        <div class="col-lg-8 text-left"> {{item.objectID}}</div>
+                        <div class="col-lg-3 text-right"><b>Related Metadata Identifier:</b></div>
+                        <div class="col-lg-8 text-left"> {{item.metadataRelatedID}}</div>
+                        <div class="col-lg-3 text-right"><b>Mime Type:</b></div>
+                        <div class="col-lg-8 text-left"> {{item.mimeType}}</div>
+                        <div class="col-lg-3 text-right"><b>File Size:</b></div>
+                        <div class="col-lg-8 text-left"> {{item.fileSizeKB}} Kb</div>
+                        <div class="col-lg-3 text-right"><b>MD5:</b></div>
+                        <div class="col-lg-8 text-left"> {{item.md5Sum}}</div>
+                        <div class="col-lg-3 text-right"><b>Downloaded URL:</b></div>
+                        <div class="col-lg-8 text-left"><a href="{{item.downloadedURL}}">{{item.downloadedURL}}</a>
+                        </div>
+                        <div class="col-lg-3 text-right"><b>Object Store URL:</b></div>
+                        <div class="col-lg-8 text-left"><a href="../objectStore/retrieve.do?objectStore={{objectStoreInfo.objectStoreId}}&objectId={{item.objectID}}">{{item.uri}}</a></div>
+                    </div>
+
+
+                </div>
+            </div>
+        </div>
+    </div>
+
+
+
+
+
+
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/list.html
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/list.html	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/html/objectStore/list.html	(revision 55508)
@@ -0,0 +1,29 @@
+<style>
+    .gridStyle {
+        width: 100%;
+        height: 150px;
+        margin-bottom: 20px;
+        margin-top: 20px;
+        font-size: 11px;
+    }
+
+    .gridStyle-big {
+        width: 100%;
+        height: 300px;
+        margin-top: 20px;
+        margin-bottom: 20px;
+        font-size: 11px;
+    }
+</style>
+<div class="row">
+    <div class="col-md-12">
+        <a href="" ng-click="refreshInfo()" class="btn btn-primary btn-sm"><span
+                class="glyphicon glyphicon-refresh"></span>
+            Refresh</a>
+    </div>
+
+
+    <div class="col-md-12" style="height: 100%">
+        <div class="gridStyle" id="gridObjectstores" ng-grid="gridOptions"></div>
+    </div>
+</div>
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector.js
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector.js	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector.js	(revision 55508)
@@ -0,0 +1,37 @@
+var module = angular.module('objectStoreInspector', ['ngGrid', 'ngRoute', 'objectStoresControllers']);
+
+module.config([
+    '$routeProvider',
+    function ($routeProvider) {
+        $routeProvider
+            .when('/list', {
+                templateUrl: '../resources/html/objectStore/list.html',
+                controller: 'objectStoresController'
+            })
+            .when('/inspect.do/:id', {
+                templateUrl: '../resources/html/objectStore/inspect.html',
+                controller: 'inspectObjectStoreController'
+            }).when('/inspect.do/:id/:start/:query', {
+                    templateUrl: '../resources/html/objectStore/inspect.html',
+                    controller: 'inspectObjectStoreController'
+                }).when('/inspect.do/:id/:start', {
+                templateUrl: '../resources/html/objectStore/inspect.html',
+                controller: 'inspectObjectStoreController'
+            })
+            .otherwise({redirectTo: '/list'});
+    }
+]);
+
+
+module.controller('moduleMenuCtrl', ['$scope', '$location',
+    function ($scope, $location) {
+        $scope.isActive = function (regex) {
+            var re = new RegExp(regex);
+            return re.test($location.path());
+        }
+    }
+]);
+
+module.filter('encodeURIComponent', function () {
+    return window.encodeURIComponent;
+});
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector_controllers.js
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector_controllers.js	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/web/resources/js/objectstore_inspector_controllers.js	(revision 55508)
@@ -0,0 +1,226 @@
+var objectStoreInspectorControllers = angular.module('objectStoresControllers', ['LocalStorageModule']);
+
+function common_init($scope, $http, $sce, $location) {
+    initSpinner();
+    $scope.showError = function (error) {
+        show_notification("error", error);
+    }
+    $scope.showNotification = function (message) {
+        show_notification("info", message);
+    }
+    $scope.showSpinner = function () {
+        showSpinner();
+    }
+    $scope.hideSpinner = function () {
+        hideSpinner();
+    }
+    $scope.to_trusted = function (html) {
+        return $sce.trustAsHtml(html);
+    }
+    $scope.go = function (path) {
+        $location.path(path);
+    }
+    $scope.encodeValue = function (val) {
+        return val;
+    }
+}
+
+function ngGridFlexibleHeightPlugin(opts) {
+    var self = this;
+    self.grid = null;
+    self.scope = null;
+    self.init = function (scope, grid, services) {
+        self.domUtilityService = services.DomUtilityService;
+        self.grid = grid;
+        self.scope = scope;
+        var recalcHeightForData = function () {
+            setTimeout(innerRecalcForData, 1);
+        };
+        var innerRecalcForData = function () {
+            var gridId = self.grid.gridId;
+            var footerPanelSel = '.' + gridId + ' .ngFooterPanel';
+            var extraHeight = self.grid.$topPanel.height() + $(footerPanelSel).height();
+            var naturalHeight = self.grid.$canvas.height() + 1;
+            if (opts != null) {
+                if (opts.minHeight != null && (naturalHeight + extraHeight) < opts.minHeight) {
+                    naturalHeight = opts.minHeight - extraHeight - 2;
+                }
+                if (opts.maxHeight != null && (naturalHeight + extraHeight) > opts.maxHeight) {
+                    naturalHeight = opts.maxHeight;
+                }
+            }
+
+            var newViewportHeight = naturalHeight + 3;
+            if (!self.scope.baseViewportHeight || self.scope.baseViewportHeight !== newViewportHeight) {
+                self.grid.$viewport.css('height', newViewportHeight + 'px');
+                self.grid.$root.css('height', (newViewportHeight + extraHeight) + 'px');
+                self.scope.baseViewportHeight = newViewportHeight;
+                self.domUtilityService.RebuildGrid(self.scope, self.grid);
+            }
+        };
+        self.scope.catHashKeys = function () {
+            var hash = '',
+                idx;
+            for (idx in self.scope.renderedRows) {
+                hash += self.scope.renderedRows[idx].$$hashKey;
+            }
+            return hash;
+        };
+        self.scope.$watch('catHashKeys()', innerRecalcForData);
+        self.scope.$watch(self.grid.config.data, recalcHeightForData);
+    };
+}
+
+window.onresize = function () {
+
+
+    var elem = document.getElementById('gridObjectstores');
+    var height = 0;
+    var body = window.document.body;
+    if (window.innerHeight) {
+        height = window.innerHeight;
+    } else if (body.parentElement.clientHeight) {
+        height = body.parentElement.clientHeight;
+    } else if (body && body.clientHeight) {
+        height = body.clientHeight;
+    }
+    elem.style.height = ((height - elem.offsetTop - 280) + "px");
+
+};
+
+function hasOwnProperty(obj, prop) {
+    var proto = obj.__proto__ || obj.constructor.prototype;
+    return (prop in obj) &&
+        (!(prop in proto) || proto[prop] !== obj[prop]);
+}
+
+objectStoreInspectorControllers.directive('compileTemplate', function ($compile, $parse) {
+    return {
+        link: function (scope, element, attr) {
+            var parsed = $parse(attr.ngBindHtml);
+
+            function getStringValue() {
+                return (parsed(scope) || '').toString();
+            }
+
+            //Recompile if the template changes
+            scope.$watch(getStringValue, function () {
+                $compile(element, null, -9999)(scope);  //The -9999 makes it skip directives so that we do not recompile ourselves
+            });
+        }
+    }
+});
+
+objectStoreInspectorControllers.controller('inspectObjectStoreController', [
+    '$scope', '$http', '$sce', '$location', '$routeParams',
+    function ($scope, $http, $sce, $location, $routeParams) {
+        common_init($scope, $http, $sce, $location);
+
+        $http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
+        $scope.id = $routeParams.id;
+
+
+        $scope.getRecordById = function () {
+            console.log("Funcion getRecordById called");
+        }
+
+
+
+        $scope.start = $routeParams['start'];
+        if ($scope.start == null)
+            $scope.start = 0;
+        else
+            $scope.start = parseInt($scope.start);
+
+
+        $scope.record_id = $routeParams['query'];
+
+
+
+
+        $scope.previousPage = 0
+
+        $scope.nextPage = 0
+
+        $scope.loadInfo = function () {
+
+            $http.post('objectStore/getObjectStoreInfo.do', $.param({
+                'objId': $routeParams.id,
+                'from': $scope.start,
+                'id': $scope.record_id
+            })).success(function (data) {
+
+                $scope.objectStoreInfo = data;
+                if (hasOwnProperty($scope, 'results') == false) {
+                    $scope.searchResult = {}
+                }
+
+                $scope.searchResult.total = data.size;
+
+                $scope.previousPage = Math.max($scope.start - 25, 0);
+                $scope.nextPage = Math.min($scope.searchResult.total, $scope.start + 25);
+            }).error(function () {
+                $scope.showError('Error getting info from objectStore');
+
+            });
+
+        };
+
+        $scope.loadInfo();
+
+
+    }]);
+
+objectStoreInspectorControllers.controller('objectStoresController', [
+    '$scope', '$http', '$sce', '$location',
+
+    function ($scope, $http, $sce, $location) {
+        common_init($scope, $http, $sce, $location);
+        $scope.showSpinner();
+        $http.get('objectStore/listObjectStores.do').success(function (data) {
+            $scope.hideSpinner();
+            $scope.objTable = data;
+        }).error(function () {
+            $scope.showError('Error listing xmldb collections');
+            $scope.hideSpinner();
+        });
+
+        $scope.refreshInfo = function () {
+            console.log("Should reload Info")
+        }
+
+        $scope.gridOptions = {
+            data: 'objTable',
+            enableRowSelection: false,
+            enableCellEditOnFocus: false,
+            enableHighlighting: true,
+            plugins: [new ngGridFlexibleHeightPlugin()],
+
+            columnDefs: [
+                {
+                    field: 'objectStoreId',
+                    displayName: 'ID',
+                    cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><b>{{row.getProperty(col.field)}}</b></div>',
+                    headerClass: 'text-center',
+                    width: '500px'
+                },
+                {field: 'interpretation', displayName: 'Interpretation'},
+                {field: 'size', displayName: 'Size'},
+                {
+                    field: 'serviceURI',
+                    displayName: 'Service URI',
+                    cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><b ng-show="row.getProperty(col.field)"> {{row.getProperty(col.field)}} </b><b ng-hide="row.getProperty(col.field)" style="color: red"> Profile Missing! </b> </div>',
+                    headerClass: 'text-center'
+                },
+                {
+                    field: 'objectStoreId',
+                    displayName: 'View',
+                    cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><b style="color:red" ng-show=\'row.getProperty("missingObjectStore")\'>Missing ObjectStore</b> <a ng-hide=\'row.getProperty("missingObjectStore")\'  href="objectstoreInspector.do#/inspect.do/{{row.getProperty(col.field)}}" class="btn btn-primary btn-xs" data-placement="top" title="{{row.getProperty(col.field)}}"><span class="glyphicon glyphicon-zoom-in"></span> inspect</a></div>',
+                    width: '130px',
+                    headerClass: 'text-center'
+                }
+            ]
+        };
+
+
+    }]);
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/objectstoreInspector.st
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/objectstoreInspector.st	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/objectstoreInspector.st	(revision 55508)
@@ -0,0 +1,13 @@
+$common/master( header={
+	<script type="text/javascript" src="../resources/js/angular.min.js" ></script>
+	<script type="text/javascript" src="../resources/js/angular-route.min.js"></script>
+	<script type="text/javascript" src="../resources/js/angular-local-storage.min.js"></script>
+	<script type="text/javascript" src="../resources/js/ng-grid-2.0.7.min.js"></script>
+	<script type="text/javascript" src="../resources/js/objectstore_inspector_controllers.js"></script>
+	<script type="text/javascript" src="../resources/js/objectstore_inspector.js"></script>
+	<link rel="stylesheet" type="text/css" href="../resources/css/ng-grid.min.css" />
+}, body={
+	<div ng-app="objectStoreInspector" class="row">
+		<div ng-view class="col-lg-12"></div>
+	</div>
+} )$
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-objectstore.xml
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/xml
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-objectstore.xml
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-objectstore.xml	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-objectstore.xml	(revision 55508)

Property changes on: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/resources/eu/dnetlib/functionality/modular/ui/webContext-modular-ui-objectstore.xml
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/xml
\ No newline at end of property
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceInternalController.java
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceInternalController.java	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceInternalController.java	(revision 55508)
@@ -0,0 +1,175 @@
+package eu.dnetlib.functionality.modular.ui.objectStore;
+
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.gson.Gson;
+import eu.dnetlib.data.objectstore.modular.ModularObjectStoreDeliver;
+import eu.dnetlib.data.objectstore.modular.ModularObjectStoreService;
+import eu.dnetlib.data.objectstore.modular.connector.ObjectStore;
+import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
+import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
+import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
+import eu.dnetlib.enabling.locators.UniqueServiceLocator;
+import eu.dnetlib.enabling.resultset.ResultSetListener;
+import eu.dnetlib.functionality.modular.ui.objectStore.info.ObjectStoreInfo;
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by Sandro La Bruzzo on 11/18/15.
+ */
+
+@Controller
+public class ObjectStoreServiceInternalController {
+
+
+    private static final Log log = LogFactory.getLog(ObjectStoreServiceInternalController.class);
+
+    @Autowired
+    public UniqueServiceLocator serviceLocator;
+
+
+    @Autowired
+    public ModularObjectStoreService objectStoreservice;
+
+    private final Gson gson = new Gson();
+
+
+    private final Function<String, ObjectStoreFile> convertFunction = new Function<String, ObjectStoreFile>() {
+        @Override
+        public ObjectStoreFile apply(String input) {
+            return gson.fromJson(input, ObjectStoreFile.class);
+        }
+    };
+
+
+    @RequestMapping(value = "/ui/objectStore/listObjectStores.do")
+    @ResponseBody
+    public List<ObjectStoreInfo> listObjectStoreInfo(final ModelMap map) throws ObjectStoreServiceException {
+        final Map<String, ObjectStoreInfo> inputObjectStore = Maps.newHashMap();
+        retrieveObjectStoreFromProfiles(inputObjectStore);
+        retrieveObjectStoreFromService(inputObjectStore);
+        return Lists.newArrayList(inputObjectStore.values());
+    }
+
+
+    private void retrieveObjectStoreFromService(final Map<String, ObjectStoreInfo> inputMap) {
+
+        final List<String> stores = objectStoreservice.getFeeder().getDao().listObjectStores();
+        for (final String s : stores) {
+            if (!inputMap.containsKey(s)) {
+                try {
+                    final ObjectStoreInfo info = new ObjectStoreInfo();
+                    final ObjectStore store = objectStoreservice.getObjectStoreDeliver().getDao().getObjectStore(s);
+                    info.setInterpretation(store.getInterpretation());
+                    info.setSize(store.getSize());
+                    info.setObjectStoreId(s);
+                    info.setMissingObjectStore(false);
+                    inputMap.put(s, info);
+                } catch (ObjectStoreServiceException e) {
+                    log.error(e);
+                }
+            } else {
+                inputMap.get(s).setMissingObjectStore(false);
+            }
+        }
+    }
+
+
+    private void retrieveObjectStoreFromProfiles(final Map<String, ObjectStoreInfo> inputMap) {
+        final String query = "for $x in  collection('/db/DRIVER/ObjectStoreDSResources/ObjectStoreDSResourceType') \n" +
+                "let $interpretation :=$x//OBJECTSTORE_INTERPRETATION\n" +
+                "let $uri := $x//RESOURCE_URI/@value/string()  \n" +
+                "let $id := $x//RESOURCE_IDENTIFIER/@value/string() \n" +
+                "let $lastDate := $x//LAST_STORAGE_DATE  \n" +
+                "let $size :=$x//STORE_SIZE \n" +
+                "return concat($uri,'@::@',$id,'@::@',$interpretation,'@::@',$lastDate,'@::@',$size) ";
+
+
+        ISLookUpService lookUpService = serviceLocator.getService(ISLookUpService.class);
+        try {
+            List<String> results = lookUpService.quickSearchProfile(query);
+            if (results == null) return;
+            for (String result : results) {
+                String dataInfo[] = result.split("@::@");
+                if (dataInfo != null && dataInfo.length == 5) {
+                    final String webUri = dataInfo[0];
+                    final String id = dataInfo[1];
+                    final String interpretation = dataInfo[2];
+                    final String lastDate = dataInfo[3];
+                    final int size = Integer.parseInt(dataInfo[4]);
+                    final ObjectStoreInfo currentInfo = new ObjectStoreInfo();
+                    currentInfo.setObjectStoreId(id);
+                    currentInfo.setInterpretation(interpretation);
+                    currentInfo.setLastStorageDate(lastDate);
+                    currentInfo.setSize(size);
+                    currentInfo.setServiceURI(webUri);
+                    currentInfo.setMissingProfile(false);
+                    inputMap.put(id, currentInfo);
+                }
+            }
+        } catch (ISLookUpException e) {
+            log.error(String.format("%s", "Error on making query on is " + query, e));
+        }
+    }
+
+
+    @RequestMapping(value = "/ui/objectStore/getObjectStoreInfo.do")
+    @ResponseBody
+    public ObjectStoreInfo getObjectStoreInfo(
+            final ModelMap map, @RequestParam(value = "objId", required = true) final String objId,
+            @RequestParam(value = "from", required = true) final int from,
+            @RequestParam(value ="id",required = false) final String recordId) {
+        try {
+            final ModularObjectStoreDeliver objectStoreDeliver = objectStoreservice.getObjectStoreDeliver();
+            final ObjectStore store = objectStoreDeliver.getDao().getObjectStore(objId);
+
+            ResultSetListener rs;
+            if (recordId!=null && !StringUtils.isEmpty(recordId)){
+                rs = store.deliverIds(Lists.newArrayList(recordId));
+            }
+            else {
+             rs = store.deliver((long) 0, System.currentTimeMillis());
+            }
+            final List<String> page = rs.getResult((1 + from), (from + 25));
+
+
+            final ObjectStoreInfo info = new ObjectStoreInfo();
+            info.setInterpretation(store.getInterpretation());
+            info.setObjectStoreId(store.getId());
+            info.setSize(store.getSize());
+            info.setMissingObjectStore(false);
+            info.setMissingProfile(existId(objId));
+            info.setResults(Lists.transform(page, convertFunction));
+            return info;
+        } catch (ObjectStoreServiceException e) {
+            return null;
+        }
+    }
+
+
+    private boolean existId(final String objectStoreId) {
+
+        ISLookUpService lookUpService = serviceLocator.getService(ISLookUpService.class);
+        try {
+            final String resourceProfile = lookUpService.getResourceProfile(objectStoreId);
+            return resourceProfile == null;
+        } catch (ISLookUpException e) {
+            log.debug(objectStoreId + " not found!");
+        }
+        return true;
+    }
+
+}
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/info/ObjectStoreInfo.java
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/info/ObjectStoreInfo.java	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/info/ObjectStoreInfo.java	(revision 55508)
@@ -0,0 +1,92 @@
+package eu.dnetlib.functionality.modular.ui.objectStore.info;
+
+import eu.dnetlib.data.objectstore.rmi.ObjectStoreFile;
+
+import java.util.List;
+
+/**
+ * Created by Sandro La Bruzzo on 11/19/15.
+ */
+public class ObjectStoreInfo {
+
+    private String objectStoreId;
+
+    private int size;
+
+    private String interpretation;
+
+    private List<ObjectStoreFile> results;
+
+    private String lastStorageDate;
+
+    private String serviceURI;
+
+    private boolean missingProfile = true;
+
+    private boolean missingObjectStore = true;
+
+    public boolean isMissingProfile() {
+        return missingProfile;
+    }
+
+    public void setMissingProfile(boolean missingProfile) {
+        this.missingProfile = missingProfile;
+    }
+
+    public boolean isMissingObjectStore() {
+        return missingObjectStore;
+    }
+
+    public void setMissingObjectStore(boolean missingObjectStore) {
+        this.missingObjectStore = missingObjectStore;
+    }
+
+    public String getLastStorageDate() {
+        return lastStorageDate;
+    }
+
+    public void setLastStorageDate(String lastStorageDate) {
+        this.lastStorageDate = lastStorageDate;
+    }
+
+    public String getServiceURI() {
+        return serviceURI;
+    }
+
+    public void setServiceURI(String serviceURI) {
+        this.serviceURI = serviceURI;
+    }
+
+    public List<ObjectStoreFile> getResults() {
+        return results;
+    }
+
+    public void setResults(List<ObjectStoreFile> results) {
+        this.results = results;
+    }
+
+    public String getObjectStoreId() {
+        return objectStoreId;
+    }
+
+    public void setObjectStoreId(String objectStoreId) {
+        this.objectStoreId = objectStoreId;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+
+    public String getInterpretation() {
+        return interpretation;
+    }
+
+    public void setInterpretation(String interpretation) {
+        this.interpretation = interpretation;
+    }
+}
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceEntryPointController.java
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceEntryPointController.java	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/src/main/java/eu/dnetlib/functionality/modular/ui/objectStore/ObjectStoreServiceEntryPointController.java	(revision 55508)
@@ -0,0 +1,18 @@
+/**
+ * Created by Sandro La Bruzzo on 11/18/15.
+ */
+
+package eu.dnetlib.functionality.modular.ui.objectStore;
+
+import eu.dnetlib.functionality.modular.ui.ModuleEntryPoint;
+import org.springframework.ui.ModelMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class ObjectStoreServiceEntryPointController extends ModuleEntryPoint {
+    @Override
+    protected void initialize(ModelMap modelMap, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception {
+
+    }
+}
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/deploy.info
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/deploy.info	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1/deploy.info	(revision 55508)
@@ -0,0 +1 @@
+{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet45/modules/dnet-objectStore-ui/trunk/", "deploy_repository": "dnet45-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet45-snapshots", "name": "dnet-objectStore-ui"}
\ No newline at end of file
Index: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1
===================================================================
--- modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1	(nonexistent)
+++ modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1	(revision 55508)

Property changes on: modules/dnet-objectStore-ui/tags/dnet-objectStore-ui-2.0.1
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+target
+*.iml
