Skip to content

Commit

Permalink
임시 커밋
Browse files Browse the repository at this point in the history
  • Loading branch information
cheonjeongdae committed Dec 21, 2017
1 parent 39f90e4 commit 8ac78d2
Show file tree
Hide file tree
Showing 96 changed files with 49,994 additions and 47,015 deletions.
4 changes: 2 additions & 2 deletions .settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
connection.project.dir=mago3d-user
#Wed Nov 29 16:27:40 KST 2017
eclipse.preferences.version=1
connection.project.dir=
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
3 changes: 3 additions & 0 deletions mago3d-admin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ dependencies {
compile 'javax.servlet:jstl:1.2'
compile 'org.apache.logging.log4j:log4j:2.8.2'
//compile('org.springframework.boot:spring-boot-starter-actuator')

//compile 'io.springfox:springfox-swagger2:2.7.0'
//compile 'io.springfox:springfox-swagger-ui:2.7.0'

compileOnly('org.projectlombok:lombok')

Expand Down
48 changes: 16 additions & 32 deletions mago3d-admin/src/main/java/com/gaia3d/config/CacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@
import com.gaia3d.domain.CacheName;
import com.gaia3d.domain.CacheType;
import com.gaia3d.domain.CommonCode;
import com.gaia3d.domain.DataGroup;
import com.gaia3d.domain.DataInfo;
import com.gaia3d.domain.ExternalService;
import com.gaia3d.domain.Menu;
import com.gaia3d.domain.OSType;
import com.gaia3d.domain.Policy;
import com.gaia3d.domain.Project;
import com.gaia3d.domain.UserGroup;
import com.gaia3d.domain.UserGroupMenu;
import com.gaia3d.helper.HttpClientHelper;
import com.gaia3d.security.Crypt;
import com.gaia3d.service.APIService;
import com.gaia3d.service.CommonCodeService;
import com.gaia3d.service.DataGroupService;
import com.gaia3d.service.DataService;
import com.gaia3d.service.MenuService;
import com.gaia3d.service.PolicyService;
import com.gaia3d.service.ProjectService;
import com.gaia3d.service.UserGroupService;

import lombok.extern.slf4j.Slf4j;
Expand All @@ -42,7 +42,7 @@ public class CacheConfig {
@Autowired
private DataService dataService;
@Autowired
private DataGroupService dataGroupService;
private ProjectService projectService;
// @Autowired
// private LicenseService licenseService;
@Autowired
Expand Down Expand Up @@ -99,7 +99,7 @@ public void loadCache(CacheName cacheName, CacheType cacheType) {
else if(cacheName == CacheName.POLICY) policy(cacheType);
else if(cacheName == CacheName.MENU) menu(cacheType);
else if(cacheName == CacheName.COMMON_CODE) commonCode(cacheType);
else if(cacheName == CacheName.DATA_GROUP) data(cacheType);
else if(cacheName == CacheName.PROJECT) data(cacheType);
}

private void license(CacheType cacheType) {
Expand Down Expand Up @@ -157,36 +157,15 @@ private void menu(CacheType cacheType) {
* @param cacheType
*/
private void data(CacheType cacheType) {
Map<String, Map<String, DataInfo>> dataGroupMap = new HashMap<>();
List<DataInfo> allDataInfoList = new ArrayList<>();

// 1 Depth group 정보를 전부 가져옴
List<DataGroup> dataGroupList = dataGroupService.getListDataGroupByDepth(1);
// 1 그룹별 하위 object 정보들을 전부 가져옴
for(DataGroup dataGroup : dataGroupList) {
List<DataGroup> childGroupList = dataGroupService.getListDataGroupByAncestor(dataGroup.getData_group_id());
// List<DataInfo> allChildDataInfoList = new ArrayList<>();
for(DataGroup childDataGroup : childGroupList) {
DataInfo dataInfo = new DataInfo();
dataInfo.setData_group_id(childDataGroup.getData_group_id());
// allChildDataInfoList.addAll(dataService.getListDataByDataGroupId(dataInfo));
allDataInfoList.addAll(dataService.getListDataByDataGroupId(dataInfo));
}
// dataGroupMap.put(dataGroup.getData_group_key(), allChildDataInfoList);
}

Map<String, DataInfo> allDataInfoMap = new HashMap<>();
for(DataInfo dataInfo : allDataInfoList) {
allDataInfoMap.put(dataInfo.getData_key(), dataInfo);
List<Project> projectList = projectService.getListProject(new Project());
Map<Long, Project> projectMap = new HashMap<>();
for(Project project : projectList) {
projectMap.put(project.getProject_id(), project);
}

dataGroupMap.put("alldata", allDataInfoMap);

CacheManager.setProjectDataGroupList(dataGroupList);
CacheManager.setDataGroupMap(dataGroupMap);
CacheManager.setProjectMap(projectMap);

if(cacheType == CacheType.BROADCAST) {
callRemoteCache(CacheName.DATA_GROUP);
callRemoteCache(CacheName.PROJECT);
}
}

Expand Down Expand Up @@ -271,6 +250,11 @@ private void externalServiceCache(CacheType cacheType) {
private void callRemoteCache(CacheName cacheName) {

log.info("@@@@@@@@@@@@@@@@@@@@@@@@@@ callRemoteCache start! ");
if(propertiesConfig.getOsType().toUpperCase().equals(OSType.WINDOW.toString().toUpperCase())) {
log.info("@@@@@@@@@@@@@@@@@@@@@@@@@@ OS Type = {}. skip callRemoteCache ", propertiesConfig.getOsType().toUpperCase());
return;
}

// TODO 로컬, 이중화 등의 분기 처리가 생략되어 있음
List<ExternalService> remoteCacheServerList = CacheManager.getRemoteCacheServiceList();
for(ExternalService externalService : remoteCacheServerList) {
Expand Down
48 changes: 48 additions & 0 deletions mago3d-admin/src/main/java/com/gaia3d/config/ServletConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import java.util.Locale;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
Expand All @@ -11,10 +13,12 @@
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.Ordered;
import org.springframework.http.CacheControl;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
Expand All @@ -39,6 +43,7 @@
* @author Cheon JeongDae
*
*/
//@EnableSwagger2
@Slf4j
@EnableWebMvc
@Configuration
Expand Down Expand Up @@ -104,12 +109,28 @@ public MessageSourceAccessor getMessageSourceAccessor(){

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {

log.info(" @@@ ServletConfig addResourceHandlers @@@");
registry.addResourceHandler("/css/**").addResourceLocations("/css/");
registry.addResourceHandler("/externlib/**").addResourceLocations("/externlib/");
// registry.addResourceHandler("/hompage/**").addResourceLocations("/homepage/");
registry.addResourceHandler("/images/**").addResourceLocations("/images/");
registry.addResourceHandler("/js/**").addResourceLocations("/js/");
//registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
// registry.addResourceHandler("/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html");
// registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
//registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");

// if (!registry.hasMappingForPattern("/webjars/**")) {
// registry.addResourceHandler("/webjars/**")
// .addResourceLocations("classpath:/resources/webjars/")
// .setCacheControl( CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic() );
// }
// if (!registry.hasMappingForPattern("/**")) {
// registry.addResourceHandler("/**")
// .addResourceLocations("classpath:/static")
// .setCacheControl( CacheControl.maxAge(0, TimeUnit.SECONDS).cachePublic());
// }
}

@Override
Expand Down Expand Up @@ -149,6 +170,7 @@ public SimpleMappingExceptionResolver simpleMappingExceptionResolver() {
}

@Bean
@ConditionalOnMissingBean(InternalResourceViewResolver.class)
public InternalResourceViewResolver viewResolver() {
log.info(" @@@ ServletConfig viewResolver @@@");
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
Expand All @@ -164,4 +186,30 @@ public RequestDataValueProcessor requestDataValueProcessor() {
log.info(" @@@ ServletConfig requestDataValueProcessor @@@ ");
return new CSRFRequestDataValueProcessor();
}

// /**
// * Global CORS Configuration
// */
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// // 간략설정
// registry.addMapping("/**");
//
// // 상세설정
// registry.addMapping("/api/**").allowedOrigins("http://domain2.com")
// .allowedMethods("PUT", "DELETE")
// .allowedHeaders("header1", "header2", "header3")
// .exposedHeaders("header1", "header2").allowCredentials(false)
// .maxAge(3600);
// }

// @Bean
// public Docket petApi() {
// return new Docket(DocumentationType.SWAGGER_2)
// .select()
// .apis(RequestHandlerSelectors.any())
// .paths(PathSelectors.any())
// .build()
// .pathMapping("/");
// }
}
Loading

0 comments on commit 8ac78d2

Please sign in to comment.