]> source.dussan.org Git - archiva.git/commitdiff
move this rest services used only by the js ui in a new rest ui service
authorOlivier Lamy <olamy@apache.org>
Fri, 27 Jan 2012 11:19:51 +0000 (11:19 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 27 Jan 2012 11:19:51 +0000 (11:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1236634 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArchivaRuntimeInfo.java [deleted file]
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultRuntimeInfoService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/RuntimeInfoService.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/ApplicationRuntimeInfo.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-js/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html

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 (file)
index f27bfe1..0000000
+++ /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();
-    }
-}
index 675a31ef8d3a0ff4fa1b5c71b5286147c8a8993f..1c2ed2bf0aa50b84510593fbff5c55722abe73ec 100644 (file)
@@ -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
index ba010aaf1fcbef6ede079d52e9aa2e181588098b..4a7940e0c757ade942759c89f61689feea0a3164 100644 (file)
@@ -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 (file)
index 0000000..c4562fb
--- /dev/null
@@ -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 (file)
index 0000000..43e82dd
--- /dev/null
@@ -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 (file)
index 0000000..3759d9a
--- /dev/null
@@ -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();
+    }
+}
index 7bbafb370aad4161720c7b08e7f526459cdec704..4751faff4e63b12b217751a5f8bbbf92a32b808a 100755 (executable)
        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">
 
+  <import resource="classpath:META-INF/cxf/cxf.xml"/>
+  <!--
+  <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
+  -->
+  <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
   <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.webapp.ui.services.api"/>
 
 
   <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
     <constructor-arg value="${appserver.base}/data/jcr"/>
   </bean>
 
+  <jaxrs:server id="archivaUiServices" address="/archivaUiServices">
+
+    <jaxrs:providers>
+      <ref bean="authenticationInterceptor#rest"/>
+      <ref bean="permissionInterceptor#rest"/>
+      <ref bean="archivaRestServiceExceptionMapper"/>
+    </jaxrs:providers>
+
+    <jaxrs:serviceBeans>
+      <ref bean="runtimeInfoService#rest"/>
+    </jaxrs:serviceBeans>
+
+    <jaxrs:outInterceptors>
+      <ref bean="threadLocalUserCleaner#rest"/>
+    </jaxrs:outInterceptors>
+
+    <jaxrs:outFaultInterceptors>
+
+    </jaxrs:outFaultInterceptors>
+  </jaxrs:server>
+
 
 </beans>
\ No newline at end of file
index 857fa4e631bd7ecc29c5d665e92993cdb8445d55..1d06f8be335d832634714df731a921e0192eac7c 100644 (file)
 <script type="text/javascript">
 $.ajax(
   {
-    url: "restServices/archivaServices/commonServices/archivaRuntimeInfo",
+    url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo",
     dataType: 'json',
     success:function(data){
-        window.archivaDevMode=data.archivaRuntimeInfo.devMode;
-        window.archivaJavascriptLog=data.archivaRuntimeInfo.javascriptLog;
+        window.archivaDevMode=data.applicationRuntimeInfo.devMode;
+        window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog;
         require.config({
             baseUrl: "js/"
           });