From: Olivier Lamy Date: Fri, 27 Jan 2012 11:19:51 +0000 (+0000) Subject: move this rest services used only by the js ui in a new rest ui service X-Git-Tag: archiva-1.4-M3~1454 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7b50ea96e2a4f963e922abc2b662053dda1e741e;p=archiva.git move this rest services used only by the js ui in a new rest ui service git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236634 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArchivaRuntimeInfo.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArchivaRuntimeInfo.java deleted file mode 100644 index f27bfe1bc..000000000 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArchivaRuntimeInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -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; - -/** - * @author Olivier Lamy - * @since 1.4-M3 - */ -@XmlRootElement( name = "archivaRuntimeInfo" ) -public class ArchivaRuntimeInfo -{ - private boolean devMode = false; - - private boolean javascriptLog = false; - - public ArchivaRuntimeInfo() - { - this.devMode = Boolean.getBoolean( "archiva.devMode" ); - - this.javascriptLog = Boolean.getBoolean( "archiva.javascriptLog" ); - } - - public boolean isDevMode() - { - return devMode; - } - - public void setDevMode( boolean devMode ) - { - this.devMode = devMode; - } - - public boolean isJavascriptLog() - { - return javascriptLog; - } - - public void setJavascriptLog( boolean javascriptLog ) - { - this.javascriptLog = javascriptLog; - } - - @Override - public String toString() - { - final StringBuilder sb = new StringBuilder(); - sb.append( "ArchivaRuntimeInfo" ); - sb.append( "{devMode=" ).append( devMode ); - sb.append( ", javascriptLog=" ).append( javascriptLog ); - sb.append( '}' ); - return sb.toString(); - } -} diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java index 675a31ef8..1c2ed2bf0 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java @@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.services; * under the License. */ -import org.apache.archiva.rest.api.model.ArchivaRuntimeInfo; import org.codehaus.plexus.redback.authorization.RedbackAuthorization; import javax.ws.rs.GET; @@ -61,12 +60,6 @@ public interface CommonServices String getAllI18nResources( @QueryParam( "locale" ) String locale ) throws ArchivaRestServiceException; - @Path( "archivaRuntimeInfo" ) - @GET - @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) - @RedbackAuthorization( noRestriction = true ) - ArchivaRuntimeInfo archivaRuntimeInfo(); - @Path( "validateCronExpression" ) @GET diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java index ba010aaf1..4a7940e0c 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java @@ -18,7 +18,6 @@ package org.apache.archiva.rest.services; * under the License. */ -import org.apache.archiva.rest.api.model.ArchivaRuntimeInfo; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.CommonServices; import org.apache.commons.io.IOUtils; @@ -31,7 +30,6 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import javax.inject.Inject; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -175,10 +173,6 @@ public class DefaultCommonServices } } - public ArchivaRuntimeInfo archivaRuntimeInfo() - { - return new ArchivaRuntimeInfo(); - } public Boolean validateCronExpression( String cronExpression ) throws ArchivaRestServiceException diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java new file mode 100644 index 000000000..c4562fb74 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java @@ -0,0 +1,36 @@ +package org.apache.archiva.webapp.ui.services.api; +/* + * 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.webapp.ui.services.model.ApplicationRuntimeInfo; +import org.springframework.stereotype.Service; + +/** + * @author Olivier Lamy + */ +@Service( "runtimeInfoService#rest" ) +public class DefaultRuntimeInfoService + implements RuntimeInfoService +{ + public ApplicationRuntimeInfo archivaRuntimeInfo() + { + ApplicationRuntimeInfo archivaRuntimeInfo = new ApplicationRuntimeInfo(); + return archivaRuntimeInfo; + } +} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java new file mode 100644 index 000000000..43e82dd59 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java @@ -0,0 +1,41 @@ +package org.apache.archiva.webapp.ui.services.api; +/* + * 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.webapp.ui.services.model.ApplicationRuntimeInfo; +import org.codehaus.plexus.redback.authorization.RedbackAuthorization; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +/** + * @author Olivier Lamy + * @since 1.4-M3 + */ +@Path( "/runtimeInfoService/" ) +public interface RuntimeInfoService +{ + @Path( "archivaRuntimeInfo" ) + @GET + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) + @RedbackAuthorization( noRestriction = true ) + ApplicationRuntimeInfo archivaRuntimeInfo(); +} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java new file mode 100644 index 000000000..3759d9a3e --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java @@ -0,0 +1,71 @@ +package org.apache.archiva.webapp.ui.services.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; + +/** + * @author Olivier Lamy + * @since 1.4-M3 + */ +@XmlRootElement( name = "applicationRuntimeInfo" ) +public class ApplicationRuntimeInfo +{ + private boolean devMode = false; + + private boolean javascriptLog = false; + + public ApplicationRuntimeInfo() + { + this.devMode = Boolean.getBoolean( "archiva.devMode" ); + + this.javascriptLog = Boolean.getBoolean( "archiva.javascriptLog" ); + } + + public boolean isDevMode() + { + return devMode; + } + + public void setDevMode( boolean devMode ) + { + this.devMode = devMode; + } + + public boolean isJavascriptLog() + { + return javascriptLog; + } + + public void setJavascriptLog( boolean javascriptLog ) + { + this.javascriptLog = javascriptLog; + } + + @Override + public String toString() + { + final StringBuilder sb = new StringBuilder(); + sb.append( "ApplicationRuntimeInfo" ); + sb.append( "{devMode=" ).append( devMode ); + sb.append( ", javascriptLog=" ).append( javascriptLog ); + sb.append( '}' ); + return sb.toString(); + } +} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml index 7bbafb370..4751faff4 100755 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml @@ -22,15 +22,25 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" + xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util - http://www.springframework.org/schema/util/spring-util-3.0.xsd" + http://www.springframework.org/schema/util/spring-util-3.0.xsd + http://cxf.apache.org/jaxrs + http://cxf.apache.org/schemas/jaxrs.xsd" default-lazy-init="true"> + + + + + @@ -44,5 +54,26 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 857fa4e63..1d06f8be3 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -48,11 +48,11 @@