diff --git a/so-bizcontext/src/main/java/com/pineone/icbms/so/bizcontext/proxy/BizContextSDAProxy.java b/so-bizcontext/src/main/java/com/pineone/icbms/so/bizcontext/proxy/BizContextSDAProxy.java index 67d7d82d..3e9804b2 100644 --- a/so-bizcontext/src/main/java/com/pineone/icbms/so/bizcontext/proxy/BizContextSDAProxy.java +++ b/so-bizcontext/src/main/java/com/pineone/icbms/so/bizcontext/proxy/BizContextSDAProxy.java @@ -39,7 +39,7 @@ public int retrieveCurrentValue(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService - (contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CURRENT_VALUE + "/" + domain.getName()); + (contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CURRENT_VALUE + "/" + domain.getName()); String response = new Gson().toJson(message); int currentValue = Integer.parseInt(response); return currentValue; @@ -52,7 +52,7 @@ public int retrievePastValue(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_PAST_VALUE + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_PAST_VALUE + "/" + domain.getName()); String response = new Gson().toJson(message); int pastValue = Integer.parseInt(response); return pastValue; @@ -65,7 +65,7 @@ public int retrieveAllDeviceUseAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_USE_AMOUNT + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_USE_AMOUNT + "/" + domain.getName()); String response = new Gson().toJson(message); int useAmount = Integer.parseInt(response); return useAmount; @@ -77,7 +77,7 @@ public int retrieveObjectValue(Domain domain) { // // contextAddress = ContextAddress.newContextAddress(); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_OBJECT_VALUE + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_OBJECT_VALUE + "/" + domain.getName()); String response = new Gson().toJson(message); int objectValue = Integer.parseInt(response); return objectValue; @@ -90,7 +90,7 @@ public int retrieveCurrentClassPCAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CURRENT_PC + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CURRENT_PC + "/" + domain.getName()); String response = new Gson().toJson(message); int currentPC = Integer.parseInt(response); return currentPC; @@ -103,7 +103,7 @@ public int retrieveNextClassPCAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_NEXT_PC + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_NEXT_PC + "/" + domain.getName()); String response = new Gson().toJson(message); int nextPC = Integer.parseInt(response); return nextPC; @@ -116,7 +116,7 @@ public int retrieveCurrentClassMouseAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CURRENT_MOUSE + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CURRENT_MOUSE + "/" + domain.getName()); String response = new Gson().toJson(message); int currentMouse = Integer.parseInt(response); return currentMouse; @@ -129,7 +129,7 @@ public int retrieveNextClassMouseAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_NEXT_MOUSE + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_NEXT_MOUSE + "/" + domain.getName()); String response = new Gson().toJson(message); int nextMouse = Integer.parseInt(response); return nextMouse; @@ -142,7 +142,7 @@ public int retrieveCurrentClassKeyBoardAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CURRENT_KEYBOARD + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CURRENT_KEYBOARD + "/" + domain.getName()); String response = new Gson().toJson(message); int currentKeyBoard = Integer.parseInt(response); return currentKeyBoard; @@ -155,7 +155,7 @@ public int retrieveNextClassKeyBoardAmount(Domain domain) { // contextAddress = ContextAddress.newContextAddress(); logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_NEXT_KEYBOARD + "/" + domain.getName()); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_NEXT_KEYBOARD + "/" + domain.getName()); String response = new Gson().toJson(message); int nextKeyBoard = Integer.parseInt(response); return nextKeyBoard; diff --git a/so-contextinformation/src/main/java/com/pineone/icbms/so/contextinformation/proxy/ContextInformationSDAProxy.java b/so-contextinformation/src/main/java/com/pineone/icbms/so/contextinformation/proxy/ContextInformationSDAProxy.java index 4f088db0..6277bebd 100644 --- a/so-contextinformation/src/main/java/com/pineone/icbms/so/contextinformation/proxy/ContextInformationSDAProxy.java +++ b/so-contextinformation/src/main/java/com/pineone/icbms/so/contextinformation/proxy/ContextInformationSDAProxy.java @@ -44,7 +44,7 @@ public String registerContextInformation(ContextInformation contextInformation){ logger.debug("ContextInformation = " + contextInformation.toString()); // contextAddress = ContextAddress.newContextAddress(); IHttpResponseMessage message = clientService.requestPostService - (contextAddress.getSDAAddress() + AddressStore.REGISTER_CONTEXTINFORMATION, sendData); + (contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.REGISTER_CONTEXTINFORMATION, sendData); String response = new Gson().toJson(message); return response; } @@ -54,7 +54,7 @@ public List retrieveContextInformationListFromSDA(){ // logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CONTEXTINFORMATION); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CONTEXTINFORMATION); String readData = new Gson().toJson(message); Type type = new TypeToken>(){}.getType(); List contextInformationNameList = new Gson().fromJson(readData,type); @@ -67,7 +67,7 @@ public ContextInformation retrieveGeneralContextDetail(String contextId){ logger.info(LogPrint.outputInfoLogPrint()); logger.debug("ContextId = " + contextId); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CONTEXTINFORMATION + "/" + contextId); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CONTEXTINFORMATION + "/" + contextId); String readData = new Gson().toJson(message); Type type = new TypeToken(){}.getType(); ContextInformation contextInformation = new Gson().fromJson(readData,type); diff --git a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/proxy/ContextModelSDAProxy.java b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/proxy/ContextModelSDAProxy.java index 0203dfaa..0ab4edd5 100644 --- a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/proxy/ContextModelSDAProxy.java +++ b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/proxy/ContextModelSDAProxy.java @@ -49,7 +49,7 @@ public String registerContextModel(ContextModel contextModel) { logger.debug("ContextModel = " + contextModel.toString()); String sendData = DataConversion.objectToString(contextModel); - String response = clientService.requestPostServiceReceiveString(contextAddress.getSDAAddress() + AddressStore.REGISTER_CONTEXTMODEL, sendData); + String response = clientService.requestPostServiceReceiveString(contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.REGISTER_CONTEXTMODEL, sendData); return response; } @@ -59,7 +59,7 @@ public List retrieveContextModelListFromSDA() { // logger.info(LogPrint.outputInfoLogPrint()); IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CONTEXTMODEL); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CONTEXTMODEL); String readData = new Gson().toJson(message); Type type = new TypeToken>(){}.getType(); List contextModelList = new Gson().fromJson(readData,type); @@ -73,7 +73,7 @@ public ContextModel retrieveContextModelDetail(String contextModelId) { // logger.info(LogPrint.outputInfoLogPrint() + ", ContextModelId = " + contextModelId); logger.debug("ContextModelId = " + contextModelId); - String readData = clientService.requestGetServiceReceiveString(contextAddress.getSDAAddress() + AddressStore.RETRIEVE_CONTEXTMODEL + "/" + contextModelId); + String readData = clientService.requestGetServiceReceiveString(contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.RETRIEVE_CONTEXTMODEL + "/" + contextModelId); Type type = new TypeToken(){}.getType(); ContextModel contextModel = new Gson().fromJson(readData, type); @@ -219,7 +219,7 @@ public List retrieveContextModelEvent(String contextModelId) { private List getContents(String contextModelId) throws BadRequestException { IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + contextModelId + "/?p=," ); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + contextModelId + "/?p=," ); if(message.getStatusCode() == 200) { System.out.println(message.getBodyByteArray().toString()); logger.debug("ResponseMessage : " + message); diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java index 8be79538..37096902 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java @@ -55,7 +55,7 @@ public void deviceRegister(String deviceUri, String time){ logger.debug("Device Uri = " + deviceUri + " Time = " + time); // 디바이스 ID로 SDA에 데이터 요청. // TODO: SDA에 Device Uri만으로 Device정보 연동 규격 필요. - Device device = deviceRequest(contextAddress.getSIAddress() + AddressStore.SDA_DEVICE + deviceUri); + Device device = deviceRequest(contextAddress.getServerAddress(ContextAddress.SI_SERVER) + AddressStore.SDA_DEVICE + deviceUri); logger.debug("Device = " + device.toString()); // 디바이스 저장. deviceCreate(device); @@ -126,7 +126,7 @@ public String deviceExecute(String deviceId,String deviceCommand, String session } // Device 제어 요청 보냄. - ResultMessage resultMessage = deviceControlProxy.deviceControlRequest(contextAddress.getSIAddress() + AddressStore.SI_CONTOL_URI,deviceControlMessage); + ResultMessage resultMessage = deviceControlProxy.deviceControlRequest(contextAddress.getServerAddress(ContextAddress.SI_SERVER) + AddressStore.SI_CONTOL_URI,deviceControlMessage); logger.debug(LogPrint.LogMethodNamePrint() + " | Device Control Result : " + " , Device Uri = " + device.getDeviceUri() + " , Result : " + resultMessage + " , Session ID = " + sessionId); /** diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxy.java b/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxy.java index d9c9f068..73ab537d 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxy.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxy.java @@ -135,7 +135,7 @@ public String findDeviceOperation(String deviceId, String deviceService) { logger.info((LogPrint.outputInfoLogPrint())+ "DeviceID = " + deviceId); logger.debug("DeviceID = " + deviceId + "DeviceService = " + deviceService); - String requestUri = contextAddress.getSDAAddress() + AddressStore.SDA_DEVICE + AddressStore.SDA_DEVICE_OPERATION; + String requestUri = contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.SDA_DEVICE + AddressStore.SDA_DEVICE_OPERATION; JSONObject obj = new JSONObject(); obj.put("deviceId", deviceId); obj.put("deviceService", deviceService); diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSIProxy.java b/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSIProxy.java index 60f7e778..6b7bfa2e 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSIProxy.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/proxy/DeviceSIProxy.java @@ -63,14 +63,14 @@ public String deviceSubscriptionRequest(String deviceUri) { logger.debug(LogPrint.LogMethodNamePrint() + " | DeviceUri = " + deviceUri); DeviceSubscriptionData deviceSubscriptionData = new DeviceSubscriptionData(); - deviceSubscriptionData.set_notificationUri(contextAddress.getSOAddress() + AddressStore.SO_DEVICE_STATUS); + deviceSubscriptionData.set_notificationUri(contextAddress.getServerAddress(ContextAddress.SO_SERVER) + AddressStore.SO_DEVICE_STATUS); deviceSubscriptionData.set_uri(deviceUri); String requestBody = new Gson().toJson(deviceSubscriptionData); // DeviceLogic에 생성되거나 제어되면 서브스크립트 걸어야 겠군. // 현제 정책이 안되어 있어서. 등록되면 걸지.. 제어시 걸지는 고려 필요. - String responseData = clientService.requestPostServiceReceiveString(contextAddress.getSIAddress() + AddressStore.SI_SUBSCRIPTION_URI, requestBody); + String responseData = clientService.requestPostServiceReceiveString(contextAddress.getServerAddress(ContextAddress.SI_SERVER) + AddressStore.SI_SUBSCRIPTION_URI, requestBody); // ResponseData{ "code" : "2000", "message" : "", "content" : "" } logger.debug(LogPrint.LogMethodNamePrint() + " | Subscription Request : Response Data = " + responseData); ResultMessage resultMessage = new ResultMessage(); @@ -97,7 +97,7 @@ public String deviceSubscriptionReleaseRequest(String deviceUri) { String requestBody = new Gson().toJson(deviceSubscriptionData); // DeviceLogic에 생성되거나 제어되면 서브스크립트 걸어야 겠군. // 현제 정책이 안되어 있어서. 등록되면 걸지.. 제어시 걸지는 고려 필요. - String responseData = clientService.requestPostServiceReceiveString(contextAddress.getSIAddress() + AddressStore.SI_SUBSCRIPTION_RELEASE_URI, requestBody); + String responseData = clientService.requestPostServiceReceiveString(contextAddress.getServerAddress(ContextAddress.SI_SERVER) + AddressStore.SI_SUBSCRIPTION_RELEASE_URI, requestBody); logger.debug(LogPrint.LogMethodNamePrint() + " | Device SubscriptionRelease Request Result = " + responseData); logger.info("<================ Device SubscriptionRelease Request End ================>"); return responseData; diff --git a/so-domain/src/main/java/com/pineone/icbms/so/domain/proxy/DomainSDAProxy.java b/so-domain/src/main/java/com/pineone/icbms/so/domain/proxy/DomainSDAProxy.java index 2ea9f4ec..3cf94d5d 100644 --- a/so-domain/src/main/java/com/pineone/icbms/so/domain/proxy/DomainSDAProxy.java +++ b/so-domain/src/main/java/com/pineone/icbms/so/domain/proxy/DomainSDAProxy.java @@ -43,7 +43,7 @@ public List retrieveDomainFromSDA(){ logger.info(LogPrint.outputInfoLogPrint()); // contextAddress = ContextAddress.newContextAddress(); IHttpResponseMessage message = clientService.requestGetService - (contextAddress.getSDAAddress() + AddressStore.REGISTER_CONTEXTINFORMATION); + (contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.REGISTER_CONTEXTINFORMATION); String readData = new Gson().toJson(message); Type type = new TypeToken>(){}.getType(); List domainList = new Gson().fromJson(readData,type); diff --git a/so-service/src/main/java/com/pineone/icbms/so/service/proxy/ServiceSDAProxyImpl.java b/so-service/src/main/java/com/pineone/icbms/so/service/proxy/ServiceSDAProxyImpl.java index fe524668..4693de18 100644 --- a/so-service/src/main/java/com/pineone/icbms/so/service/proxy/ServiceSDAProxyImpl.java +++ b/so-service/src/main/java/com/pineone/icbms/so/service/proxy/ServiceSDAProxyImpl.java @@ -41,7 +41,7 @@ public String getPCCountUri(Session session) throws BadRequestException { } IHttpResponseMessage message = clientService.requestGetService( - contextAddress.getSDAAddress() + "cm-lack-equipment-count/?p=" + location ); + contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + "cm-lack-equipment-count/?p=" + location ); if(message.getStatusCode() == 200) { System.out.println(message.getBodyByteArray().toString()); logger.debug("ResponseMessage : " + message); diff --git a/so-util/src/main/java/com/pineone/icbms/so/util/address/AddressStore.java b/so-util/src/main/java/com/pineone/icbms/so/util/address/AddressStore.java index 07bb1530..43ce6d82 100644 --- a/so-util/src/main/java/com/pineone/icbms/so/util/address/AddressStore.java +++ b/so-util/src/main/java/com/pineone/icbms/so/util/address/AddressStore.java @@ -39,5 +39,7 @@ public class AddressStore { //SO Data public static final String SO_DEVICE_STATUS = "/so/device/status"; - + private AddressStore() { + throw new IllegalAccessError("AddressStore class"); + } } diff --git a/so-util/src/main/java/com/pineone/icbms/so/util/address/ContextAddress.java b/so-util/src/main/java/com/pineone/icbms/so/util/address/ContextAddress.java index 55298320..ef5968f9 100644 --- a/so-util/src/main/java/com/pineone/icbms/so/util/address/ContextAddress.java +++ b/so-util/src/main/java/com/pineone/icbms/so/util/address/ContextAddress.java @@ -13,49 +13,29 @@ @Service public class ContextAddress { + public static final String SERVER_PROPERTIES = "server.properties"; + public static final String SDA_SERVER = "Sda_Connection"; + public static final String SI_SERVER = "SI_Connection"; + public static final String SO_SERVER = "SO_Connection"; -// private ContextAddress(){}; -// public static ContextAddress newContextAddress(){ -// ContextAddress contextAddress = new ContextAddress(); -// return contextAddress; -// } - - public String getSDAAddress(){ - // - String sdaConnection = null; - Properties sdaInfo = new Properties(); - InputStream inputStream = ContextAddress.class.getClassLoader().getResourceAsStream("server.properties"); - try{ - sdaInfo.load(inputStream); - sdaConnection = sdaInfo.getProperty("Sda_Connection"); - } catch (IOException e) { - e.printStackTrace(); - } - return sdaConnection; - } - - public String getSIAddress(){ - // - String siConnection = null; - Properties siInfo = new Properties(); - InputStream inputStream = ContextAddress.class.getClassLoader().getResourceAsStream("server.properties"); - try{ - siInfo.load(inputStream); - siConnection = siInfo.getProperty("SI_Connection"); - } catch (IOException e) { - e.printStackTrace(); - } - return siConnection; - } - - public String getSOAddress(){ + public String getServerAddress(String server){ // String soConnection = null; Properties siInfo = new Properties(); - InputStream inputStream = ContextAddress.class.getClassLoader().getResourceAsStream("server.properties"); + + InputStream inputStream = ContextAddress.class.getClassLoader().getResourceAsStream(SERVER_PROPERTIES); + try{ siInfo.load(inputStream); - soConnection = siInfo.getProperty("SO_Connection"); + switch (server){ + case SDA_SERVER : soConnection = siInfo.getProperty(SDA_SERVER); + break; + case SI_SERVER : soConnection = siInfo.getProperty(SI_SERVER); + break; + case SO_SERVER : soConnection = siInfo.getProperty(SO_SERVER); + break; + default: soConnection = siInfo.getProperty(SI_SERVER); + } } catch (IOException e) { e.printStackTrace(); } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManager.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManager.java index b532feea..6fa2c918 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManager.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManager.java @@ -11,5 +11,4 @@ public interface VirtualObjectManager { List searchVirtualObjectList(); String requestControlDevice(String voId, String operation, String sessionId); void produceVirtualObject(VirtualObject virtualObject); -// String controlDevice(List serviceControls); } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java index 23e3781e..2b26e215 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java @@ -88,7 +88,9 @@ public void deleteVirtualObject(@PathVariable String id){ private VirtualObject virtualObjectMapping(VirtualObjectTransFormObject virtualObjectDataObject) { - if(virtualObjectDataObject == null)return null; + if(virtualObjectDataObject == null){ + return null; + } VirtualObject virtualObject = new VirtualObject(virtualObjectDataObject.getId(),virtualObjectDataObject.getVoName(),virtualObjectDataObject.getFunctionality(),virtualObjectDataObject.getVoDescription(),virtualObjectDataObject.getVoCreateTime(),virtualObjectDataObject.getVoExpiredTime(),virtualObjectDataObject.getDeviceService(),virtualObjectDataObject.getDeviceId(),virtualObjectDataObject.getVoCommand(),virtualObjectDataObject.getVoLocation()); if(!virtualObject.getId().startsWith(VirtualObjectProfile.VIRTUALOBJECT_ID)){ String voId = virtualObject.getId(); diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/proxy/VirtualObjectSDAProxy.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/proxy/VirtualObjectSDAProxy.java index 9550ffec..b2c0deb0 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/proxy/VirtualObjectSDAProxy.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/proxy/VirtualObjectSDAProxy.java @@ -28,15 +28,13 @@ public String findFunctionality(String deviceId, String deviceService){ logger.info(LogPrint.outputInfoLogPrint()); logger.debug("Device ID = " + deviceId + " DeviceService = " + deviceService); // - String requestUri = contextAddress.getSDAAddress() + AddressStore.SDA_DEVICE; + String requestUri = contextAddress.getServerAddress(ContextAddress.SDA_SERVER) + AddressStore.SDA_DEVICE; JSONObject obj = new JSONObject(); obj.put("deviceId", deviceId); obj.put("deviceService", deviceService); String requestData = obj.toString(); - String responseData = clientService.requestPostServiceReceiveString(requestUri, requestData); - - return responseData; + return clientService.requestPostServiceReceiveString(requestUri, requestData); } } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/ref/VirtualObjectProfile.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/ref/VirtualObjectProfile.java index 6bb83d68..513e827d 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/ref/VirtualObjectProfile.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/ref/VirtualObjectProfile.java @@ -2,4 +2,8 @@ public class VirtualObjectProfile { public static final String VIRTUALOBJECT_ID = "vo-"; + + private VirtualObjectProfile() { + throw new IllegalAccessError("Prifile class"); + } } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java index e3b01657..f260846c 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java @@ -95,7 +95,9 @@ public void delete(String id) { } private VirtualObjectDataObject virtualObjectToDataObject(VirtualObject virtualObject) { - if(virtualObject == null) return null; + if(virtualObject == null){ + return null; + } return new VirtualObjectDataObject(virtualObject.getId(), virtualObject.getVoName(), virtualObject.getFunctionality(), virtualObject.getVoDescription(), virtualObject.getVoCreateTime(), virtualObject.getVoExpiredTime(), virtualObject.getDeviceService(), virtualObject.getDeviceId(), virtualObject.getVoCommand(), virtualObject.getVoLocation()); }