--- /dev/null
+package org.apache.archiva.rest.api.model;
+
+/*
+ * 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 javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * AdminRepositoryConsumer
+ *
+ * @version $Id$
+ */
+@XmlRootElement( name = "adminRepositoryConsumer" )
+public class AdminRepositoryConsumer
+{
+ private boolean enabled = false;
+
+ private String id;
+
+ private String description;
+
+ public AdminRepositoryConsumer()
+ {
+ // no op
+ }
+
+ public AdminRepositoryConsumer( boolean enabled, String id, String description )
+ {
+ this.enabled = enabled;
+ this.id = id;
+ this.description = description;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ public void setEnabled( boolean enabled )
+ {
+ this.enabled = enabled;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+}
}
+ //---------------------------
+ // repository scanning part
+ //---------------------------
+
+ FileType=function(id,patterns){
+ //private String id;
+ this.id=ko.observable(id);
+
+ //private List<String> patterns;
+ this.patterns=ko.observableArray(patterns);
+
+ }
+
+ mapFileType=function(data){
+ return new FileType(data.id,data.patterns);
+ }
+
+ mapFileTypes=function(data){
+ if (data!=null){
+ return $.isArray(data)? $.map(data,function(item){
+ return mapFileType(item)
+ }):[mapFileType(data)];
+ }
+ return [];
+ }
+
+ displayRepositoryScanning=function(){
+
+ $.ajax("restServices/archivaServices/archivaAdministrationService/getFileTypes", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data){
+ var fileTypes=mapFileTypes(data);
+ }
+ });
+
+ }
+
+
});
\ No newline at end of file
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-legacy-support-list-a" onclick="displayLegacyArtifactPathSupport()">${$.i18n.prop('menu.legacy-artifact-support')}</a>
</li>
+ <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
+ <a href="#" id="menu-repository-scanning-list-a" onclick="displayRepositoryScanning()">${$.i18n.prop('menu.repository-scanning')}</a>
+ </li>
</ul>
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-users']}">
* under the License.
*/
+import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.commons.collections.Closure;
import org.apache.archiva.consumers.RepositoryContentConsumer;
+++ /dev/null
-package org.apache.archiva.web.action.admin.scanning;
-
-/*
- * 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.
- */
-
-/**
- * AdminRepositoryConsumer
- *
- * @version $Id$
- */
-public class AdminRepositoryConsumer
-{
- private boolean enabled = false;
- private String id;
- private String description;
-
- public String getDescription()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isEnabled()
- {
- return enabled;
- }
-
- public void setDescription( String description )
- {
- this.description = description;
- }
-
- public void setEnabled( boolean enabled )
- {
- this.enabled = enabled;
- }
-
- public void setId( String id )
- {
- this.id = id;
- }
-}
* under the License.
*/
+import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
+
import java.util.Comparator;
/**
import org.apache.archiva.admin.repository.admin.FiletypeToMapClosure;
import org.apache.archiva.audit.Auditable;
import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
+import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
private List<String> fileTypeIds;
/**
- * List of {@link AdminRepositoryConsumer} objects for consumers of known content.
+ * List of {@link org.apache.archiva.rest.api.model.AdminRepositoryConsumer} objects for consumers of known content.
*/
private List<AdminRepositoryConsumer> knownContentConsumers;
log.info( "[ActionMessage] {}", aMessage );
}
+ public void prepare()
+ throws Exception
+ {
+ FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure();
+
+ CollectionUtils.forAllDo( archivaAdministration.getFileTypes(), filetypeToMapClosure );
+ fileTypeMap = filetypeToMapClosure.getMap();
+
+ AddAdminRepoConsumerClosure addAdminRepoConsumer =
+ new AddAdminRepoConsumerClosure( archivaAdministration.getKnownContentConsumers() );
+ CollectionUtils.forAllDo( repoconsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer );
+ this.knownContentConsumers = addAdminRepoConsumer.getList();
+ Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
+
+ addAdminRepoConsumer = new AddAdminRepoConsumerClosure( archivaAdministration.getInvalidContentConsumers() );
+ CollectionUtils.forAllDo( repoconsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer );
+ this.invalidContentConsumers = addAdminRepoConsumer.getList();
+ Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
+
+ fileTypeIds = new ArrayList<String>();
+ fileTypeIds.addAll( fileTypeMap.keySet() );
+ Collections.sort( fileTypeIds );
+ }
+
public String addFiletypePattern()
{
log.info( "Add New File Type Pattern [{}:{}]", getFileTypeId(), getPattern() );
return bundle;
}
- public void prepare()
- throws Exception
- {
-
-
- FiletypeToMapClosure filetypeToMapClosure = new FiletypeToMapClosure();
-
- CollectionUtils.forAllDo( archivaAdministration.getFileTypes(), filetypeToMapClosure );
- fileTypeMap = filetypeToMapClosure.getMap();
-
- AddAdminRepoConsumerClosure addAdminRepoConsumer =
- new AddAdminRepoConsumerClosure( archivaAdministration.getKnownContentConsumers() );
- CollectionUtils.forAllDo( repoconsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer );
- this.knownContentConsumers = addAdminRepoConsumer.getList();
- Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
-
- addAdminRepoConsumer = new AddAdminRepoConsumerClosure( archivaAdministration.getInvalidContentConsumers() );
- CollectionUtils.forAllDo( repoconsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer );
- this.invalidContentConsumers = addAdminRepoConsumer.getList();
- Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
-
- fileTypeIds = new ArrayList<String>();
- fileTypeIds.addAll( fileTypeMap.keySet() );
- Collections.sort( fileTypeIds );
- }
-
public void setFileTypeId( String fileTypeId )
{
this.fileTypeId = fileTypeId;