From 1da6ba77c3682f9ed04cb2cce0a0ac1a159958fd Mon Sep 17 00:00:00 2001 From: skygo Date: Thu, 25 Apr 2013 20:10:44 +0000 Subject: [PATCH 01/11] branche to setup some reorganization of web application to make archiva more modular. (https://jira.codehaus.org/browse/MRM-1756) git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1475941 13f79535-47bb-0310-9956-ffa450edef68 From 3875293d16e114de4862952977ae67a4b6d7a7a6 Mon Sep 17 00:00:00 2001 From: skygo Date: Mon, 29 Apr 2013 18:33:12 +0000 Subject: [PATCH 02/11] move some js. darker background to differenciate the branche. (still WIP) git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1477259 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/css/archiva.css | 4 +- .../archiva/admin/repository/legacy/main.js | 317 ++++++++++++++++++ .../archiva/admin/repository/maven2/main.js | 44 +++ .../main/webapp/js/archiva/general-admin.js | 278 +-------------- .../src/main/webapp/js/archiva/main.js | 38 ++- 5 files changed, 386 insertions(+), 295 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/archiva.css b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/archiva.css index e93392117..79d3daa94 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/archiva.css +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/archiva.css @@ -16,7 +16,9 @@ * specific language governing permissions and limitations * under the License. */ - +body { + background-color: #a0a0a0; +} /* medium-spinner */ #medium-spinner { z-index: 20001; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js new file mode 100644 index 000000000..7de78f71a --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js @@ -0,0 +1,317 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], + function(jquery,i18n,ko) { + + showMenu = function(administrationMenuItems) { + administrationMenuItems.push( + { + text: $.i18n.prop('menu.legacy-artifact-support'), + id: "menu-legacy-support-list-a", + href: "#legacy", + redback: "{permissions: ['archiva-manage-configuration']}", + func: function() { + displayLegacyArtifactPathSupport() + } + }); + } + + + //------------------------- + // legacy path part + //------------------------- + + LegacyArtifactPath = function(path, groupId, artifactId, version, classifier, type, update) { + //private String path; + this.path = ko.observable(path); + + /** + * The artifact reference, as " [groupId] : + * [artifactId] : [version] : [classifier] : [type] ". + */ + //private String artifact; + //this.artifact=ko.observable(artifact); + this.update = update; + //private String groupId; + this.groupId = ko.observable(groupId); + + //private String artifactId; + this.artifactId = ko.observable(artifactId); + + //private String version; + this.version = ko.observable(version); + + //private String classifier; + this.classifier = ko.observable(classifier); + + //private String type; + this.type = ko.observable(type); + + this.modified = ko.observable(); + + this.artifact = ko.computed(function() { + var artifactValue = ""; + if (this.groupId()) { + artifactValue += this.groupId(); + } + if (this.artifactId()) { + artifactValue += ":" + this.artifactId(); + } + if (this.version()) { + artifactValue += ":" + this.version(); + } + if (this.classifier()) { + artifactValue += ":" + this.classifier(); + } + if (this.type()) { + artifactValue += ":" + this.type(); + } + return artifactValue; + }, this); + }; + + mapLegacyArtifactPaths = function(data) { + if (data) { + return $.isArray(data) ? $.map(data, function(item) { + return mapLegacyArtifactPath(item); + }) : [mapLegacyArtifactPath(data)]; + } + return []; + }; + + mapLegacyArtifactPath = function(data) { + return data ? new LegacyArtifactPath(data.path, data.groupId, data.artifactId, data.version, data.classifier, data.type) : null; + }; + + activateLegacyArtifactPathFormValidation = function() { + var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form"); + var validator = theForm.validate({ + showErrors: function(validator, errorMap, errorList) { + customShowError("#main-content #legacy-artifact-paths-edit-form", validator, errorMap, errorMap); + } + }); + }; + + LegacyArtifactPathViewModel = function(legacyArtifactPath, update, legacyArtifactPathsViewModel) { + var self = this; + this.update = update; + this.legacyArtifactPath = legacyArtifactPath; + this.legacyArtifactPathsViewModel = legacyArtifactPathsViewModel; + + this.display = function() { + var mainContent = $("#main-content"); + ko.applyBindings(self, mainContent.find("#legacy-artifact-paths-edit").get(0)); + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("edit")); + activateLegacyArtifactPathFormValidation(); + activateLegacyArtifactPathsEditTab(); + }; + + displayGrid = function() { + activateLegacyArtifactPathsGridTab(); + }; + + calculatePath = function() { + var path = ""; + if (self.legacyArtifactPath.groupId()) { + path += self.legacyArtifactPath.groupId() + "/jars/"; + } + if (self.legacyArtifactPath.artifactId()) { + path += self.legacyArtifactPath.artifactId(); + } + if (self.legacyArtifactPath.version()) { + path += "-" + self.legacyArtifactPath.version(); + } + if (self.legacyArtifactPath.classifier()) { + path += "-" + self.legacyArtifactPath.classifier(); + } + if (self.legacyArtifactPath.type()) { + path += "." + self.legacyArtifactPath.type(); + } + self.legacyArtifactPath.path(path); + }; + + this.save = function() { + var theForm = $("#main-content").find("#legacy-artifact-paths-edit-form"); + if (!theForm.valid()) { + return; + } + // do that on server side + /*if (theForm.find("#artifact" ).val() + !=theForm.find("#path" ).val()){ + var errorList=[{ + message: $.i18n.prop("path must match artifact"), + element: theForm.find("#path" ).get(0) + }]; + customShowError("#main-content #legacy-artifact-paths-edit-form", null, null, errorList); + return; + }*/ + // TODO call id exists if add ? + clearUserMessages(); + $.log("save ok"); + if (self.update) { + $.log("update"); + } else { + $.ajax("restServices/archivaServices/archivaAdministrationService/addLegacyArtifactPath", + { + type: "POST", + contentType: 'application/json', + data: ko.toJSON(self.legacyArtifactPath), + dataType: 'json', + success: function(data) { + self.legacyArtifactPath.modified(false); + self.legacyArtifactPathsViewModel.legacyArtifactPaths.push(self.legacyArtifactPath); + displaySuccessMessage($.i18n.prop('legacy-artifact-path.added', self.legacyArtifactPath.path())); + activateLegacyArtifactPathsGridTab(); + }, + error: function(data) { + var res = $.parseJSON(data.responseText); + displayRestError(res); + } + } + ); + } + } + }; + + LegacyArtifactPathsViewModel = function() { + var self = this; + this.legacyArtifactPaths = ko.observableArray([]); + + this.gridViewModel = new ko.simpleGrid.viewModel({ + data: self.legacyArtifactPaths, + columns: [ + { + headerText: $.i18n.prop('legacy-artifact-paths.path'), + rowText: "path" + }, + { + headerText: $.i18n.prop('legacy-artifact-paths.artifact'), + rowText: "artifact" + } + ], + pageSize: 5, + gridUpdateCallBack: function(networkProxy) { + $("#main-content").find("#legacy-artifact-paths-table").find("[title]").tooltip(); + } + }); + + + editLegacyArtifactPath = function(legacyArtifactPath) { + var legacyArtifactPathViewModel = new LegacyArtifactPathViewModel(legacyArtifactPath, true); + legacyArtifactPathViewModel.display(); + }; + + removeLegacyArtifactPath = function(legacyArtifactPath) { + + openDialogConfirm( + function() { + + $.ajax("restServices/archivaServices/archivaAdministrationService/deleteLegacyArtifactPath?path=" + encodeURIComponent(legacyArtifactPath.path()), + { + type: "GET", + dataType: 'json', + success: function(data) { + self.legacyArtifactPaths.remove(legacyArtifactPath); + displaySuccessMessage($.i18n.prop('legacy-artifact-path.removed', legacyArtifactPath.path())); + activateLegacyArtifactPathsGridTab(); + }, + error: function(data) { + var res = $.parseJSON(data.responseText); + displayRestError(res); + }, + complete: function() { + closeDialogConfirm(); + } + } + ); + }, $.i18n.prop('ok'), $.i18n.prop('cancel'), $.i18n.prop('legacy-artifact-path.delete.confirm', legacyArtifactPath.path()), + $("#legacy-artifact-path-delete-warning-tmpl").tmpl(legacyArtifactPath)); + + }; + + updateLegacyArtifactPath = function(legacyArtifactPath) { + + } + + }; + + displayLegacyArtifactPathSupport = function() { + screenChange(); + var mainContent = $("#main-content"); + mainContent.html(mediumSpinnerImg()); + + $.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", { + type: "GET", + dataType: 'json', + success: function(data) { + mainContent.html($("#legacy-artifact-path-main").tmpl()); + var legacyArtifactPathsViewModel = new LegacyArtifactPathsViewModel(); + var legacyPaths = mapLegacyArtifactPaths(data); + $.log("legacyPaths:" + legacyPaths.length); + legacyArtifactPathsViewModel.legacyArtifactPaths(legacyPaths); + ko.applyBindings(legacyArtifactPathsViewModel, mainContent.find("#legacy-artifact-paths-view").get(0)); + + mainContent.find("#legacy-artifact-paths-view-tabs").on('show', function(e) { + if ($(e.target).attr("href") == "#legacy-artifact-paths-edit") { + var viewModel = new LegacyArtifactPathViewModel(new LegacyArtifactPath(), false, legacyArtifactPathsViewModel); + viewModel.display(); + activateLegacyArtifactPathFormValidation(); + clearUserMessages(); + } + if ($(e.target).attr("href") == "#legacy-artifact-paths-view") { + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add")); + clearUserMessages(); + } + + }); + + + activateLegacyArtifactPathsGridTab(); + } + }); + + + }; + + + activateLegacyArtifactPathsGridTab = function() { + var mainContent = $("#main-content"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active"); + mainContent.find("#legacy-artifact-paths-edit").removeClass("active"); + + mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active"); + mainContent.find("#legacy-artifact-paths-view").addClass("active"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add")); + + }; + + activateLegacyArtifactPathsEditTab = function() { + var mainContent = $("#main-content"); + mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active"); + mainContent.find("#legacy-artifact-paths-view").removeClass("active"); + + mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active"); + mainContent.find("#legacy-artifact-paths-edit").addClass("active"); + }; + + + + + } +); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js new file mode 100644 index 000000000..f2e8cc03f --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +define("archiva/admin/repository/maven2/main",["jquery",'i18n'], + function() { + showMenu = function(administrationMenuItems) { + administrationMenuItems.push( + {text: $.i18n.prop('menu.repository.groups'), + id: "menu-repository-groups-list-a", + href: "#repositorygroup", + redback: "{permissions: ['archiva-manage-configuration']}", + func: function() { + displayRepositoryGroups() + } + }); + administrationMenuItems.push({text: $.i18n.prop('menu.repositories'), id: "menu-repositories-list-a", href: "#repositorylist", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + displayRepositoriesGrid() + }}); + administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors'), id: "menu-proxy-connectors-list-a", href: "#proxyconnectors", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + displayProxyConnectors() + }}); + administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors-rules'), id: "menu.proxy-connectors-rules-list-a", href: "#proxyconnectorsrules", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + displayProxyConnectorsRules() + }}); + + }; + } + +); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js index 9e07b3dd4..55fc14a22 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js @@ -20,283 +20,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" "knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2","knockout.select2"] , function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) { - //------------------------- - // legacy path part - //------------------------- - - LegacyArtifactPath=function(path,groupId,artifactId,version,classifier,type,update){ - //private String path; - this.path=ko.observable(path); - - /** - * The artifact reference, as " [groupId] : - * [artifactId] : [version] : [classifier] : [type] ". - */ - //private String artifact; - //this.artifact=ko.observable(artifact); - this.update=update; - //private String groupId; - this.groupId=ko.observable(groupId); - - //private String artifactId; - this.artifactId=ko.observable(artifactId); - - //private String version; - this.version=ko.observable(version); - - //private String classifier; - this.classifier=ko.observable(classifier); - - //private String type; - this.type=ko.observable(type); - - this.modified=ko.observable(); - - this.artifact = ko.computed(function() { - var artifactValue=""; - if (this.groupId()){ - artifactValue+=this.groupId(); - } - if (this.artifactId()){ - artifactValue+=":"+this.artifactId(); - } - if (this.version()){ - artifactValue+=":"+this.version(); - } - if (this.classifier()){ - artifactValue+=":"+this.classifier(); - } - if (this.type()){ - artifactValue+=":"+this.type(); - } - return artifactValue; - }, this); - }; - - mapLegacyArtifactPaths=function(data){ - if (data){ - return $.isArray(data)? $.map(data,function(item){ - return mapLegacyArtifactPath(item); - }):[mapLegacyArtifactPath(data)]; - } - return []; - }; - - mapLegacyArtifactPath=function(data){ - return data?new LegacyArtifactPath(data.path,data.groupId,data.artifactId,data.version,data.classifier,data.type):null; - }; - - activateLegacyArtifactPathFormValidation=function(){ - var theForm=$("#main-content" ).find("#legacy-artifact-paths-edit-form"); - var validator = theForm.validate({ - showErrors: function(validator, errorMap, errorList) { - customShowError("#main-content #legacy-artifact-paths-edit-form",validator,errorMap,errorMap); - } - }); - }; - - LegacyArtifactPathViewModel=function(legacyArtifactPath,update,legacyArtifactPathsViewModel){ - var self=this; - this.update=update; - this.legacyArtifactPath=legacyArtifactPath; - this.legacyArtifactPathsViewModel=legacyArtifactPathsViewModel; - - this.display=function(){ - var mainContent=$("#main-content"); - ko.applyBindings(self,mainContent.find("#legacy-artifact-paths-edit" ).get(0)); - mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("edit")); - activateLegacyArtifactPathFormValidation(); - activateLegacyArtifactPathsEditTab(); - }; - - displayGrid=function(){ - activateLegacyArtifactPathsGridTab(); - }; - - calculatePath=function(){ - var path=""; - if (self.legacyArtifactPath.groupId()){ - path+=self.legacyArtifactPath.groupId()+"/jars/"; - } - if (self.legacyArtifactPath.artifactId()){ - path+=self.legacyArtifactPath.artifactId(); - } - if (self.legacyArtifactPath.version()){ - path+="-"+self.legacyArtifactPath.version(); - } - if (self.legacyArtifactPath.classifier()){ - path+="-"+self.legacyArtifactPath.classifier(); - } - if (self.legacyArtifactPath.type()){ - path+="."+self.legacyArtifactPath.type(); - } - self.legacyArtifactPath.path(path); - }; - - this.save=function(){ - var theForm=$("#main-content" ).find("#legacy-artifact-paths-edit-form"); - if (!theForm.valid()){ - return; - } - // do that on server side - /*if (theForm.find("#artifact" ).val() - !=theForm.find("#path" ).val()){ - var errorList=[{ - message: $.i18n.prop("path must match artifact"), - element: theForm.find("#path" ).get(0) - }]; - customShowError("#main-content #legacy-artifact-paths-edit-form", null, null, errorList); - return; - }*/ - // TODO call id exists if add ? - clearUserMessages(); - $.log("save ok"); - if (self.update){ - $.log("update"); - }else { - $.ajax("restServices/archivaServices/archivaAdministrationService/addLegacyArtifactPath", - { - type: "POST", - contentType: 'application/json', - data: ko.toJSON(self.legacyArtifactPath), - dataType: 'json', - success: function(data) { - self.legacyArtifactPath.modified(false); - self.legacyArtifactPathsViewModel.legacyArtifactPaths.push(self.legacyArtifactPath); - displaySuccessMessage($.i18n.prop('legacy-artifact-path.added',self.legacyArtifactPath.path())); - activateLegacyArtifactPathsGridTab(); - }, - error: function(data) { - var res = $.parseJSON(data.responseText); - displayRestError(res); - } - } - ); - } - } - }; - - LegacyArtifactPathsViewModel=function(){ - var self=this; - this.legacyArtifactPaths=ko.observableArray([]); - - this.gridViewModel = new ko.simpleGrid.viewModel({ - data: self.legacyArtifactPaths, - columns: [ - { - headerText: $.i18n.prop('legacy-artifact-paths.path'), - rowText: "path" - }, - { - headerText: $.i18n.prop('legacy-artifact-paths.artifact'), - rowText: "artifact" - } - ], - pageSize: 5, - gridUpdateCallBack: function(networkProxy){ - $("#main-content").find("#legacy-artifact-paths-table" ).find("[title]").tooltip(); - } - }); - - - editLegacyArtifactPath=function(legacyArtifactPath){ - var legacyArtifactPathViewModel=new LegacyArtifactPathViewModel(legacyArtifactPath,true); - legacyArtifactPathViewModel.display(); - }; - - removeLegacyArtifactPath=function(legacyArtifactPath){ - - openDialogConfirm( - function(){ - - $.ajax("restServices/archivaServices/archivaAdministrationService/deleteLegacyArtifactPath?path="+encodeURIComponent(legacyArtifactPath.path()), - { - type: "GET", - dataType: 'json', - success: function(data) { - self.legacyArtifactPaths.remove(legacyArtifactPath); - displaySuccessMessage($.i18n.prop('legacy-artifact-path.removed',legacyArtifactPath.path())); - activateLegacyArtifactPathsGridTab(); - }, - error: function(data) { - var res = $.parseJSON(data.responseText); - displayRestError(res); - }, - complete: function(){ - closeDialogConfirm(); - } - } - ); - }, $.i18n.prop('ok'), $.i18n.prop('cancel'), $.i18n.prop('legacy-artifact-path.delete.confirm',legacyArtifactPath.path()), - $("#legacy-artifact-path-delete-warning-tmpl" ).tmpl(legacyArtifactPath)); - - }; - - updateLegacyArtifactPath=function(legacyArtifactPath){ - - } - - }; - - displayLegacyArtifactPathSupport=function(){ - screenChange(); - var mainContent=$("#main-content"); - mainContent.html(mediumSpinnerImg()); - - $.ajax("restServices/archivaServices/archivaAdministrationService/getLegacyArtifactPaths", { - type: "GET", - dataType: 'json', - success: function(data){ - mainContent.html($("#legacy-artifact-path-main").tmpl()); - var legacyArtifactPathsViewModel=new LegacyArtifactPathsViewModel(); - var legacyPaths=mapLegacyArtifactPaths(data); - $.log("legacyPaths:"+legacyPaths.length); - legacyArtifactPathsViewModel.legacyArtifactPaths(legacyPaths); - ko.applyBindings(legacyArtifactPathsViewModel,mainContent.find("#legacy-artifact-paths-view" ).get(0)); - - mainContent.find("#legacy-artifact-paths-view-tabs").on('show', function (e) { - if ($(e.target).attr("href")=="#legacy-artifact-paths-edit") { - var viewModel = new LegacyArtifactPathViewModel(new LegacyArtifactPath(),false,legacyArtifactPathsViewModel); - viewModel.display(); - activateLegacyArtifactPathFormValidation(); - clearUserMessages(); - } - if ($(e.target).attr("href")=="#legacy-artifact-paths-view") { - mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add")); - clearUserMessages(); - } - - }); - - - activateLegacyArtifactPathsGridTab(); - } - }); - - - }; - - - activateLegacyArtifactPathsGridTab=function(){ - var mainContent = $("#main-content"); - mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").removeClass("active"); - mainContent.find("#legacy-artifact-paths-edit").removeClass("active"); - - mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").addClass("active"); - mainContent.find("#legacy-artifact-paths-view").addClass("active"); - mainContent.find("#legacy-artifact-paths-view-tabs-li-edit a").html($.i18n.prop("add")); - - }; - - activateLegacyArtifactPathsEditTab=function(){ - var mainContent = $("#main-content"); - mainContent.find("#legacy-artifact-paths-view-tabs-li-grid").removeClass("active"); - mainContent.find("#legacy-artifact-paths-view").removeClass("active"); - - mainContent.find("#legacy-artifact-paths-view-tabs-li-edit").addClass("active"); - mainContent.find("#legacy-artifact-paths-edit").addClass("active"); - }; - + //--------------------------- // repository scanning part diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index ec039f6ea..717c5a4e9 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -224,25 +224,29 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa { text : $.i18n.prop('menu.artifacts.upload') , id: "menu-find-upload-a", href: "#upload" , redback: "{permissions: ['archiva-upload-repository']}", func: function(){displayUploadArtifact(true)}} ]); this.administrationMenuItems = ko.observableArray([ - { text : $.i18n.prop('menu.administration') , id: null}, - { text : $.i18n.prop('menu.repository.groups') , id: "menu-repository-groups-list-a" , href: "#repositorygroup" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryGroups()}}, - { text : $.i18n.prop('menu.repositories') , id: "menu-repositories-list-a" , href: "#repositorylist" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoriesGrid()}}, - { text : $.i18n.prop('menu.proxy-connectors') , id: "menu-proxy-connectors-list-a" , href: "#proxyconnectors" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayProxyConnectors()}}, - { text : $.i18n.prop('menu.proxy-connectors-rules') , id: "menu.proxy-connectors-rules-list-a" , href: "#proxyconnectorsrules" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayProxyConnectorsRules()}}, - { text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}}, - { text : $.i18n.prop('menu.legacy-artifact-support') , id: "menu-legacy-support-list-a" , href: "#legacy" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayLegacyArtifactPathSupport()}}, - { text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}}, - { text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}}, - { text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}}, - { text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}}, - { text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}} - ]); + {text: $.i18n.prop('menu.administration'), id: null} ]); + + + var myrepplugins = "archiva/admin/repository/legacy/main|archiva/admin/repository/maven2/main"; + $.each(myrepplugins.split("|"), function(key, value) { + alert(value); + require([value], function() { + showMenu(self.administrationMenuItems); + }); + + }); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}}); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}}); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}}); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}}); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}}); + self.administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}); - this.usersMenuItems = ko.observableArray([ + this.usersMenuItems = ko.observableArray([ { text : $.i18n.prop('menu.users') , id: null}, - { text : $.i18n.prop('menu.users.manage') , id: "menu-users-list-a" , href: "#users" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayUsersGrid()}}, - { text : $.i18n.prop('menu.users.roles') , id: "menu-roles-list-a" , href: "#roles" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayRolesGrid()}}, - { text : $.i18n.prop('menu.users-runtime-configuration') , id: "menu-redback-runtime-configuration-list-a" , href: "#redbackruntimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRedbackRuntimeConfiguration()}} + { text : $.i18n.prop('menu.users.manage') , id: "menu-users-list-a" , href: "#users" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayUsersGrid();}}, + { text : $.i18n.prop('menu.users.roles') , id: "menu-roles-list-a" , href: "#roles" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayRolesGrid();}}, + { text : $.i18n.prop('menu.users-runtime-configuration') , id: "menu-redback-runtime-configuration-list-a" , href: "#redbackruntimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRedbackRuntimeConfiguration();}} ]); this.docsMenuItems = ko.observableArray([ From a98c867b7fc38b83f0c0452d811c0edb20c8e4ee Mon Sep 17 00:00:00 2001 From: skygo Date: Mon, 29 Apr 2013 22:38:11 +0000 Subject: [PATCH 03/11] Add a service and use ajax to build menus git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1477395 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/PluginsService.java | 45 +++++++++++ .../rest/services/DefaultPluginsServices.java | 76 +++++++++++++++++++ .../resources/META-INF/spring-context.xml | 1 + .../src/main/webapp/js/archiva/main.js | 16 ++-- 4 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java create mode 100644 archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java new file mode 100644 index 000000000..27f8df0a6 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java @@ -0,0 +1,45 @@ +package org.apache.archiva.rest.api.services; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.archiva.redback.authorization.RedbackAuthorization; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * contains some services for plugins + * + * @author Eric Barboni + * @since 1.4-M4 + */ +@Path( "/pluginsService/" ) +public interface PluginsService +{ + + @Path( "getAdminPlugins" ) + @GET + @Produces( { MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noRestriction = true ) + String getAdminPlugins( ) + throws ArchivaRestServiceException; + +} diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java new file mode 100644 index 000000000..b47b7e7a1 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -0,0 +1,76 @@ +package org.apache.archiva.rest.services; +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.archiva.rest.api.services.ArchivaRestServiceException; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import org.apache.archiva.rest.api.services.PluginsService; +import org.springframework.context.ApplicationContext; +import org.springframework.core.io.Resource; + +/** + * @author Eric Barboni + */ +@Service( "pluginsService#rest" ) +public class DefaultPluginsServices + implements PluginsService +{ + + private List repositoryType = new ArrayList(); + + @Inject + public DefaultPluginsServices( ApplicationContext applicationContext ) + { + Resource[] xmlResources; + try { + xmlResources = applicationContext.getResources( "/**/repository/**/main.js" ); + for (Resource rc : xmlResources) + { + String tmp = rc.getURL().toString(); + tmp = tmp.substring( tmp.lastIndexOf("repository") + 11, tmp.length() - 8 ); + repositoryType.add( tmp ); + } + } catch (IOException ex) { + + } + + } + + @Override + public String getAdminPlugins() + throws ArchivaRestServiceException + { + // rebuild + String baseRepo = "archiva/admin/repository/"; + StringBuilder sb = new StringBuilder(); + for (String repoType : repositoryType) + { + sb.append( baseRepo ).append( repoType ).append( "/main" ).append( "|" ); + } + + return sb.substring( 0, sb.length() - 1); + + } + +} diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml index 1b2188b09..f2c1f2d8f 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml @@ -68,6 +68,7 @@ + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 717c5a4e9..ccf7416d2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -226,15 +226,21 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa this.administrationMenuItems = ko.observableArray([ {text: $.i18n.prop('menu.administration'), id: null} ]); - - var myrepplugins = "archiva/admin/repository/legacy/main|archiva/admin/repository/maven2/main"; - $.each(myrepplugins.split("|"), function(key, value) { - alert(value); - require([value], function() { + var pluginsURL = "restServices/archivaServices/pluginsService/getAdminPlugins"; + $.ajax(pluginsURL, { + type: "GET", + dataType: 'text', + success: function(data) { + $.each(data.split("|"), function(key, value) { + require([value], function() { showMenu(self.administrationMenuItems); }); }); + } + }); + //var myrepplugins = "archiva/admin/repository/legacy/main|archiva/admin/repository/maven2/main"; + self.administrationMenuItems.push({ text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}}); self.administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}}); self.administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}}); From 7499737816eea33c04857f663b41ecd248e5344e Mon Sep 17 00:00:00 2001 From: skygo Date: Tue, 30 Apr 2013 11:40:21 +0000 Subject: [PATCH 04/11] make a test within another modules git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1477572 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/admin/repository/maven2d/main.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js diff --git a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js new file mode 100644 index 000000000..fae0c5af0 --- /dev/null +++ b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +define("archiva/admin/repository/maven2d/main",["jquery",'i18n'], + function() { + showMenu = function(administrationMenuItems) { + administrationMenuItems.push( + {text: "dummymaven", + id: "menu-repository-groups-list-aa", + href: "#repositorygroupd", + redback: "{permissions: ['archiva-manage-configuration']}", + func: function() { + alert('Ah! We are the ruthless Pilou-Pilou warriors. I know not very archiva but it not final yet'); + } + }); + + }; + } + +); \ No newline at end of file From b9bc7bc3dcbdbf10e55d87d53b479c0910d7a1bd Mon Sep 17 00:00:00 2001 From: skygo Date: Tue, 7 May 2013 21:42:38 +0000 Subject: [PATCH 05/11] clean maven2repository module to focus only on layout in webapp make some order hypothesis git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1480100 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/PluginsService.java | 12 ++++--- .../repository/{maven2 => 10maven2}/main.js | 10 +++--- .../repository/{legacy => 20legacy}/main.js | 10 +++--- .../src/main/webapp/js/archiva/main.js | 34 +++++++++--------- .../webapp/js/archiva/repository-groups.js | 2 +- .../archiva/admin/repository/maven2d/main.js | 35 ------------------- 6 files changed, 35 insertions(+), 68 deletions(-) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{maven2 => 10maven2}/main.js (88%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{legacy => 20legacy}/main.js (99%) delete mode 100644 archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java index 27f8df0a6..4468d614b 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/PluginsService.java @@ -35,11 +35,13 @@ import javax.ws.rs.core.MediaType; public interface PluginsService { - @Path( "getAdminPlugins" ) + @Path( "getAdminPlugins" ) @GET - @Produces( { MediaType.TEXT_PLAIN } ) + @Produces( + { + MediaType.TEXT_PLAIN + } ) @RedbackAuthorization( noRestriction = true ) - String getAdminPlugins( ) - throws ArchivaRestServiceException; - + String getAdminPlugins() + throws ArchivaRestServiceException; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js similarity index 88% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js index f2e8cc03f..3be9c5c6f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/maven2/main",["jquery",'i18n'], +define("archiva/admin/repository/10maven2/main",["jquery",'i18n'], function() { showMenu = function(administrationMenuItems) { administrationMenuItems.push( @@ -25,17 +25,17 @@ define("archiva/admin/repository/maven2/main",["jquery",'i18n'], href: "#repositorygroup", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { - displayRepositoryGroups() + displayRepositoryGroups(); } }); administrationMenuItems.push({text: $.i18n.prop('menu.repositories'), id: "menu-repositories-list-a", href: "#repositorylist", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { - displayRepositoriesGrid() + displayRepositoriesGrid(); }}); administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors'), id: "menu-proxy-connectors-list-a", href: "#proxyconnectors", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { - displayProxyConnectors() + displayProxyConnectors(); }}); administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors-rules'), id: "menu.proxy-connectors-rules-list-a", href: "#proxyconnectorsrules", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { - displayProxyConnectorsRules() + displayProxyConnectorsRules(); }}); }; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js index 7de78f71a..907cdf02e 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], +define("archiva/admin/repository/20legacy/main", ["jquery", 'i18n','knockout'], function(jquery,i18n,ko) { showMenu = function(administrationMenuItems) { @@ -27,10 +27,10 @@ define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], href: "#legacy", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { - displayLegacyArtifactPathSupport() + displayLegacyArtifactPathSupport(); } }); - } + }; //------------------------- @@ -186,7 +186,7 @@ define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], } ); } - } + }; }; LegacyArtifactPathsViewModel = function() { @@ -247,7 +247,7 @@ define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], updateLegacyArtifactPath = function(legacyArtifactPath) { - } + }; }; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index ccf7416d2..f470c3156 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -232,11 +232,11 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa dataType: 'text', success: function(data) { $.each(data.split("|"), function(key, value) { - require([value], function() { - showMenu(self.administrationMenuItems); - }); - - }); + require([value], function() { + showMenu(self.administrationMenuItems); + }); + + }); } }); //var myrepplugins = "archiva/admin/repository/legacy/main|archiva/admin/repository/maven2/main"; @@ -777,7 +777,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa $("#main-content" ).html($("#welcome" ).tmpl({runtimeInfo: window.archivaRuntimeInfo})); drawQuickSearchAutocomplete("#quick-search-autocomplete-welcome"); }); - } + }; userLoggedCallbackFn=function(user){ $.log("userLoggedCallbackFn:"+ (user?user.username():null)); @@ -901,18 +901,18 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa } ); }, - select: function( event, ui ) { - $.log("select artifactId:"+ui.item.artifactId); - window.sammyArchivaApplication.setLocation("#quicksearch~"+ui.item.artifactId); - } - }).data( "autocomplete" )._renderItem = function( ul, item ) { - return $( "
  • " ) - .data( "item.autocomplete", item ) - .append( "" + item.artifactId + "" ) - .appendTo( ul ); - }; + select: function(event, ui) { + $.log("select artifactId:" + ui.item.artifactId); + window.sammyArchivaApplication.setLocation("#quicksearch~" + ui.item.artifactId); + } + }).data("autocomplete")._renderItem = function(ul, item) { + return $("
  • ") + .data("item.autocomplete", item) + .append("" + item.artifactId + "") + .appendTo(ul); + }; - } + }; }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js index ce567c882..e49fd1f75 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js @@ -245,7 +245,7 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { } ); - } + }; this.addRepositoryGroup=function(repositoryGroup){ clearUserMessages(); diff --git a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js b/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js deleted file mode 100644 index fae0c5af0..000000000 --- a/archiva-modules/plugins/maven2-repository/src/main/resources/META-INF/resources/js/archiva/admin/repository/maven2d/main.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -define("archiva/admin/repository/maven2d/main",["jquery",'i18n'], - function() { - showMenu = function(administrationMenuItems) { - administrationMenuItems.push( - {text: "dummymaven", - id: "menu-repository-groups-list-aa", - href: "#repositorygroupd", - redback: "{permissions: ['archiva-manage-configuration']}", - func: function() { - alert('Ah! We are the ruthless Pilou-Pilou warriors. I know not very archiva but it not final yet'); - } - }); - - }; - } - -); \ No newline at end of file From 5e7a5fdeaa79cfe28a106d22d604685a8cf79e1b Mon Sep 17 00:00:00 2001 From: skygo Date: Sun, 12 May 2013 16:19:41 +0000 Subject: [PATCH 06/11] admin in folders. Some features may not work properly git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1481595 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/services/DefaultPluginsServices.java | 74 +++++++++++-------- .../features/10networkproxies/main.js} | 9 ++- .../features/20generaladmin/main.js} | 35 +++------ .../archiva/admin/repository/10maven2/main.js | 2 +- .../10maven2}/proxy-connectors-rules.js | 4 +- .../repository/10maven2}/proxy-connectors.js | 2 +- .../repository/10maven2}/repositories.js | 2 +- .../repository/10maven2}/repository-groups.js | 4 +- .../src/main/webapp/js/archiva/archiva.js | 40 ++++++++-- .../src/main/webapp/js/archiva/main.js | 13 +--- 10 files changed, 101 insertions(+), 84 deletions(-) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{network-proxies.js => admin/features/10networkproxies/main.js} (96%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{general-admin.js => admin/features/20generaladmin/main.js} (97%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{ => admin/repository/10maven2}/proxy-connectors-rules.js (98%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{ => admin/repository/10maven2}/proxy-connectors.js (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{ => admin/repository/10maven2}/repositories.js (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/{ => admin/repository/10maven2}/repository-groups.js (98%) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index b47b7e7a1..492066953 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -34,43 +34,53 @@ import org.springframework.core.io.Resource; */ @Service( "pluginsService#rest" ) public class DefaultPluginsServices - implements PluginsService + implements PluginsService { private List repositoryType = new ArrayList(); - + private List adminFeatures = new ArrayList(); + @Inject - public DefaultPluginsServices( ApplicationContext applicationContext ) + public DefaultPluginsServices( ApplicationContext applicationContext ) { - Resource[] xmlResources; - try { - xmlResources = applicationContext.getResources( "/**/repository/**/main.js" ); - for (Resource rc : xmlResources) - { - String tmp = rc.getURL().toString(); - tmp = tmp.substring( tmp.lastIndexOf("repository") + 11, tmp.length() - 8 ); - repositoryType.add( tmp ); - } - } catch (IOException ex) { - - } - - } - - @Override - public String getAdminPlugins() - throws ArchivaRestServiceException - { - // rebuild - String baseRepo = "archiva/admin/repository/"; - StringBuilder sb = new StringBuilder(); - for (String repoType : repositoryType) - { - sb.append( baseRepo ).append( repoType ).append( "/main" ).append( "|" ); - } - - return sb.substring( 0, sb.length() - 1); - + feed( repositoryType, "repository", applicationContext ); + feed( adminFeatures, "features", applicationContext ); } + private void feed( List repository, String key, ApplicationContext applicationContext ) + { + Resource[] xmlResources; + try + { + xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" ); + for ( Resource rc : xmlResources ) + { + String tmp = rc.getURL().toString(); + tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 ); + repository.add( "archiva/admin/" + key + "/" + tmp + "/main" ); + } + } + catch ( IOException ex ) + { + } + } + + @Override + public String getAdminPlugins() + throws ArchivaRestServiceException + { + // rebuild + StringBuilder sb = new StringBuilder(); + for ( String repoType : repositoryType ) + { + sb.append( repoType ).append( "|" ); + } + for ( String repoType : adminFeatures ) + { + sb.append( repoType ).append( "|" ); + } + + return sb.substring( 0, sb.length() - 1 ); + + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/network-proxies.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js similarity index 96% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/network-proxies.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js index 13a5a8cd8..c2d7a0711 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/network-proxies.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js @@ -16,10 +16,15 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.network-proxies",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" +define("archiva/admin/features/10networkproxies/main",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" ,"knockout.simpleGrid"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { - + showMenu = function(administrationMenuItems) { + administrationMenuItems.push( + { text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}} + ); + } + NetworkProxy=function(id,protocol,host,port,username,password,useNtlm){ var self=this; //private String id; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js similarity index 97% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js index 10a21c4a5..4aa130e61 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/general-admin.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js @@ -16,12 +16,19 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid", +define("archiva/admin/features/20generaladmin/main",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid", "knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2","knockout.select2"] , function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) { + showMenu = function( administrationMenuItems) { + administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage();}}); + + }; - //--------------------------- // repository scanning part //--------------------------- @@ -1780,28 +1787,6 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout" return new CacheConfiguration(data.timeToIdleSeconds,data.timeToLiveSeconds,data.maxElementsInMemory,data.maxElementsOnDisk); } - CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){ - //private String path; - this.path=path; - - //private String domain; - this.domain=domain; - - //private String secure; - this.secure=secure; - - //private String timeout; - this.timeout=timeout; - - //private boolean rememberMeEnabled; - this.rememberMeEnabled=rememberMeEnabled; - } - - mapCookieInformation=function(data){ - if(!data){ - return new CookieInformation(); - } - return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled); - } + }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js index 3be9c5c6f..b669fa00f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/main",["jquery",'i18n'], +define("archiva/admin/repository/10maven2/main",["jquery",'i18n',"archiva/admin/repository/10maven2/repository-groups","archiva/admin/repository/10maven2/proxy-connectors-rules","archiva/admin/repository/10maven2/proxy-connectors"], function() { showMenu = function(administrationMenuItems) { administrationMenuItems.push( diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js similarity index 98% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors-rules.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js index e8b9ca74f..99976117d 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout" - ,"knockout.simpleGrid","knockout.sortable","archiva.proxy-connectors"], +define("archiva/admin/repository/10maven2/proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout" + ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/10maven2/proxy-connectors"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryUi,ko) { ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js index ec6787606..afdc7c146 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" +define("archiva/admin/repository/10maven2/proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" ,"knockout.simpleGrid","knockout.sortable","select2"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repositories.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js index 498cc95e9..cfaad6ec2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"], +define("archiva/admin/repository/10maven2/repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { // FIXME this must be dynamic if we do a plugin mechanism with dynamic repositories types diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js similarity index 98% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js index e49fd1f75..be7956de0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva.repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout" - ,"knockout.simpleGrid","knockout.sortable"], +define("archiva/admin/repository/10maven2/repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout" + ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/10maven2/repositories"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { RepositoryGroup=function(id,repositories,mergedIndexPath){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js index cea993127..c2beda5e7 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js @@ -88,21 +88,47 @@ $.ajax({ "redback.user": "redback/user", "redback.users": "redback/users", "redback.templates": "redback/redback-tmpl", - "archiva.general-admin":"archiva/general-admin", + // "archiva.general-admin":"archiva/general-admin", "archiva.templates": "archiva/main-tmpl", - "archiva.repositories": "archiva/repositories", - "archiva.network-proxies": "archiva/network-proxies", - "archiva.proxy-connectors": "archiva/proxy-connectors", - "archiva.repository-groups": "archiva/repository-groups", + // "archiva.repositories": "archiva/repositories", + // "archiva.network-proxies": "archiva/network-proxies", + // "archiva.proxy-connectors": "archiva/proxy-connectors", + // "archiva.repository-groups": "archiva/repository-groups", "archiva.artifacts-management": "archiva/artifacts-management", "archiva.search": "archiva/search", - "archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules", + // "archiva.proxy-connectors-rules": "archiva/proxy-connectors-rules", "archiva.docs": "archiva/docs", "archiva.main": "archiva/main" } }); + + + CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){ + //private String path; + this.path=path; - requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.general-admin'], function () { + //private String domain; + this.domain=domain; + + //private String secure; + this.secure=secure; + + //private String timeout; + this.timeout=timeout; + + //private boolean rememberMeEnabled; + this.rememberMeEnabled=rememberMeEnabled; + } + + mapCookieInformation=function(data){ + if(!data){ + return new CookieInformation(); + } + return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled); + } + + + requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main'/*,'archiva.general-admin'*/], function () { loadi18n(function () { $.ajax({ url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(), diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index f470c3156..0e088b01a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -18,9 +18,7 @@ */ define("archiva.main",["jquery","jquery.ui","sammy","jquery.tmpl",'i18n',"jquery.cookie","bootstrap","archiva.search", "jquery.validate","jquery.json","knockout","redback.templates","archiva.templates", - "redback.roles","redback","archiva.general-admin","archiva.repositories", - "archiva.network-proxies","archiva.proxy-connectors","archiva.repository-groups","archiva.artifacts-management", - "archiva.proxy-connectors-rules","archiva.docs"], + "redback.roles","redback","archiva.artifacts-management","archiva.docs"], function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryValidate,jqueryJson,ko) { /** @@ -239,15 +237,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa }); } }); - //var myrepplugins = "archiva/admin/repository/legacy/main|archiva/admin/repository/maven2/main"; - self.administrationMenuItems.push({ text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}}); - self.administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning()}}); - self.administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration()}}); - self.administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus()}}); - self.administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration()}}); - self.administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage()}}); - + this.usersMenuItems = ko.observableArray([ { text : $.i18n.prop('menu.users') , id: null}, { text : $.i18n.prop('menu.users.manage') , id: "menu-users-list-a" , href: "#users" , redback: "{permissions: ['archiva-manage-users']}", func: function(){displayUsersGrid();}}, From 796cec82cf500dd4f14a7451ea0d993b3ee18a7e Mon Sep 17 00:00:00 2001 From: skygo Date: Sat, 25 May 2013 15:43:04 +0000 Subject: [PATCH 07/11] Change require.2.1.6.js add some nbactions.xml to help skygo to launch tomcat7 remove ordered by name folder introduce order field in menu to allow sort onevery callback git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1486339 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-web/archiva-webapp/nbactions.xml | 13 ++++++ .../archiva-web/archiva-webapp/pom.xml | 1 + .../archiva-webapp/src/main/webapp/index.html | 2 +- .../{20generaladmin => generaladmin}/main.js | 12 +++--- .../main.js | 4 +- .../repository/{20legacy => legacy}/main.js | 3 +- .../repository/{10maven2 => maven2}/main.js | 9 ++-- .../proxy-connectors-rules.js | 4 +- .../{10maven2 => maven2}/proxy-connectors.js | 2 +- .../{10maven2 => maven2}/repositories.js | 2 +- .../{10maven2 => maven2}/repository-groups.js | 4 +- .../src/main/webapp/js/archiva/archiva.js | 28 ++----------- .../webapp/js/archiva/cookie-information.js | 41 +++++++++++++++++++ .../src/main/webapp/js/archiva/main.js | 12 +++++- .../src/main/webapp/js/require.2.1.6.js | 36 ++++++++++++++++ 15 files changed, 126 insertions(+), 47 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-webapp/nbactions.xml rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/{20generaladmin => generaladmin}/main.js (98%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/{10networkproxies => networkproxies}/main.js (97%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{20legacy => legacy}/main.js (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{10maven2 => maven2}/main.js (69%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{10maven2 => maven2}/proxy-connectors-rules.js (98%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{10maven2 => maven2}/proxy-connectors.js (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{10maven2 => maven2}/repositories.js (99%) rename archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/{10maven2 => maven2}/repository-groups.js (98%) create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/cookie-information.js create mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/require.2.1.6.js diff --git a/archiva-modules/archiva-web/archiva-webapp/nbactions.xml b/archiva-modules/archiva-web/archiva-webapp/nbactions.xml new file mode 100644 index 000000000..6f4d0393b --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/nbactions.xml @@ -0,0 +1,13 @@ + + + + CUSTOM-T + T + + tomcat7:run + -pl + :archiva-webapp + -am + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 4e201b764..7707630fe 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -869,6 +869,7 @@ apache-rat-plugin + nbactions.xml src/main/webapp/css/*.css src/main/webapp/js/*.js src/site/resources/css/*.css diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html index 4326e674a..c2411eb54 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/index.html @@ -34,7 +34,7 @@ - + Apache Archiva diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js similarity index 98% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js index 4aa130e61..6c7201411 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/20generaladmin/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/generaladmin/main.js @@ -16,16 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/features/20generaladmin/main",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid", +define("archiva/admin/features/generaladmin/main",["jquery","i18n","utils","jquery.tmpl","knockout","knockout.simpleGrid", "knockout.sortable","jquery.ui","jquery.validate","bootstrap","select2","knockout.select2"] , function(jquery,i18n,utils,jqueryTmpl,ko,simpleGrid,sortable,jqueryUi,validate,bootstrap,select2) { showMenu = function( administrationMenuItems) { - administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning();}}); - administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration();}}); - administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus();}}); - administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration();}}); - administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.repository-scanning') , order:2000, id: "menu-repository-scanning-list-a" , href: "#scanningList" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRepositoryScanning();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.runtime-configuration') , order:2010, id: "menu-runtime-configuration-list-a" , href: "#runtimeconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayRuntimeConfiguration();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.system-status') , order:2020, id: "menu-system-status-list-a" , href: "#status" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displaySystemStatus();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.ui-configuration') , order:2030, id: "menu-ui-configuration-list-a" , href: "#uiconfig" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayUiConfiguration();}}); + administrationMenuItems.push({ text : $.i18n.prop('menu.reports') , order:2040, id: "menu-report-list-a" , href: "#reports" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayReportsPage();}}); }; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/networkproxies/main.js similarity index 97% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/networkproxies/main.js index c2d7a0711..4925694f5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/10networkproxies/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/features/networkproxies/main.js @@ -16,12 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/features/10networkproxies/main",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" +define("archiva/admin/features/networkproxies/main",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" ,"knockout.simpleGrid"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { showMenu = function(administrationMenuItems) { administrationMenuItems.push( - { text : $.i18n.prop('menu.network-proxies') , id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}} + { text : $.i18n.prop('menu.network-proxies') ,order:1000, id: "menu-network-proxies-list-a" , href: "#networkproxies" , redback: "{permissions: ['archiva-manage-configuration']}", func: function(){displayNetworkProxies()}} ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js index 907cdf02e..bc6db19e1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/20legacy/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/legacy/main.js @@ -16,13 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/20legacy/main", ["jquery", 'i18n','knockout'], +define("archiva/admin/repository/legacy/main", ["jquery", 'i18n','knockout'], function(jquery,i18n,ko) { showMenu = function(administrationMenuItems) { administrationMenuItems.push( { text: $.i18n.prop('menu.legacy-artifact-support'), + order:600, id: "menu-legacy-support-list-a", href: "#legacy", redback: "{permissions: ['archiva-manage-configuration']}", diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js similarity index 69% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js index b669fa00f..301ecc1c8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/main.js @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/main",["jquery",'i18n',"archiva/admin/repository/10maven2/repository-groups","archiva/admin/repository/10maven2/proxy-connectors-rules","archiva/admin/repository/10maven2/proxy-connectors"], +define("archiva/admin/repository/maven2/main",["jquery",'i18n',"archiva/admin/repository/maven2/repository-groups","archiva/admin/repository/maven2/proxy-connectors-rules","archiva/admin/repository/maven2/proxy-connectors"], function() { showMenu = function(administrationMenuItems) { administrationMenuItems.push( {text: $.i18n.prop('menu.repository.groups'), + order:500, id: "menu-repository-groups-list-a", href: "#repositorygroup", redback: "{permissions: ['archiva-manage-configuration']}", @@ -28,13 +29,13 @@ define("archiva/admin/repository/10maven2/main",["jquery",'i18n',"archiva/admin/ displayRepositoryGroups(); } }); - administrationMenuItems.push({text: $.i18n.prop('menu.repositories'), id: "menu-repositories-list-a", href: "#repositorylist", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + administrationMenuItems.push({text: $.i18n.prop('menu.repositories'), order:510, id: "menu-repositories-list-a", href: "#repositorylist", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { displayRepositoriesGrid(); }}); - administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors'), id: "menu-proxy-connectors-list-a", href: "#proxyconnectors", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors'), order:520, id: "menu-proxy-connectors-list-a", href: "#proxyconnectors", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { displayProxyConnectors(); }}); - administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors-rules'), id: "menu.proxy-connectors-rules-list-a", href: "#proxyconnectorsrules", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { + administrationMenuItems.push({text: $.i18n.prop('menu.proxy-connectors-rules'), order:530, id: "menu.proxy-connectors-rules-list-a", href: "#proxyconnectorsrules", redback: "{permissions: ['archiva-manage-configuration']}", func: function() { displayProxyConnectorsRules(); }}); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors-rules.js similarity index 98% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors-rules.js index 99976117d..74b08eaea 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors-rules.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout" - ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/10maven2/proxy-connectors"], +define("archiva/admin/repository/maven2/proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstrap","jquery.ui","knockout" + ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/maven2/proxy-connectors"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryUi,ko) { ProxyConnectorRulesViewModel=function(proxyConnectorRules,proxyConnectors){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors.js index afdc7c146..7c498f3cf 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/proxy-connectors.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/proxy-connectors.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" +define("archiva/admin/repository/maven2/proxy-connectors",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout" ,"knockout.simpleGrid","knockout.sortable","select2"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js similarity index 99% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js index cfaad6ec2..eb590bf6b 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repositories.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repositories.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"], +define("archiva/admin/repository/maven2/repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","knockout","knockout.simpleGrid"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,ko) { // FIXME this must be dynamic if we do a plugin mechanism with dynamic repositories types diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js similarity index 98% rename from archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js rename to archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js index be7956de0..6af71b002 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/10maven2/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/admin/repository/maven2/repository-groups.js @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -define("archiva/admin/repository/10maven2/repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout" - ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/10maven2/repositories"], +define("archiva/admin/repository/maven2/repository-groups",["jquery","i18n","jquery.tmpl","bootstrap","jquery.validate","jquery.ui","knockout" + ,"knockout.simpleGrid","knockout.sortable","archiva/admin/repository/maven2/repositories"], function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { RepositoryGroup=function(id,repositories,mergedIndexPath){ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js index c2beda5e7..eda3184d2 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/archiva.js @@ -88,7 +88,7 @@ $.ajax({ "redback.user": "redback/user", "redback.users": "redback/users", "redback.templates": "redback/redback-tmpl", - // "archiva.general-admin":"archiva/general-admin", + "archiva.cookie-information":"archiva/cookie-information", "archiva.templates": "archiva/main-tmpl", // "archiva.repositories": "archiva/repositories", // "archiva.network-proxies": "archiva/network-proxies", @@ -103,32 +103,10 @@ $.ajax({ }); - CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){ - //private String path; - this.path=path; - - //private String domain; - this.domain=domain; - - //private String secure; - this.secure=secure; - - //private String timeout; - this.timeout=timeout; - - //private boolean rememberMeEnabled; - this.rememberMeEnabled=rememberMeEnabled; - } - - mapCookieInformation=function(data){ - if(!data){ - return new CookieInformation(); - } - return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled); - } + - requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main'/*,'archiva.general-admin'*/], function () { + requirejs(['jquery','jquery.tmpl','jquery.ui','i18n','sammy','startup','utils','domReady!','archiva.main','archiva.cookie-information'], function () { loadi18n(function () { $.ajax({ url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo/"+usedLang(), diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/cookie-information.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/cookie-information.js new file mode 100644 index 000000000..ae764ce28 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/cookie-information.js @@ -0,0 +1,41 @@ +/* + * Copyright 2013 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +define("archiva.cookie-information",function() { +CookieInformation=function(path,domain,secure,timeout,rememberMeEnabled){ + //private String path; + this.path=path; + + //private String domain; + this.domain=domain; + + //private String secure; + this.secure=secure; + + //private String timeout; + this.timeout=timeout; + + //private boolean rememberMeEnabled; + this.rememberMeEnabled=rememberMeEnabled; + } + + mapCookieInformation=function(data){ + if(!data){ + return new CookieInformation(); + } + return new CookieInformation(data.path,data.domain,data.secure,data.timeout,data.rememberMeEnabled); + } + +}); \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js index 0e088b01a..24676aca8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js @@ -222,20 +222,28 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa { text : $.i18n.prop('menu.artifacts.upload') , id: "menu-find-upload-a", href: "#upload" , redback: "{permissions: ['archiva-upload-repository']}", func: function(){displayUploadArtifact(true)}} ]); this.administrationMenuItems = ko.observableArray([ - {text: $.i18n.prop('menu.administration'), id: null} ]); + {text: $.i18n.prop('menu.administration'), id: null ,order : 1} ]); var pluginsURL = "restServices/archivaServices/pluginsService/getAdminPlugins"; $.ajax(pluginsURL, { type: "GET", dataType: 'text', + success: function(data) { - $.each(data.split("|"), function(key, value) { + $.each(data.split("|"), function(key, value) { require([value], function() { showMenu(self.administrationMenuItems); + // sort menu according to order field + // + self.administrationMenuItems.sort(function(left, right) { + return left.order == right.order ? 0 : (left.order < right.order ? -1 : 1) + }) }); }); + } + }); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/require.2.1.6.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/require.2.1.6.js new file mode 100644 index 000000000..b2dfc2550 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/require.2.1.6.js @@ -0,0 +1,36 @@ +/* + RequireJS 2.1.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + Available via the MIT or new BSD license. + see: http://github.com/jrburke/requirejs for details +*/ +var requirejs,require,define; +(function(ba){function J(b){return"[object Function]"===N.call(b)}function K(b){return"[object Array]"===N.call(b)}function z(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(J(n)){if(this.events.error&&this.map.isDefine||h.onError!==ca)try{e=k.execCb(c,n,b,e)}catch(d){a=d}else e=k.execCb(c,n,b,e);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!== +this.exports?e=b.exports:void 0===e&&this.usingExports&&(e=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else e=n;this.exports=e;if(this.map.isDefine&&!this.ignore&&(r[c]=e,h.onResourceLoad))h.onResourceLoad(k,this.map,this.depMaps);y(c);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete= +!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=l(a.prefix);this.depMaps.push(d);u(d,"defined",v(this,function(e){var n,d;d=this.map.name;var g=this.map.parentMap?this.map.parentMap.name:null,C=k.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(e.normalize&&(d=e.normalize(d,function(a){return c(a,g,!0)})||""),e=l(a.prefix+"!"+d,this.map.parentMap),u(e,"defined",v(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})), +d=m(q,e.id)){this.depMaps.push(e);if(this.events.error)d.on("error",v(this,function(a){this.emit("error",a)}));d.enable()}}else n=v(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),n.error=v(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];H(q,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),n.fromText=v(this,function(e,c){var d=a.name,g=l(d),i=Q;c&&(e=c);i&&(Q=!1);s(g);t(j.config,b)&&(j.config[d]=j.config[b]);try{h.exec(e)}catch(D){return w(B("fromtexteval", +"fromText eval for "+b+" failed: "+D,D,[b]))}i&&(Q=!0);this.depMaps.push(g);k.completeLoad(d);C([d],n)}),e.load(a.name,C,n,j)}));k.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;z(this.depMaps,v(this,function(a,b){var c,e;if("string"===typeof a){a=l(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=m(P,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;u(a,"defined",v(this,function(a){this.defineDep(b, +a);this.check()}));this.errback&&u(a,"error",v(this,this.errback))}c=a.id;e=q[c];!t(P,c)&&(e&&!e.enabled)&&k.enable(a,this)}));H(this.pluginMaps,v(this,function(a){var b=m(q,a.id);b&&!b.enabled&&k.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){z(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};k={config:j,contextName:b,registry:q,defined:r,urlFetched:V,defQueue:I,Module:$,makeModuleMap:l, +nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=j.pkgs,c=j.shim,e={paths:!0,config:!0,map:!0};H(a,function(a,b){e[b]?"map"===b?(j.map||(j.map={}),S(j[b],a,!0,!0)):S(j[b],a,!0):j[b]=a});a.shim&&(H(a.shim,function(a,b){K(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=k.makeShimExports(a);c[b]=a}),j.shim=c);a.packages&&(z(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name, +location:a.location||a.name,main:(a.main||"main").replace(ka,"").replace(fa,"")}}),j.pkgs=b);H(q,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=l(b))});if(a.deps||a.callback)k.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ba,arguments));return b||a.exports&&da(a.exports)}},makeRequire:function(a,f){function d(e,c,g){var i,j;f.enableBuildCallback&&(c&&J(c))&&(c.__requireJsBuild=!0);if("string"===typeof e){if(J(c))return w(B("requireargs", +"Invalid require call"),g);if(a&&t(P,e))return P[e](q[a.id]);if(h.get)return h.get(k,e,a,d);i=l(e,a,!1,!0);i=i.id;return!t(r,i)?w(B("notloaded",'Module name "'+i+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):r[i]}M();k.nextTick(function(){M();j=s(l(null,a));j.skipMap=f.skipMap;j.init(e,c,g,{enabled:!0});E()});return d}f=f||{};S(d,{isBrowser:A,toUrl:function(b){var d,f=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==f&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(Q=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,E?y.insertBefore(g,E):y.appendChild(g), +M=null,g;if(ea)try{importScripts(d),b.completeLoad(c)}catch(l){b.onError(B("importscripts","importScripts failed for "+c+" at "+d,l,[c]))}};A&&O(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return s=L,u.baseUrl||(F=s.split("/"),s=F.pop(),ga=F.length?F.join("/")+"/":"./",u.baseUrl=ga),s=s.replace(fa,""),h.jsExtRegExp.test(s)&&(s=L),u.deps=u.deps?u.deps.concat(s):[s],!0});define=function(b,c,d){var h,g;"string"!==typeof b&&(d=c,c=b,b=null); +K(c)||(d=c,c=null);!c&&J(d)&&(c=[],d.length&&(d.toString().replace(ma,"").replace(na,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(Q){if(!(h=M))R&&"interactive"===R.readyState||O(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return R=b}),h=R;h&&(b||(b=h.getAttribute("data-requiremodule")),g=G[h.getAttribute("data-requirecontext")])}(g?g.defQueue:U).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)}; +h(u)}})(this); From 60d0a2d36caf5373915fa028b4d7e49b224e68d2 Mon Sep 17 00:00:00 2001 From: skygo Date: Mon, 27 May 2013 22:04:25 +0000 Subject: [PATCH 08/11] rewrite try some tests git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1486718 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/services/DefaultPluginsServices.java | 28 +++++++++--- .../services/AbstractArchivaRestTest.java | 9 ++++ .../rest/services/PluginServiceTest.java | 45 +++++++++++++++++++ 3 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index 492066953..1896f4597 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -39,20 +39,23 @@ public class DefaultPluginsServices private List repositoryType = new ArrayList(); private List adminFeatures = new ArrayList(); + private ApplicationContext appCont; @Inject public DefaultPluginsServices( ApplicationContext applicationContext ) { - feed( repositoryType, "repository", applicationContext ); - feed( adminFeatures, "features", applicationContext ); + System.err.println( "appCont" ); + this.appCont = applicationContext; } - private void feed( List repository, String key, ApplicationContext applicationContext ) + private void feed( List repository, String key ) throws ArchivaRestServiceException { + System.err.println( "feeed" ); + repository.clear(); Resource[] xmlResources; try { - xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" ); + xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" ); for ( Resource rc : xmlResources ) { String tmp = rc.getURL().toString(); @@ -60,8 +63,10 @@ public class DefaultPluginsServices repository.add( "archiva/admin/" + key + "/" + tmp + "/main" ); } } - catch ( IOException ex ) + catch ( IOException e ) { + + throw new ArchivaRestServiceException( e.getMessage(), e ); } } @@ -70,6 +75,8 @@ public class DefaultPluginsServices throws ArchivaRestServiceException { // rebuild + feed( repositoryType, "repository" ); + feed( adminFeatures, "features" ); StringBuilder sb = new StringBuilder(); for ( String repoType : repositoryType ) { @@ -79,8 +86,15 @@ public class DefaultPluginsServices { sb.append( repoType ).append( "|" ); } - - return sb.substring( 0, sb.length() - 1 ); + System.err.println( "sb" + sb.toString() ); + if ( sb.length() > 1 ) + { + return sb.substring( 0, sb.length() - 1 ); + } + else + { + return sb.toString(); + } } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java index 1fb4fbd5a..6655bbfe8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java @@ -53,6 +53,7 @@ import javax.ws.rs.core.MediaType; import java.io.File; import java.util.Collections; import java.util.Date; +import org.apache.archiva.rest.api.services.PluginsService; /** * @author Olivier Lamy @@ -165,6 +166,14 @@ public abstract class AbstractArchivaRestTest { return getService( PingService.class, null ); } + + protected PluginsService getPluginsService() + { + PluginsService service = getService( PluginsService.class, null ); + WebClient.client( service ).accept( MediaType.TEXT_PLAIN ); + WebClient.client( service ).type( MediaType.TEXT_PLAIN ); + return service; + } protected RemoteRepositoriesService getRemoteRepositoriesService() { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java new file mode 100644 index 000000000..76dc89bbd --- /dev/null +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/PluginServiceTest.java @@ -0,0 +1,45 @@ +package org.apache.archiva.rest.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import static junit.framework.TestCase.assertEquals; +import org.apache.archiva.rest.api.services.PluginsService; +import org.junit.Test; + +/** + * @author Olivier Lamy + * @since 1.4-M1 + */ +public class PluginServiceTest + extends AbstractArchivaRestTest +{ + + @Test + public void testGetPluginAdmin() + throws Exception + { + // 1000000L + + PluginsService res = getPluginsService(); + String value = res.getAdminPlugins(); + assertEquals( "", value ); + } + + +} From ad2961ba667e1760f924191b751ec93d3fcc8aca Mon Sep 17 00:00:00 2001 From: skygo Date: Tue, 28 May 2013 16:47:45 +0000 Subject: [PATCH 09/11] use of logger instead serr git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1487002 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/rest/services/DefaultPluginsServices.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index 1896f4597..bfa6e752d 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -26,6 +26,8 @@ import org.springframework.stereotype.Service; import javax.inject.Inject; import org.apache.archiva.rest.api.services.PluginsService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.core.io.Resource; @@ -40,17 +42,17 @@ public class DefaultPluginsServices private List repositoryType = new ArrayList(); private List adminFeatures = new ArrayList(); private ApplicationContext appCont; + private Logger log = LoggerFactory.getLogger( getClass() ); @Inject public DefaultPluginsServices( ApplicationContext applicationContext ) { - System.err.println( "appCont" ); this.appCont = applicationContext; } private void feed( List repository, String key ) throws ArchivaRestServiceException { - System.err.println( "feeed" ); + log.info( "Feeding: {}", key ); repository.clear(); Resource[] xmlResources; try @@ -86,7 +88,7 @@ public class DefaultPluginsServices { sb.append( repoType ).append( "|" ); } - System.err.println( "sb" + sb.toString() ); + log.debug( "getAdminPlugins: {}", sb.toString() ); if ( sb.length() > 1 ) { return sb.substring( 0, sb.length() - 1 ); From 0c9c688ea99d35a1d474f535110d27a80dc6bbfb Mon Sep 17 00:00:00 2001 From: skygo Date: Sat, 1 Jun 2013 14:40:42 +0000 Subject: [PATCH 10/11] git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-MRM-1756@1488531 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-artifact-converter/pom.xml | 2 +- .../archiva-base/archiva-checksum/pom.xml | 2 +- .../archiva-base/archiva-common/pom.xml | 2 +- .../archiva-configuration/pom.xml | 2 +- .../src/main/mdo/configuration.mdo | 8 + .../archiva-consumer-api/pom.xml | 2 +- .../archiva-consumer-archetype/pom.xml | 2 +- .../archiva-core-consumers/pom.xml | 2 +- .../repository/TestMetadataRepository.java | 2 +- .../archiva-lucene-consumers/pom.xml | 2 +- .../archiva-metadata-consumer/pom.xml | 2 +- .../archiva-signature-consumers/pom.xml | 2 +- .../archiva-base/archiva-consumers/pom.xml | 2 +- .../archiva-base/archiva-converter/pom.xml | 2 +- .../archiva-base/archiva-indexer/pom.xml | 2 +- .../indexer/merger/DefaultIndexMerger.java | 17 +- .../archiva/indexer/merger/IndexMerger.java | 12 -- .../indexer/merger/IndexMergerRequest.java | 16 +- .../indexer/merger/TemporaryGroupIndex.java | 13 +- .../merger/TemporaryGroupIndexCleaner.java | 2 +- .../mock/MockRepositorySessionFactory.java | 2 +- .../archiva-maven2-metadata/pom.xml | 3 +- .../archiva-base/archiva-maven2-model/pom.xml | 3 +- .../archiva-base/archiva-model/pom.xml | 2 +- .../archiva-plexus-bridge/pom.xml | 2 +- .../archiva-base/archiva-policies/pom.xml | 2 +- .../archiva-base/archiva-proxy-api/pom.xml | 2 +- .../archiva-base/archiva-proxy-common/pom.xml | 2 +- .../archiva-base/archiva-proxy/pom.xml | 2 +- .../repository/TestMetadataRepository.java | 2 +- .../archiva-repository-admin-api/pom.xml | 2 +- .../admin/model/beans/RepositoryGroup.java | 26 ++- .../archiva-repository-admin-default/pom.xml | 2 +- .../group/DefaultRepositoryGroupAdmin.java | 10 +- .../mock/MockRepositorySessionFactory.java | 2 +- .../group/RepositoryGroupAdminTest.java | 87 ++++++++- .../archiva-repository-admin/pom.xml | 2 +- .../archiva-repository-layer/pom.xml | 2 +- .../archiva-repository-scanner/pom.xml | 2 +- .../archiva-security-common/pom.xml | 2 +- .../archiva-base/archiva-test-utils/pom.xml | 2 +- .../archiva-base/archiva-transaction/pom.xml | 2 +- .../archiva-base/archiva-xml-tools/pom.xml | 2 +- archiva-modules/archiva-base/pom.xml | 2 +- .../archiva-karaf/archiva-features/pom.xml | 2 +- archiva-modules/archiva-karaf/pom.xml | 2 +- .../archiva-scheduler-api/pom.xml | 2 +- .../archiva-scheduler-indexing/pom.xml | 2 +- .../mock/MockRepositorySessionFactory.java | 2 +- .../archiva-scheduler-repository-api/pom.xml | 2 +- .../archiva-scheduler-repository/pom.xml | 2 +- archiva-modules/archiva-scheduler/pom.xml | 2 +- .../archiva-rest/archiva-rest-api/pom.xml | 5 +- .../archiva-rest-services/pom.xml | 2 +- .../DefaultRepositoryGroupService.java | 11 +- .../services/RepositoryGroupServiceTest.java | 4 +- .../archiva-web/archiva-rest/pom.xml | 2 +- .../archiva-web/archiva-rss/pom.xml | 2 +- .../NewArtifactsRssFeedProcessorTest.java | 2 +- .../archiva-web/archiva-security/pom.xml | 2 +- .../archiva-web/archiva-test-mocks/pom.xml | 3 +- .../archiva-web/archiva-web-common/pom.xml | 2 +- .../apache/archiva/i18n/default.properties | 1 + .../memory/TestMetadataRepository.java | 2 +- .../archiva-web/archiva-webapp-test/pom.xml | 2 +- .../archiva-web/archiva-webapp/pom.xml | 3 +- .../src/main/webapp/css/jqueryFileTree.css | 180 +++++++++--------- .../js/templates/archiva/repositories.html | 7 + .../archiva-web/archiva-webdav/pom.xml | 2 +- .../webdav/ArchivaDavResourceFactory.java | 9 +- .../repository/TestMetadataRepository.java | 2 +- archiva-modules/archiva-web/pom.xml | 2 +- .../metadata/metadata-model-maven2/pom.xml | 5 +- .../metadata/metadata-model/pom.xml | 11 +- .../archiva/metadata/model/CiManagement.java | 6 +- .../archiva/metadata/model/Dependency.java | 4 +- .../metadata/model/IssueManagement.java | 6 +- .../archiva/metadata/model/License.java | 4 +- .../archiva/metadata/model/MailingList.java | 4 +- .../archiva/metadata/model/Organization.java | 6 +- .../metadata/model/ProjectMetadata.java | 10 + .../model/ProjectVersionMetadata.java | 3 + .../apache/archiva/metadata/model/Scm.java | 6 +- .../metadata/metadata-repository-api/pom.xml | 2 +- .../repository/MetadataRepository.java | 27 ++- .../AbstractMetadataRepositoryTest.java | 82 +++++--- archiva-modules/metadata/pom.xml | 2 +- .../metadata/test-repository/pom.xml | 2 +- archiva-modules/plugins/audit/pom.xml | 2 +- .../plugins/generic-metadata-support/pom.xml | 2 +- .../plugins/maven1-repository/pom.xml | 2 +- .../plugins/maven2-repository/pom.xml | 2 +- .../repository/TestMetadataRepository.java | 12 +- .../plugins/metadata-store-file/pom.xml | 2 +- .../file/FileMetadataRepository.java | 2 +- .../plugins/metadata-store-jcr/pom.xml | 2 +- .../repository/jcr/JcrMetadataRepository.java | 4 +- .../plugins/npanday-support/pom.xml | 2 +- archiva-modules/plugins/pom.xml | 2 +- .../plugins/problem-reports/pom.xml | 2 +- .../plugins/repository-statistics/pom.xml | 2 +- .../DefaultRepositoryStatisticsManager.java | 4 +- .../plugins/stage-repository-merge/pom.xml | 2 +- archiva-modules/pom.xml | 2 +- 104 files changed, 484 insertions(+), 266 deletions(-) mode change 100755 => 100644 archiva-modules/archiva-web/archiva-webapp/src/main/webapp/css/jqueryFileTree.css diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml index b1ce59a85..9268570f0 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-artifact-converter bundle diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index 2d481976a..a85ccb0a2 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-checksum bundle diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index b9d57c263..ddfb44350 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-common diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index 3068537d9..d253c77e4 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-configuration diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 43b383819..209e62b58 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -848,6 +848,14 @@ /.indexer The path of the merged index. + + mergedIndexTtl + 1.4.0+ + int + false + 30 + The time to live of the merged index of the repository group. + repositories 1.2.0+ diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index bdceddfa2..92f8d12d9 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-consumers - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-consumer-api bundle diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml index dd8cbd0e6..0e86f8263 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-consumers - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-consumer-archetype maven-archetype diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index 5f3c2f63f..03e675077 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-consumers - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-core-consumers bundle diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index 00cd4d241..1426cab8f 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -173,7 +173,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index c07595bf9..c66af5f2d 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-consumers - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-lucene-consumers bundle diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index 9b7d1bc02..6a2fab9f1 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -23,7 +23,7 @@ archiva-consumers org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-metadata-consumer bundle diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml index b11a0e0a6..97d2da298 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml @@ -20,7 +20,7 @@ org.apache.archiva archiva-consumers - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-signature-consumers diff --git a/archiva-modules/archiva-base/archiva-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/pom.xml index 2de964ed6..de25d15e6 100644 --- a/archiva-modules/archiva-base/archiva-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-consumers diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index 180955a9e..098a46f9f 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-converter diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index 4070eb73c..f5e34fe98 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-indexer diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index 77618be8b..4a53182f8 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -19,6 +19,7 @@ package org.apache.archiva.indexer.merger; */ import com.google.common.io.Files; + import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; @@ -35,7 +36,6 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import javax.inject.Inject; import java.io.File; import java.io.IOException; @@ -70,8 +70,6 @@ public class DefaultIndexMerger private List temporaryGroupIndexes = new CopyOnWriteArrayList(); - private int groupMergedIndexTtl; - @Inject public DefaultIndexMerger( PlexusSisuBridge plexusSisuBridge, MavenIndexerUtils mavenIndexerUtils ) throws PlexusSisuBridgeException @@ -81,12 +79,6 @@ public class DefaultIndexMerger indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); } - @PostConstruct - public void intialize() - { - this.groupMergedIndexTtl = Integer.getInteger( IndexMerger.TMP_GROUP_INDEX_SYS_KEY, DEFAULT_GROUP_INDEX_TTL ); - } - public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest ) throws IndexMergerException { @@ -122,7 +114,7 @@ public class DefaultIndexMerger indexPacker.packIndex( request ); } temporaryGroupIndexes.add( - new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId() ) ); + new TemporaryGroupIndex( tempRepoFile, tempRepoId, indexMergerRequest.getGroupId(), indexMergerRequest.getMergedIndexTtl() ) ); stopWatch.stop(); log.info( "merged index for repos {} in {} s", indexMergerRequest.getRepositoriesIds(), stopWatch.getTime() ); @@ -170,9 +162,4 @@ public class DefaultIndexMerger { return this.temporaryGroupIndexes; } - - public int getGroupMergedIndexTtl() - { - return this.groupMergedIndexTtl; - } } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java index 462c3e4a1..756819e4f 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMerger.java @@ -28,12 +28,6 @@ import java.util.Collection; */ public interface IndexMerger { - - /** - * system property which contains the value in s for ttl of temporary index groups - */ - String TMP_GROUP_INDEX_SYS_KEY = "archiva.tmp.group.index.ttl"; - /** * @param indexMergerRequest * @return a temporary directory with a merge index (directory marked deleteOnExit) @@ -45,10 +39,4 @@ public interface IndexMerger void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex ); Collection getTemporaryGroupIndexes(); - - /** - * @return ttl of temporay group index - */ - int getGroupMergedIndexTtl(); - } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java index 76d238fd2..a7a3b656f 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java @@ -42,6 +42,8 @@ public class IndexMergerRequest private String mergedIndexPath = "/.indexer"; + private int mergedIndexTtl; + public IndexMergerRequest( Collection repositoriesIds, boolean packIndex, String groupId ) { this.repositoriesIds = repositoriesIds; @@ -52,13 +54,14 @@ public class IndexMergerRequest /** * @since 1.4-M4 */ - public IndexMergerRequest( Collection repositoriesIds, boolean packIndex, String groupId, - String mergedIndexPath ) + public IndexMergerRequest(Collection repositoriesIds, boolean packIndex, String groupId, + String mergedIndexPath, int mergedIndexTtl) { this.repositoriesIds = repositoriesIds; this.packIndex = packIndex; this.groupId = groupId; this.mergedIndexPath = mergedIndexPath; + this.mergedIndexTtl = mergedIndexTtl; } public Collection getRepositoriesIds() @@ -101,6 +104,14 @@ public class IndexMergerRequest this.mergedIndexPath = mergedIndexPath; } + public int getMergedIndexTtl() { + return mergedIndexTtl; + } + + public void setMergedIndexTtl(int mergedIndexTtl) { + this.mergedIndexTtl = mergedIndexTtl; + } + @Override public String toString() { @@ -109,6 +120,7 @@ public class IndexMergerRequest sb.append( ", packIndex=" ).append( packIndex ); sb.append( ", groupId='" ).append( groupId ).append( '\'' ); sb.append( ", mergedIndexPath='" ).append( mergedIndexPath ).append( '\'' ); + sb.append( ", mergedIndexTtl='" ).append( mergedIndexTtl ).append( '\'' ); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java index 9152160b0..9ab06d647 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndex.java @@ -36,11 +36,14 @@ public class TemporaryGroupIndex private String groupId; - public TemporaryGroupIndex( File directory, String indexId, String groupId ) + private int mergedIndexTtl; + + public TemporaryGroupIndex(File directory, String indexId, String groupId, int mergedIndexTtl) { this.directory = directory; this.indexId = indexId; this.groupId = groupId; + this.mergedIndexTtl = mergedIndexTtl; } public long getCreationTime() @@ -86,6 +89,14 @@ public class TemporaryGroupIndex this.groupId = groupId; } + public int getMergedIndexTtl() { + return mergedIndexTtl; + } + + public void setMergedIndexTtl(int mergedIndexTtl) { + this.mergedIndexTtl = mergedIndexTtl; + } + @Override public int hashCode() { diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java index e34b24991..322d82e06 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/TemporaryGroupIndexCleaner.java @@ -58,7 +58,7 @@ public class TemporaryGroupIndexCleaner for ( TemporaryGroupIndex temporaryGroupIndex : indexMerger.getTemporaryGroupIndexes() ) { // cleanup files older than the ttl - if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > indexMerger.getGroupMergedIndexTtl() ) + if ( new Date().getTime() - temporaryGroupIndex.getCreationTime() > temporaryGroupIndex.getMergedIndexTtl() ) { log.info( "cleanTemporaryIndex for groupId {}", temporaryGroupIndex.getGroupId() ); indexMerger.cleanTemporaryGroupIndex( temporaryGroupIndex ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java index 66838594b..2acbcb57c 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml index 5584d802d..bc322bc03 100644 --- a/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-metadata/pom.xml @@ -22,11 +22,10 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-maven2-metadata - 1.4-M4-SNAPSHOT bundle Archiva Base :: Maven 2 Metadata diff --git a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml index 6c5e17662..f97271731 100644 --- a/archiva-modules/archiva-base/archiva-maven2-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-maven2-model/pom.xml @@ -22,11 +22,10 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-maven2-model - 1.4-M4-SNAPSHOT bundle Archiva Base :: Maven 2 Model diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index a13aec642..dad15c4b8 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-model diff --git a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml index 339c95c70..8acffe4cc 100644 --- a/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml +++ b/archiva-modules/archiva-base/archiva-plexus-bridge/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-plexus-bridge diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index 4716fb244..919b140ac 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-policies diff --git a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml index f729a3946..52ee68c2e 100644 --- a/archiva-modules/archiva-base/archiva-proxy-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-api/pom.xml @@ -22,7 +22,7 @@ archiva-base org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-proxy-api bundle diff --git a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml index cc3285a0e..62c957399 100644 --- a/archiva-modules/archiva-base/archiva-proxy-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy-common/pom.xml @@ -22,7 +22,7 @@ archiva-base org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-proxy-common bundle diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 2c0b46998..fd661ac1c 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-proxy diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index d7c52cea3..533951968 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -178,7 +178,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index 8ecfc6ffd..66a0b7fda 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-repository-admin - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-repository-admin-api bundle diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java index 371e7d488..047724dbe 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/beans/RepositoryGroup.java @@ -46,6 +46,11 @@ public class RepositoryGroup */ private String mergedIndexPath = "/.indexer"; + /** + * The TTL (time to live) of the repo group's merged index. + */ + private int mergedIndexTtl = 30; + public RepositoryGroup() { // no op @@ -132,12 +137,29 @@ public class RepositoryGroup this.mergedIndexPath = mergedIndexPath; } - public RepositoryGroup mergedIndexPath( String mergedIndexPath ) - { + public int getMergedIndexTtl() { + return mergedIndexTtl; + } + + /** + * Set the TTL of the repo group's merged index. + * + * @param mergedIndexTtl + */ + public void setMergedIndexTtl(int mergedIndexTtl) { + this.mergedIndexTtl = mergedIndexTtl; + } + + public RepositoryGroup mergedIndexPath( String mergedIndexPath ) { this.mergedIndexPath = mergedIndexPath; return this; } + public RepositoryGroup mergedIndexTtl( int mergedIndexTtl ) { + this.mergedIndexTtl = mergedIndexTtl; + return this; + } + public boolean equals( Object other ) { if ( this == other ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 168b02209..ee4b42c67 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-repository-admin - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-repository-admin-default bundle diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java index 047b8494b..ef43c1042 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java @@ -68,7 +68,7 @@ public class DefaultRepositoryGroupAdmin { repositoriesGroups.add( new RepositoryGroup( repositoryGroupConfiguration.getId(), new ArrayList( repositoryGroupConfiguration.getRepositories() ) ).mergedIndexPath( - repositoryGroupConfiguration.getMergedIndexPath() ) ); + repositoryGroupConfiguration.getMergedIndexPath() ).mergedIndexTtl( repositoryGroupConfiguration.getMergedIndexTtl() ) ); } return repositoriesGroups; @@ -93,10 +93,12 @@ public class DefaultRepositoryGroupAdmin { validateRepositoryGroup( repositoryGroup, false ); validateManagedRepositoriesExists( repositoryGroup.getRepositories() ); + RepositoryGroupConfiguration repositoryGroupConfiguration = new RepositoryGroupConfiguration(); repositoryGroupConfiguration.setId( repositoryGroup.getId() ); repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() ); repositoryGroupConfiguration.setMergedIndexPath( repositoryGroup.getMergedIndexPath() ); + repositoryGroupConfiguration.setMergedIndexTtl( repositoryGroup.getMergedIndexTtl() ); Configuration configuration = getArchivaConfiguration().getConfiguration(); configuration.addRepositoryGroup( repositoryGroupConfiguration ); saveConfiguration( configuration ); @@ -141,6 +143,7 @@ public class DefaultRepositoryGroupAdmin repositoryGroupConfiguration.setRepositories( repositoryGroup.getRepositories() ); repositoryGroupConfiguration.setMergedIndexPath( repositoryGroup.getMergedIndexPath() ); + repositoryGroupConfiguration.setMergedIndexTtl( repositoryGroup.getMergedIndexTtl() ); configuration.addRepositoryGroup( repositoryGroupConfiguration ); saveConfiguration( configuration ); @@ -282,6 +285,11 @@ public class DefaultRepositoryGroupAdmin "Invalid character(s) found in identifier. Only the following characters are allowed: alphanumeric, '.', '-' and '_'" ); } + if ( repositoryGroup.getMergedIndexTtl() <= 0) + { + throw new RepositoryAdminException( "Merged Index TTL must be greater than 0." ); + } + Configuration configuration = getArchivaConfiguration().getConfiguration(); if ( configuration.getRepositoryGroupsAsMap().containsKey( repoGroupId ) ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java index c594a9e75..7be9d6cb7 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java index 84135d4d8..a79d724d0 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/repository/group/RepositoryGroupAdminTest.java @@ -18,6 +18,7 @@ package org.apache.archiva.admin.repository.group; * under the License. */ +import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.beans.RepositoryGroup; import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; @@ -67,6 +68,10 @@ public class RepositoryGroupAdminTest assertEquals( Arrays.asList( "test-new-one", "test-new-two" ), repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + // verify if default values were saved + assertEquals(30, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals("/.indexer", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); + repositoryGroupAdmin.deleteRepositoryGroup( "repo-group-one", getFakeAuditInformation() ); assertEquals( 0, repositoryGroupAdmin.getRepositoriesGroups().size() ); @@ -100,7 +105,8 @@ public class RepositoryGroupAdminTest managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); - RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) ); + RepositoryGroup repositoryGroup = new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one" ) ) + .mergedIndexTtl( 20 ).mergedIndexPath( "/.nonDefaultPath" ); mockAuditListener.clearEvents(); @@ -111,6 +117,8 @@ public class RepositoryGroupAdminTest assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() ); assertEquals( Arrays.asList( "test-new-one" ), repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + assertEquals( 20, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals( "/.nonDefaultPath", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" ); assertNotNull( repositoryGroup ); @@ -143,9 +151,8 @@ public class RepositoryGroupAdminTest } } - @Test - public void addAndDeleteGroupWithRemowingManagedRepo() + public void addAndDeleteGroupWithRemovedManagedRepo() throws Exception { try @@ -199,4 +206,78 @@ public class RepositoryGroupAdminTest managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); } } + + @Test( expected = RepositoryAdminException.class ) + public void testAddGroupWithInvalidMergedIndexTtl() throws Exception { + try { + ManagedRepository managedRepositoryOne = + getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" ); + + ManagedRepository managedRepositoryTwo = + getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); + + RepositoryGroup repositoryGroup = + new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) ) + .mergedIndexTtl( -1 ); + + mockAuditListener.clearEvents(); + + repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + } + finally + { + mockAuditListener.clearEvents(); + managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true ); + managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); + } + } + + @Test( expected = RepositoryAdminException.class ) + public void testAddAndUpdateGroupWithInvalidMergedIndexTtl() throws Exception { + try { + ManagedRepository managedRepositoryOne = + getTestManagedRepository( "test-new-one", APPSERVER_BASE_PATH + File.separator + "test-new-one" ); + + ManagedRepository managedRepositoryTwo = + getTestManagedRepository( "test-new-two", APPSERVER_BASE_PATH + File.separator + "test-new-two" ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryOne, false, getFakeAuditInformation() ); + + managedRepositoryAdmin.addManagedRepository( managedRepositoryTwo, false, getFakeAuditInformation() ); + + RepositoryGroup repositoryGroup = + new RepositoryGroup( "repo-group-one", Arrays.asList( "test-new-one", "test-new-two" ) ); + + mockAuditListener.clearEvents(); + + repositoryGroupAdmin.addRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + + assertEquals( 1, repositoryGroupAdmin.getRepositoriesGroups().size() ); + assertEquals( "repo-group-one", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getId() ); + assertEquals( 2, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories().size() ); + assertEquals( Arrays.asList( "test-new-one", "test-new-two" ), + repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getRepositories() ); + + // verify if default values were saved + assertEquals(30, repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexTtl() ); + assertEquals("/.indexer", repositoryGroupAdmin.getRepositoriesGroups().get( 0 ).getMergedIndexPath() ); + + repositoryGroup = repositoryGroupAdmin.getRepositoryGroup( "repo-group-one" ); + assertNotNull( repositoryGroup ); + + repositoryGroup.mergedIndexTtl( -1 ); + + repositoryGroupAdmin.updateRepositoryGroup( repositoryGroup, getFakeAuditInformation() ); + } + finally + { + mockAuditListener.clearEvents(); + managedRepositoryAdmin.deleteManagedRepository( "test-new-one", getFakeAuditInformation(), true ); + managedRepositoryAdmin.deleteManagedRepository( "test-new-two", getFakeAuditInformation(), true ); + } + } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml index c92cae4e6..c531fd05b 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-repository-admin Archiva Base :: Repository Admin diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index 7571ad42c..46c6dc6c7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-repository-layer diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml index 48c45607c..a33e050ca 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml @@ -23,7 +23,7 @@ archiva-base org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-repository-scanner bundle diff --git a/archiva-modules/archiva-base/archiva-security-common/pom.xml b/archiva-modules/archiva-base/archiva-security-common/pom.xml index 5381565c3..b5428aaf1 100644 --- a/archiva-modules/archiva-base/archiva-security-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-security-common/pom.xml @@ -22,7 +22,7 @@ archiva-base org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT org.apache.archiva archiva-security-common diff --git a/archiva-modules/archiva-base/archiva-test-utils/pom.xml b/archiva-modules/archiva-base/archiva-test-utils/pom.xml index 5f8b149b2..78f221ee4 100644 --- a/archiva-modules/archiva-base/archiva-test-utils/pom.xml +++ b/archiva-modules/archiva-base/archiva-test-utils/pom.xml @@ -22,7 +22,7 @@ archiva-base org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-test-utils diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index 832b7610b..6b40cb60d 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-transaction bundle diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index 1b726e4e6..67ffd959c 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-base - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-xml-tools diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index 10b001b7c..a9ce3f587 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-modules - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-base diff --git a/archiva-modules/archiva-karaf/archiva-features/pom.xml b/archiva-modules/archiva-karaf/archiva-features/pom.xml index e27bbe350..f3b0b1155 100644 --- a/archiva-modules/archiva-karaf/archiva-features/pom.xml +++ b/archiva-modules/archiva-karaf/archiva-features/pom.xml @@ -21,7 +21,7 @@ org.apache.archiva archiva-karaf - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 org.apache.archiva.karaf diff --git a/archiva-modules/archiva-karaf/pom.xml b/archiva-modules/archiva-karaf/pom.xml index 754ad00a9..81bcd589f 100644 --- a/archiva-modules/archiva-karaf/pom.xml +++ b/archiva-modules/archiva-karaf/pom.xml @@ -21,7 +21,7 @@ org.apache.archiva archiva-modules - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-karaf diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml index 2208c0920..13befbf6e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-api/pom.xml @@ -22,7 +22,7 @@ archiva-scheduler org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-scheduler-api bundle diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml index 986217a75..4cbdfb7a4 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/pom.xml @@ -22,7 +22,7 @@ archiva-scheduler org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-scheduler-indexing bundle diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java index a42b6aeda..85c01299a 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java @@ -256,7 +256,7 @@ public class MockRepositorySessionFactory return false; //To change body of implemented methods use File | Settings | File Templates. } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml index 989c4d180..eee6c4170 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository-api/pom.xml @@ -22,7 +22,7 @@ archiva-scheduler org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-scheduler-repository-api bundle diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml index 4ddd92dd0..e93e553a0 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml @@ -22,7 +22,7 @@ archiva-scheduler org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-scheduler-repository bundle diff --git a/archiva-modules/archiva-scheduler/pom.xml b/archiva-modules/archiva-scheduler/pom.xml index df0fe7289..95ea815dd 100644 --- a/archiva-modules/archiva-scheduler/pom.xml +++ b/archiva-modules/archiva-scheduler/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-modules - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-scheduler diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml index effc430c0..84091a80c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml @@ -17,13 +17,12 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + 4.0.0 archiva-rest org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-rest-api diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index a89d66cbe..9c47799b2 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-rest - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-rest-services bundle diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java index 4b1882bb4..1b5759101 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java @@ -52,7 +52,8 @@ public class DefaultRepositoryGroupService for ( org.apache.archiva.admin.model.beans.RepositoryGroup repoGroup : repositoryGroupAdmin.getRepositoriesGroups() ) { repositoriesGroups.add( new RepositoryGroup( repoGroup.getId(), new ArrayList( - repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ) ); + repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ) + .mergedIndexTtl( repoGroup.getMergedIndexTtl() ) ); } return repositoriesGroups; } @@ -82,8 +83,8 @@ public class DefaultRepositoryGroupService { return repositoryGroupAdmin.addRepositoryGroup( new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList( - repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ), - getAuditInformation() ); + repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ) + .mergedIndexTtl( repoGroup.getMergedIndexTtl() ), getAuditInformation() ); } catch ( RepositoryAdminException e ) { @@ -98,8 +99,8 @@ public class DefaultRepositoryGroupService { return repositoryGroupAdmin.updateRepositoryGroup( new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList( - repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ), - getAuditInformation() ); + repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ) + .mergedIndexTtl( repoGroup.getMergedIndexTtl() ), getAuditInformation() ); } catch ( RepositoryAdminException e ) { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java index c872d8268..017505859 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java @@ -51,11 +51,13 @@ public class RepositoryGroupServiceTest managedRepositoriesService.addManagedRepository( managedRepository ); - RepositoryGroup repositoryGroup = new RepositoryGroup( "one", Arrays.asList( managedRepository.getId() ) ); + RepositoryGroup repositoryGroup = new RepositoryGroup( "one", Arrays.asList( managedRepository.getId() ) ) + .mergedIndexTtl( 40 ); service.addRepositoryGroup( repositoryGroup ); assertFalse( service.getRepositoriesGroups().isEmpty() ); assertEquals( 1, service.getRepositoriesGroups().size() ); + assertEquals( 40, service.getRepositoriesGroups().get(0).getMergedIndexTtl() ); service.deleteRepositoryGroup( "one" ); diff --git a/archiva-modules/archiva-web/archiva-rest/pom.xml b/archiva-modules/archiva-web/archiva-rest/pom.xml index 42a2ad366..d442f3c97 100644 --- a/archiva-modules/archiva-web/archiva-rest/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-rest Archiva Web :: REST support diff --git a/archiva-modules/archiva-web/archiva-rss/pom.xml b/archiva-modules/archiva-web/archiva-rss/pom.xml index c5381d524..cb020f532 100644 --- a/archiva-modules/archiva-web/archiva-rss/pom.xml +++ b/archiva-modules/archiva-web/archiva-rss/pom.xml @@ -22,7 +22,7 @@ archiva-web org.apache.archiva - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-rss diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java index b6f25bec5..a83f38301 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java @@ -250,7 +250,7 @@ public class NewArtifactsRssFeedProcessorTest return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { throw new UnsupportedOperationException(); } diff --git a/archiva-modules/archiva-web/archiva-security/pom.xml b/archiva-modules/archiva-web/archiva-security/pom.xml index 7e7ecfe1e..ccb2f31d2 100644 --- a/archiva-modules/archiva-web/archiva-security/pom.xml +++ b/archiva-modules/archiva-web/archiva-security/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT 4.0.0 archiva-security diff --git a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml index 47efd89f9..41e92218c 100644 --- a/archiva-modules/archiva-web/archiva-test-mocks/pom.xml +++ b/archiva-modules/archiva-web/archiva-test-mocks/pom.xml @@ -22,11 +22,10 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-test-mocks - 1.4-M4-SNAPSHOT Archiva Web :: Tests Mocks diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml index 5ef279dd2..aff3b8f71 100644 --- a/archiva-modules/archiva-web/archiva-web-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-web-common diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties index c528c028b..c2f9f35b7 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties @@ -312,6 +312,7 @@ repository.groups.list=Repository Groups repository-groups.grid.tab.title=Repository Groups repository.group.delete.confirm=Are you sure to delete Repository Group {0} ? repository.group.mergedIndexPath=Merged Index Path +repository.group.mergedIndexTtl=Merged Index Time to Live (in Minutes) #roles roles.bulk.save.confirm=Are you sure to update {0} Role(s) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java index 02d428515..8f9fc13bd 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java @@ -220,7 +220,7 @@ public class TestMetadataRepository return false; } - public Object obtainAccess( Class aClass ) + public T obtainAccess( Class aClass ) { return null; } diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index a4a54e996..4e6192d4a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -23,7 +23,7 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-webapp-test pom diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index 7707630fe..614ad32a1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -22,7 +22,7 @@ org.apache.archiva archiva-web - 1.4-M4-SNAPSHOT + 1.4-M5-SNAPSHOT archiva-webapp war @@ -1014,7 +1014,6 @@ ${archiva.devMode} ${archiva.javascriptLog} ${archiva.logMissingI18n} - ${archiva.groupIndexTtl}