fixed API version

merge-requests/7/head
Chatura Dilan 7 years ago
parent 5d8b8ab697
commit b548094862

@ -46,7 +46,7 @@
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<configuration> <configuration>
<packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes> <packagingExcludes>WEB-INF/lib/*cxf*.jar</packagingExcludes>
<warName>api#application-mgt#v1.0</warName> <warName>api#application-mgt#v2.0</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>

@ -16,10 +16,10 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.api.services; package org.wso2.carbon.device.application.mgt.api.v2.apis;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse; import org.wso2.carbon.device.application.mgt.api.v2.beans.ErrorResponse;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -30,7 +30,7 @@ import javax.ws.rs.core.Response;
"such as get all the available devices, etc.") "such as get all the available devices, etc.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public interface ApplicationManagementService { public interface ApplicationManagementAPI {
public final static String SCOPE = "scope"; public final static String SCOPE = "scope";

@ -16,13 +16,13 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.api.services.impl; package org.wso2.carbon.device.application.mgt.api.v2.apis.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.dto.Filter;
import org.wso2.carbon.device.application.mgt.core.services.ApplicationManager;
import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -30,11 +30,11 @@ import javax.ws.rs.core.Response;
@Produces({ "application/json"}) @Produces({ "application/json"})
@Consumes({ "application/json"}) @Consumes({ "application/json"})
public class ApplicationManagementServiceImpl { public class ApplicationManagementAPIImpl {
public static final int DEFAULT_LIMIT = 20; public static final int DEFAULT_LIMIT = 20;
private static Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class); private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class);
@GET @GET
@ -42,7 +42,8 @@ public class ApplicationManagementServiceImpl {
@Path("applications") @Path("applications")
public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit,
@QueryParam("q") String searchQuery) { @QueryParam("q") String searchQuery) {
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManager(); ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagementService();
try { try {
if(limit == 0){ if(limit == 0){

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.api.beans; package org.wso2.carbon.device.application.mgt.api.v2.beans;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

@ -16,7 +16,7 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.api.beans; package org.wso2.carbon.device.application.mgt.api.v2.beans;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.application.mgt.api.common; package org.wso2.carbon.device.application.mgt.api.v2.common;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.application.mgt.api.common; package org.wso2.carbon.device.application.mgt.api.v2.common;
public class ErrorMessage { public class ErrorMessage {

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.application.mgt.api.common; package org.wso2.carbon.device.application.mgt.api.v2.common;
import com.google.gson.Gson; import com.google.gson.Gson;

@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.application.mgt.api.common; package org.wso2.carbon.device.application.mgt.api.v2.common;
/** /**
* Custom exception class for handling CDM API related exceptions. * Custom exception class for handling CDM API related exceptions.

@ -16,7 +16,7 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
</jaxrs:providers> </jaxrs:providers>
</jaxrs:server> </jaxrs:server>
<bean id="applicationMgtServiceBean" class="org.wso2.carbon.device.application.mgt.api.services.impl.ApplicationManagementServiceImpl"/> <bean id="applicationMgtServiceBean" class="org.wso2.carbon.device.application.mgt.api.v2.apis.impl.ApplicationManagementAPIImpl"/>
<bean id="jsonProvider" class="org.wso2.carbon.device.application.mgt.api.common.GsonMessageBodyHandler"/> <bean id="jsonProvider" class="org.wso2.carbon.device.application.mgt.api.v2.common.GsonMessageBodyHandler"/>
</beans> </beans>

@ -22,8 +22,8 @@ import org.apache.commons.logging.Log;
import org.osgi.service.component.ComponentContext; import org.osgi.service.component.ComponentContext;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.services.ApplicationManagementService;
import org.wso2.carbon.device.application.mgt.core.components.impl.ApplicationManagerImpl; import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceImpl;
import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager; import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager;
import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO;
@ -33,7 +33,7 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import javax.naming.NamingException; import javax.naming.NamingException;
/** /**
* @scr.component name="org.wso2.carbon.application.mgt" immediate="true" * @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true"
* @scr.reference name="org.wso2.carbon.device.manager" * @scr.reference name="org.wso2.carbon.device.manager"
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
* cardinality="1..1" * cardinality="1..1"
@ -49,8 +49,8 @@ public class ApplicationManagementServiceComponent {
protected void activate(ComponentContext componentContext) throws NamingException { protected void activate(ComponentContext componentContext) throws NamingException {
BundleContext bundleContext = componentContext.getBundleContext(); BundleContext bundleContext = componentContext.getBundleContext();
bundleContext.registerService(ApplicationManager.class.getName(), bundleContext.registerService(ApplicationManagementService.class.getName(),
ApplicationManagerImpl.getInstance(), null); ApplicationManagementServiceImpl.getInstance(), null);
DataSourceConfig dataSourceConfig = ApplicationConfigurationManager.getInstance() DataSourceConfig dataSourceConfig = ApplicationConfigurationManager.getInstance()
@ -73,14 +73,14 @@ public class ApplicationManagementServiceComponent {
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Setting Application Management OSGI Service"); log.debug("Setting Application Management OSGI Manager");
} }
ApplicationManagementDataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService); ApplicationManagementDataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService);
} }
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Removing Application Management OSGI Service"); log.debug("Removing Application Management OSGI Manager");
} }
ApplicationManagementDataHolder.getInstance().setDeviceManagementService(null); ApplicationManagementDataHolder.getInstance().setDeviceManagementService(null);
} }

@ -0,0 +1,30 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
import org.wso2.carbon.device.application.mgt.core.dto.Application;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.dto.Filter;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException;
public interface ApplicationManagementService extends ApplicationReleaseManager, ApplicationManager, CategoryManager,
CommentsManager, LifecycleStateManager, PlatformManager, ResourceTypeManager, SubscriptionManager,
VisibilityManager {
}

@ -16,17 +16,16 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.core.components; package org.wso2.carbon.device.application.mgt.core.services;
import org.wso2.carbon.device.application.mgt.core.dto.Application; import org.wso2.carbon.device.application.mgt.core.dto.Application;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.dto.Filter; import org.wso2.carbon.device.application.mgt.core.dto.Filter;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException;
public interface ApplicationManager { public interface ApplicationManager {
public void createApplication(Application application) throws ApplicationManagerException; void createApplication(Application application) throws ApplicationManagerException;
public ApplicationList getApplications(Filter filter) throws ApplicationManagerException;
ApplicationList getApplications(Filter filter) throws ApplicationManagerException;
} }

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface ApplicationReleaseManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface CategoryManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface CommentsManager {
}

@ -0,0 +1,23 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface LifecycleStateManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface PlatformManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface ResourceTypeManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface SubscriptionManager {
}

@ -0,0 +1,22 @@
/*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. 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.
*
*/
package org.wso2.carbon.device.application.mgt.core.services;
public interface VisibilityManager {
}

@ -16,11 +16,11 @@
* under the License. * under the License.
* *
*/ */
package org.wso2.carbon.device.application.mgt.core.components.impl; package org.wso2.carbon.device.application.mgt.core.services.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.services.ApplicationManagementService;
import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO;
import org.wso2.carbon.device.application.mgt.core.dto.Application; import org.wso2.carbon.device.application.mgt.core.dto.Application;
import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList;
@ -29,18 +29,18 @@ import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerE
import org.wso2.carbon.device.application.mgt.core.internal.ApplicationManagementDataHolder; import org.wso2.carbon.device.application.mgt.core.internal.ApplicationManagementDataHolder;
import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
public class ApplicationManagerImpl implements ApplicationManager { public class ApplicationManagementServiceImpl implements ApplicationManagementService {
private static final Log log = LogFactory.getLog(ApplicationManagerImpl.class); private static final Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class);
private static ApplicationManagerImpl applicationManager = new ApplicationManagerImpl(); private static ApplicationManagementServiceImpl applicationManager = new ApplicationManagementServiceImpl();
private ApplicationManagerImpl() { private ApplicationManagementServiceImpl() {
} }
public static ApplicationManagerImpl getInstance() { public static ApplicationManagementServiceImpl getInstance() {
return applicationManager; return applicationManager;
} }

@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.application.mgt.core.components.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.services.ApplicationManagementService;
import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException;
import javax.xml.XMLConstants; import javax.xml.XMLConstants;
@ -35,10 +35,10 @@ public class ApplicationManagementUtil {
private static Log log = LogFactory.getLog(ApplicationManagementUtil.class); private static Log log = LogFactory.getLog(ApplicationManagementUtil.class);
public static ApplicationManager getApplicationManager() { public static ApplicationManagementService getApplicationManagementService() {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
ApplicationManager applicationManager = ApplicationManagementService applicationManager =
(ApplicationManager) CarbonContext.getThreadLocalCarbonContext().getOSGiService(ApplicationManager.class, null); (ApplicationManagementService) CarbonContext.getThreadLocalCarbonContext().getOSGiService(ApplicationManagementService.class, null);
if (applicationManager == null) { if (applicationManager == null) {
String msg = "Application Management provider service has not initialized."; String msg = "Application Management provider service has not initialized.";
log.error(msg); log.error(msg);

@ -36,7 +36,7 @@
<modules> <modules>
<module>org.wso2.carbon.device.application.mgt.core</module> <module>org.wso2.carbon.device.application.mgt.core</module>
<module>org.wso2.carbon.device.application.mgt.api</module> <module>org.wso2.carbon.device.application.mgt.api.v2</module>
</modules> </modules>
<build> <build>

Loading…
Cancel
Save