Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
NEXUS-5639: URL change of the resources
Browse files Browse the repository at this point in the history
Client is handled too
  • Loading branch information
cstamas committed Mar 28, 2013
1 parent 2dbec3c commit c2249e0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
Expand Up @@ -59,7 +59,7 @@ public Status getStatus( final String mavenRepositoryId )
try try
{ {
final RoutingStatusMessage message = final RoutingStatusMessage message =
getNexusClient().serviceResource( wlPath( mavenRepositoryId ) ).get( RoutingStatusMessageWrapper.class ).getData(); getNexusClient().serviceResource( routingPath( mavenRepositoryId ) ).get( RoutingStatusMessageWrapper.class ).getData();


final DiscoveryStatus discoveryStatus; final DiscoveryStatus discoveryStatus;
if ( message.getDiscovery() == null ) if ( message.getDiscovery() == null )
Expand Down Expand Up @@ -98,7 +98,7 @@ public void updatePrefixFile( final String mavenProxyRepositoryId )
{ {
try try
{ {
getNexusClient().serviceResource( wlPath( mavenProxyRepositoryId ) ).delete(); getNexusClient().serviceResource( routingPath( mavenProxyRepositoryId ) ).delete();
} }
catch ( UniformInterfaceException e ) catch ( UniformInterfaceException e )
{ {
Expand All @@ -117,7 +117,7 @@ public DiscoveryConfiguration getDiscoveryConfigurationFor( final String mavenPr
try try
{ {
final RoutingConfigMessage message = final RoutingConfigMessage message =
getNexusClient().serviceResource( wlConfigPath( mavenProxyRepositoryId ) ).get( getNexusClient().serviceResource( routingConfigPath( mavenProxyRepositoryId ) ).get(
RoutingConfigMessageWrapper.class ).getData(); RoutingConfigMessageWrapper.class ).getData();
return new DiscoveryConfiguration( message.isDiscoveryEnabled(), message.getDiscoveryIntervalHours() ); return new DiscoveryConfiguration( message.isDiscoveryEnabled(), message.getDiscoveryIntervalHours() );
} }
Expand All @@ -143,7 +143,7 @@ public void setDiscoveryConfigurationFor( final String mavenProxyRepositoryId,
message.setDiscoveryIntervalHours( configuration.getIntervalHours() ); message.setDiscoveryIntervalHours( configuration.getIntervalHours() );
final RoutingConfigMessageWrapper wrapper = new RoutingConfigMessageWrapper(); final RoutingConfigMessageWrapper wrapper = new RoutingConfigMessageWrapper();
wrapper.setData( message ); wrapper.setData( message );
getNexusClient().serviceResource( wlConfigPath( mavenProxyRepositoryId ) ).put( wrapper ); getNexusClient().serviceResource( routingConfigPath( mavenProxyRepositoryId ) ).put( wrapper );
} }
catch ( UniformInterfaceException e ) catch ( UniformInterfaceException e )
{ {
Expand All @@ -157,20 +157,20 @@ public void setDiscoveryConfigurationFor( final String mavenProxyRepositoryId,


// == // ==


static String wlPath( final String mavenRepositoryId ) static String routingPath( final String mavenRepositoryId )
{ {
try try
{ {
return "repositories/" + URLEncoder.encode( mavenRepositoryId, "UTF-8" ) + "/wl"; return "repositories/" + URLEncoder.encode( mavenRepositoryId, "UTF-8" ) + "/routing";
} }
catch ( UnsupportedEncodingException e ) catch ( UnsupportedEncodingException e )
{ {
throw Throwables.propagate( e ); throw Throwables.propagate( e );
} }
} }


static String wlConfigPath( final String mavenRepositoryId ) static String routingConfigPath( final String mavenRepositoryId )
{ {
return wlPath( mavenRepositoryId ) + "/config"; return routingPath( mavenRepositoryId ) + "/config";
} }
} }
Expand Up @@ -11,7 +11,7 @@
* Eclipse Foundation. All other trademarks are the property of their respective owners. * Eclipse Foundation. All other trademarks are the property of their respective owners.
*/ */
/*global define, Ext, Nexus, Sonatype, NX*/ /*global define, Ext, Nexus, Sonatype, NX*/
NX.define('Sonatype.repoServer.RepositoryWLPanel', { NX.define('Sonatype.repoServer.RepositoryRoutingPanel', {
extend : 'Nexus.ext.FormPanel', extend : 'Nexus.ext.FormPanel',


requirejs : ['Nexus/config'], requirejs : ['Nexus/config'],
Expand Down Expand Up @@ -67,7 +67,7 @@ NX.define('Sonatype.repoServer.RepositoryWLPanel', {
} }


// should be static, but Sonatype.config is not defined yet when statics are defined (before requirejs dep resolution) // should be static, but Sonatype.config is not defined yet when statics are defined (before requirejs dep resolution)
this.resourceUrl = new Ext.Template(Sonatype.config.repos.urls.repositories + "/{0}/wl").compile(); this.resourceUrl = new Ext.Template(Sonatype.config.repos.urls.repositories + "/{0}/routing").compile();


var var
self = this, self = this,
Expand Down Expand Up @@ -97,13 +97,13 @@ NX.define('Sonatype.repoServer.RepositoryWLPanel', {
load : { load : {
'publishedStatus' : function(value) { 'publishedStatus' : function(value) {
self.publishedStatus = value; self.publishedStatus = value;
var store = Sonatype.repoServer.RepositoryWLPanel.publishStatusStore; var store = Sonatype.repoServer.RepositoryRoutingPanel.publishStatusStore;
return store.getAt(store.find('value', value)).get('text'); return store.getAt(store.find('value', value)).get('text');
}, },


'discovery.discoveryLastStatus' : function(value) { 'discovery.discoveryLastStatus' : function(value) {
self.discoveryStatus = value; self.discoveryStatus = value;
var store = Sonatype.repoServer.RepositoryWLPanel.discoveryStatusStore; var store = Sonatype.repoServer.RepositoryRoutingPanel.discoveryStatusStore;
return store.getAt(store.find('value', value)).get('text'); return store.getAt(store.find('value', value)).get('text');
}, },


Expand Down Expand Up @@ -217,7 +217,7 @@ NX.define('Sonatype.repoServer.RepositoryWLPanel', {
xtype : 'combo', xtype : 'combo',
fieldLabel : 'Update interval', fieldLabel : 'Update interval',
name : 'discovery.discoveryIntervalHours', name : 'discovery.discoveryIntervalHours',
store : Sonatype.repoServer.RepositoryWLPanel.discoveryUpdateIntervalStore, store : Sonatype.repoServer.RepositoryRoutingPanel.discoveryUpdateIntervalStore,
displayField : 'intervalLabel', displayField : 'intervalLabel',
valueField : 'valueHrs', valueField : 'valueHrs',
emptyText : 'Select...', emptyText : 'Select...',
Expand Down Expand Up @@ -248,7 +248,7 @@ NX.define('Sonatype.repoServer.RepositoryWLPanel', {
} }
]; ];


Sonatype.repoServer.RepositoryWLPanel.superclass.constructor.apply(self, arguments); Sonatype.repoServer.RepositoryRoutingPanel.superclass.constructor.apply(self, arguments);


self.on('actioncomplete', self.onActionComplete); self.on('actioncomplete', self.onActionComplete);
}, },
Expand Down Expand Up @@ -399,7 +399,7 @@ NX.define('Sonatype.repoServer.RepositoryWLPanel', {


if (!newRecord && maven2FormatRepo && notShadowType && if (!newRecord && maven2FormatRepo && notShadowType &&
( sp.checkPermission('nexus:repositories', sp.CREATE) || sp.checkPermission('nexus:repositories', sp.DELETE) || sp.checkPermission('nexus:repositories', sp.EDIT) )) { ( sp.checkPermission('nexus:repositories', sp.CREATE) || sp.checkPermission('nexus:repositories', sp.DELETE) || sp.checkPermission('nexus:repositories', sp.EDIT) )) {
cardPanel.add(new Sonatype.repoServer.RepositoryWLPanel({ cardPanel.add(new Sonatype.repoServer.RepositoryRoutingPanel({
tabTitle : 'Routing', tabTitle : 'Routing',
name : 'routing', name : 'routing',
payload : rec payload : rec
Expand Down
2 changes: 1 addition & 1 deletion nexus-webapp/src/main/webapp/js/repoServer.js
Expand Up @@ -31,7 +31,7 @@ define('repoServer',
'repoServer/SchedulesEditPanel', 'repoServer/SchedulesEditPanel',
'repoServer/UserBrowserPanel', 'repoServer/UserBrowserPanel',
'repoServer/UserPrivilegeBrowserPanel', 'repoServer/UserPrivilegeBrowserPanel',
'Sonatype/repoServer/RepositoryWLPanel', 'Sonatype/repoServer/RepositoryRoutingPanel',
'Sonatype/repoServer/ServerEditPanel', 'Sonatype/repoServer/ServerEditPanel',
'Sonatype/repoServer/ConfigViewPanel', 'Sonatype/repoServer/ConfigViewPanel',
'Sonatype/repoServer/DefaultUserEditor', 'Sonatype/repoServer/DefaultUserEditor',
Expand Down
Expand Up @@ -53,7 +53,7 @@ public class RoutingConfigResource
/** /**
* REST resource URI. * REST resource URI.
*/ */
public static final String RESOURCE_URI = "/repositories/{" + REPOSITORY_ID_KEY + "}/wl/config"; public static final String RESOURCE_URI = "/repositories/{" + REPOSITORY_ID_KEY + "}/routing/config";


@Override @Override
public Object getPayloadInstance() public Object getPayloadInstance()
Expand All @@ -70,7 +70,7 @@ public String getResourceUri()
@Override @Override
public PathProtectionDescriptor getResourceProtection() public PathProtectionDescriptor getResourceProtection()
{ {
return new PathProtectionDescriptor( "/repositories/*/wl/config", "authcBasic,perms[nexus:repositories]" ); return new PathProtectionDescriptor( "/repositories/*/routing/config", "authcBasic,perms[nexus:repositories]" );
} }


/** /**
Expand Down
Expand Up @@ -63,7 +63,7 @@ public class RoutingStatusResource
/** /**
* REST resource URI. * REST resource URI.
*/ */
public static final String RESOURCE_URI = "/repositories/{" + REPOSITORY_ID_KEY + "}/wl"; public static final String RESOURCE_URI = "/repositories/{" + REPOSITORY_ID_KEY + "}/routing";


@Requirement( hint = "RestletRepositoryUrlBuilder" ) @Requirement( hint = "RestletRepositoryUrlBuilder" )
private RepositoryURLBuilder repositoryURLBuilder; private RepositoryURLBuilder repositoryURLBuilder;
Expand All @@ -83,7 +83,7 @@ public String getResourceUri()
@Override @Override
public PathProtectionDescriptor getResourceProtection() public PathProtectionDescriptor getResourceProtection()
{ {
return new PathProtectionDescriptor( "/repositories/*/wl", "authcBasic,perms[nexus:repositories]" ); return new PathProtectionDescriptor( "/repositories/*/routing", "authcBasic,perms[nexus:repositories]" );
} }


@Override @Override
Expand Down

0 comments on commit c2249e0

Please sign in to comment.