From 2c3a8d7d6e6bab270686fd1144473003c364b435 Mon Sep 17 00:00:00 2001 From: m.veroni Date: Tue, 24 Jun 2014 08:29:19 +0000 Subject: [PATCH] Versione 1.0.0 --- .classpath | 173 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .project | 36 ++++++++++++++++++++++++++++++++++++ .settings/.jsdtscope | 11 +++++++++++ .settings/org.eclipse.core.resources.prefs | 15 +++++++++++++++ .settings/org.eclipse.jdt.core.prefs | 11 +++++++++++ .settings/org.eclipse.jst.jsp.core.prefs | 31 +++++++++++++++++++++++++++++++ .settings/org.eclipse.wst.common.component | 17 +++++++++++++++++ .settings/org.eclipse.wst.common.project.facet.core.xml | 9 +++++++++ .settings/org.eclipse.wst.jsdt.ui.superType.container | 1 + .settings/org.eclipse.wst.jsdt.ui.superType.name | 1 + .settings/org.eclipse.wst.ws.service.policy.prefs | 2 ++ .settings/org.hibernate.eclipse.console.prefs | 4 ++++ WebContent/META-INF/LILIANA (web144db2).txt | 1 + WebContent/META-INF/MANIFEST.MF | 3 +++ WebContent/META-INF/context.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ WebContent/WEB-INF/web.xml | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ WebContent/favicon.ico | Bin 0 -> 5686 bytes builder.xml | 382 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/context_.xml | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/develop/META-INF/context.xml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/develop/WEB-INF/web.xml | 471 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/develop/conf/log4j.xml | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/develop/conf/portal_settings.xml | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/develop/conf/sso.xml | 35 +++++++++++++++++++++++++++++++++++ conf/liliana/develop/image-pack/apple-touch-icon-ipad-76x76.png | Bin 0 -> 6371 bytes conf/liliana/develop/image-pack/apple-touch-icon-ipad-retina-152x152.png | Bin 0 -> 17006 bytes conf/liliana/develop/image-pack/apple-touch-icon-iphone-60x60.png | Bin 0 -> 4384 bytes conf/liliana/develop/image-pack/apple-touch-icon-iphone-retina-120x120.png | Bin 0 -> 12415 bytes conf/liliana/develop/image-pack/background-image.png | Bin 0 -> 50042 bytes conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-76x76.png | Bin 0 -> 7287 bytes conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-retina-152x152.png | Bin 0 -> 13263 bytes conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-60x60.png | Bin 0 -> 6175 bytes conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-retina-120x120.png | Bin 0 -> 10457 bytes conf/liliana/develop/version.xml | 12 ++++++++++++ conf/liliana/staging/META-INF/context.xml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/staging/WEB-INF/web.xml | 471 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/staging/conf/log4j.xml | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/staging/conf/portal_settings.xml | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/liliana/staging/conf/sso.xml | 31 +++++++++++++++++++++++++++++++ conf/liliana/staging/image-pack/apple-touch-icon-ipad-76x76.png | Bin 0 -> 8775 bytes conf/liliana/staging/image-pack/apple-touch-icon-ipad-retina-152x152.png | Bin 0 -> 25023 bytes conf/liliana/staging/image-pack/apple-touch-icon-iphone-60x60.png | Bin 0 -> 6134 bytes conf/liliana/staging/image-pack/apple-touch-icon-iphone-retina-120x120.png | Bin 0 -> 17327 bytes conf/liliana/staging/image-pack/background-image.png | Bin 0 -> 42730 bytes conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-76x76.png | Bin 0 -> 7306 bytes conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-retina-152x152.png | Bin 0 -> 13303 bytes conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-60x60.png | Bin 0 -> 6168 bytes conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-retina-120x120.png | Bin 0 -> 10457 bytes conf/liliana/staging/version.xml | 12 ++++++++++++ conf/log4j.dtd | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ conf/myMETA-INF/context-jcluster-web77db12.xml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ conf/myMETA-INF/context-liliana-web144db2.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ conf/version.properties | 6 ++++++ conf/version.xml | 12 ++++++++++++ conf/web.xml | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ database/change_in_progress/20140623 http file proxy.sql | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ deployer-script.xml | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ deployer.xml | 419 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/amazon.s3/aws-java-sdk-1.0.11-javadoc.jar | Bin 0 -> 3208491 bytes lib/amazon.s3/aws-java-sdk-1.0.11-sources.jar | Bin 0 -> 1976714 bytes lib/amazon.s3/aws-java-sdk-1.0.11.jar | Bin 0 -> 1931978 bytes lib/amazon.s3/lib.removed/jackson-core-asl-1.4.3.jar | Bin 0 -> 150846 bytes lib/amazon.s3/lib.required/commons-codec-1.3.jar | Bin 0 -> 46725 bytes lib/amazon.s3/lib.required/commons-httpclient-3.0.1.jar | Bin 0 -> 279781 bytes lib/amazon.s3/lib.required/commons-logging-1.1.1.jar | Bin 0 -> 60841 bytes lib/amazon.s3/lib.required/stax-1.2.0.jar | Bin 0 -> 179346 bytes lib/amazon.s3/lib.required/stax-api-1.0.1.jar | Bin 0 -> 26514 bytes lib/ant/ant-classloadertask-1.0-RC2.zip | Bin 0 -> 138143 bytes lib/ant/ant-classloadertask.jar | Bin 0 -> 70515 bytes lib/ant/ant-contrib-0.6-bin.zip | Bin 0 -> 470739 bytes lib/ant/ant-contrib-0.6.jar | Bin 0 -> 119512 bytes lib/ant/ant-jsch-1.9.2.jar | Bin 0 -> 46512 bytes lib/ant/apache-ant-1.7.1-bin.zip | Bin 0 -> 11657986 bytes lib/ant/apache/catalina-ant.jar | Bin 0 -> 27202 bytes lib/ant/apache/catalina-deployer.jar | Bin 0 -> 69029 bytes lib/ant/apache/commons-el.jar | Bin 0 -> 112341 bytes lib/ant/apache/commons-logging-1.1.1.jar | Bin 0 -> 60841 bytes lib/ant/apache/jasper-compiler.jar | Bin 0 -> 408842 bytes lib/ant/apache/jasper-runtime.jar | Bin 0 -> 77185 bytes lib/ant/apache/jsp-api.jar | Bin 0 -> 49889 bytes lib/ant/apache/servlet-api.jar | Bin 0 -> 93538 bytes lib/ant/jsch-0.1.50.jar | Bin 0 -> 249282 bytes lib/ant/jsch-0.1.50.zip | Bin 0 -> 333297 bytes lib/axis/axis.jar | Bin 0 -> 1599570 bytes lib/axis/commons-discovery-0.2.jar | Bin 0 -> 71442 bytes lib/axis/commons-logging.jar | Bin 0 -> 68107 bytes lib/axis/jaxrpc.jar | Bin 0 -> 31191 bytes lib/axis/saaj.jar | Bin 0 -> 18979 bytes lib/axis/wsdl4j.jar | Bin 0 -> 168203 bytes lib/c3p0/c3p0-0.9.2.jar | Bin 0 -> 423809 bytes lib/c3p0/mchange-commons-java-0.2.3.3.jar | Bin 0 -> 581068 bytes lib/common/activation-1.1.jar | Bin 0 -> 62983 bytes lib/common/commons-codec-1.3.jar | Bin 0 -> 46725 bytes lib/common/commons-fileupload-1.0.jar | Bin 0 -> 22379 bytes lib/common/commons-httpclient-3.0-rc1.jar | Bin 0 -> 275378 bytes lib/common/commons-logging-1.1.1.jar | Bin 0 -> 60686 bytes lib/common/itext-0.98.jar | Bin 0 -> 634158 bytes lib/common/jdom.jar | Bin 0 -> 153253 bytes lib/common/local/dbConnect_1.7.1.jar | Bin 0 -> 116787 bytes lib/common/local/dmsso_1.4.2.jar | Bin 0 -> 101517 bytes lib/common/local/jwebber_2.5.5.jar | Bin 0 -> 759097 bytes lib/common/local/kahuna5j_4.2.3.jar | Bin 0 -> 402022 bytes lib/common/local/s4_1.0.5.jar | Bin 0 -> 115697 bytes lib/common/log4j-1.2.15.jar | Bin 0 -> 391834 bytes lib/common/mail-1.4.jar | Bin 0 -> 388864 bytes lib/common/urlrewrite-2.6.0.jar | Bin 0 -> 148661 bytes lib/common/xmlwise-1_2.jar | Bin 0 -> 12176 bytes lib/gcm/gcm-server-1.0.2.jar | Bin 0 -> 19718 bytes lib/gcm/gcm-server.jar | Bin 0 -> 19679 bytes lib/gcm/json_simple-1.1.jar | Bin 0 -> 16046 bytes lib/jackson/jackson-annotations-2.2.3.jar | Bin 0 -> 33483 bytes lib/jackson/jackson-core-2.2.3.jar | Bin 0 -> 192699 bytes lib/jackson/jackson-databind-2.2.3.jar | Bin 0 -> 865838 bytes lib/java-apns/apns-0.1.5-jar-with-dependencies.jar | Bin 0 -> 1217203 bytes lib/java-apns/apns-0.1.5.jar | Bin 0 -> 44246 bytes lib/java-apns/java-apns.zip | Bin 0 -> 843672 bytes lib/jdbc/mysql-connector-java-5.0.8-bin.jar | Bin 0 -> 540852 bytes lib/uploadbean/cos.jar | Bin 0 -> 48585 bytes lib/uploadbean/fileupload.jar | Bin 0 -> 22379 bytes lib/uploadbean/struts.jar | Bin 0 -> 498051 bytes lib/uploadbean/uploadbean.jar | Bin 0 -> 32471 bytes mycredential.xml | 38 ++++++++++++++++++++++++++++++++++++++ packaging.xml | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/conf/log4j.xml | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/conf/portal_settings.xml | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/httpfileproxy_dictionary_it_IT.properties | 379 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/PortalSettings.java | 16 ++++++++++++++++ src/it/softecspa/fileproxy/DatabaseBalancer.java | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/ReverserSchema.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/cache/CacheContainer.java | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/cache/CacheElement.java | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/cache/CacheException.java | 19 +++++++++++++++++++ src/it/softecspa/fileproxy/db/ChangeLog.java | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/ClusterInfo.java | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/ConfigProperties.java | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/Log.java | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/Protocol.java | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/criterias/ChangeLogCriteria.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/criterias/ClusterInfoCriteria.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/criterias/ConfigPropertiesCriteria.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/criterias/LogCriteria.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/criterias/ProtocolCriteria.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/ChangeLogSkin.java | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/ClusterInfoSkin.java | 245 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/ConfigPropertiesSkin.java | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/LogSkin.java | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/ProtocolSkin.java | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/criterias/ChangeLogCSkin.java | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/criterias/ClusterInfoCSkin.java | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/criterias/ConfigPropertiesCSkin.java | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/criterias/LogCSkin.java | 190 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/db/skins/criterias/ProtocolCSkin.java | 162 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/HttpFileProxyService.java | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyRequest.java | 10 ++++++++++ src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyResponse.java | 8 ++++++++ src/it/softecspa/fileproxy/proxyservices/core/HttpFileProxyServiceInterfaceServlet.java | 36 ++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/AbstractHttpFileProxyManager.java | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/DeleteManager.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/DownloadManager.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/ListManager.java | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/UploadManager.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/manager/core/NullSession.java | 27 +++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/request/AbstractHttpFileProxyRequest.java | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/request/DeleteRequestType.java | 26 ++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/request/DownloadRequestType.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/request/ListRequestType.java | 34 ++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/request/UploadRequestType.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/response/AbstractHttpFileProxyResponse.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/response/DeleteResponseType.java | 5 +++++ src/it/softecspa/fileproxy/proxyservices/response/DownloadResponseType.java | 5 +++++ src/it/softecspa/fileproxy/proxyservices/response/ListResponseType.java | 8 ++++++++ src/it/softecspa/fileproxy/proxyservices/response/UploadResponseType.java | 5 +++++ src/it/softecspa/fileproxy/proxyservices/xml/output/list/FileElement.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/proxyservices/xml/output/list/ResponseROOT.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/ClusterSynchronizer.java | 676 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/HttpClazzTransformer.java | 538 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/ServerCacheFactory.java | 337 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/CheckerException.java | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/EnterpriseLog.java | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/ManagerException.java | 18 ++++++++++++++++++ src/it/softecspa/fileproxy/services/common/RemoteCallException.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/ResponseOutcome.java | 526 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/ResponseResult.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/TraceableWithIdException.java | 13 +++++++++++++ src/it/softecspa/fileproxy/services/common/UniversalStatementException.java | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/comunicator/http/Browser.java | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/comunicator/http/HttpRemote.java | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/comunicator/http/MimeType.java | 376 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/BodyResponseException.java | 10 ++++++++++ src/it/softecspa/fileproxy/services/common/core/DelayedExecution.java | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/ModeRequest.java | 9 +++++++++ src/it/softecspa/fileproxy/services/common/core/ModeResponse.java | 9 +++++++++ src/it/softecspa/fileproxy/services/common/core/MyHttpServletResponse.java | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/MyReturn.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/UniversalManager.java | 944 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/UniversalSession.java | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/UniversalStatementHttpServlet.java | 990 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/AddressableRequest.java | 17 +++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/AuthIsMandatory.java | 5 +++++ src/it/softecspa/fileproxy/services/common/core/request/EnableLoginProfileRequest.java | 9 +++++++++ src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderJSON.java | 34 ++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderXML.java | 35 +++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/JsonMapper.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/MultipartFormDataRequestReader.java | 20 ++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/OnlyStageRequest.java | 17 +++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/OutputPrintWriter.java | 20 ++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/OutputStreamWriter.java | 20 ++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/Protocollo.java | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/RemoteHostRequestInfo.java | 12 ++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/TrackRequestInfo.java | 15 +++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/UniversalAuthenticatedRequest.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/request/UniversalRequest.java | 24 ++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/AbstractDummyResponse.java | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/EmptyResponseType.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/Entry.java | 35 +++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/JsonResponse.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/JsonResponseKO.java | 23 +++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/UniversalResponse.java | 37 +++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/XMLResponseKO.java | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyBase64.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyFileAttach.java | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyHTML.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyJson.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyNull.java | 22 ++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyText.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/BodyXML.java | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBody.java | 9 +++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyJson.java | 38 ++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyXML.java | 40 ++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/core/response/body/MyBody.java | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_it.properties | 325 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_pt.properties | 324 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/ArrayCopy.java | 43 +++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/Convert.java | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/If.java | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/ImageBase64Manager.java | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/ImageResizer.java | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/Size.java | 39 +++++++++++++++++++++++++++++++++++++++ src/it/softecspa/fileproxy/util/VersionComparator.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/InitWebApp.java | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/filters/DayReportFilter.java | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/filters/ShareFilter.java | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/filters/StoreFilter.java | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/processRequest/HttpHeader.java | 11 +++++++++++ src/it/softecspa/portal/processRequest/xml/request/master/NodeInfo.java | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/processRequest/xml/request/master/NodeNotify.java | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRegistration.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRequest.java | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/security/KeyStoreImpl.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/it/softecspa/portal/security/MyPolicy.java | 29 +++++++++++++++++++++++++++++ src/it/softecspa/portal/version.xml | 12 ++++++++++++ switch.xml | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 253 files changed, 18221 insertions(+), 0 deletions(-) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/.jsdtscope create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 .settings/org.eclipse.jst.jsp.core.prefs create mode 100644 .settings/org.eclipse.wst.common.component create mode 100644 .settings/org.eclipse.wst.common.project.facet.core.xml create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.container create mode 100644 .settings/org.eclipse.wst.jsdt.ui.superType.name create mode 100644 .settings/org.eclipse.wst.ws.service.policy.prefs create mode 100644 .settings/org.hibernate.eclipse.console.prefs create mode 100644 WebContent/META-INF/LILIANA (web144db2).txt create mode 100644 WebContent/META-INF/MANIFEST.MF create mode 100644 WebContent/META-INF/context.xml create mode 100644 WebContent/WEB-INF/web.xml create mode 100644 WebContent/favicon.ico create mode 100644 builder.xml create mode 100644 conf/context_.xml create mode 100644 conf/liliana/develop/META-INF/context.xml create mode 100644 conf/liliana/develop/WEB-INF/web.xml create mode 100644 conf/liliana/develop/conf/log4j.xml create mode 100644 conf/liliana/develop/conf/portal_settings.xml create mode 100644 conf/liliana/develop/conf/sso.xml create mode 100644 conf/liliana/develop/image-pack/apple-touch-icon-ipad-76x76.png create mode 100644 conf/liliana/develop/image-pack/apple-touch-icon-ipad-retina-152x152.png create mode 100644 conf/liliana/develop/image-pack/apple-touch-icon-iphone-60x60.png create mode 100644 conf/liliana/develop/image-pack/apple-touch-icon-iphone-retina-120x120.png create mode 100644 conf/liliana/develop/image-pack/background-image.png create mode 100644 conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-76x76.png create mode 100644 conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-retina-152x152.png create mode 100644 conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-60x60.png create mode 100644 conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-retina-120x120.png create mode 100644 conf/liliana/develop/version.xml create mode 100644 conf/liliana/staging/META-INF/context.xml create mode 100644 conf/liliana/staging/WEB-INF/web.xml create mode 100644 conf/liliana/staging/conf/log4j.xml create mode 100644 conf/liliana/staging/conf/portal_settings.xml create mode 100644 conf/liliana/staging/conf/sso.xml create mode 100644 conf/liliana/staging/image-pack/apple-touch-icon-ipad-76x76.png create mode 100644 conf/liliana/staging/image-pack/apple-touch-icon-ipad-retina-152x152.png create mode 100644 conf/liliana/staging/image-pack/apple-touch-icon-iphone-60x60.png create mode 100644 conf/liliana/staging/image-pack/apple-touch-icon-iphone-retina-120x120.png create mode 100644 conf/liliana/staging/image-pack/background-image.png create mode 100644 conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-76x76.png create mode 100644 conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-retina-152x152.png create mode 100644 conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-60x60.png create mode 100644 conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-retina-120x120.png create mode 100644 conf/liliana/staging/version.xml create mode 100644 conf/log4j.dtd create mode 100644 conf/myMETA-INF/context-jcluster-web77db12.xml create mode 100644 conf/myMETA-INF/context-liliana-web144db2.xml create mode 100644 conf/version.properties create mode 100644 conf/version.xml create mode 100644 conf/web.xml create mode 100644 database/change_in_progress/20140623 http file proxy.sql create mode 100644 deployer-script.xml create mode 100644 deployer.xml create mode 100644 lib/amazon.s3/aws-java-sdk-1.0.11-javadoc.jar create mode 100644 lib/amazon.s3/aws-java-sdk-1.0.11-sources.jar create mode 100644 lib/amazon.s3/aws-java-sdk-1.0.11.jar create mode 100644 lib/amazon.s3/lib.removed/jackson-core-asl-1.4.3.jar create mode 100644 lib/amazon.s3/lib.required/commons-codec-1.3.jar create mode 100644 lib/amazon.s3/lib.required/commons-httpclient-3.0.1.jar create mode 100644 lib/amazon.s3/lib.required/commons-logging-1.1.1.jar create mode 100644 lib/amazon.s3/lib.required/stax-1.2.0.jar create mode 100644 lib/amazon.s3/lib.required/stax-api-1.0.1.jar create mode 100644 lib/ant/ant-classloadertask-1.0-RC2.zip create mode 100644 lib/ant/ant-classloadertask.jar create mode 100644 lib/ant/ant-contrib-0.6-bin.zip create mode 100644 lib/ant/ant-contrib-0.6.jar create mode 100644 lib/ant/ant-jsch-1.9.2.jar create mode 100644 lib/ant/apache-ant-1.7.1-bin.zip create mode 100644 lib/ant/apache/catalina-ant.jar create mode 100644 lib/ant/apache/catalina-deployer.jar create mode 100644 lib/ant/apache/commons-el.jar create mode 100644 lib/ant/apache/commons-logging-1.1.1.jar create mode 100644 lib/ant/apache/jasper-compiler.jar create mode 100644 lib/ant/apache/jasper-runtime.jar create mode 100644 lib/ant/apache/jsp-api.jar create mode 100644 lib/ant/apache/servlet-api.jar create mode 100644 lib/ant/jsch-0.1.50.jar create mode 100644 lib/ant/jsch-0.1.50.zip create mode 100644 lib/axis/axis.jar create mode 100644 lib/axis/commons-discovery-0.2.jar create mode 100644 lib/axis/commons-logging.jar create mode 100644 lib/axis/jaxrpc.jar create mode 100644 lib/axis/saaj.jar create mode 100644 lib/axis/wsdl4j.jar create mode 100644 lib/c3p0/c3p0-0.9.2.jar create mode 100644 lib/c3p0/mchange-commons-java-0.2.3.3.jar create mode 100644 lib/common/activation-1.1.jar create mode 100644 lib/common/commons-codec-1.3.jar create mode 100644 lib/common/commons-fileupload-1.0.jar create mode 100644 lib/common/commons-httpclient-3.0-rc1.jar create mode 100644 lib/common/commons-logging-1.1.1.jar create mode 100644 lib/common/itext-0.98.jar create mode 100644 lib/common/jdom.jar create mode 100644 lib/common/local/dbConnect_1.7.1.jar create mode 100644 lib/common/local/dmsso_1.4.2.jar create mode 100644 lib/common/local/jwebber_2.5.5.jar create mode 100644 lib/common/local/kahuna5j_4.2.3.jar create mode 100644 lib/common/local/s4_1.0.5.jar create mode 100644 lib/common/log4j-1.2.15.jar create mode 100644 lib/common/mail-1.4.jar create mode 100644 lib/common/urlrewrite-2.6.0.jar create mode 100644 lib/common/xmlwise-1_2.jar create mode 100644 lib/gcm/gcm-server-1.0.2.jar create mode 100644 lib/gcm/gcm-server.jar create mode 100644 lib/gcm/json_simple-1.1.jar create mode 100644 lib/jackson/jackson-annotations-2.2.3.jar create mode 100644 lib/jackson/jackson-core-2.2.3.jar create mode 100644 lib/jackson/jackson-databind-2.2.3.jar create mode 100644 lib/java-apns/apns-0.1.5-jar-with-dependencies.jar create mode 100644 lib/java-apns/apns-0.1.5.jar create mode 100644 lib/java-apns/java-apns.zip create mode 100644 lib/jdbc/mysql-connector-java-5.0.8-bin.jar create mode 100644 lib/uploadbean/cos.jar create mode 100644 lib/uploadbean/fileupload.jar create mode 100644 lib/uploadbean/struts.jar create mode 100644 lib/uploadbean/uploadbean.jar create mode 100644 mycredential.xml create mode 100644 packaging.xml create mode 100644 src/conf/log4j.xml create mode 100644 src/conf/portal_settings.xml create mode 100644 src/httpfileproxy_dictionary_it_IT.properties create mode 100644 src/it/softecspa/PortalSettings.java create mode 100644 src/it/softecspa/fileproxy/DatabaseBalancer.java create mode 100644 src/it/softecspa/fileproxy/ReverserSchema.java create mode 100644 src/it/softecspa/fileproxy/cache/CacheContainer.java create mode 100644 src/it/softecspa/fileproxy/cache/CacheElement.java create mode 100644 src/it/softecspa/fileproxy/cache/CacheException.java create mode 100644 src/it/softecspa/fileproxy/db/ChangeLog.java create mode 100644 src/it/softecspa/fileproxy/db/ClusterInfo.java create mode 100644 src/it/softecspa/fileproxy/db/ConfigProperties.java create mode 100644 src/it/softecspa/fileproxy/db/Log.java create mode 100644 src/it/softecspa/fileproxy/db/Protocol.java create mode 100644 src/it/softecspa/fileproxy/db/criterias/ChangeLogCriteria.java create mode 100644 src/it/softecspa/fileproxy/db/criterias/ClusterInfoCriteria.java create mode 100644 src/it/softecspa/fileproxy/db/criterias/ConfigPropertiesCriteria.java create mode 100644 src/it/softecspa/fileproxy/db/criterias/LogCriteria.java create mode 100644 src/it/softecspa/fileproxy/db/criterias/ProtocolCriteria.java create mode 100644 src/it/softecspa/fileproxy/db/skins/ChangeLogSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/ClusterInfoSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/ConfigPropertiesSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/LogSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/ProtocolSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/criterias/ChangeLogCSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/criterias/ClusterInfoCSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/criterias/ConfigPropertiesCSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/criterias/LogCSkin.java create mode 100644 src/it/softecspa/fileproxy/db/skins/criterias/ProtocolCSkin.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/HttpFileProxyService.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyRequest.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyResponse.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/core/HttpFileProxyServiceInterfaceServlet.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/AbstractHttpFileProxyManager.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/DeleteManager.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/DownloadManager.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/ListManager.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/UploadManager.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/manager/core/NullSession.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/request/AbstractHttpFileProxyRequest.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/request/DeleteRequestType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/request/DownloadRequestType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/request/ListRequestType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/request/UploadRequestType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/response/AbstractHttpFileProxyResponse.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/response/DeleteResponseType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/response/DownloadResponseType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/response/ListResponseType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/response/UploadResponseType.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/xml/output/list/FileElement.java create mode 100644 src/it/softecspa/fileproxy/proxyservices/xml/output/list/ResponseROOT.java create mode 100644 src/it/softecspa/fileproxy/services/ClusterSynchronizer.java create mode 100644 src/it/softecspa/fileproxy/services/HttpClazzTransformer.java create mode 100644 src/it/softecspa/fileproxy/services/ServerCacheFactory.java create mode 100644 src/it/softecspa/fileproxy/services/common/CheckerException.java create mode 100644 src/it/softecspa/fileproxy/services/common/EnterpriseLog.java create mode 100644 src/it/softecspa/fileproxy/services/common/ManagerException.java create mode 100644 src/it/softecspa/fileproxy/services/common/RemoteCallException.java create mode 100644 src/it/softecspa/fileproxy/services/common/ResponseOutcome.java create mode 100644 src/it/softecspa/fileproxy/services/common/ResponseResult.java create mode 100644 src/it/softecspa/fileproxy/services/common/TraceableWithIdException.java create mode 100644 src/it/softecspa/fileproxy/services/common/UniversalStatementException.java create mode 100644 src/it/softecspa/fileproxy/services/common/comunicator/http/Browser.java create mode 100644 src/it/softecspa/fileproxy/services/common/comunicator/http/HttpRemote.java create mode 100644 src/it/softecspa/fileproxy/services/common/comunicator/http/MimeType.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/BodyResponseException.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/DelayedExecution.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/ModeRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/ModeResponse.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/MyHttpServletResponse.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/MyReturn.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/UniversalManager.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/UniversalSession.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/UniversalStatementHttpServlet.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/AddressableRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/AuthIsMandatory.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/EnableLoginProfileRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderJSON.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderXML.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/JsonMapper.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/MultipartFormDataRequestReader.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/OnlyStageRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/OutputPrintWriter.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/OutputStreamWriter.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/Protocollo.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/RemoteHostRequestInfo.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/TrackRequestInfo.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/UniversalAuthenticatedRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/request/UniversalRequest.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/AbstractDummyResponse.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/EmptyResponseType.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/Entry.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/JsonResponse.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/JsonResponseKO.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/UniversalResponse.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/XMLResponseKO.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyBase64.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyFileAttach.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyHTML.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyJson.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyNull.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyText.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/BodyXML.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBody.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyJson.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyXML.java create mode 100644 src/it/softecspa/fileproxy/services/common/core/response/body/MyBody.java create mode 100644 src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties create mode 100644 src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_it.properties create mode 100644 src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_pt.properties create mode 100644 src/it/softecspa/fileproxy/util/ArrayCopy.java create mode 100644 src/it/softecspa/fileproxy/util/Convert.java create mode 100644 src/it/softecspa/fileproxy/util/If.java create mode 100644 src/it/softecspa/fileproxy/util/ImageBase64Manager.java create mode 100644 src/it/softecspa/fileproxy/util/ImageResizer.java create mode 100644 src/it/softecspa/fileproxy/util/Size.java create mode 100644 src/it/softecspa/fileproxy/util/VersionComparator.java create mode 100644 src/it/softecspa/portal/InitWebApp.java create mode 100644 src/it/softecspa/portal/filters/DayReportFilter.java create mode 100644 src/it/softecspa/portal/filters/ShareFilter.java create mode 100644 src/it/softecspa/portal/filters/StoreFilter.java create mode 100644 src/it/softecspa/portal/processRequest/HttpHeader.java create mode 100644 src/it/softecspa/portal/processRequest/xml/request/master/NodeInfo.java create mode 100644 src/it/softecspa/portal/processRequest/xml/request/master/NodeNotify.java create mode 100644 src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRegistration.java create mode 100644 src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRequest.java create mode 100644 src/it/softecspa/portal/security/KeyStoreImpl.java create mode 100644 src/it/softecspa/portal/security/MyPolicy.java create mode 100644 src/it/softecspa/portal/version.xml create mode 100644 switch.xml diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..72c10d3 --- /dev/null +++ b/.classpath @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..5874a7d --- /dev/null +++ b/.project @@ -0,0 +1,36 @@ + + + FileProxyServer + + + + + + org.eclipse.wst.jsdt.core.javascriptValidator + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/.settings/.jsdtscope b/.settings/.jsdtscope new file mode 100644 index 0000000..f40dd98 --- /dev/null +++ b/.settings/.jsdtscope @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..b5f4951 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/CoopvoceAppBike.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/CoopvoceAppBikeLocator.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/CoopvoceAppBikeService.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/CoopvoceAppBikeServicePortBindingStub.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/EsitoBonus.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/EsitoCoopVoce.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/EsitoReport.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/Promozione.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/RichiestaBonus.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/RichiestaCoopVoce.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/RichiestaReport.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/TypeBonus.java=UTF-8 +encoding//src.wsdl/it/coop/coopitalia/coopvoceappbike/ws/TypeKM.java=UTF-8 +encoding//src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties=ISO-8859-1 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..54e493c --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/.settings/org.eclipse.jst.jsp.core.prefs b/.settings/org.eclipse.jst.jsp.core.prefs new file mode 100644 index 0000000..6bdcd18 --- /dev/null +++ b/.settings/org.eclipse.jst.jsp.core.prefs @@ -0,0 +1,31 @@ +eclipse.preferences.version=1 +validateFragments=false +validation.actions-missing-required-attribute=1 +validation.actions-non-empty-inline-tag=2 +validation.actions-unexpected-rtexprvalue=2 +validation.actions-unknown-attribute=2 +validation.directive-attribute-duplicate=1 +validation.directive-include-fragment-file-not-found=1 +validation.directive-include-fragment-file-not-specified=1 +validation.directive-taglib-duplicate-prefixes-different-uris=1 +validation.directive-taglib-duplicate-prefixes-same-uris=-1 +validation.directive-taglib-missing-prefix=1 +validation.directive-taglib-missing-uri-or-tagdir=1 +validation.directive-taglib-unresolvable-uri-or-tagdir=1 +validation.el-function-undefined=1 +validation.el-general-syntax=1 +validation.el-lexical-failure=-1 +validation.java-=-1 +validation.java-local-variable-is-never-used=-1 +validation.java-null-local-variable-reference=-1 +validation.java-potential-null-local-variable-reference=-1 +validation.java-unused-import=-1 +validation.translation-tag-class-not-found=2 +validation.translation-tei-class-not-found=2 +validation.translation-tei-class-not-instantiated=2 +validation.translation-tei-class-runtime-exception=2 +validation.translation-tei-message=1 +validation.translation-usebean-ambiguous-type-info=2 +validation.translation-usebean-invalid-id=1 +validation.translation-usebean-missing-type-info=1 +validation.use-project-settings=true diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..f86e323 --- /dev/null +++ b/.settings/org.eclipse.wst.common.component @@ -0,0 +1,17 @@ + + + + + + uses + + + uses + + + uses + + + + + diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..c220802 --- /dev/null +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.container b/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/.settings/org.eclipse.wst.jsdt.ui.superType.name b/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/.settings/org.eclipse.wst.ws.service.policy.prefs b/.settings/org.eclipse.wst.ws.service.policy.prefs new file mode 100644 index 0000000..6da2f3d --- /dev/null +++ b/.settings/org.eclipse.wst.ws.service.policy.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.wst.ws.service.policy.projectEnabled=false diff --git a/.settings/org.hibernate.eclipse.console.prefs b/.settings/org.hibernate.eclipse.console.prefs new file mode 100644 index 0000000..57f6ff3 --- /dev/null +++ b/.settings/org.hibernate.eclipse.console.prefs @@ -0,0 +1,4 @@ +#Wed May 12 16:33:38 CEST 2010 +default.configuration= +eclipse.preferences.version=1 +hibernate3.enabled=false diff --git a/WebContent/META-INF/LILIANA (web144db2).txt b/WebContent/META-INF/LILIANA (web144db2).txt new file mode 100644 index 0000000..bc0e4dc --- /dev/null +++ b/WebContent/META-INF/LILIANA (web144db2).txt @@ -0,0 +1 @@ +context.xml from D:\Sviluppo\Desktopmate\FileProxyServer/conf/myMETA-INF/context-liliana-web144db2.xml \ No newline at end of file diff --git a/WebContent/META-INF/MANIFEST.MF b/WebContent/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e94951 --- /dev/null +++ b/WebContent/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/WebContent/META-INF/context.xml b/WebContent/META-INF/context.xml new file mode 100644 index 0000000..2fac333 --- /dev/null +++ b/WebContent/META-INF/context.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + WEB-INF/web.xml + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml new file mode 100644 index 0000000..ac0122b --- /dev/null +++ b/WebContent/WEB-INF/web.xml @@ -0,0 +1,133 @@ + + + FileProxy @version.number@ (@build.number@) - @build.installation@ [@build.date@] + + + + + com.newrelic.agent.APPLICATION_NAME + @new.relic@ + + + + + + ErrorPage + /error.jsp + + + constantsFile + portal_settings.xml + + + logPropertyFile + log4j.xml + + + + defaultLanguage + it + + + + + SessionFactory + it.softecspa.jwebber.frameworkImpl.session.CMSImplSessionFactory + + + + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.CMSImplSecurityManager + + + + + accessLogWhat + ,*, + + + + + mailServer + localhost + + + + + keyStore + it.softecspa.portal.security.KeyStoreImpl + + + + + + + WebApp + it.softecspa.portal.InitWebApp + 1 + + + WebApp + /WebApp + + + + + + Servlet http file proxy + httpFileProxy-Statement Servlet + httpFileProxyServlet + it.softecspa.fileproxy.proxyservices.HttpFileProxyService + + + httpFileProxyServlet + /proxy-services/statement + + + + + + + Servlet di monitoraggio standard + Monitor Servlet + Monitor + it.softecspa.portal.Monitor + + + Monitor + /monitor + + + + + + + 15 + + + + html + text/html + + + + dtd + text/plain + + + + + + + + + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + diff --git a/WebContent/favicon.ico b/WebContent/favicon.ico new file mode 100644 index 0000000..379fa0b Binary files /dev/null and b/WebContent/favicon.ico differ diff --git a/builder.xml b/builder.xml new file mode 100644 index 0000000..16c8592 --- /dev/null +++ b/builder.xml @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Eclipse refresh in progress... + + + Eclipse refreshed! + + + + Per funzionare deve essere impostato il seguente flag in "External tool configuration" + JRE > Run in the same JRE as the workspace + + + + + + + + + + + + + + Include ANT-contrib jar + + + + + + + + + + + + Include JSCH jar + + + + + + + \ No newline at end of file diff --git a/conf/context_.xml b/conf/context_.xml new file mode 100644 index 0000000..9334a1a --- /dev/null +++ b/conf/context_.xml @@ -0,0 +1,61 @@ + + + + + WEB-INF/web.xml + + + + + + + + + + + \ No newline at end of file diff --git a/conf/liliana/develop/META-INF/context.xml b/conf/liliana/develop/META-INF/context.xml new file mode 100644 index 0000000..30f538a --- /dev/null +++ b/conf/liliana/develop/META-INF/context.xml @@ -0,0 +1,62 @@ + + + + + WEB-INF/web.xml + + + + + + + + + + + + \ No newline at end of file diff --git a/conf/liliana/develop/WEB-INF/web.xml b/conf/liliana/develop/WEB-INF/web.xml new file mode 100644 index 0000000..5e74ddd --- /dev/null +++ b/conf/liliana/develop/WEB-INF/web.xml @@ -0,0 +1,471 @@ + + + DesktopMate + Jarvis console 2.10.16 (1814) - liliana/develop [05/06/2014 11:39] + + + + + + ErrorPage + /error.jsp + + + constantsFile + portal_settings.xml + + + logPropertyFile + log4j.xml + + + + defaultLanguage + it + + + + + SessionFactory + it.softecspa.jwebber.frameworkImpl.session.CMSImplSessionFactory + + + + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.CMSImplSecurityManager + + + + + accessLogWhat + ,*, + + + + + mailServer + moon.softecspa.it + + + + + keyStore + it.softecspa.portal.security.KeyStoreImpl + + + + + + urlRewrite-DayReportFilter + it.softecspa.portal.filters.DayReportFilter + + + urlRewrite-DayReportFilter + /dailyreport/* + + + + + + urlRewrite-StoreFilter + it.softecspa.portal.filters.StoreFilter + + + urlRewrite-StoreFilter + /store/* + + + + + + urlRewrite-ShareFilter + it.softecspa.portal.filters.ShareFilter + + + urlRewrite-ShareFilter + /share/* + + + + + + + + + + + Mark2 + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + mark-II + + + ProcessRequest + it.softecspa.portal.processRequest.Mark2PR + + + ErrorJsp + /error.jsp + + + + + Mark2 + /jarvis + + + + + + BackdoorPanel + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + backdoor-panel + + + ProcessRequest + it.softecspa.portal.processRequest.BackdoorPR + + + ErrorJsp + /error.jsp + + + + + BackdoorPanel + /backdoor-panel + + + + BackdoorPanel + /jarvis1 + + + + + + ServicesStatus + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-status + + + ProcessRequest + it.softecspa.portal.processRequest.BackdoorPR + + + ErrorJsp + /error.jsp + + + + + ServicesStatus + /services-status + + + + + + + MasterSlave + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + master-slave + + + ProcessRequest + it.softecspa.portal.processRequest.MasterSlavePR + + + ErrorJsp + /error.jsp + + + + MasterSlave + /master-slave + + + + + + ServicesSynchro + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-synchro + + + ProcessRequest + it.softecspa.portal.processRequest.ServicesSynchroPR + + + ErrorJsp + /error.jsp + + + + ServicesSynchro + /services-synchro + + + + + + ServicesImages + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-images + + + ProcessRequest + it.softecspa.portal.processRequest.ServicesImagesPR + + + ErrorJsp + /error.jsp + + + + ServicesImages + /services-images + + + + + + WebApp + it.softecspa.portal.InitWebApp + 1 + + + WebApp + /WebApp + + + + + + + Servlet utilizzata per la gestione dei downloade dello store + Store Service Servlet + StoreServiceServlet + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + store + + + ProcessRequest + it.softecspa.portal.processRequest.StorePR + + + ErrorJsp + /error.jsp + + + + + StoreServiceServlet + /store + + + + + + Servlet utilizzata per la comunicazione tra server e device + Device-Statement Servlet + DeviceStatementServlet + it.softecspa.desktopmate.deviceservices.DeviceStatement + + + DeviceStatementServlet + /services-post/statement + + + + + + Servlet utilizzata per la notifica dei pagamenti eseguiti in remoto + Renewal Notification Servlet + NotifyRemoteRenewal + it.softecspa.desktopmate.otherservices.NotifyRemoteRenewal + + + NotifyRemoteRenewal + /notify + + + + + + Servlet utilizzata per la gestione remota dei serivzi push + Push-Statement Servlet + PushStatementServlet + it.softecspa.desktopmate.pushservices.PushStatement + + + PushStatementServlet + /services-push/statement + + + + + + Servlet utilizzata per la gestione dei servizi amministrativi + Auth-Statement Servlet + AuthStatementServlet + it.softecspa.desktopmate.authservices.AuthStatement + + + AuthStatementServlet + /authentication-service/statement + + + + + + Servlet utilizzata per la esportazione dei dati + Exporter-Statement Servlet + ExporterStatementServlet + it.softecspa.desktopmate.connectors.ExporterStatement + + + ExporterStatementServlet + /connector-export/statement + + + + + + Servlet di portale servizi con autenticazione + Portal-Statement (authenticated) Servlet + AuthPortalStatementServlet + it.softecspa.desktopmate.portalservices.auth.AuthenticatedStatement + + + AuthPortalStatementServlet + /portal-service/statement + + + + + + Servlet di portale servizi + Portal-Statement (guest) Servlet + GuestPortalStatementServlet + it.softecspa.desktopmate.portalservices.guest.GuestStatement + + + GuestPortalStatementServlet + /portal-service-guest/statement + + + + + + Servlet collegamento con MyDesktopmate + MyDesktopmate-Statement Servlet + MyDesktopmateStatementServlet + it.softecspa.desktopmate.my.services.ConnectorStatement + + + MyDesktopmateStatementServlet + /mydesktopmate-service/statement + + + + + + + + Servlet di monitoraggio standard + Monitor Servlet + Monitor + it.softecspa.portal.Monitor + + + Monitor + /monitor + + + + + + + 30 + + + + html + text/html + + + + dtd + text/plain + + + + + + + + + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + diff --git a/conf/liliana/develop/conf/log4j.xml b/conf/liliana/develop/conf/log4j.xml new file mode 100644 index 0000000..30d86dd --- /dev/null +++ b/conf/liliana/develop/conf/log4j.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/liliana/develop/conf/portal_settings.xml b/conf/liliana/develop/conf/portal_settings.xml new file mode 100644 index 0000000..6333e42 --- /dev/null +++ b/conf/liliana/develop/conf/portal_settings.xml @@ -0,0 +1,106 @@ + + + + Applicazione DesktopaMate 2.0 - sviluppo + + + jdbc/dm-stage#MYSQL + + + + jdbc/dm-master#MYSQL,jdbc/dm-stage#MYSQL + + + + + + web103.${hostname}.cluster-liliana.aws.softecspa.it:8180 + web103.${hostname}.cluster-liliana.aws.backplane.softecspa.it:8180 + + #F0DF25 + + service.dev.desktopmate.net + + + + + + + + DesktopMate + + + dmservice + sviluppo + + en + http://service.dev.desktopmate.net + + + true + DOWNLOADER + + + SA + + + dd/MM/yyyy HH:mm:ss + dd/MM/yyyy + + + + SA + ADMIN + + + + false + + + + true + + + localhost + + + + + dm-web103-service.liliana@desktopmate.net + massimiliano.veroni@softecspa.it + + + DesktopMate - web103 - liliana - + + + false + + + true + + + true + + + true + + + false + + + + + \ No newline at end of file diff --git a/conf/liliana/develop/conf/sso.xml b/conf/liliana/develop/conf/sso.xml new file mode 100644 index 0000000..5e67ac4 --- /dev/null +++ b/conf/liliana/develop/conf/sso.xml @@ -0,0 +1,35 @@ + + + + Configurazione SSO DNA + + true + + + + dmservice + d1906cca-d858-4420-ba54-f8c0984883bd + userinfo + SOFTEC + + http://dmsso.dev.desktopmate.net/dmsso + 9c5a523d-e3b1-4611-968b-c0e9207394fa:a9eaecee-387e-43ff-84ae-e2d77d3e4d1b + + + ${oauth2.server}/oauth2/authorize + ${oauth2.server}/oauth2/token + ${oauth2.server}/v1/tokeninfo + ${oauth2.server}/v1/userinfo + ${oauth2.server}/admin + ${oauth2.server}/logout + + + ${autourl} + ${autourl}?sso_status=LOGOUT + ${autourl}?sso_status=ERROR + + \ No newline at end of file diff --git a/conf/liliana/develop/image-pack/apple-touch-icon-ipad-76x76.png b/conf/liliana/develop/image-pack/apple-touch-icon-ipad-76x76.png new file mode 100644 index 0000000..fffc196 Binary files /dev/null and b/conf/liliana/develop/image-pack/apple-touch-icon-ipad-76x76.png differ diff --git a/conf/liliana/develop/image-pack/apple-touch-icon-ipad-retina-152x152.png b/conf/liliana/develop/image-pack/apple-touch-icon-ipad-retina-152x152.png new file mode 100644 index 0000000..39acd17 Binary files /dev/null and b/conf/liliana/develop/image-pack/apple-touch-icon-ipad-retina-152x152.png differ diff --git a/conf/liliana/develop/image-pack/apple-touch-icon-iphone-60x60.png b/conf/liliana/develop/image-pack/apple-touch-icon-iphone-60x60.png new file mode 100644 index 0000000..ab8c2a7 Binary files /dev/null and b/conf/liliana/develop/image-pack/apple-touch-icon-iphone-60x60.png differ diff --git a/conf/liliana/develop/image-pack/apple-touch-icon-iphone-retina-120x120.png b/conf/liliana/develop/image-pack/apple-touch-icon-iphone-retina-120x120.png new file mode 100644 index 0000000..aeda664 Binary files /dev/null and b/conf/liliana/develop/image-pack/apple-touch-icon-iphone-retina-120x120.png differ diff --git a/conf/liliana/develop/image-pack/background-image.png b/conf/liliana/develop/image-pack/background-image.png new file mode 100644 index 0000000..554ce10 Binary files /dev/null and b/conf/liliana/develop/image-pack/background-image.png differ diff --git a/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-76x76.png b/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-76x76.png new file mode 100644 index 0000000..b909a23 Binary files /dev/null and b/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-76x76.png differ diff --git a/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-retina-152x152.png b/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-retina-152x152.png new file mode 100644 index 0000000..8c4cda3 Binary files /dev/null and b/conf/liliana/develop/image-pack/store/apple-touch-icon-ipad-retina-152x152.png differ diff --git a/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-60x60.png b/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-60x60.png new file mode 100644 index 0000000..2b9fb69 Binary files /dev/null and b/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-60x60.png differ diff --git a/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-retina-120x120.png b/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-retina-120x120.png new file mode 100644 index 0000000..c7f3113 Binary files /dev/null and b/conf/liliana/develop/image-pack/store/apple-touch-icon-iphone-retina-120x120.png differ diff --git a/conf/liliana/develop/version.xml b/conf/liliana/develop/version.xml new file mode 100644 index 0000000..3deb8f9 --- /dev/null +++ b/conf/liliana/develop/version.xml @@ -0,0 +1,12 @@ + + + + Version information + + 2.10.16 + + 1814 + 05/06/2014 11:39 + liliana/develop + + diff --git a/conf/liliana/staging/META-INF/context.xml b/conf/liliana/staging/META-INF/context.xml new file mode 100644 index 0000000..8268f17 --- /dev/null +++ b/conf/liliana/staging/META-INF/context.xml @@ -0,0 +1,62 @@ + + + + + WEB-INF/web.xml + + + + + + + + + + + + \ No newline at end of file diff --git a/conf/liliana/staging/WEB-INF/web.xml b/conf/liliana/staging/WEB-INF/web.xml new file mode 100644 index 0000000..1168422 --- /dev/null +++ b/conf/liliana/staging/WEB-INF/web.xml @@ -0,0 +1,471 @@ + + + DesktopMate + Jarvis console 2.10.18 (1820) - liliana/staging [13/06/2014 12:30] + + + + + + ErrorPage + /error.jsp + + + constantsFile + portal_settings.xml + + + logPropertyFile + log4j.xml + + + + defaultLanguage + it + + + + + SessionFactory + it.softecspa.jwebber.frameworkImpl.session.CMSImplSessionFactory + + + + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.CMSImplSecurityManager + + + + + accessLogWhat + ,*, + + + + + mailServer + moon.softecspa.it + + + + + keyStore + it.softecspa.portal.security.KeyStoreImpl + + + + + + urlRewrite-DayReportFilter + it.softecspa.portal.filters.DayReportFilter + + + urlRewrite-DayReportFilter + /dailyreport/* + + + + + + urlRewrite-StoreFilter + it.softecspa.portal.filters.StoreFilter + + + urlRewrite-StoreFilter + /store/* + + + + + + urlRewrite-ShareFilter + it.softecspa.portal.filters.ShareFilter + + + urlRewrite-ShareFilter + /share/* + + + + + + + + + + + Mark2 + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + mark-II + + + ProcessRequest + it.softecspa.portal.processRequest.Mark2PR + + + ErrorJsp + /error.jsp + + + + + Mark2 + /jarvis + + + + + + BackdoorPanel + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + backdoor-panel + + + ProcessRequest + it.softecspa.portal.processRequest.BackdoorPR + + + ErrorJsp + /error.jsp + + + + + BackdoorPanel + /backdoor-panel + + + + BackdoorPanel + /jarvis1 + + + + + + ServicesStatus + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-status + + + ProcessRequest + it.softecspa.portal.processRequest.BackdoorPR + + + ErrorJsp + /error.jsp + + + + + ServicesStatus + /services-status + + + + + + + MasterSlave + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + master-slave + + + ProcessRequest + it.softecspa.portal.processRequest.MasterSlavePR + + + ErrorJsp + /error.jsp + + + + MasterSlave + /master-slave + + + + + + ServicesSynchro + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-synchro + + + ProcessRequest + it.softecspa.portal.processRequest.ServicesSynchroPR + + + ErrorJsp + /error.jsp + + + + ServicesSynchro + /services-synchro + + + + + + ServicesImages + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager + + + servletCode + services-images + + + ProcessRequest + it.softecspa.portal.processRequest.ServicesImagesPR + + + ErrorJsp + /error.jsp + + + + ServicesImages + /services-images + + + + + + WebApp + it.softecspa.portal.InitWebApp + 1 + + + WebApp + /WebApp + + + + + + + Servlet utilizzata per la gestione dei downloade dello store + Store Service Servlet + StoreServiceServlet + it.softecspa.mvc.MVCGenericServlet + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.DMSsoSecurityManager + + + servletCode + store + + + ProcessRequest + it.softecspa.portal.processRequest.StorePR + + + ErrorJsp + /error.jsp + + + + + StoreServiceServlet + /store + + + + + + Servlet utilizzata per la comunicazione tra server e device + Device-Statement Servlet + DeviceStatementServlet + it.softecspa.desktopmate.deviceservices.DeviceStatement + + + DeviceStatementServlet + /services-post/statement + + + + + + Servlet utilizzata per la notifica dei pagamenti eseguiti in remoto + Renewal Notification Servlet + NotifyRemoteRenewal + it.softecspa.desktopmate.otherservices.NotifyRemoteRenewal + + + NotifyRemoteRenewal + /notify + + + + + + Servlet utilizzata per la gestione remota dei serivzi push + Push-Statement Servlet + PushStatementServlet + it.softecspa.desktopmate.pushservices.PushStatement + + + PushStatementServlet + /services-push/statement + + + + + + Servlet utilizzata per la gestione dei servizi amministrativi + Auth-Statement Servlet + AuthStatementServlet + it.softecspa.desktopmate.authservices.AuthStatement + + + AuthStatementServlet + /authentication-service/statement + + + + + + Servlet utilizzata per la esportazione dei dati + Exporter-Statement Servlet + ExporterStatementServlet + it.softecspa.desktopmate.connectors.ExporterStatement + + + ExporterStatementServlet + /connector-export/statement + + + + + + Servlet di portale servizi con autenticazione + Portal-Statement (authenticated) Servlet + AuthPortalStatementServlet + it.softecspa.desktopmate.portalservices.auth.AuthenticatedStatement + + + AuthPortalStatementServlet + /portal-service/statement + + + + + + Servlet di portale servizi + Portal-Statement (guest) Servlet + GuestPortalStatementServlet + it.softecspa.desktopmate.portalservices.guest.GuestStatement + + + GuestPortalStatementServlet + /portal-service-guest/statement + + + + + + Servlet collegamento con MyDesktopmate + MyDesktopmate-Statement Servlet + MyDesktopmateStatementServlet + it.softecspa.desktopmate.my.services.ConnectorStatement + + + MyDesktopmateStatementServlet + /mydesktopmate-service/statement + + + + + + + + Servlet di monitoraggio standard + Monitor Servlet + Monitor + it.softecspa.portal.Monitor + + + Monitor + /monitor + + + + + + + 30 + + + + html + text/html + + + + dtd + text/plain + + + + + + + + + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + diff --git a/conf/liliana/staging/conf/log4j.xml b/conf/liliana/staging/conf/log4j.xml new file mode 100644 index 0000000..88589a8 --- /dev/null +++ b/conf/liliana/staging/conf/log4j.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/liliana/staging/conf/portal_settings.xml b/conf/liliana/staging/conf/portal_settings.xml new file mode 100644 index 0000000..7504efa --- /dev/null +++ b/conf/liliana/staging/conf/portal_settings.xml @@ -0,0 +1,104 @@ + + + + Applicazione DesktopaMate 2.0 - staging + + + jdbc/dm-stage#MYSQL + + + + jdbc/dm-master#MYSQL,jdbc/dm-stage#MYSQL + + + + + + web124.${hostname}.cluster-liliana.aws.softecspa.it:8180 + web124.${hostname}.cluster-liliana.aws.backplane.softecspa.it:8180 + + #44F025 + + stage-service.dev.desktopmate.net + + + + + + + + DesktopMate (Staging version) + + + dmservice + staging + + en + http://stage-service.dev.desktopmate.net + + + true + DOWNLOADER + + + SA + + + dd/MM/yyyy HH:mm:ss + dd/MM/yyyy + + + + SA + ADMIN + + + + + true + + + localhost + + + + + dm-web124-service@desktopmate.net + massimiliano.veroni@softecspa.it + + + DesktopMate - web124 - + + + false + + + true + + + true + + + false + + + true + + + + + + \ No newline at end of file diff --git a/conf/liliana/staging/conf/sso.xml b/conf/liliana/staging/conf/sso.xml new file mode 100644 index 0000000..b756619 --- /dev/null +++ b/conf/liliana/staging/conf/sso.xml @@ -0,0 +1,31 @@ + + + + Configurazione SSO DNA + + true + dev.desktopmate.net + + + dmservice + d1906cca-d858-4420-ba54-f8c0984883bd + userinfo + SOFTEC + + http://dmsso.dev.desktopmate.net/dmsso + 9c5a523d-e3b1-4611-968b-c0e9207394fa:a9eaecee-387e-43ff-84ae-e2d77d3e4d1b + + + ${oauth2.server}/oauth2/authorize + ${oauth2.server}/oauth2/token + ${oauth2.server}/v1/tokeninfo + ${oauth2.server}/v1/userinfo + ${oauth2.server}/admin + ${oauth2.server}/logout + + + http://stage-service.dev.desktopmate.net/jarvis + http://stage-service.dev.desktopmate.net/jarvis?sso_status=LOGOUT + http://stage-service.dev.desktopmate.net/jarvis?sso_status=ERROR + + \ No newline at end of file diff --git a/conf/liliana/staging/image-pack/apple-touch-icon-ipad-76x76.png b/conf/liliana/staging/image-pack/apple-touch-icon-ipad-76x76.png new file mode 100644 index 0000000..c4a8d06 Binary files /dev/null and b/conf/liliana/staging/image-pack/apple-touch-icon-ipad-76x76.png differ diff --git a/conf/liliana/staging/image-pack/apple-touch-icon-ipad-retina-152x152.png b/conf/liliana/staging/image-pack/apple-touch-icon-ipad-retina-152x152.png new file mode 100644 index 0000000..7270483 Binary files /dev/null and b/conf/liliana/staging/image-pack/apple-touch-icon-ipad-retina-152x152.png differ diff --git a/conf/liliana/staging/image-pack/apple-touch-icon-iphone-60x60.png b/conf/liliana/staging/image-pack/apple-touch-icon-iphone-60x60.png new file mode 100644 index 0000000..7b3360e Binary files /dev/null and b/conf/liliana/staging/image-pack/apple-touch-icon-iphone-60x60.png differ diff --git a/conf/liliana/staging/image-pack/apple-touch-icon-iphone-retina-120x120.png b/conf/liliana/staging/image-pack/apple-touch-icon-iphone-retina-120x120.png new file mode 100644 index 0000000..d779348 Binary files /dev/null and b/conf/liliana/staging/image-pack/apple-touch-icon-iphone-retina-120x120.png differ diff --git a/conf/liliana/staging/image-pack/background-image.png b/conf/liliana/staging/image-pack/background-image.png new file mode 100644 index 0000000..4cfbcbb Binary files /dev/null and b/conf/liliana/staging/image-pack/background-image.png differ diff --git a/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-76x76.png b/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-76x76.png new file mode 100644 index 0000000..0ec13e5 Binary files /dev/null and b/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-76x76.png differ diff --git a/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-retina-152x152.png b/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-retina-152x152.png new file mode 100644 index 0000000..e75f415 Binary files /dev/null and b/conf/liliana/staging/image-pack/store/apple-touch-icon-ipad-retina-152x152.png differ diff --git a/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-60x60.png b/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-60x60.png new file mode 100644 index 0000000..bd58277 Binary files /dev/null and b/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-60x60.png differ diff --git a/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-retina-120x120.png b/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-retina-120x120.png new file mode 100644 index 0000000..dbabe0e Binary files /dev/null and b/conf/liliana/staging/image-pack/store/apple-touch-icon-iphone-retina-120x120.png differ diff --git a/conf/liliana/staging/version.xml b/conf/liliana/staging/version.xml new file mode 100644 index 0000000..09f4402 --- /dev/null +++ b/conf/liliana/staging/version.xml @@ -0,0 +1,12 @@ + + + + Version information + + 2.10.18 + + 1820 + 13/06/2014 12:30 + liliana/staging + + diff --git a/conf/log4j.dtd b/conf/log4j.dtd new file mode 100644 index 0000000..1aabd96 --- /dev/null +++ b/conf/log4j.dtd @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/myMETA-INF/context-jcluster-web77db12.xml b/conf/myMETA-INF/context-jcluster-web77db12.xml new file mode 100644 index 0000000..b692216 --- /dev/null +++ b/conf/myMETA-INF/context-jcluster-web77db12.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + WEB-INF/web.xml + + + + + + + + + + + diff --git a/conf/myMETA-INF/context-liliana-web144db2.xml b/conf/myMETA-INF/context-liliana-web144db2.xml new file mode 100644 index 0000000..2fac333 --- /dev/null +++ b/conf/myMETA-INF/context-liliana-web144db2.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + WEB-INF/web.xml + + + + + + + + + + + + + diff --git a/conf/version.properties b/conf/version.properties new file mode 100644 index 0000000..dccfff1 --- /dev/null +++ b/conf/version.properties @@ -0,0 +1,6 @@ +#Build Number for ANT. Do not edit! +#Fri Jun 13 12:30:23 CEST 2014 +build.number=1821 +version.release= +build.date=13/06/2014 12\:30 +version.number=2.10.18 diff --git a/conf/version.xml b/conf/version.xml new file mode 100644 index 0000000..614d104 --- /dev/null +++ b/conf/version.xml @@ -0,0 +1,12 @@ + + + + Version information + + @version.number@ + @version.release@ + @build.number@ + @build.date@ + @build.installation@ + + diff --git a/conf/web.xml b/conf/web.xml new file mode 100644 index 0000000..ac0122b --- /dev/null +++ b/conf/web.xml @@ -0,0 +1,133 @@ + + + FileProxy @version.number@ (@build.number@) - @build.installation@ [@build.date@] + + + + + com.newrelic.agent.APPLICATION_NAME + @new.relic@ + + + + + + ErrorPage + /error.jsp + + + constantsFile + portal_settings.xml + + + logPropertyFile + log4j.xml + + + + defaultLanguage + it + + + + + SessionFactory + it.softecspa.jwebber.frameworkImpl.session.CMSImplSessionFactory + + + + + SecurityManager + it.softecspa.jwebber.frameworkImpl.security.CMSImplSecurityManager + + + + + accessLogWhat + ,*, + + + + + mailServer + localhost + + + + + keyStore + it.softecspa.portal.security.KeyStoreImpl + + + + + + + WebApp + it.softecspa.portal.InitWebApp + 1 + + + WebApp + /WebApp + + + + + + Servlet http file proxy + httpFileProxy-Statement Servlet + httpFileProxyServlet + it.softecspa.fileproxy.proxyservices.HttpFileProxyService + + + httpFileProxyServlet + /proxy-services/statement + + + + + + + Servlet di monitoraggio standard + Monitor Servlet + Monitor + it.softecspa.portal.Monitor + + + Monitor + /monitor + + + + + + + 15 + + + + html + text/html + + + + dtd + text/plain + + + + + + + + + + index.html + index.htm + index.jsp + default.html + default.htm + default.jsp + + diff --git a/database/change_in_progress/20140623 http file proxy.sql b/database/change_in_progress/20140623 http file proxy.sql new file mode 100644 index 0000000..a60bd48 --- /dev/null +++ b/database/change_in_progress/20140623 http file proxy.sql @@ -0,0 +1,50 @@ +CREATE TABLE IF NOT EXISTS `a00_change_log` ( +`v00_code` varchar(30) NOT NULL , +`v00_description` varchar(200) NULL , +`d00_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , +PRIMARY KEY (`v00_code`) +) +; + +insert into a00_change_log values('20140623 http file proxy.sql','Tabella per server Http File Proxy (ADT)', now()); + + + + +CREATE TABLE `t000_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `v_source` varchar(50) NOT NULL COMMENT 'Sorgente errore', + `v_message` text NOT NULL, + `v_stacktrace` text, + `n_ticket` int(11) DEFAULT NULL, + `d_record` datetime NOT NULL COMMENT 'Timestamp aggiornamento record', + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Tracciamento eccezioni gravi del server'; + + +CREATE TABLE `t001_config_properties` ( + `v_key` varchar(50) NOT NULL, + `v_value` varchar(256) NOT NULL, + `v_description` varchar(100) DEFAULT NULL, + PRIMARY KEY (`v_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + +CREATE TABLE `t005_cluster_info` ( + `v_hostname` varchar(100) NOT NULL, + `v_context` varchar(100) NOT NULL DEFAULT '/', + `v_address` varchar(20) DEFAULT NULL, + `v_backplane_hostname` varchar(100) DEFAULT NULL COMMENT 'Indirizzo privato alla rete', + `d_life_start` datetime NOT NULL COMMENT 'Inizio sessione di vita', + `d_life_stop` datetime DEFAULT NULL, + `d_last_beat` datetime NOT NULL COMMENT 'Ultimo "battito"', + `f_do_not_use` tinyint(1) NOT NULL DEFAULT '0', + `v_version` varchar(50) DEFAULT NULL, + `d_record` datetime NOT NULL COMMENT 'Timestamp aggiornamento record', + PRIMARY KEY (`v_hostname`,`v_context`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Autorilevamento cluster attivi'; + + + +INSERT INTO `t001_config_properties` (`v_key`, `v_value`, `v_description`) VALUES ('haertbeat.delay', '0', 'Heartbeat verso server master'): +INSERT INTO `t001_config_properties` (`v_key`, `v_value`, `v_description`) VALUES ('resource.root', '/var/www/web77/user/web77_adt', 'Root dei file') \ No newline at end of file diff --git a/deployer-script.xml b/deployer-script.xml new file mode 100644 index 0000000..8053147 --- /dev/null +++ b/deployer-script.xml @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Include ANT-contrib JAR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + + + + + + + + + + + + Utente nullo, operazione annullata + + + + + + + + + + + + + + + + + + + Password nulla, operazione annullata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + Deploy della nuova versione sui nodi + * context = ${context} + * war (locale) = ${warfile.name} + + + + cd ${remote.path} && tomcat-deploy -c -f + + + Deploy completato su tutti i nodi + + + + + + + + + Eclipse refresh in progress... + + + Eclipse refreshed! + + + + Per funzionare deve essere impostato il seguente flag in "External tool configuration" + JRE > Run in the same JRE as the workspace + + + + + + + + + + + + + \ No newline at end of file diff --git a/deployer.xml b/deployer.xml new file mode 100644 index 0000000..6f4bc6a --- /dev/null +++ b/deployer.xml @@ -0,0 +1,419 @@ + + + + + + + + + + + + + + + + + + + + + + Include ANT-contrib JAR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + + + + + + + + + + + + Utente nullo, operazione annullata + + + + + + + + + + + + + + + + + + + Password nulla, operazione annullata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + + + Passo 1 - Undeploy della vecchia versione su ${nome.cluster} + * context = ${tomcat.context.path} + + + + + + + + + + Tutto ok + + + Controllare messaggio FAIL + + + + + + + + + + Passo 2 - Deploy della nuova versione su ${nome.cluster} + * context = ${tomcat.context.path} + * war (locale) = ${tomcat.war} + + + + + + + + + + Deploy completato su ${nome.cluster} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Include Tomcat Deployer JAR + + + + + + + + + + + + + + + + + + + + + Eclipse refresh in progress... + + + Eclipse refreshed! + + + + Per funzionare deve essere impostato il seguente flag in "External tool configuration" + JRE > Run in the same JRE as the workspace + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/amazon.s3/aws-java-sdk-1.0.11-javadoc.jar b/lib/amazon.s3/aws-java-sdk-1.0.11-javadoc.jar new file mode 100644 index 0000000..8ea4328 Binary files /dev/null and b/lib/amazon.s3/aws-java-sdk-1.0.11-javadoc.jar differ diff --git a/lib/amazon.s3/aws-java-sdk-1.0.11-sources.jar b/lib/amazon.s3/aws-java-sdk-1.0.11-sources.jar new file mode 100644 index 0000000..8e12cfb Binary files /dev/null and b/lib/amazon.s3/aws-java-sdk-1.0.11-sources.jar differ diff --git a/lib/amazon.s3/aws-java-sdk-1.0.11.jar b/lib/amazon.s3/aws-java-sdk-1.0.11.jar new file mode 100644 index 0000000..76c1cc5 Binary files /dev/null and b/lib/amazon.s3/aws-java-sdk-1.0.11.jar differ diff --git a/lib/amazon.s3/lib.removed/jackson-core-asl-1.4.3.jar b/lib/amazon.s3/lib.removed/jackson-core-asl-1.4.3.jar new file mode 100644 index 0000000..1bc6032 Binary files /dev/null and b/lib/amazon.s3/lib.removed/jackson-core-asl-1.4.3.jar differ diff --git a/lib/amazon.s3/lib.required/commons-codec-1.3.jar b/lib/amazon.s3/lib.required/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/lib/amazon.s3/lib.required/commons-codec-1.3.jar differ diff --git a/lib/amazon.s3/lib.required/commons-httpclient-3.0.1.jar b/lib/amazon.s3/lib.required/commons-httpclient-3.0.1.jar new file mode 100644 index 0000000..cfc777c Binary files /dev/null and b/lib/amazon.s3/lib.required/commons-httpclient-3.0.1.jar differ diff --git a/lib/amazon.s3/lib.required/commons-logging-1.1.1.jar b/lib/amazon.s3/lib.required/commons-logging-1.1.1.jar new file mode 100644 index 0000000..8758a96 Binary files /dev/null and b/lib/amazon.s3/lib.required/commons-logging-1.1.1.jar differ diff --git a/lib/amazon.s3/lib.required/stax-1.2.0.jar b/lib/amazon.s3/lib.required/stax-1.2.0.jar new file mode 100644 index 0000000..0df112a Binary files /dev/null and b/lib/amazon.s3/lib.required/stax-1.2.0.jar differ diff --git a/lib/amazon.s3/lib.required/stax-api-1.0.1.jar b/lib/amazon.s3/lib.required/stax-api-1.0.1.jar new file mode 100644 index 0000000..d9a1665 Binary files /dev/null and b/lib/amazon.s3/lib.required/stax-api-1.0.1.jar differ diff --git a/lib/ant/ant-classloadertask-1.0-RC2.zip b/lib/ant/ant-classloadertask-1.0-RC2.zip new file mode 100644 index 0000000..56ec6dc Binary files /dev/null and b/lib/ant/ant-classloadertask-1.0-RC2.zip differ diff --git a/lib/ant/ant-classloadertask.jar b/lib/ant/ant-classloadertask.jar new file mode 100644 index 0000000..d2f58d9 Binary files /dev/null and b/lib/ant/ant-classloadertask.jar differ diff --git a/lib/ant/ant-contrib-0.6-bin.zip b/lib/ant/ant-contrib-0.6-bin.zip new file mode 100644 index 0000000..48f1778 Binary files /dev/null and b/lib/ant/ant-contrib-0.6-bin.zip differ diff --git a/lib/ant/ant-contrib-0.6.jar b/lib/ant/ant-contrib-0.6.jar new file mode 100644 index 0000000..db90b0a Binary files /dev/null and b/lib/ant/ant-contrib-0.6.jar differ diff --git a/lib/ant/ant-jsch-1.9.2.jar b/lib/ant/ant-jsch-1.9.2.jar new file mode 100644 index 0000000..56f74eb Binary files /dev/null and b/lib/ant/ant-jsch-1.9.2.jar differ diff --git a/lib/ant/apache-ant-1.7.1-bin.zip b/lib/ant/apache-ant-1.7.1-bin.zip new file mode 100644 index 0000000..b466529 Binary files /dev/null and b/lib/ant/apache-ant-1.7.1-bin.zip differ diff --git a/lib/ant/apache/catalina-ant.jar b/lib/ant/apache/catalina-ant.jar new file mode 100644 index 0000000..89463fd Binary files /dev/null and b/lib/ant/apache/catalina-ant.jar differ diff --git a/lib/ant/apache/catalina-deployer.jar b/lib/ant/apache/catalina-deployer.jar new file mode 100644 index 0000000..2898d6e Binary files /dev/null and b/lib/ant/apache/catalina-deployer.jar differ diff --git a/lib/ant/apache/commons-el.jar b/lib/ant/apache/commons-el.jar new file mode 100644 index 0000000..608ed79 Binary files /dev/null and b/lib/ant/apache/commons-el.jar differ diff --git a/lib/ant/apache/commons-logging-1.1.1.jar b/lib/ant/apache/commons-logging-1.1.1.jar new file mode 100644 index 0000000..8758a96 Binary files /dev/null and b/lib/ant/apache/commons-logging-1.1.1.jar differ diff --git a/lib/ant/apache/jasper-compiler.jar b/lib/ant/apache/jasper-compiler.jar new file mode 100644 index 0000000..d9c04bd Binary files /dev/null and b/lib/ant/apache/jasper-compiler.jar differ diff --git a/lib/ant/apache/jasper-runtime.jar b/lib/ant/apache/jasper-runtime.jar new file mode 100644 index 0000000..5a50c19 Binary files /dev/null and b/lib/ant/apache/jasper-runtime.jar differ diff --git a/lib/ant/apache/jsp-api.jar b/lib/ant/apache/jsp-api.jar new file mode 100644 index 0000000..e4e36ea Binary files /dev/null and b/lib/ant/apache/jsp-api.jar differ diff --git a/lib/ant/apache/servlet-api.jar b/lib/ant/apache/servlet-api.jar new file mode 100644 index 0000000..5285f81 Binary files /dev/null and b/lib/ant/apache/servlet-api.jar differ diff --git a/lib/ant/jsch-0.1.50.jar b/lib/ant/jsch-0.1.50.jar new file mode 100644 index 0000000..85c044f Binary files /dev/null and b/lib/ant/jsch-0.1.50.jar differ diff --git a/lib/ant/jsch-0.1.50.zip b/lib/ant/jsch-0.1.50.zip new file mode 100644 index 0000000..09314fd Binary files /dev/null and b/lib/ant/jsch-0.1.50.zip differ diff --git a/lib/axis/axis.jar b/lib/axis/axis.jar new file mode 100644 index 0000000..20b09a5 Binary files /dev/null and b/lib/axis/axis.jar differ diff --git a/lib/axis/commons-discovery-0.2.jar b/lib/axis/commons-discovery-0.2.jar new file mode 100644 index 0000000..b885548 Binary files /dev/null and b/lib/axis/commons-discovery-0.2.jar differ diff --git a/lib/axis/commons-logging.jar b/lib/axis/commons-logging.jar new file mode 100644 index 0000000..2007db7 Binary files /dev/null and b/lib/axis/commons-logging.jar differ diff --git a/lib/axis/jaxrpc.jar b/lib/axis/jaxrpc.jar new file mode 100644 index 0000000..a2c13d9 Binary files /dev/null and b/lib/axis/jaxrpc.jar differ diff --git a/lib/axis/saaj.jar b/lib/axis/saaj.jar new file mode 100644 index 0000000..4ea696e Binary files /dev/null and b/lib/axis/saaj.jar differ diff --git a/lib/axis/wsdl4j.jar b/lib/axis/wsdl4j.jar new file mode 100644 index 0000000..3aa8b96 Binary files /dev/null and b/lib/axis/wsdl4j.jar differ diff --git a/lib/c3p0/c3p0-0.9.2.jar b/lib/c3p0/c3p0-0.9.2.jar new file mode 100644 index 0000000..5dea94b Binary files /dev/null and b/lib/c3p0/c3p0-0.9.2.jar differ diff --git a/lib/c3p0/mchange-commons-java-0.2.3.3.jar b/lib/c3p0/mchange-commons-java-0.2.3.3.jar new file mode 100644 index 0000000..c44160e Binary files /dev/null and b/lib/c3p0/mchange-commons-java-0.2.3.3.jar differ diff --git a/lib/common/activation-1.1.jar b/lib/common/activation-1.1.jar new file mode 100644 index 0000000..53f82a1 Binary files /dev/null and b/lib/common/activation-1.1.jar differ diff --git a/lib/common/commons-codec-1.3.jar b/lib/common/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/lib/common/commons-codec-1.3.jar differ diff --git a/lib/common/commons-fileupload-1.0.jar b/lib/common/commons-fileupload-1.0.jar new file mode 100644 index 0000000..1ca4a9c Binary files /dev/null and b/lib/common/commons-fileupload-1.0.jar differ diff --git a/lib/common/commons-httpclient-3.0-rc1.jar b/lib/common/commons-httpclient-3.0-rc1.jar new file mode 100644 index 0000000..124a3d9 Binary files /dev/null and b/lib/common/commons-httpclient-3.0-rc1.jar differ diff --git a/lib/common/commons-logging-1.1.1.jar b/lib/common/commons-logging-1.1.1.jar new file mode 100644 index 0000000..1deef14 Binary files /dev/null and b/lib/common/commons-logging-1.1.1.jar differ diff --git a/lib/common/itext-0.98.jar b/lib/common/itext-0.98.jar new file mode 100644 index 0000000..922ea45 Binary files /dev/null and b/lib/common/itext-0.98.jar differ diff --git a/lib/common/jdom.jar b/lib/common/jdom.jar new file mode 100644 index 0000000..288e64c Binary files /dev/null and b/lib/common/jdom.jar differ diff --git a/lib/common/local/dbConnect_1.7.1.jar b/lib/common/local/dbConnect_1.7.1.jar new file mode 100644 index 0000000..1d1fea4 Binary files /dev/null and b/lib/common/local/dbConnect_1.7.1.jar differ diff --git a/lib/common/local/dmsso_1.4.2.jar b/lib/common/local/dmsso_1.4.2.jar new file mode 100644 index 0000000..7925a99 Binary files /dev/null and b/lib/common/local/dmsso_1.4.2.jar differ diff --git a/lib/common/local/jwebber_2.5.5.jar b/lib/common/local/jwebber_2.5.5.jar new file mode 100644 index 0000000..f1e6368 Binary files /dev/null and b/lib/common/local/jwebber_2.5.5.jar differ diff --git a/lib/common/local/kahuna5j_4.2.3.jar b/lib/common/local/kahuna5j_4.2.3.jar new file mode 100644 index 0000000..fa7278d Binary files /dev/null and b/lib/common/local/kahuna5j_4.2.3.jar differ diff --git a/lib/common/local/s4_1.0.5.jar b/lib/common/local/s4_1.0.5.jar new file mode 100644 index 0000000..dd99f8d Binary files /dev/null and b/lib/common/local/s4_1.0.5.jar differ diff --git a/lib/common/log4j-1.2.15.jar b/lib/common/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/lib/common/log4j-1.2.15.jar differ diff --git a/lib/common/mail-1.4.jar b/lib/common/mail-1.4.jar new file mode 100644 index 0000000..fd4555b Binary files /dev/null and b/lib/common/mail-1.4.jar differ diff --git a/lib/common/urlrewrite-2.6.0.jar b/lib/common/urlrewrite-2.6.0.jar new file mode 100644 index 0000000..bfb55f0 Binary files /dev/null and b/lib/common/urlrewrite-2.6.0.jar differ diff --git a/lib/common/xmlwise-1_2.jar b/lib/common/xmlwise-1_2.jar new file mode 100644 index 0000000..c96a3ec Binary files /dev/null and b/lib/common/xmlwise-1_2.jar differ diff --git a/lib/gcm/gcm-server-1.0.2.jar b/lib/gcm/gcm-server-1.0.2.jar new file mode 100644 index 0000000..983fdb7 Binary files /dev/null and b/lib/gcm/gcm-server-1.0.2.jar differ diff --git a/lib/gcm/gcm-server.jar b/lib/gcm/gcm-server.jar new file mode 100644 index 0000000..b152a27 Binary files /dev/null and b/lib/gcm/gcm-server.jar differ diff --git a/lib/gcm/json_simple-1.1.jar b/lib/gcm/json_simple-1.1.jar new file mode 100644 index 0000000..f395f41 Binary files /dev/null and b/lib/gcm/json_simple-1.1.jar differ diff --git a/lib/jackson/jackson-annotations-2.2.3.jar b/lib/jackson/jackson-annotations-2.2.3.jar new file mode 100644 index 0000000..b62c87d Binary files /dev/null and b/lib/jackson/jackson-annotations-2.2.3.jar differ diff --git a/lib/jackson/jackson-core-2.2.3.jar b/lib/jackson/jackson-core-2.2.3.jar new file mode 100644 index 0000000..24318a4 Binary files /dev/null and b/lib/jackson/jackson-core-2.2.3.jar differ diff --git a/lib/jackson/jackson-databind-2.2.3.jar b/lib/jackson/jackson-databind-2.2.3.jar new file mode 100644 index 0000000..8545084 Binary files /dev/null and b/lib/jackson/jackson-databind-2.2.3.jar differ diff --git a/lib/java-apns/apns-0.1.5-jar-with-dependencies.jar b/lib/java-apns/apns-0.1.5-jar-with-dependencies.jar new file mode 100644 index 0000000..d7b1faa Binary files /dev/null and b/lib/java-apns/apns-0.1.5-jar-with-dependencies.jar differ diff --git a/lib/java-apns/apns-0.1.5.jar b/lib/java-apns/apns-0.1.5.jar new file mode 100644 index 0000000..86ea677 Binary files /dev/null and b/lib/java-apns/apns-0.1.5.jar differ diff --git a/lib/java-apns/java-apns.zip b/lib/java-apns/java-apns.zip new file mode 100644 index 0000000..22381a7 Binary files /dev/null and b/lib/java-apns/java-apns.zip differ diff --git a/lib/jdbc/mysql-connector-java-5.0.8-bin.jar b/lib/jdbc/mysql-connector-java-5.0.8-bin.jar new file mode 100644 index 0000000..0170c3e Binary files /dev/null and b/lib/jdbc/mysql-connector-java-5.0.8-bin.jar differ diff --git a/lib/uploadbean/cos.jar b/lib/uploadbean/cos.jar new file mode 100644 index 0000000..bcb822a Binary files /dev/null and b/lib/uploadbean/cos.jar differ diff --git a/lib/uploadbean/fileupload.jar b/lib/uploadbean/fileupload.jar new file mode 100644 index 0000000..1ca4a9c Binary files /dev/null and b/lib/uploadbean/fileupload.jar differ diff --git a/lib/uploadbean/struts.jar b/lib/uploadbean/struts.jar new file mode 100644 index 0000000..db32f9f Binary files /dev/null and b/lib/uploadbean/struts.jar differ diff --git a/lib/uploadbean/uploadbean.jar b/lib/uploadbean/uploadbean.jar new file mode 100644 index 0000000..fd684ab Binary files /dev/null and b/lib/uploadbean/uploadbean.jar differ diff --git a/mycredential.xml b/mycredential.xml new file mode 100644 index 0000000..68872e3 --- /dev/null +++ b/mycredential.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packaging.xml b/packaging.xml new file mode 100644 index 0000000..dce0fb0 --- /dev/null +++ b/packaging.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + Help.. + * Reverse database STAGING: Crea le classi secondo lo standard dbConnect a partire dal database di STAGE (web124) + * Reverse database SVILUPPO: Crea le classi secondo lo standard dbConnect a partire dal database di SVILUPPO (web103) + + * dist-PRODUCTION: Crea il file WAR per la distribuzione in PRODUZIONE sul contesto principale + * dist-liliana/STAGING: Crea il file WAR per la distribuzione in su STAGE + * dist-liliana/SVILUPPO: Crea il file WAR per la distribuzione in su SVILUPPO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Switch context.xml to ${param.title} + + + + + + + + + + context.xml from ${basedir}/conf/myMETA-INF/${param.source} + + + + + + + + + + + + + + + + Operazione annullata dall'utente + + + + + + + + + + + + + Esclude rule: ${exclude} + + + + + + + + + + + \ No newline at end of file diff --git a/src/conf/log4j.xml b/src/conf/log4j.xml new file mode 100644 index 0000000..bfbceff --- /dev/null +++ b/src/conf/log4j.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/conf/portal_settings.xml b/src/conf/portal_settings.xml new file mode 100644 index 0000000..9a8ee97 --- /dev/null +++ b/src/conf/portal_settings.xml @@ -0,0 +1,63 @@ + + + + Applicazione Http File Proxy 1.0 - sviluppo + + + jdbc/mwm_app#MYSQL + + + + jdbc/mwm_app#MYSQL + + + + + + ${hostname}:8080 + + + localhost + + fileproxy + + 8080 + 8443 + + Http file proxy + + + httpfileproxy + sviluppo + + en + http://localhost:8080/fileproxy + + + + false + + + true + + smtp-out.softecspa.it + + + + + noreply@desktopmate.net + massimiliano.veroni@softecspa.it + + + File Proxy - localhost - + + + false + + + false + + \ No newline at end of file diff --git a/src/httpfileproxy_dictionary_it_IT.properties b/src/httpfileproxy_dictionary_it_IT.properties new file mode 100644 index 0000000..22b5350 --- /dev/null +++ b/src/httpfileproxy_dictionary_it_IT.properties @@ -0,0 +1,379 @@ +##################################################### +# Dizionario con etichette e messaggi dell'applicazione + +? = !Etichetta non dichiarata! + +##GLOBAL +lblNuovo = Nuovo +lblDettagli = Dettagli +lblBenvenuto = Benvenuto +lblVersione = Versione +lblAllegati = Allegati +lblDel = del + + +lblAggiorna = Aggiorna +lblAttivo = Attivo +lblAttiva = Attiva +lblAutoOpen = Apri automaticamente +lblBloccante = Bloccante +lblCampiObbligatori = Campi obbligatori +lblCap = Cap +lblCambioPassword = Cambio Password +lblCerca = Cerca +lblChiediInvioReport = Richiedi invio report +lblChiediInvioAttachment = Richiedi invio allegati +lblChiudi = Chiudi +lblCodice = Codice +lblCodBolla = Cod. bolla +lblCodiceExt = Codice esterno +lblCodMittente = Cod. mittente +lblCodObu = Cod. OBU +lblCognome = Cognome +lblColore = Colore +lblCommittente = Committente +lblDal = Dal +lblDataEvasione = Data evasione +lblDataOraFine = Data/Ora fine +lblDataOraIni = Data/Ora inizio +lblDataOraProg = Data/Ora programmate +lblDataRil = Data ril. +lblDefault = Default +lblDenominazione = Denominazione +lblDescrizione = Descrizione +lblDestinazione = Destinazione +lblDevicePin = Device PIN +lblDi = di +lblDisattiva = Disattiva +lblDominio = Dominio +lblCampagna = Campagna +lblNumeroViaggiDownload = Programmi lavoro scaricabili +lblDoppioTurno = Doppio turno +lblDriverAuth = Autentica operatori +lblEditabile = Modificabile +lblEmail = Email +lblDeviceName = Dispositivo +lblApplicationVersion = Versione OneJoins +lblApplicationVersion_breve = OneJoins +lblPlatformVersion = Release S.O. +lblAttivazione = Attivazione +lblUltimoPost = Ultimo Post +lblEtichetta = Etichetta +lblFax = Fax +lblFiliale = Filiale +lblID = ID +lblGestFiliali = Gestione filiali +lblGestCartografia = Abilita cartografia +lblGestTipiVeicolo = Gestisci tipi veicolo +lblGestVeicoli = Gestisci veicoli +lblGestVettori = Gestisci aree +lblGPSEnabled = Abilita GPS +lblInCaricoA = In carico a +lblIndirizzo = Indirizzo +lblIndLoc = Indirizzo - Località +lblInizioPagina = Inizio pagina +lblInviaAlDispositivo = Invia al dispositivo +lblLicenzeWeb = Licenze Web +lblLicenzeClient = Licenze BB +lblMaxCampagne = Campagne attive contemporanee +lblLinkXPagina = Link per pagina +lblListaInterventi = Lista interventi +lblListValues = Lista di valori +lblListaVeicoli = Lista veicoli +lblLocalita = Località +lblMailSender = Mail sender +lblMailServer = Mail server +lblMaxVal = Massimo +lblMinVal = Minimo +lblDefaultValue = Valore di default +lblMngCarico = Gestisci carico su BB +lblMngFiliali = Gestisci filiali +lblModifica = Modifica +lblMostraPercorso = Mostra percorso +lblNessuno = Nessuno +lblNessuna = Nessuna +lblNo = No +lblNome = Nome +lblNominativo = Nominativo +lblNote = Note +lblNotInReport = Escludi da report +lblNuovo = Nuovo +lblNumMaxInterventi = Interventi scaricabili +lblObbligatorio = Obbligatorio +lblEvidenza = In evidenza +lblOperatore = Operatore +lblPagina = Pagina +lblParametro = Parametro +lblScheda = Scheda +lblSchedeIntervento = Schede intervento +lblPIN = PIN/Codice +lblProfilo = Profilo +lblProvincia = Provincia +lblPwd = Password +lblPwdConf = Conferma password +lblPwdNuova = Nuova password +lblPwdVecchia = Vecchia password +lblRagSoc = Ragione sociale +lblReferente = Referente +lblRigheXPagina = Righe per pagina +lblRmIfNull = Attiva dinamicamente +lblSalva = Salva +lblSegnacollo = Segnacollo +lblSendAlert = Invia avvisi +lblSepDopo = Separatore dopo il parametro +lblSepValori = Separare i valori andando a capo +lblSi = Si +lblSimbolo = Simbolo +lblSpostaInAlto = Sposta in alto +lblSpostaInBasso = Sposta in basso +lblStato = Stato +lblStrutturaIntervento = Struttura intervento +lblTel = Tel. +lblTipo = Tipo +lblTipoParametro = Tipo parametro +lblTipoScheda = Tipo scheda +lblTitolo = Titolo +lblTornaIndietro = Chiudi +lblRefresh = Ricarica +lblUsername = Username +lblDataProgramma = Data Progr. +lblInterventiAssocia = Associa Interventi +lblInterventiDisassocia = Disassocia Intervento +lblGgRischedulazione = Rischedula tra gg. +lblRischedulazione = Rischedulazione +lblSabRischedulazione = Salta Sabati +lblDomRischedulazione = Salta Domeniche +lblFesRischedulazione = Salta Festività +lblDataInizioRicerca = Data Inizio Selezione +lblDataFineRicerca = Data Fine Selezione +lblReportInterventi = Report Interventi +lblScaricaReport = Scarica Report +lblMostraMappa = Mostra mappa itinerario +lblDeleteDispositivoAttachmentOnClose = Rimuovi allegati dal dispositivo alla chiusura dell'intervento +lblUseSingleActivity = Lavora per interventi +lblOpenSingleActivity = Apri singola attività +lblOpenSingleStep = Apri singolo passo +lblServerUrl = serverUrl +lblInvioDatiInChiusuraIntervento = Invia dati alla chiusura dell'intervento +lblUrlUploadDatiIntervento = Url di destinazione +lblUserDownload = Utente +lblPasswordDownload = Password +lblCertificatoSSL=Utilizza certificato SSL +lblPasswordCertificato=Password certificato + +msgAttachConversionInProgress=Conversione formato per anteprima in corso... +msgAttachConversionInError=Anteprima non disponibile (errore) +msgAttachConversionOriginal=Anteprima non disponibile +msgAttachStatusInvalid=Anteprima non disponibile! + + + + + +msgProtocolloNonCorretto=Incongruenza di dati: Il certificato SSL necessita del protocollo https +msgAtLeastOneField = Almeno uno dei campi +msgBadDateIntervento = 'Data/Ora fine' deve essere successiva a 'Data/Ora inizio' +msgCaratteri = caratteri +msgCampo = Il campo +msgCampi = I campi +msgConfInvioIntervento = Inviare l'Intervento al dipositivo? +msgDeveValorizzato = può essere valorizzato +msgDeviceBadFiliale = Errore: Il dispositivo è associato a una filiale non valida +msgDeviceDisattivo = Errore: Dispositivo non attivo +msgDeviceDisabilitato = Errore: Dispositivo non abilitato +msgEliminazione = Procedere all'eliminazione ? +msgConfCopiaCamapagna = Proseguire con la copia della campagna? +msgErrDb = Errore: Errore di salvataggio a DB +msgErrRicezione = Errore durante la ricezione dei dati +msgEsisteCommittente = Esiste già un Committente con il Codice specificato +msgEsisteDispositivo = Esiste già un Dispositivo con il PIN specificato +msgEsisteDominio = Esiste già un Dominio con il Codice specificato +msgEsisteIntervento = Esiste già un intervento con il Codice specificato +msgEsisteParametro = Esiste già un Parametro per questo scheda con il Codice specificato +msgEsisteScheda = Esiste già una scheda con il Titolo specificato +msgEsisteCampagna = Esiste già una Campagna con il Codice specificato +msgEsisteUtente = Esiste già un Utente con lo username specificato +msgEsisteVeicolo = Esiste già un Veicolo con il Codice specificato +msgInizioPagina = Inizio pagina +msgIntInesistente = Errore: L'intervento specificato non risulta definito a sistema + +msgLicWebSuperate = E' stato già raggiunto il numero massimo di Licenze Web consentito +msgLicBBSuperate = E' stato già raggiunto il numero massimo di Licenze BB consentito + +msgNoAttivitaProg = Nessun nuovo Programma di lavoro disponibile +msgNonAutorizzato = Utente non autorizzato +msgNonUguali = non corrispondono +msgObbligatorio = è obbligatorio +msgValoreIntero = è un numero intero +msgValoreNumerico = è un valore numerico valido +msgOnlyOneField = Solo uno dei campi +msgPosTask = Selezionare un veicolo per zoomare sulla sua posizione +msgPwdErrata = La vecchia password non coincide con quella dell'utente +msgPwdInvariata = Se non specificata la password rimmarrà invariata +msgPwdModificata = La Password è stata modificata con successo +msgPuoContenere = può contenere al massimo +msgPuoValorizzato = può essere valorizzato +msgRicercaVuota = Nessun elemento soddifa i criteri di ricerca impostati +msgRisorsaInesistente = Risorsa inesistente +msgUtenteSconosciuto = Utente non riconosciuto +msgSalva = Salva +msgTipIntNonDef = Errore: Camapagna non definito +msgViagInesistente = Errore: Il viaggio specificato risulta già chiuso +msgViagNotOpen = Errore: Il viaggio specificato risulta più in corso +msgSelezioneInterventiVuota = Non è stato selezionato nessun intervento +msgDataInizioIntervento = Non è stata inserita la data d'inizio +msgDataFineIntervento = Non è stata inserita la data di fine +msgSelezioneTipoInterventoNon = Non è stato selezionato nessun Camapagna +msgAssociazioneDominioInterventoNon = Errore: associazione Dominio - Intevento non corretta +msgFormatoOraMinutiDataInizio = L'ora e i minuti del campo data inizio non sono nel formato corretto +msgFormatoOraMinutiDataFine = L'ora e i minuti del campo data fine non sono nel formato corretto +msgOraMinutiDataVuota = Impossibile inserire Ora e Minuti senza selezionare una data +msgFormatoOraMinutiDataProgrammazione = L'ora e i minuti del campo data/ora programmate non sono nel formato corretto +msgDataValida = deve essere una data valida + +selNessuna = -- Nessuna -- +selNessuno = -- Nessuno -- +selSeleziona = -- Seleziona -- +selTutte = -- Tutte -- +selTutti = -- Tutti -- + + +##################################################### +# ETICHETTE DOMINI +lblDominiDettagli = Dettagli +lblDominiElimina = Elimina +lblDominiGestione = Domini +lblDominiNuovo = Nuovo +lblDominiMultischeda = Schede multiple +lblDominiIpAutorizzati = Limitazione IP + + +##################################################### +# ETICHETTE UTENTI +lblUtentiDettagli = Dettagli +lblUtentiElimina = Elimina +lblUtentiGestione = Utenti +lblUtentiNuovo = Nuovo + + +##################################################### +# ETICHETTE DISPOSITIVI +lblDispositiviDettagli = Dettagli +lblDispositiviElimina = Elimina +lblDispositiviGestione = Dispositivi +lblDispositiviNuovo = Nuovo +lblDispositiviSendConfig = Invia Configurazione + + +##################################################### +# ETICHETTE CAMPAGNA +lblCampagnaDettagli = Dettagli +lblCampagnaElimina = Elimina +lblCampagnaGestione = Campagna +lblCampagnaNuovo = Nuovo +lblCampagnaCopia = Crea copia +lblMaxAllegati = Massimo allegati +lblMaxAllegatiImage = Massimo immagini +lblMaxAllegatiVideo = Massimo video +lblMaxAllegatiAudio = Massimo audio +lblMaxAllegatiOther = Massimo altro +lblUrlBlog = URL blog +lblCoordinateGPS = Acquisisci dati GPS +lblInizioCampagna = Inizio +lblFineCampagna = Fine +lblMaxPostUtente = Post utente +lblMaxPostUtenteGiorno = Post giornalieri +lblCampagnaPostSegue = Post cronologici + +msgTagBlog = E' possibile utilizzare i seguenti TAG per la composizione dell'URL: +lblTagUsername = Username +lblTagPassword = Password (cifrata MD5) +lblTagCampagna = Codice campagna +lblTagDominio = Codice dominio + + +##################################################### +# ETICHETTE SCHEDE +lblSchedeDettagli = Dettagli +lblSchedeElimina = Elimina +lblSchedeGestione = Scheda +lblSchedeNuovo = Nuova scheda +lblSchedeIdCampagna = id campagna +lblSchedeOrdine = numero ordine + + +##################################################### +# ETICHETTE SCHEDA PARAMETRI +lblParametriDettagli = Dettagli +lblParametriElimina = Elimina +lblParametriGestione = Parametri +lblParametriNuovo = Nuovo +lblParametriIdScheda = Id scheda +lblParametriOrdine = Numero ordine +lblParametriScheda = Scheda + +##################################################### +# ETICHETTE POST +lblPostDettagli = Dettagli +lblPostElimina = Elimina +lblPostGestione = Post +lblPostNuovo = Nuovo post +lblPostUID = UID +lblPostDevice = Device +lblPostTimestamp = Data/Ora +lblPostUpload = Upload +lblPostDownload = Download +lblPostLatitudine = Latitudine +lblPostLongitudine = Longitudine +lblPostScheda = Scheda +lblPostParametro = Parametro +lblPostValore = Valore +lblPostCodice = Codice +lblPostStato = Stato +lblPostNumeroAllegati = Allegati + +lblPostTimestampInizio = Post da +lblPostTimestampFine = Post a + +statoPost0 = Conpletato +statoPostA = In attesa di allegati +statoPostE = Errore +statoPostP = Pronto +statoPostR = Post processing + + +##################################################### +# ETICHETTE HELP ON LINE +##################################################### +helpUtentiCommittente=Consente di limitare per l\\\'utente la possibilità di creare/visualizzare i dati di interventi commissionati soltanto dal particolare Committente selezionato +helpUtentiInviaAvvisi=Selezionare la casella di spunta se si desidera che l\\\'utente riceva via mail gli alert gestiti dal sistema + +helpDispositiviPin=PIN del dispositivo: tale dato è reperibile sul dispositivo da Opzioni -> Stato +helpDipositiviAbilitaGPS=Selezionare la casella di spunta se si desidera che il sistema sia abilitato a ricevere dati GPS dal dispositivo + +helpCampagnaCodice=Codice univoco assegnato al Camapagna all\\\'interno del sistema: tale codice è quello con cui ci si potrà riferire al Camapagna nelle procedure di upload/download dati a/da sistema +helpCampagnaMaxAllegati=Numero massimo di allegati per ogni post della campagna +helpCampagnaMaxAllegatiVideo=Numero massimo di allegati in formato video +helpCampagnaMaxAllegatiImage=Numero massimo di allegati in formato immagine +helpCampagnaMaxAllegatiAudio=Numero massimo di allegati in formato audio +helpCampagnaMaxAllegatiOther=Numero massimo di allegati in formato altro +helpCampagnaMaxPostUtente = Help... +helpCampagnaMaxPostUtenteGiorno = Help... +helpCampagnaPostSegue = Se selezionato offre la possibilità di concatenare tra loro i post + +helpSchedeTitolo=Help... +helpSchedeTipoPasso=Descrittivo se il passo contiene dati di sola lettura e non necessita di essere esplicitamente salvato dall\\\'utente per risultare completato
Facoltativo se non blocca la compilazione di passi successivi prima di essere salvato
Obbligatorio se blocca la compilazione di passi successivi prima di essere salvato + +helpParametriEtichetta=Rappresenta l\\\'etichetta con cui verrà identificato il Parametro sulle form di inserimento dati sia lato server che client +helpParametriCodice=Codice univoco assegnato al Parametro all\\\'interno della Camapagna +helpParametriAttivaDinamicamente=Selezionare la casella di spunta se si desidera che il parametro venga inviato al client solo se selezionato dall\\\'utente in fase di inserimento dei dati di dettaglio di un intervento +helpParametriSeparatoreDopo=Selezionare la casella di spunta se si desidera che dopo il Parametro venga inserita una riga orizzontale + +helpDominiCodice=Help... +helpDominiLicenzeWeb=Help... +helpDominiLicenzeBB=Help... +helpDominiUtentePassword=Eventuale autenticazione di sicurezza al web server di destinazione +helpDominiMultischeda=Permette di creare campagne composte da più di una scheda +helpDominiIpAutorizzati=Elenco di indirizzi IP remoti a cui è limitata la trasmissione dei post
Separare i valori andando a capo + + diff --git a/src/it/softecspa/PortalSettings.java b/src/it/softecspa/PortalSettings.java new file mode 100644 index 0000000..16f1238 --- /dev/null +++ b/src/it/softecspa/PortalSettings.java @@ -0,0 +1,16 @@ +package it.softecspa; + +public interface PortalSettings extends it.softecspa.kahuna.services.PortalSettings { + + public String MAIL_START_ENABLE = "mail.start.enable"; + public String MAIL_ERROR_ENABLE = "mail.error.enable"; + public String MAIL_SQL_ERROR_ENABLE = "mail.sqlerror.enable"; + public String MAIL_NEW_DEVICE_MODEL_ENABLE = "mail.new-device-model.enable"; + + + public String PUSH_RECOVERY_ENABLE = "push.recovery.enable"; + + + public String JARVIS_HEADER_COLOR = "jarvis.header.color"; + +} diff --git a/src/it/softecspa/fileproxy/DatabaseBalancer.java b/src/it/softecspa/fileproxy/DatabaseBalancer.java new file mode 100644 index 0000000..37b28db --- /dev/null +++ b/src/it/softecspa/fileproxy/DatabaseBalancer.java @@ -0,0 +1,154 @@ +package it.softecspa.fileproxy; + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.mvc.businessobject.DatabaseManager; + +import org.apache.log4j.Logger; + +public class DatabaseBalancer { + + protected Logger log = Logger.getLogger(getClass()); + + public enum Balancer { + STAGE(0) + , MASTER(1); + + int i; + + private Balancer(int i) { + this.i = i; + } + + public int index() { + return i; + } + } + + + private ConnectionManager[] balance_readwrite = new ConnectionManager[2]; + private ConnectionManager[] balance_readonly = new ConnectionManager[2]; + + + private static DatabaseBalancer instance; + private boolean active; + + private DatabaseBalancer() { + super(); + synchronized (DatabaseBalancer.class) { + if (instance == null) { + instance = this; + instance.load(); + } + } + } + + public static DatabaseBalancer getInstance() { + synchronized (DatabaseBalancer.class) { + if (instance == null) new DatabaseBalancer(); + } + return instance; + } + + + private synchronized void load() { + active = false; + log.info("Configuring "+this.getClass().getSimpleName()); + DatabaseManager dbManager = DatabaseManager.getInstance(); + + int index = Balancer.STAGE.index(); + try { + balance_readwrite[index] = dbManager.getApplicationConnectionManager(0, false); + log.info("- STAGE (read/write) engagged!"); + balance_readonly[index] = dbManager.getApplicationConnectionManager(0, true); + log.info("- STAGE (read only) engagged!"); + } catch (NullPointerException e) { + // Databse non configurato + log.warn("No database configured!"); + return; + } + + index = Balancer.MASTER.index(); + try { + balance_readwrite[index] = dbManager.getApplicationConnectionManager(1, false); + log.info("- MASTER (read/write) engagged!"); + balance_readonly[index] = dbManager.getApplicationConnectionManager(1, true); + log.info("- MASTER (read only) engagged!"); + } catch (IndexOutOfBoundsException e) { + // Assimilo MASTER a SLAVE + balance_readwrite[index] = dbManager.getApplicationConnectionManager(0, false); + log.info("- MASTER (read/write) engagged! (the same of STAGE)"); + balance_readonly[index] = dbManager.getApplicationConnectionManager(0, true); + log.info("- MASTER (read only) engagged! (the same of STAGE)"); + } + active = true; + + } + + + + /** + * Restituisce il ConnectionManager in lettura/scrittura + * @return + */ + public ConnectionManager get(Balancer balance) { + return balance_readwrite[balance.index()]; + } + + public ConnectionManager get(boolean stage) { + return balance_readwrite[stage?Balancer.STAGE.index():Balancer.MASTER.index()]; + } + + /** + * Restituisce il ConnectionManager in sola lettura + * @return + */ + public ConnectionManager getReadOnly(Balancer balance) { + return balance_readonly[balance.index()]; + } + + public ConnectionManager getReadOnly(boolean stage) { + return balance_readonly[stage?Balancer.STAGE.index():Balancer.MASTER.index()]; + } + + + /** + * Restituisce il ConnectionManager MASTER in lettura/scrittura + * @return + */ + public ConnectionManager getMaster() { + return balance_readwrite[Balancer.MASTER.index()]; + } + + /** + * Restituisce il ConnectionManager MASTER in sola lettura + * @return + */ + public ConnectionManager getMasterReadOnly() { + return balance_readonly[Balancer.MASTER.index()]; + } + + + /** + * Restituisce il ConnectionManager di STAGE in lettura/scrittura + * @return + */ + public ConnectionManager getStage() { + return balance_readwrite[Balancer.STAGE.index()]; + } + + /** + * Restituisce il ConnectionManager di STAGE in sola lettura + * @return + */ + public ConnectionManager getStageReadOnly() { + return balance_readonly[Balancer.STAGE.index()]; + } + + public boolean isActive() { + return active; + } + + + + +} diff --git a/src/it/softecspa/fileproxy/ReverserSchema.java b/src/it/softecspa/fileproxy/ReverserSchema.java new file mode 100644 index 0000000..1cad4ca --- /dev/null +++ b/src/it/softecspa/fileproxy/ReverserSchema.java @@ -0,0 +1,56 @@ +package it.softecspa.fileproxy; + +import it.softecspa.database.reverser.Arguments; +import it.softecspa.database.reverser.Log4Configurator; +import it.softecspa.database.reverser.ReverseException; +import it.softecspa.database.reverser.Reverser; + +import java.util.List; + +/** + * @deprecated + * Utilizzare il servizio offerto da ANT + * @author m.veroni + */ +public class ReverserSchema { + + + /** + * @param args + */ + public static void main(String[] args) { + try { + + Log4Configurator.configure(); + Arguments arguments = null; + try { + arguments = new Arguments(args); + } catch (ReverseException e) { + System.out.println(e.getMessage()); + System.out.println(); + System.out.println(Arguments.getMessage()); + System.exit(-1); + } + Reverser reverser = new Reverser(arguments); + reverser.execute(); + + // crea la DROP dello schema + System.out.println("\n"); + List tables = reverser.getTables(); + for (int i = tables.size()-1; i>=0; i--) { + System.out.print("drop table "+tables.get(i)+";\n"); + } + System.out.println("\n"); + + + } catch (ReverseException e) { + e.printStackTrace(); + System.exit(-1); + } + + System.out.println ("End without error"); + System.exit(0); + } + + +} diff --git a/src/it/softecspa/fileproxy/cache/CacheContainer.java b/src/it/softecspa/fileproxy/cache/CacheContainer.java new file mode 100644 index 0000000..78b2516 --- /dev/null +++ b/src/it/softecspa/fileproxy/cache/CacheContainer.java @@ -0,0 +1,172 @@ +package it.softecspa.fileproxy.cache; + +import it.softecspa.fileproxy.DatabaseBalancer.Balancer; +import it.softecspa.fileproxy.services.ServerCacheFactory.CacheKey; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.SortedMap; + +import org.apache.log4j.Logger; + +public class CacheContainer { + + // Singleton instance + private static CacheContainer instance; + + private Logger log = Logger.getLogger(getClass()); + + // Mappe degli elementi + private HashMap>[] cache = null; + private HashMap>>[] cachedTables = null; + + + private CacheContainer() { + super(); + synchronized (CacheContainer.class) { + if (instance == null) { + instance = this; + + log.info(CacheContainer.class.getSimpleName()+" instance is starting!"); + instance.flushAll(); + } + } + } + + + public static CacheContainer getInstance() { + synchronized (CacheContainer.class) { + if (instance == null) new CacheContainer(); + } + return instance; + } + + + + protected synchronized void flushAll() { + flush(Balancer.MASTER); + flush(Balancer.STAGE); + } + + + @SuppressWarnings("unchecked") + protected synchronized void flush(Balancer balancer) { + // CACHE + if (cache==null) cache = new HashMap[2]; + if (cache[balancer.index()]==null) cache[balancer.index()] = new HashMap>(); + // Elenco tabelle coinvolte per singola cache + if (cachedTables==null) cachedTables = new HashMap[2]; + if (cachedTables[balancer.index()]==null) cachedTables[balancer.index()] = new HashMap>>(); + + // ....pulizia + Collection> collection = cache[balancer.index()].values(); + for (Iterator> i = collection.iterator(); i.hasNext(); ) { + CacheElement element = i.next(); + if (element!=null) element.flush(); + } + } + + + + public void createContainer(CacheElement element) throws CacheException { + createContainer(element.getUniqueName(), element, true); + } + + public void createContainer(CacheKey uniqueNane, CacheElement element, boolean autoflush) throws CacheException { + if (element==null) return; + + if (uniqueNane==null) throw new CacheException("CacheElement with null name"); + String name = uniqueNane.toString(); + if (log.isDebugEnabled()) log.debug("Create empty container with name '"+name+"'"); + int index = element.getBalancer().index(); + + CacheElement found = cache[index].get(name); + if (found!=null) { + if (found.getClass()!=element.getClass()) { + throw new CacheException("CacheElement ClassCastException: element named '"+name+"' class is "+found.getClass().getSimpleName()+"!"); + } + + if (autoflush) { + // Se esiste già un container con quel nome lo pulisco; + cache[index].get(name).flush(); + return; + } else { + throw new CacheException("CacheElement with name '"+name+"' just exist!"); + } + } else { + addTables(name, element, index); + } + + // Aggiungo l'elemento alla cache + cache[element.getBalancer().index()].put(name, element); + } + + + private void addTables(String name, CacheElement element, int index) { + for (String table : element.getTables()) { + List> lista = cachedTables[index].get(table); + if (lista==null) { + lista = new ArrayList>(); + cachedTables[index].put(table, lista); + } + if (!lista.contains(name)) { + lista.add(element); + } + } + + + } + + + @SuppressWarnings("unchecked") + public CacheElement getCacheElement(CacheKey uniqueName, Balancer balancer) throws CacheException { + int index = balancer.index(); + String name = uniqueName.toString(); + + // Estraggo il container + CacheElement container = null; + try { + container = (CacheElement) cache[index].get(name); + + // FIXME aggiungere log dell'errore su DB e invio email + + return container; + + } catch (ClassCastException e) { + throw new CacheException("ClassCastException estracting element with name '"+name+"'", e); + } catch (Exception e) { + throw new CacheException("Unhandled exception estracting element with name '"+name+"'"); + } + } + + /** + * Restituisce il container dati legato alla chiave + * @param uniqueName + * @param balancer + * @return + * @throws CacheException + */ + public SortedMap getContainer(CacheKey uniqueName, Balancer balancer) throws CacheException { + // Estraggo il container + CacheElement cacheElement = getCacheElement(uniqueName, balancer); + + // Controllo se i dati sono validi, altrimenti faccio un load + if (cacheElement.isExpired()) { + cacheElement.load(); + } + + return cacheElement.getContainer(); + } + + /** + * Restituisce la lista completa delle tabelle in cache + * @return + */ + public HashMap>>[] getCachedTables() { + return cachedTables; + } + +} diff --git a/src/it/softecspa/fileproxy/cache/CacheElement.java b/src/it/softecspa/fileproxy/cache/CacheElement.java new file mode 100644 index 0000000..4c33697 --- /dev/null +++ b/src/it/softecspa/fileproxy/cache/CacheElement.java @@ -0,0 +1,162 @@ +package it.softecspa.fileproxy.cache; + + +import it.softecspa.PortalSettings; +import it.softecspa.database.dbconnect.SQLTimeoutException; +import it.softecspa.fileproxy.DatabaseBalancer.Balancer; +import it.softecspa.fileproxy.services.ServerCacheFactory.CacheKey; +import it.softecspa.fileproxy.services.common.EnterpriseLog; + +import java.sql.SQLException; +import java.util.Collection; +import java.util.SortedMap; +import java.util.TreeMap; + +import org.apache.log4j.Logger; + +public abstract class CacheElement { + + protected Logger log = Logger.getLogger(getClass()); + + // Flag che indicase la cache è stata caricata + private boolean loaded; + // Contenitore delle coppie chiave/valore + private SortedMap container; + // Nome della cache che la identifica univocamente + private CacheKey uniqueName; + + // -------------------------------- + private Balancer balancer; + + + + public CacheElement(CacheKey name, Balancer balancer) { + this.uniqueName = name; + this.balancer = balancer; + this.container = new TreeMap(); + } + + + /** + * La cache è spirata, deve essere ricaricata + * @return + */ + public boolean isExpired() { + return !loaded; + } + + /** + * La cache non è valida, non è caricata + * @return + */ + public boolean isLoaded() { + return loaded; + } + + /** + * Restituisce il container + * @return + */ + protected SortedMap getContainer() { + return container; + } + /* + private void setContainer(Hashtable values) { + this.container = values; + } + */ + + /** + * Esegue il reload della cache + */ + public synchronized void load() { + flush(); + + // Eseguo la chiamata vera e propria per i caricamento + /* + * 2013-05-07, m.veroni - Riscontrato errore che impedisce il reload in caso di errore di caricamento + */ + try { + log.info("Load '"+getUniqueName()+"' cache container from "+balancer.toString()+" database"); + loaded = load(container, balancer); + } catch (CacheException e) { + loaded = false; + + // SQLTimeoutException, nessun invio di mail + if ((e.getCause()!=null && e.getCause() instanceof SQLTimeoutException)) { + log.fatal("SQLTimeoutException loading cache (DB TIMEOUT):" + e.getCause()); + return; + } + + // SQLException, invio della mail + if ((e.getCause()!=null && e.getCause() instanceof SQLException)) { + EnterpriseLog elog = new EnterpriseLog(e.getCause().getMessage(), e); + elog.write(); + elog.sendEmail(PortalSettings.MAIL_SQL_ERROR_ENABLE, "Error loading cache table"); + return; + } + + log.fatal("Error in table cache: "+e.toString(),e); + EnterpriseLog elog = new EnterpriseLog(e.getCause().getMessage(), e); + elog.write(); + elog.sendEmail(PortalSettings.MAIL_SQL_ERROR_ENABLE, "Error loading cache table"); + } + } + + + /** + * Esegue il caricamento della cache a partire dal database + * In caso di esito positivo è restituito TRUE + * In caso di errore è restituito un FALSE + * @param container + * @param balancer + * @return + */ + protected abstract boolean load(SortedMap container, Balancer balancer) throws CacheException; + + protected abstract String[] getTables(); + + /** + * Pulisce il contenitore e lo obbliga ad un successivo reload + */ + public synchronized void flush() { + if (log.isDebugEnabled()) log.debug("Flush '"+getUniqueName()+"' cache container ("+balancer.name()+" balance)"); + container.clear(); + loaded = false; + } + + + public Balancer getBalancer() { + return balancer; + } + + + public CacheKey getUniqueName() { + return uniqueName; + } + + + + /** + * Restituisce i valori di un altro container + * @param uniqueName + * @param balancer + * @return + * @throws CacheException + */ + protected Collection getOtherContainerValues(CacheKey uniqueName, Balancer balancer) throws CacheException { + CacheContainer cacheContainer = CacheContainer.getInstance(); + + SortedMap other = cacheContainer.getContainer(uniqueName, balancer); + if (other==null) return null; + + // Faccio una doppia verifica nel caso di errori di caricamento + CacheElement cacheElement = cacheContainer.getCacheElement(uniqueName, balancer); + if (cacheElement.isExpired()) return null; + + // + return other.values(); + } + + +} diff --git a/src/it/softecspa/fileproxy/cache/CacheException.java b/src/it/softecspa/fileproxy/cache/CacheException.java new file mode 100644 index 0000000..0fb7169 --- /dev/null +++ b/src/it/softecspa/fileproxy/cache/CacheException.java @@ -0,0 +1,19 @@ +package it.softecspa.fileproxy.cache; + +@SuppressWarnings("serial") +public class CacheException extends Throwable { + + + public CacheException(String message) { + super(message); + } + + public CacheException(Throwable cause) { + super(cause); + } + + public CacheException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/src/it/softecspa/fileproxy/db/ChangeLog.java b/src/it/softecspa/fileproxy/db/ChangeLog.java new file mode 100644 index 0000000..b1154d1 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/ChangeLog.java @@ -0,0 +1,67 @@ +package it.softecspa.fileproxy.db; +/* + * @(#)ChangeLog.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.fileproxy.db.criterias.ChangeLogCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + +/** + * Customizable manager for table A001_CHANGE_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class ChangeLog extends it.softecspa.fileproxy.db.skins.ChangeLogSkin { + + public ChangeLog() { + super(); + } + + /** + * Extract bean using key + */ + public ChangeLog(ConnectionManager cm, String code) throws NoRecordFoundException, SQLException { + super(cm, code); + } + + /** + * Execute select * with criteria + * @throws SQLException if there is an error in your query + */ + public static ChangeLog[] select(ChangeLogCriteria criteria) throws SQLException { + SqlWriter sql = criteria.getSelect(); + return (ChangeLog[])(new ChangeLog()).getRows(criteria.getConnectionManager(), sql.costruisciSelect()); + } + + /** + * Customizable update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + @Override + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + // Insert here your custom code + return super.updateRecord(updateType, dbs); + } + + @Override + public ChangeLog clone() { + try { + ChangeLog c = (ChangeLog) super.clone(); + // Insert custom clonable objects + return c; + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/it/softecspa/fileproxy/db/ClusterInfo.java b/src/it/softecspa/fileproxy/db/ClusterInfo.java new file mode 100644 index 0000000..74c754a --- /dev/null +++ b/src/it/softecspa/fileproxy/db/ClusterInfo.java @@ -0,0 +1,139 @@ +/* + * @(#)ClusterInfo.java 1.4.4,26 custom 26/05/2010 + * + * Built automatically by REVERSER + */ + +package it.softecspa.fileproxy.db; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.fileproxy.db.criterias.ClusterInfoCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable manager for table T005_CLUSTER_INFO + * Class auto generated by REVERSER, version 1.4.4,26 custom + * + * @author il Vera + */ +public class ClusterInfo extends it.softecspa.fileproxy.db.skins.ClusterInfoSkin { + + private static final UpdateType START = new UpdateType(); + private static final UpdateType HEARTBEAT = new UpdateType(); + private static final UpdateType STOP = new UpdateType(); + + private int beatCount; + + + public ClusterInfo() { + super(); + this.doNotUse = false; + } + + /** + * Extract bean using key + */ + public ClusterInfo(ConnectionManager cm, String context, String hostname) throws NoRecordFoundException, SQLException { + super(cm, context, hostname); + } + + + + /** + * Execute select * with criteria + * @throws SQLException if there is an error in your query + */ + public static ClusterInfo[] select(ClusterInfoCriteria criteria) throws SQLException { + SqlWriter sql = criteria.getSelect(); + return (ClusterInfo[])(new ClusterInfo()).getRows(criteria.getConnectionManager(), sql.costruisciSelect()); + } + + + /** + * Customizable update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + // Custom UPDATE + if (updateType == START) { + this.lifeStop = null; + if (super.updateRecord(UPDATE, dbs)==0) { + super.updateRecord(INSERT, dbs); + return -1; + } + return 1; + + } else if (updateType == HEARTBEAT) { + dbs.hideQueryLog(); + + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + sql.addColumnSET("d_last_beat" , Query.toSQLDateTime(this.lastBeat)); + sql.addColumnSET("d_record" , Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS()))); + sql.addWhere("v_hostname = " + sql.fStr(this.hostname)); + sql.addWhere("v_context = " + sql.fStr(this.context)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == STOP) { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + sql.addColumnSET("d_life_stop" , Query.toSQLDateTime(this.lifeStop)); + sql.addColumnSET("d_record" , Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS()))); + sql.addWhere("v_hostname = " +sql.fStr(this.hostname)); + sql.addWhere("v_context = " + sql.fStr(this.context)); + return dbs.execute(sql.costruisciUpdate()); + } + + // Insert here your custom code + return super.updateRecord(updateType, dbs); + } + + public final int lifeStart(ConnectionManager cm) throws SQLException { + int ret = updateRecord(cm, START); + + if (ret<0) { + // Ricarico i dati dopo l'inserimento per recuperare tutti i valori + ClusterInfoCriteria filter = new ClusterInfoCriteria(cm); + filter.setContext(context); + filter.setHostname(hostname); + readRow(cm, filter.getSelect().costruisciSelect()); + ret = 1; + } + // + + return ret; + } + + + public final int heartBeat(ConnectionManager cm) throws SQLException { + return updateRecord(cm, HEARTBEAT); + } + + public final int lifeStop(ConnectionManager cm) throws SQLException { + return updateRecord(cm, STOP); + } + + + + public int getBeatCount() { + return beatCount; + } + + public void resetBeatCount() { + this.beatCount = 0; + } + + public int addBeatCount() { + return ++beatCount; + } +} diff --git a/src/it/softecspa/fileproxy/db/ConfigProperties.java b/src/it/softecspa/fileproxy/db/ConfigProperties.java new file mode 100644 index 0000000..56cc8ad --- /dev/null +++ b/src/it/softecspa/fileproxy/db/ConfigProperties.java @@ -0,0 +1,67 @@ +package it.softecspa.fileproxy.db; +/* + * @(#)ConfigProperties.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.fileproxy.db.criterias.ConfigPropertiesCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + +/** + * Customizable manager for table T001_CONFIG_PROPERTIES + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class ConfigProperties extends it.softecspa.fileproxy.db.skins.ConfigPropertiesSkin { + + public ConfigProperties() { + super(); + } + + /** + * Extract bean using key + */ + public ConfigProperties(ConnectionManager cm, String key) throws NoRecordFoundException, SQLException { + super(cm, key); + } + + /** + * Execute select * with criteria + * @throws SQLException if there is an error in your query + */ + public static ConfigProperties[] select(ConfigPropertiesCriteria criteria) throws SQLException { + SqlWriter sql = criteria.getSelect(); + return (ConfigProperties[])(new ConfigProperties()).getRows(criteria.getConnectionManager(), sql.costruisciSelect()); + } + + /** + * Customizable update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + @Override + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + // Insert here your custom code + return super.updateRecord(updateType, dbs); + } + + @Override + public ConfigProperties clone() { + try { + ConfigProperties c = (ConfigProperties) super.clone(); + // Insert custom clonable objects + return c; + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/it/softecspa/fileproxy/db/Log.java b/src/it/softecspa/fileproxy/db/Log.java new file mode 100644 index 0000000..5a31148 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/Log.java @@ -0,0 +1,92 @@ +/* + * @(#)Log.java 1.4.4,26 custom 26/05/2010 + * + * Built automatically by REVERSER + */ + +package it.softecspa.fileproxy.db; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.fileproxy.db.criterias.LogCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable manager for table T000_LOG + * Class auto generated by REVERSER, version 1.4.4,26 custom + * + * @author il Vera + */ +public class Log extends it.softecspa.fileproxy.db.skins.LogSkin { + + private static final UpdateType FLUSH = new UpdateType(); + private static final UpdateType DELETE_BEFORE = new UpdateType(); + + + public Log() { + super(); + lockAutoincrementRetrieves=true; + } + + /** + * Extract bean using key + */ + public Log(ConnectionManager cm, Integer id) throws NoRecordFoundException, SQLException { + super(cm, id); + } + + + + /** + * Execute select * with criteria + * @throws SQLException if there is an error in your query + */ + public static Log[] select(LogCriteria criteria) throws SQLException { + SqlWriter sql = criteria.getSelect(); + return (Log[])(new Log()).getRows(criteria.getConnectionManager(), sql.costruisciSelect()); + } + + + /** + * Customizable update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + + if (updateType == DELETE_BEFORE) { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + sql.addWhere("d_record <= " + Query.toSQLDateTime(record)); + return dbs.execute(sql.costruisciDelete()); + } + if (updateType == FLUSH) { + return dbs.execute("TRUNCATE TABLE "+NAME); + } + + // Insert here your custom code + return super.updateRecord(updateType, dbs); + } + + public int deleteBefore(ConnectionManager cm) throws SQLException { + return updateRecord(cm, DELETE_BEFORE); + } + + + + public static int flush(ConnectionManager cm) throws SQLException { + Log log = new Log(); + return log.updateRecord(cm, FLUSH); + } + + + +} diff --git a/src/it/softecspa/fileproxy/db/Protocol.java b/src/it/softecspa/fileproxy/db/Protocol.java new file mode 100644 index 0000000..ef3e96b --- /dev/null +++ b/src/it/softecspa/fileproxy/db/Protocol.java @@ -0,0 +1,67 @@ +package it.softecspa.fileproxy.db; +/* + * @(#)Protocol.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.fileproxy.db.criterias.ProtocolCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + +/** + * Customizable manager for table T015_PROTOCOL + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class Protocol extends it.softecspa.fileproxy.db.skins.ProtocolSkin { + + public Protocol() { + super(); + } + + /** + * Extract bean using key + */ + public Protocol(ConnectionManager cm, Integer protocol) throws NoRecordFoundException, SQLException { + super(cm, protocol); + } + + /** + * Execute select * with criteria + * @throws SQLException if there is an error in your query + */ + public static Protocol[] select(ProtocolCriteria criteria) throws SQLException { + SqlWriter sql = criteria.getSelect(); + return (Protocol[])(new Protocol()).getRows(criteria.getConnectionManager(), sql.costruisciSelect()); + } + + /** + * Customizable update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + @Override + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + // Insert here your custom code + return super.updateRecord(updateType, dbs); + } + + @Override + public Protocol clone() { + try { + Protocol c = (Protocol) super.clone(); + // Insert custom clonable objects + return c; + } catch (CloneNotSupportedException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/it/softecspa/fileproxy/db/criterias/ChangeLogCriteria.java b/src/it/softecspa/fileproxy/db/criterias/ChangeLogCriteria.java new file mode 100644 index 0000000..881874a --- /dev/null +++ b/src/it/softecspa/fileproxy/db/criterias/ChangeLogCriteria.java @@ -0,0 +1,55 @@ +/* + * @(#)ChangeLogCriteria.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.ChangeLog; +import it.softecspa.fileproxy.db.skins.criterias.ChangeLogCSkin; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable criteria filter for table A001_CHANGE_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class ChangeLogCriteria extends ChangeLogCSkin { + + + + public ChangeLogCriteria(ConnectionManager cm) { + super(cm); + } + + + + /** + * Customizable build select * with filter + */ + public SqlWriter getSelect() { + SqlWriter sql = super.getSelect(); + // Insert here your custom code + // sql.addTable(...); + // sql.addColumn(...); + // sql.addWhere(...); + // sql.addOption(...); + return sql; + } + + /** + * Execute select * with filter + * A zero length array is returned if no record found + * @throws SQLException if there is an error in your query + */ + public ChangeLog[] select() throws SQLException { + return ChangeLog.select(this); + } + + +} diff --git a/src/it/softecspa/fileproxy/db/criterias/ClusterInfoCriteria.java b/src/it/softecspa/fileproxy/db/criterias/ClusterInfoCriteria.java new file mode 100644 index 0000000..9d6344d --- /dev/null +++ b/src/it/softecspa/fileproxy/db/criterias/ClusterInfoCriteria.java @@ -0,0 +1,74 @@ +/* + * @(#)ClusterInfoCriteria.java 1.4.4,26 custom 26/05/2010 + * + * Built automatically by REVERSER + */ + +package it.softecspa.fileproxy.db.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.ClusterInfo; +import it.softecspa.fileproxy.db.skins.criterias.ClusterInfoCSkin; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable criteria filter for table T005_CLUSTER_INFO + * Class auto generated by REVERSER, version 1.4.4,26 custom + * + * @author il Vera + */ +public class ClusterInfoCriteria extends ClusterInfoCSkin { + + + private Boolean activeOnly; + + public ClusterInfoCriteria(ConnectionManager cm) { + super(cm); + } + + + + /** + * Customizable build select * with filter + */ + public SqlWriter getSelect() { + SqlWriter sql = super.getSelect(); + + if (activeOnly!=null && activeOnly.booleanValue()) { + sql.addWhere("t.d_life_stop is null"); + sql.addWhere("t.f_do_not_use = '0'"); + } + + return sql; + } + + /** + * Execute select * with filter + * A zero length array is returned if no record found + * @throws SQLException if there is an error in your query + */ + public ClusterInfo[] select() throws SQLException { + return ClusterInfo.select(this); + } + + + + public Boolean getActiveOnly() { + return activeOnly; + } + + + + public void setActiveOnly(Boolean activeOnly) { + this.activeOnly = activeOnly; + } + + + + + +} diff --git a/src/it/softecspa/fileproxy/db/criterias/ConfigPropertiesCriteria.java b/src/it/softecspa/fileproxy/db/criterias/ConfigPropertiesCriteria.java new file mode 100644 index 0000000..4244ffb --- /dev/null +++ b/src/it/softecspa/fileproxy/db/criterias/ConfigPropertiesCriteria.java @@ -0,0 +1,55 @@ +/* + * @(#)ConfigPropertiesCriteria.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.ConfigProperties; +import it.softecspa.fileproxy.db.skins.criterias.ConfigPropertiesCSkin; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable criteria filter for table T001_CONFIG_PROPERTIES + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class ConfigPropertiesCriteria extends ConfigPropertiesCSkin { + + + + public ConfigPropertiesCriteria(ConnectionManager cm) { + super(cm); + } + + + + /** + * Customizable build select * with filter + */ + public SqlWriter getSelect() { + SqlWriter sql = super.getSelect(); + // Insert here your custom code + // sql.addTable(...); + // sql.addColumn(...); + // sql.addWhere(...); + // sql.addOption(...); + return sql; + } + + /** + * Execute select * with filter + * A zero length array is returned if no record found + * @throws SQLException if there is an error in your query + */ + public ConfigProperties[] select() throws SQLException { + return ConfigProperties.select(this); + } + + +} diff --git a/src/it/softecspa/fileproxy/db/criterias/LogCriteria.java b/src/it/softecspa/fileproxy/db/criterias/LogCriteria.java new file mode 100644 index 0000000..5c2df9e --- /dev/null +++ b/src/it/softecspa/fileproxy/db/criterias/LogCriteria.java @@ -0,0 +1,55 @@ +/* + * @(#)LogCriteria.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.Log; +import it.softecspa.fileproxy.db.skins.criterias.LogCSkin; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable criteria filter for table T000_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class LogCriteria extends LogCSkin { + + + + public LogCriteria(ConnectionManager cm) { + super(cm); + } + + + + /** + * Customizable build select * with filter + */ + public SqlWriter getSelect() { + SqlWriter sql = super.getSelect(); + // Insert here your custom code + // sql.addTable(...); + // sql.addColumn(...); + // sql.addWhere(...); + // sql.addOption(...); + return sql; + } + + /** + * Execute select * with filter + * A zero length array is returned if no record found + * @throws SQLException if there is an error in your query + */ + public Log[] select() throws SQLException { + return Log.select(this); + } + + +} diff --git a/src/it/softecspa/fileproxy/db/criterias/ProtocolCriteria.java b/src/it/softecspa/fileproxy/db/criterias/ProtocolCriteria.java new file mode 100644 index 0000000..703483d --- /dev/null +++ b/src/it/softecspa/fileproxy/db/criterias/ProtocolCriteria.java @@ -0,0 +1,55 @@ +/* + * @(#)ProtocolCriteria.java 1.7.1,126 custom 2014-06-15T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.Protocol; +import it.softecspa.fileproxy.db.skins.criterias.ProtocolCSkin; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.SQLException; + + +/** + * Customizable criteria filter for table T015_PROTOCOL + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * @author il Vera + */ +public class ProtocolCriteria extends ProtocolCSkin { + + + + public ProtocolCriteria(ConnectionManager cm) { + super(cm); + } + + + + /** + * Customizable build select * with filter + */ + public SqlWriter getSelect() { + SqlWriter sql = super.getSelect(); + // Insert here your custom code + // sql.addTable(...); + // sql.addColumn(...); + // sql.addWhere(...); + // sql.addOption(...); + return sql; + } + + /** + * Execute select * with filter + * A zero length array is returned if no record found + * @throws SQLException if there is an error in your query + */ + public Protocol[] select() throws SQLException { + return Protocol.select(this); + } + + +} diff --git a/src/it/softecspa/fileproxy/db/skins/ChangeLogSkin.java b/src/it/softecspa/fileproxy/db/skins/ChangeLogSkin.java new file mode 100644 index 0000000..0b0d24e --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/ChangeLogSkin.java @@ -0,0 +1,139 @@ +package it.softecspa.fileproxy.db.skins; +/* + * @(#)ChangeLogSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.database.dbconnect.UpdatableRow; +import it.softecspa.fileproxy.db.criterias.ChangeLogCriteria; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Abstract manager for table A001_CHANGE_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ChangeLogSkin extends UpdatableRow implements Cloneable { + + + // Table name: A001_CHANGE_LOG + public static final String NAME = "a001_change_log"; + + public static final String ALIAS = "a001"; + + + protected Logger log = Logger.getLogger(ChangeLogSkin.class); + + // V_CODE - VARCHAR(30) NOT NULL PK + protected String code; + + // V_DESCRIPTION - VARCHAR(100) NOT NULL + protected String description; + + // D_CHANGE - DATETIME NOT NULL + protected EnterpriseCalendar change; + + + protected ChangeLogSkin() { + super(); + } + + /** + * Extract bean using key + */ + protected ChangeLogSkin(ConnectionManager cm, String code) throws NoRecordFoundException, SQLException { + this(); + // Setup key filter values + ChangeLogCriteria filter = new ChangeLogCriteria(cm); + filter.setCode(code); + readRow(cm, filter.getSelect().costruisciSelect()); + } + + + public String getCode() { + return this.code; + } + + public void setCode(String value) { + this.code = value; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String value) { + this.description = value; + } + + public EnterpriseCalendar getChange() { + return this.change; + } + + public void setChange(EnterpriseCalendar value) { + this.change = value; + } + + + @Override + public ChangeLogSkin clone() throws CloneNotSupportedException { + ChangeLogSkin c = (ChangeLogSkin) super.clone(); + // + // Not primitive or not immutable objects + if (this.change!=null) c.change = (EnterpriseCalendar) this.change.clone(); + // + return c; + } + + + /** + * Standard implementation of update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + if (updateType == INSERT) { + sql.addValue("v_code" , sql.fStr(this.code)); + sql.addValue("v_description" , sql.fStr(this.description)); + sql.addValue("d_change" , Query.toSQLDateTime(dbs.getDBMS(), this.change)); + int _retval = dbs.execute(sql.costruisciInsert()); + return _retval; + + } else if (updateType == UPDATE) { + sql.addColumnSET("v_description" , sql.fStr(this.description)); + sql.addColumnSET("d_change" , Query.toSQLDateTime(dbs.getDBMS(), this.change)); + sql.addWhere("v_code = " +sql.fStr(this.code)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == DELETE) { + sql.addWhere("v_code = " +sql.fStr(this.code)); + return dbs.execute(sql.costruisciDelete()); + } + return 0; + } + + protected void readRow(ResultSet rs) throws SQLException { + setCode(rs.getString("v_code")); + // ------- + setDescription(rs.getString("v_description")); + setChange(EnterpriseCalendar.newInstance(rs.getTimestamp("d_change"))); + } + +} diff --git a/src/it/softecspa/fileproxy/db/skins/ClusterInfoSkin.java b/src/it/softecspa/fileproxy/db/skins/ClusterInfoSkin.java new file mode 100644 index 0000000..07cfce3 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/ClusterInfoSkin.java @@ -0,0 +1,245 @@ +package it.softecspa.fileproxy.db.skins; +/* + * @(#)ClusterInfoSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.database.dbconnect.UpdatableRow; +import it.softecspa.fileproxy.db.criterias.ClusterInfoCriteria; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Abstract manager for table T005_CLUSTER_INFO + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ClusterInfoSkin extends UpdatableRow implements Cloneable { + + + // Table name: T005_CLUSTER_INFO + public static final String NAME = "t005_cluster_info"; + + public static final String ALIAS = "t005"; + + + protected Logger log = Logger.getLogger(ClusterInfoSkin.class); + + // V_HOSTNAME - VARCHAR(100) NOT NULL PK + protected String hostname; + + // V_CONTEXT - VARCHAR(100) NOT NULL PK + protected String context; + + // V_ADDRESS - VARCHAR(20) nullable + protected String address; + + // V_BACKPLANE_HOSTNAME - VARCHAR(100) nullable + protected String backplaneHostname; + + // D_LIFE_START - DATETIME NOT NULL + protected EnterpriseCalendar lifeStart; + + // D_LIFE_STOP - DATETIME nullable + protected EnterpriseCalendar lifeStop; + + // D_LAST_BEAT - DATETIME NOT NULL + protected EnterpriseCalendar lastBeat; + + // F_DO_NOT_USE - BIT NOT NULL + protected Boolean doNotUse; + + // V_VERSION - VARCHAR(50) nullable + protected String version; + + // D_RECORD - DATETIME NOT NULL + protected EnterpriseCalendar record; + protected EnterpriseCalendar old_d_record; + + + protected ClusterInfoSkin() { + super(); + } + + /** + * Extract bean using key + */ + protected ClusterInfoSkin(ConnectionManager cm, String context, String hostname) throws NoRecordFoundException, SQLException { + this(); + // Setup key filter values + ClusterInfoCriteria filter = new ClusterInfoCriteria(cm); + filter.setContext(context); + filter.setHostname(hostname); + readRow(cm, filter.getSelect().costruisciSelect()); + } + + + public String getHostname() { + return this.hostname; + } + + public void setHostname(String value) { + this.hostname = value; + } + + public String getContext() { + return this.context; + } + + public void setContext(String value) { + this.context = value; + } + + public String getAddress() { + return this.address; + } + + public void setAddress(String value) { + this.address = value; + } + + public String getBackplaneHostname() { + return this.backplaneHostname; + } + + public void setBackplaneHostname(String value) { + this.backplaneHostname = value; + } + + public EnterpriseCalendar getLifeStart() { + return this.lifeStart; + } + + public void setLifeStart(EnterpriseCalendar value) { + this.lifeStart = value; + } + + public EnterpriseCalendar getLifeStop() { + return this.lifeStop; + } + + public void setLifeStop(EnterpriseCalendar value) { + this.lifeStop = value; + } + + public EnterpriseCalendar getLastBeat() { + return this.lastBeat; + } + + public void setLastBeat(EnterpriseCalendar value) { + this.lastBeat = value; + } + + public Boolean getDoNotUse() { + return this.doNotUse; + } + + public void setDoNotUse(Boolean value) { + this.doNotUse = value; + } + + public String getVersion() { + return this.version; + } + + public void setVersion(String value) { + this.version = value; + } + + public EnterpriseCalendar getRecord() { + return this.record; + } + + public void setRecord(EnterpriseCalendar value) { + this.record = value; + } + + + @Override + public ClusterInfoSkin clone() throws CloneNotSupportedException { + ClusterInfoSkin c = (ClusterInfoSkin) super.clone(); + // + // Not primitive or not immutable objects + if (this.lifeStart!=null) c.lifeStart = (EnterpriseCalendar) this.lifeStart.clone(); + if (this.lifeStop!=null) c.lifeStop = (EnterpriseCalendar) this.lifeStop.clone(); + if (this.lastBeat!=null) c.lastBeat = (EnterpriseCalendar) this.lastBeat.clone(); + if (this.record!=null) c.record = (EnterpriseCalendar) this.record.clone(); + if (this.old_d_record!=null) c.old_d_record = (EnterpriseCalendar) this.old_d_record.clone(); + // + return c; + } + + + /** + * Standard implementation of update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + if (updateType == INSERT) { + sql.addValue("v_hostname" , sql.fStr(this.hostname)); + sql.addValue("v_context" , sql.fStr(this.context)); + sql.addValue("v_address" , sql.fStr(this.address)); + sql.addValue("v_backplane_hostname" , sql.fStr(this.backplaneHostname)); + sql.addValue("d_life_start" , Query.toSQLDateTime(dbs.getDBMS(), this.lifeStart)); + sql.addValue("d_life_stop" , Query.toSQLDateTime(dbs.getDBMS(), this.lifeStop)); + sql.addValue("d_last_beat" , Query.toSQLDateTime(dbs.getDBMS(), this.lastBeat)); + sql.addValue("f_do_not_use" , sql.fNum(this.doNotUse!=null?(this.doNotUse.booleanValue()?1:0):null)); + sql.addValue("v_version" , sql.fStr(this.version)); + sql.addValue("d_record" , (this.record==null?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + int _retval = dbs.execute(sql.costruisciInsert()); + return _retval; + + } else if (updateType == UPDATE) { + sql.addColumnSET("v_address" , sql.fStr(this.address)); + sql.addColumnSET("v_backplane_hostname" , sql.fStr(this.backplaneHostname)); + sql.addColumnSET("d_life_start" , Query.toSQLDateTime(dbs.getDBMS(), this.lifeStart)); + sql.addColumnSET("d_life_stop" , Query.toSQLDateTime(dbs.getDBMS(), this.lifeStop)); + sql.addColumnSET("d_last_beat" , Query.toSQLDateTime(dbs.getDBMS(), this.lastBeat)); + sql.addColumnSET("f_do_not_use" , sql.fNum(this.doNotUse!=null?(this.doNotUse.booleanValue()?1:0):null)); + sql.addColumnSET("v_version" , sql.fStr(this.version)); + sql.addColumnSET("d_record" , (this.record==null || this.record.equals(this.old_d_record)?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + sql.addWhere("v_context = " +sql.fStr(this.context)); + sql.addWhere("v_hostname = " +sql.fStr(this.hostname)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == DELETE) { + sql.addWhere("v_context = " +sql.fStr(this.context)); + sql.addWhere("v_hostname = " +sql.fStr(this.hostname)); + return dbs.execute(sql.costruisciDelete()); + } + return 0; + } + + protected void readRow(ResultSet rs) throws SQLException { + setHostname(rs.getString("v_hostname")); + setContext(rs.getString("v_context")); + // ------- + setAddress(rs.getString("v_address")); + setBackplaneHostname(rs.getString("v_backplane_hostname")); + setLifeStart(EnterpriseCalendar.newInstance(rs.getTimestamp("d_life_start"))); + setLifeStop(EnterpriseCalendar.newInstance(rs.getTimestamp("d_life_stop"))); + setLastBeat(EnterpriseCalendar.newInstance(rs.getTimestamp("d_last_beat"))); + setDoNotUse(SqlWriter.getBoolean(rs, "f_do_not_use")); + setVersion(rs.getString("v_version")); + setRecord(EnterpriseCalendar.newInstance(rs.getTimestamp("d_record"))); + this.old_d_record = getRecord(); // Cache della colonna D_RECORD + } + +} diff --git a/src/it/softecspa/fileproxy/db/skins/ConfigPropertiesSkin.java b/src/it/softecspa/fileproxy/db/skins/ConfigPropertiesSkin.java new file mode 100644 index 0000000..92fc031 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/ConfigPropertiesSkin.java @@ -0,0 +1,136 @@ +package it.softecspa.fileproxy.db.skins; +/* + * @(#)ConfigPropertiesSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.UpdatableRow; +import it.softecspa.fileproxy.db.criterias.ConfigPropertiesCriteria; +import it.softecspa.kahuna.sql.SqlWriter; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Abstract manager for table T001_CONFIG_PROPERTIES + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ConfigPropertiesSkin extends UpdatableRow implements Cloneable { + + + // Table name: T001_CONFIG_PROPERTIES + public static final String NAME = "t001_config_properties"; + + public static final String ALIAS = "t001"; + + + protected Logger log = Logger.getLogger(ConfigPropertiesSkin.class); + + // V_KEY - VARCHAR(50) NOT NULL PK + protected String key; + + // V_VALUE - VARCHAR(256) NOT NULL + protected String value; + + // V_DESCRIPTION - VARCHAR(100) nullable + protected String description; + + + protected ConfigPropertiesSkin() { + super(); + } + + /** + * Extract bean using key + */ + protected ConfigPropertiesSkin(ConnectionManager cm, String key) throws NoRecordFoundException, SQLException { + this(); + // Setup key filter values + ConfigPropertiesCriteria filter = new ConfigPropertiesCriteria(cm); + filter.setKey(key); + readRow(cm, filter.getSelect().costruisciSelect()); + } + + + public String getKey() { + return this.key; + } + + public void setKey(String value) { + this.key = value; + } + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String value) { + this.description = value; + } + + + @Override + public ConfigPropertiesSkin clone() throws CloneNotSupportedException { + ConfigPropertiesSkin c = (ConfigPropertiesSkin) super.clone(); + // + // Not primitive or not immutable objects + // + return c; + } + + + /** + * Standard implementation of update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + if (updateType == INSERT) { + sql.addValue("v_key" , sql.fStr(this.key)); + sql.addValue("v_value" , sql.fStr(this.value)); + sql.addValue("v_description" , sql.fStr(this.description)); + int _retval = dbs.execute(sql.costruisciInsert()); + return _retval; + + } else if (updateType == UPDATE) { + sql.addColumnSET("v_value" , sql.fStr(this.value)); + sql.addColumnSET("v_description" , sql.fStr(this.description)); + sql.addWhere("v_key = " +sql.fStr(this.key)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == DELETE) { + sql.addWhere("v_key = " +sql.fStr(this.key)); + return dbs.execute(sql.costruisciDelete()); + } + return 0; + } + + protected void readRow(ResultSet rs) throws SQLException { + setKey(rs.getString("v_key")); + // ------- + setValue(rs.getString("v_value")); + setDescription(rs.getString("v_description")); + } + +} diff --git a/src/it/softecspa/fileproxy/db/skins/LogSkin.java b/src/it/softecspa/fileproxy/db/skins/LogSkin.java new file mode 100644 index 0000000..7d7bcc1 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/LogSkin.java @@ -0,0 +1,189 @@ +package it.softecspa.fileproxy.db.skins; +/* + * @(#)LogSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.database.dbconnect.UpdatableRow; +import it.softecspa.fileproxy.db.criterias.LogCriteria; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Abstract manager for table T000_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class LogSkin extends UpdatableRow implements Cloneable { + + + // Table name: T000_LOG + public static final String NAME = "t000_log"; + + public static final String ALIAS = "t000"; + + + protected Logger log = Logger.getLogger(LogSkin.class); + protected boolean lockAutoincrementRetrieves; + + // ID - INT(10) NOT NULL PK autoincrement + protected Integer id; + + // V_SOURCE - VARCHAR(50) NOT NULL + protected String source; + + // V_MESSAGE - TEXT(65535) NOT NULL + protected String message; + + // V_STACKTRACE - TEXT(65535) nullable + protected String stacktrace; + + // N_TICKET - INT(10) nullable + protected Integer ticket; + + // D_RECORD - DATETIME NOT NULL + protected EnterpriseCalendar record; + protected EnterpriseCalendar old_d_record; + + + protected LogSkin() { + super(); + } + + /** + * Extract bean using key + */ + protected LogSkin(ConnectionManager cm, Integer id) throws NoRecordFoundException, SQLException { + this(); + // Setup key filter values + LogCriteria filter = new LogCriteria(cm); + filter.setId(id); + readRow(cm, filter.getSelect().costruisciSelect()); + } + + + public Integer getId() { + return this.id; + } + + public void setId(Integer value) { + this.id = value; + } + + public String getSource() { + return this.source; + } + + public void setSource(String value) { + this.source = value; + } + + public String getMessage() { + return this.message; + } + + public void setMessage(String value) { + this.message = value; + } + + public String getStacktrace() { + return this.stacktrace; + } + + public void setStacktrace(String value) { + this.stacktrace = value; + } + + public Integer getTicket() { + return this.ticket; + } + + public void setTicket(Integer value) { + this.ticket = value; + } + + public EnterpriseCalendar getRecord() { + return this.record; + } + + public void setRecord(EnterpriseCalendar value) { + this.record = value; + } + + + @Override + public LogSkin clone() throws CloneNotSupportedException { + LogSkin c = (LogSkin) super.clone(); + // + // Not primitive or not immutable objects + if (this.record!=null) c.record = (EnterpriseCalendar) this.record.clone(); + if (this.old_d_record!=null) c.old_d_record = (EnterpriseCalendar) this.old_d_record.clone(); + // + return c; + } + + + /** + * Standard implementation of update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + if (updateType == INSERT) { + sql.addValue("id" , sql.fNum(this.id)); + sql.addValue("v_source" , sql.fStr(this.source)); + sql.addValue("v_message" , sql.fStr(this.message)); + sql.addValue("v_stacktrace" , sql.fStr(this.stacktrace)); + sql.addValue("n_ticket" , sql.fNum(this.ticket)); + sql.addValue("d_record" , (this.record==null?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + int _retval = dbs.execute(sql.costruisciInsert()); + if (lockAutoincrementRetrieves) return _retval; + + // Calcolo del massimo progressivo e lo assegno alla chiave + this.id = LogCriteria.getMaxId(dbs); + return this.id.intValue(); + + } else if (updateType == UPDATE) { + sql.addColumnSET("v_source" , sql.fStr(this.source)); + sql.addColumnSET("v_message" , sql.fStr(this.message)); + sql.addColumnSET("v_stacktrace" , sql.fStr(this.stacktrace)); + sql.addColumnSET("n_ticket" , sql.fNum(this.ticket)); + sql.addColumnSET("d_record" , (this.record==null || this.record.equals(this.old_d_record)?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + sql.addWhere("id = " +sql.fNum(this.id)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == DELETE) { + sql.addWhere("id = " +sql.fNum(this.id)); + return dbs.execute(sql.costruisciDelete()); + } + return 0; + } + + protected void readRow(ResultSet rs) throws SQLException { + setId(SqlWriter.getInteger(rs, "id")); + // ------- + setSource(rs.getString("v_source")); + setMessage(rs.getString("v_message")); + setStacktrace(rs.getString("v_stacktrace")); + setTicket(SqlWriter.getInteger(rs, "n_ticket")); + setRecord(EnterpriseCalendar.newInstance(rs.getTimestamp("d_record"))); + this.old_d_record = getRecord(); // Cache della colonna D_RECORD + } + +} diff --git a/src/it/softecspa/fileproxy/db/skins/ProtocolSkin.java b/src/it/softecspa/fileproxy/db/skins/ProtocolSkin.java new file mode 100644 index 0000000..6ba9ee5 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/ProtocolSkin.java @@ -0,0 +1,156 @@ +package it.softecspa.fileproxy.db.skins; +/* + * @(#)ProtocolSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.database.dbconnect.UpdatableRow; +import it.softecspa.fileproxy.db.criterias.ProtocolCriteria; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Abstract manager for table T015_PROTOCOL + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ProtocolSkin extends UpdatableRow implements Cloneable { + + + // Table name: T015_PROTOCOL + public static final String NAME = "t015_protocol"; + + public static final String ALIAS = "t015"; + + + protected Logger log = Logger.getLogger(ProtocolSkin.class); + + // N_PROTOCOL - INT UNSIGNED(10) NOT NULL PK + protected Integer protocol; + + // V_NAME - VARCHAR(50) NOT NULL + protected String name; + + // V_SERVER_VERSION - VARCHAR(50) NOT NULL + protected String serverVersion; + + // D_RECORD - DATETIME NOT NULL + protected EnterpriseCalendar record; + protected EnterpriseCalendar old_d_record; + + + protected ProtocolSkin() { + super(); + } + + /** + * Extract bean using key + */ + protected ProtocolSkin(ConnectionManager cm, Integer protocol) throws NoRecordFoundException, SQLException { + this(); + // Setup key filter values + ProtocolCriteria filter = new ProtocolCriteria(cm); + filter.setProtocol(protocol); + readRow(cm, filter.getSelect().costruisciSelect()); + } + + + public Integer getProtocol() { + return this.protocol; + } + + public void setProtocol(Integer value) { + this.protocol = value; + } + + public String getName() { + return this.name; + } + + public void setName(String value) { + this.name = value; + } + + public String getServerVersion() { + return this.serverVersion; + } + + public void setServerVersion(String value) { + this.serverVersion = value; + } + + public EnterpriseCalendar getRecord() { + return this.record; + } + + public void setRecord(EnterpriseCalendar value) { + this.record = value; + } + + + @Override + public ProtocolSkin clone() throws CloneNotSupportedException { + ProtocolSkin c = (ProtocolSkin) super.clone(); + // + // Not primitive or not immutable objects + if (this.record!=null) c.record = (EnterpriseCalendar) this.record.clone(); + if (this.old_d_record!=null) c.old_d_record = (EnterpriseCalendar) this.old_d_record.clone(); + // + return c; + } + + + /** + * Standard implementation of update method + * @param updateType operation to execute + * @param dbs DatabaseStatement that perform operation + * @return number of update rows or new autoincrement id + * @throws SQLException if there is an error in your query + */ + public int updateRecord(UpdateType updateType, DatabaseStatement dbs) throws SQLException { + SqlWriter sql = new SqlWriter(); + sql.setTables(NAME); + if (updateType == INSERT) { + sql.addValue("n_protocol" , sql.fNum(this.protocol)); + sql.addValue("v_name" , sql.fStr(this.name)); + sql.addValue("v_server_version" , sql.fStr(this.serverVersion)); + sql.addValue("d_record" , (this.record==null?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + int _retval = dbs.execute(sql.costruisciInsert()); + return _retval; + + } else if (updateType == UPDATE) { + sql.addColumnSET("v_name" , sql.fStr(this.name)); + sql.addColumnSET("v_server_version" , sql.fStr(this.serverVersion)); + sql.addColumnSET("d_record" , (this.record==null || this.record.equals(this.old_d_record)?Query.toSQL(Query.getFunCurrentDateTime(dbs.getDBMS())):Query.toSQLDateTime(dbs.getDBMS(), this.record))); + sql.addWhere("n_protocol = " +sql.fNum(this.protocol)); + return dbs.execute(sql.costruisciUpdate()); + + } else if (updateType == DELETE) { + sql.addWhere("n_protocol = " +sql.fNum(this.protocol)); + return dbs.execute(sql.costruisciDelete()); + } + return 0; + } + + protected void readRow(ResultSet rs) throws SQLException { + setProtocol(SqlWriter.getInteger(rs, "n_protocol")); + // ------- + setName(rs.getString("v_name")); + setServerVersion(rs.getString("v_server_version")); + setRecord(EnterpriseCalendar.newInstance(rs.getTimestamp("d_record"))); + this.old_d_record = getRecord(); // Cache della colonna D_RECORD + } + +} diff --git a/src/it/softecspa/fileproxy/db/skins/criterias/ChangeLogCSkin.java b/src/it/softecspa/fileproxy/db/skins/criterias/ChangeLogCSkin.java new file mode 100644 index 0000000..5c7c11a --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/criterias/ChangeLogCSkin.java @@ -0,0 +1,143 @@ +/* + * @(#)ChangeLogCSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.skins.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.fileproxy.db.ChangeLog; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import org.apache.log4j.Logger; + + +/** + * Abstract criteria filter for table A001_CHANGE_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ChangeLogCSkin { + + + protected Logger log = Logger.getLogger(getClass()); + + protected ConnectionManager cm; + + // V_CODE - VARCHAR(30) NOT NULL PK + protected String code; + + // V_DESCRIPTION - VARCHAR(100) NOT NULL + protected String description; + + // D_CHANGE - DATETIME NOT NULL + // protected EnterpriseCalendar change; + + protected String custom_order_by; + protected String custom_add_where; + protected String custom_add_options; + + + protected ChangeLogCSkin(ConnectionManager cm) { + super(); + this.cm = cm; + } + + + public String getCode() { + return this.code; + } + + public void setCode(String value) { + this.code = value; + } + + + public String getDescription() { + return this.description; + } + + public void setDescription(String value) { + this.description = value; + } + + + /** + * ORDER BY condition + */ + public void orderBy(String value) { + this.custom_order_by = value; + } + + /** + * Custom WHERE condition to add in query composition + */ + public void addCustomWhere(String value) { + this.custom_add_where = value; + } + + /** + * Custom option to add in query composition + */ + public void addCustomOptions(String value) { + this.custom_add_options = value; + } + + + + public ConnectionManager getConnectionManager() { + return this.cm; + } + + /** + * Columns used in select with alias + */ + protected String getColumns(String alias) { + return alias+".v_code" + + ", "+alias+".v_description" + + ", "+alias+".d_change"; + } + + /** + * Build select * using alias + */ + protected SqlWriter getSelectAll(String alias) { + SqlWriter sql = new SqlWriter(); + sql.setColumns(getColumns(alias)); + sql.setTables(ChangeLog.NAME +" "+ alias); + return sql; + } + + /** + * Build select * with filter with standard alias 't' + */ + protected SqlWriter getSelect() { + return getSelect("t"); + } + + /** + * Build select * with filter using custom alias + */ + protected SqlWriter getSelect(String alias) { + SqlWriter sql = getSelectAll(alias); + if (this.code != null) sql.addWhere(alias+".v_code = "+ sql.fStr(this.code)); + if (this.description != null) sql.addWhere(alias+".v_description = "+ sql.fStr(this.description)); + // No query condition set for column D_CHANGE + + // Custom WHERE + if (this.custom_add_where!=null) sql.addWhere(this.custom_add_where); + // Custom OPTIONS + if (this.custom_add_options!=null) sql.addOption(this.custom_add_options); + // Custom ORDER_BY + if (this.custom_order_by!=null) sql.addOption("ORDER BY "+this.custom_order_by); + + return sql; + } + + +} diff --git a/src/it/softecspa/fileproxy/db/skins/criterias/ClusterInfoCSkin.java b/src/it/softecspa/fileproxy/db/skins/criterias/ClusterInfoCSkin.java new file mode 100644 index 0000000..8ae3481 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/criterias/ClusterInfoCSkin.java @@ -0,0 +1,210 @@ +/* + * @(#)ClusterInfoCSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.skins.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.Query; +import it.softecspa.fileproxy.db.ClusterInfo; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import org.apache.log4j.Logger; + + +/** + * Abstract criteria filter for table T005_CLUSTER_INFO + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ClusterInfoCSkin { + + + protected Logger log = Logger.getLogger(getClass()); + + protected ConnectionManager cm; + + // V_HOSTNAME - VARCHAR(100) NOT NULL PK + protected String hostname; + + // V_CONTEXT - VARCHAR(100) NOT NULL PK + protected String context; + + // V_ADDRESS - VARCHAR(20) nullable + protected String address; + + // V_BACKPLANE_HOSTNAME - VARCHAR(100) nullable + protected String backplaneHostname; + + // D_LIFE_START - DATETIME NOT NULL + // protected EnterpriseCalendar lifeStart; + + // D_LIFE_STOP - DATETIME nullable + // protected EnterpriseCalendar lifeStop; + + // D_LAST_BEAT - DATETIME NOT NULL + // protected EnterpriseCalendar lastBeat; + + // F_DO_NOT_USE - BIT NOT NULL + protected Boolean doNotUse; + + // V_VERSION - VARCHAR(50) nullable + protected String version; + + protected String custom_order_by; + protected String custom_add_where; + protected String custom_add_options; + + + protected ClusterInfoCSkin(ConnectionManager cm) { + super(); + this.cm = cm; + } + + + public String getHostname() { + return this.hostname; + } + + public void setHostname(String value) { + this.hostname = value; + } + + + public String getContext() { + return this.context; + } + + public void setContext(String value) { + this.context = value; + } + + + public String getAddress() { + return this.address; + } + + public void setAddress(String value) { + this.address = value; + } + + + public String getBackplaneHostname() { + return this.backplaneHostname; + } + + public void setBackplaneHostname(String value) { + this.backplaneHostname = value; + } + + + public Boolean getDoNotUse() { + return this.doNotUse; + } + + public void setDoNotUse(Boolean value) { + this.doNotUse = value; + } + + + public String getVersion() { + return this.version; + } + + public void setVersion(String value) { + this.version = value; + } + + + /** + * ORDER BY condition + */ + public void orderBy(String value) { + this.custom_order_by = value; + } + + /** + * Custom WHERE condition to add in query composition + */ + public void addCustomWhere(String value) { + this.custom_add_where = value; + } + + /** + * Custom option to add in query composition + */ + public void addCustomOptions(String value) { + this.custom_add_options = value; + } + + + + public ConnectionManager getConnectionManager() { + return this.cm; + } + + /** + * Columns used in select with alias + */ + protected String getColumns(String alias) { + return alias+".v_hostname" + + ", "+alias+".v_context" + + ", "+alias+".v_address" + + ", "+alias+".v_backplane_hostname" + + ", "+alias+".d_life_start" + + ", "+alias+".d_life_stop" + + ", "+alias+".d_last_beat" + + ", "+alias+".f_do_not_use" + + ", "+alias+".v_version" + + ", "+alias+".d_record"; + } + + /** + * Build select * using alias + */ + protected SqlWriter getSelectAll(String alias) { + SqlWriter sql = new SqlWriter(); + sql.setColumns(getColumns(alias)); + sql.setTables(ClusterInfo.NAME +" "+ alias); + return sql; + } + + /** + * Build select * with filter with standard alias 't' + */ + protected SqlWriter getSelect() { + return getSelect("t"); + } + + /** + * Build select * with filter using custom alias + */ + protected SqlWriter getSelect(String alias) { + SqlWriter sql = getSelectAll(alias); + if (this.hostname != null) sql.addWhere(alias+".v_hostname = "+ sql.fStr(this.hostname)); + if (this.context != null) sql.addWhere(alias+".v_context = "+ sql.fStr(this.context)); + if (this.address != null) sql.addWhere(alias+".v_address = "+ sql.fStr(this.address)); + if (this.backplaneHostname != null) sql.addWhere(alias+".v_backplane_hostname = "+ sql.fStr(this.backplaneHostname)); + // No query condition set for column D_LIFE_START + // No query condition set for column D_LIFE_STOP + // No query condition set for column D_LAST_BEAT + if (this.doNotUse != null) sql.addWhere(alias+".f_do_not_use = "+ sql.fNum(this.doNotUse!=null?(this.doNotUse.booleanValue()?1:0):null)); + if (this.version != null) sql.addWhere(alias+".v_version = "+ sql.fStr(this.version)); + + // Custom WHERE + if (this.custom_add_where!=null) sql.addWhere(this.custom_add_where); + // Custom OPTIONS + if (this.custom_add_options!=null) sql.addOption(this.custom_add_options); + // Custom ORDER_BY + if (this.custom_order_by!=null) sql.addOption("ORDER BY "+this.custom_order_by); + + return sql; + } + + +} diff --git a/src/it/softecspa/fileproxy/db/skins/criterias/ConfigPropertiesCSkin.java b/src/it/softecspa/fileproxy/db/skins/criterias/ConfigPropertiesCSkin.java new file mode 100644 index 0000000..a8034b9 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/criterias/ConfigPropertiesCSkin.java @@ -0,0 +1,150 @@ +/* + * @(#)ConfigPropertiesCSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.skins.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.db.ConfigProperties; +import it.softecspa.kahuna.sql.SqlWriter; + +import org.apache.log4j.Logger; + + +/** + * Abstract criteria filter for table T001_CONFIG_PROPERTIES + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ConfigPropertiesCSkin { + + + protected Logger log = Logger.getLogger(getClass()); + + protected ConnectionManager cm; + + // V_KEY - VARCHAR(50) NOT NULL PK + protected String key; + + // V_VALUE - VARCHAR(256) NOT NULL + protected String value; + + // V_DESCRIPTION - VARCHAR(100) nullable + protected String description; + + protected String custom_order_by; + protected String custom_add_where; + protected String custom_add_options; + + + protected ConfigPropertiesCSkin(ConnectionManager cm) { + super(); + this.cm = cm; + } + + + public String getKey() { + return this.key; + } + + public void setKey(String value) { + this.key = value; + } + + + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + + public String getDescription() { + return this.description; + } + + public void setDescription(String value) { + this.description = value; + } + + + /** + * ORDER BY condition + */ + public void orderBy(String value) { + this.custom_order_by = value; + } + + /** + * Custom WHERE condition to add in query composition + */ + public void addCustomWhere(String value) { + this.custom_add_where = value; + } + + /** + * Custom option to add in query composition + */ + public void addCustomOptions(String value) { + this.custom_add_options = value; + } + + + + public ConnectionManager getConnectionManager() { + return this.cm; + } + + /** + * Columns used in select with alias + */ + protected String getColumns(String alias) { + return alias+".v_key" + + ", "+alias+".v_value" + + ", "+alias+".v_description"; + } + + /** + * Build select * using alias + */ + protected SqlWriter getSelectAll(String alias) { + SqlWriter sql = new SqlWriter(); + sql.setColumns(getColumns(alias)); + sql.setTables(ConfigProperties.NAME +" "+ alias); + return sql; + } + + /** + * Build select * with filter with standard alias 't' + */ + protected SqlWriter getSelect() { + return getSelect("t"); + } + + /** + * Build select * with filter using custom alias + */ + protected SqlWriter getSelect(String alias) { + SqlWriter sql = getSelectAll(alias); + if (this.key != null) sql.addWhere(alias+".v_key = "+ sql.fStr(this.key)); + if (this.value != null) sql.addWhere(alias+".v_value = "+ sql.fStr(this.value)); + if (this.description != null) sql.addWhere(alias+".v_description = "+ sql.fStr(this.description)); + + // Custom WHERE + if (this.custom_add_where!=null) sql.addWhere(this.custom_add_where); + // Custom OPTIONS + if (this.custom_add_options!=null) sql.addOption(this.custom_add_options); + // Custom ORDER_BY + if (this.custom_order_by!=null) sql.addOption("ORDER BY "+this.custom_order_by); + + return sql; + } + + +} diff --git a/src/it/softecspa/fileproxy/db/skins/criterias/LogCSkin.java b/src/it/softecspa/fileproxy/db/skins/criterias/LogCSkin.java new file mode 100644 index 0000000..baffdd6 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/criterias/LogCSkin.java @@ -0,0 +1,190 @@ +/* + * @(#)LogCSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.skins.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.fileproxy.db.Log; +import it.softecspa.kahuna.sql.SqlWriter; + +import org.apache.log4j.Logger; + + +/** + * Abstract criteria filter for table T000_LOG + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class LogCSkin { + + + protected Logger log = Logger.getLogger(getClass()); + + protected ConnectionManager cm; + + // ID - INT(10) NOT NULL PK autoincrement + protected Integer id; + + // V_SOURCE - VARCHAR(50) NOT NULL + protected String source; + + // V_MESSAGE - TEXT(65535) NOT NULL + protected String message; + + // V_STACKTRACE - TEXT(65535) nullable + protected String stacktrace; + + // N_TICKET - INT(10) nullable + protected Integer ticket; + + protected String custom_order_by; + protected String custom_add_where; + protected String custom_add_options; + + + protected LogCSkin(ConnectionManager cm) { + super(); + this.cm = cm; + } + + + public Integer getId() { + return this.id; + } + + public void setId(Integer value) { + this.id = value; + } + + + public String getSource() { + return this.source; + } + + public void setSource(String value) { + this.source = value; + } + + + public String getMessage() { + return this.message; + } + + public void setMessage(String value) { + this.message = value; + } + + + public String getStacktrace() { + return this.stacktrace; + } + + public void setStacktrace(String value) { + this.stacktrace = value; + } + + + public Integer getTicket() { + return this.ticket; + } + + public void setTicket(Integer value) { + this.ticket = value; + } + + + /** + * ORDER BY condition + */ + public void orderBy(String value) { + this.custom_order_by = value; + } + + /** + * Custom WHERE condition to add in query composition + */ + public void addCustomWhere(String value) { + this.custom_add_where = value; + } + + /** + * Custom option to add in query composition + */ + public void addCustomOptions(String value) { + this.custom_add_options = value; + } + + + + public ConnectionManager getConnectionManager() { + return this.cm; + } + + /** + * Columns used in select with alias + */ + protected String getColumns(String alias) { + return alias+".id" + + ", "+alias+".v_source" + + ", "+alias+".v_message" + + ", "+alias+".v_stacktrace" + + ", "+alias+".n_ticket" + + ", "+alias+".d_record"; + } + + /** + * Build select * using alias + */ + protected SqlWriter getSelectAll(String alias) { + SqlWriter sql = new SqlWriter(); + sql.setColumns(getColumns(alias)); + sql.setTables(Log.NAME +" "+ alias); + return sql; + } + + /** + * Build select * with filter with standard alias 't' + */ + protected SqlWriter getSelect() { + return getSelect("t"); + } + + /** + * Build select * with filter using custom alias + */ + protected SqlWriter getSelect(String alias) { + SqlWriter sql = getSelectAll(alias); + if (this.id != null) sql.addWhere(alias+".id = "+ sql.fNum(this.id)); + if (this.source != null) sql.addWhere(alias+".v_source = "+ sql.fStr(this.source)); + if (this.message != null) sql.addWhere(alias+".v_message = "+ sql.fStr(this.message)); + if (this.stacktrace != null) sql.addWhere(alias+".v_stacktrace = "+ sql.fStr(this.stacktrace)); + if (this.ticket != null) sql.addWhere(alias+".n_ticket = "+ sql.fNum(this.ticket)); + + // Custom WHERE + if (this.custom_add_where!=null) sql.addWhere(this.custom_add_where); + // Custom OPTIONS + if (this.custom_add_options!=null) sql.addOption(this.custom_add_options); + // Custom ORDER_BY + if (this.custom_order_by!=null) sql.addOption("ORDER BY "+this.custom_order_by); + + return sql; + } + + /** + * Build select MAX for recover id + */ + public static Integer getMaxId(DatabaseStatement dbs) throws java.sql.SQLException { + SqlWriter sql = new SqlWriter(); + sql.setColumns("MAX(id)"); + sql.setTables(Log.NAME); + return new Integer(dbs.getInt(sql.costruisciSelect())); + } + + +} diff --git a/src/it/softecspa/fileproxy/db/skins/criterias/ProtocolCSkin.java b/src/it/softecspa/fileproxy/db/skins/criterias/ProtocolCSkin.java new file mode 100644 index 0000000..61823a7 --- /dev/null +++ b/src/it/softecspa/fileproxy/db/skins/criterias/ProtocolCSkin.java @@ -0,0 +1,162 @@ +/* + * @(#)ProtocolCSkin.java 1.7.1,126 custom 2014-06-22T22:00:00Z UTC + * Built automatically by REVERSER + */ +package it.softecspa.fileproxy.db.skins.criterias; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.DatabaseStatement; +import it.softecspa.fileproxy.db.Protocol; +import it.softecspa.kahuna.sql.SqlWriter; + +import org.apache.log4j.Logger; + + +/** + * Abstract criteria filter for table T015_PROTOCOL + * Class auto generated by REVERSER, version 1.7.1,126 custom + * + * Warning: this class will be rewrited from REVERSER + * + * @author il Vera + */ +public abstract class ProtocolCSkin { + + + protected Logger log = Logger.getLogger(getClass()); + + protected ConnectionManager cm; + + // N_PROTOCOL - INT UNSIGNED(10) NOT NULL PK + protected Integer protocol; + + // V_NAME - VARCHAR(50) NOT NULL + protected String name; + + // V_SERVER_VERSION - VARCHAR(50) NOT NULL + protected String serverVersion; + + protected String custom_order_by; + protected String custom_add_where; + protected String custom_add_options; + + + protected ProtocolCSkin(ConnectionManager cm) { + super(); + this.cm = cm; + } + + + public Integer getProtocol() { + return this.protocol; + } + + public void setProtocol(Integer value) { + this.protocol = value; + } + + + public String getName() { + return this.name; + } + + public void setName(String value) { + this.name = value; + } + + + public String getServerVersion() { + return this.serverVersion; + } + + public void setServerVersion(String value) { + this.serverVersion = value; + } + + + /** + * ORDER BY condition + */ + public void orderBy(String value) { + this.custom_order_by = value; + } + + /** + * Custom WHERE condition to add in query composition + */ + public void addCustomWhere(String value) { + this.custom_add_where = value; + } + + /** + * Custom option to add in query composition + */ + public void addCustomOptions(String value) { + this.custom_add_options = value; + } + + + + public ConnectionManager getConnectionManager() { + return this.cm; + } + + /** + * Columns used in select with alias + */ + protected String getColumns(String alias) { + return alias+".n_protocol" + + ", "+alias+".v_name" + + ", "+alias+".v_server_version" + + ", "+alias+".d_record"; + } + + /** + * Build select * using alias + */ + protected SqlWriter getSelectAll(String alias) { + SqlWriter sql = new SqlWriter(); + sql.setColumns(getColumns(alias)); + sql.setTables(Protocol.NAME +" "+ alias); + return sql; + } + + /** + * Build select * with filter with standard alias 't' + */ + protected SqlWriter getSelect() { + return getSelect("t"); + } + + /** + * Build select * with filter using custom alias + */ + protected SqlWriter getSelect(String alias) { + SqlWriter sql = getSelectAll(alias); + if (this.protocol != null) sql.addWhere(alias+".n_protocol = "+ sql.fNum(this.protocol)); + if (this.name != null) sql.addWhere(alias+".v_name = "+ sql.fStr(this.name)); + if (this.serverVersion != null) sql.addWhere(alias+".v_server_version = "+ sql.fStr(this.serverVersion)); + + // Custom WHERE + if (this.custom_add_where!=null) sql.addWhere(this.custom_add_where); + // Custom OPTIONS + if (this.custom_add_options!=null) sql.addOption(this.custom_add_options); + // Custom ORDER_BY + if (this.custom_order_by!=null) sql.addOption("ORDER BY "+this.custom_order_by); + + return sql; + } + + /** + * Build select MAX for recover id + */ + public static Integer getMaxId(DatabaseStatement dbs) throws java.sql.SQLException { + SqlWriter sql = new SqlWriter(); + sql.setColumns("MAX(n_protocol)"); + sql.setTables(Protocol.NAME); + return new Integer(dbs.getInt(sql.costruisciSelect())); + } + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/HttpFileProxyService.java b/src/it/softecspa/fileproxy/proxyservices/HttpFileProxyService.java new file mode 100644 index 0000000..1cd226b --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/HttpFileProxyService.java @@ -0,0 +1,79 @@ +package it.softecspa.fileproxy.proxyservices; + +import it.softecspa.fileproxy.proxyservices.core.HttpFileProxyServiceInterfaceServlet; +import it.softecspa.fileproxy.proxyservices.manager.DeleteManager; +import it.softecspa.fileproxy.proxyservices.manager.DownloadManager; +import it.softecspa.fileproxy.proxyservices.manager.ListManager; +import it.softecspa.fileproxy.proxyservices.manager.UploadManager; +import it.softecspa.fileproxy.proxyservices.request.DeleteRequestType; +import it.softecspa.fileproxy.proxyservices.request.DownloadRequestType; +import it.softecspa.fileproxy.proxyservices.request.ListRequestType; +import it.softecspa.fileproxy.proxyservices.request.UploadRequestType; +import it.softecspa.fileproxy.proxyservices.response.DeleteResponseType; +import it.softecspa.fileproxy.proxyservices.response.DownloadResponseType; +import it.softecspa.fileproxy.proxyservices.response.ListResponseType; +import it.softecspa.fileproxy.proxyservices.response.UploadResponseType; + +import javax.servlet.ServletConfig; + + +@SuppressWarnings({ "serial" }) +public class HttpFileProxyService extends HttpFileProxyServiceInterfaceServlet { + + + @Override + protected void afterStart(Configurable myConfig, ServletConfig config) { + /* Nessuna operazione */ + } + + @Override + protected void beforeDestroy() { + /* Nessuna operazione */ + } + + + /** + * Upload file in streaming + * @param _request + * @return + */ + public UploadResponseType upload(UploadRequestType _request) { + UploadManager service = new UploadManager(); + return service.process(_request); + } + + + /** + * Cancellazione di un file per nome + * @param _request + * @return + */ + public DeleteResponseType delete(DeleteRequestType _request) { + DeleteManager service = new DeleteManager(); + return service.process(_request); + } + + + /** + * Lista dei file o cartelle di un percorso + * @param _request + * @return + */ + public ListResponseType list(ListRequestType _request) { + ListManager service = new ListManager(); + return service.process(_request); + } + + + + /** + * Cancellazione di un file per nome + * @param _request + * @return + */ + public DownloadResponseType download(DownloadRequestType _request) { + DownloadManager service = new DownloadManager(); + return service.process(_request); + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyRequest.java b/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyRequest.java new file mode 100644 index 0000000..2fab59a --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyRequest.java @@ -0,0 +1,10 @@ +package it.softecspa.fileproxy.proxyservices.core; + +import it.softecspa.fileproxy.services.common.core.request.UniversalRequest; + +public interface GlobalHttpProxyRequest extends UniversalRequest { + + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyResponse.java b/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyResponse.java new file mode 100644 index 0000000..553ed70 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/core/GlobalHttpProxyResponse.java @@ -0,0 +1,8 @@ +package it.softecspa.fileproxy.proxyservices.core; + +import it.softecspa.fileproxy.services.common.core.response.UniversalResponse; + + +public interface GlobalHttpProxyResponse extends UniversalResponse { + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/core/HttpFileProxyServiceInterfaceServlet.java b/src/it/softecspa/fileproxy/proxyservices/core/HttpFileProxyServiceInterfaceServlet.java new file mode 100644 index 0000000..0518c0f --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/core/HttpFileProxyServiceInterfaceServlet.java @@ -0,0 +1,36 @@ +package it.softecspa.fileproxy.proxyservices.core; + +import it.softecspa.fileproxy.services.common.core.ModeRequest; +import it.softecspa.fileproxy.services.common.core.UniversalStatementHttpServlet; +import it.softecspa.fileproxy.services.common.core.response.body.ErrorBodyXML; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@SuppressWarnings("serial") +public abstract class HttpFileProxyServiceInterfaceServlet extends UniversalStatementHttpServlet { + + + @Override + protected void configure(Configurable myConfig) { + myConfig.setHeaderPrefix("X-"); + myConfig.setRequestMode(ModeRequest.HEADER_OR_PARAMETER); + myConfig.setUseResult(false); + myConfig.setErrorBody(new ErrorBodyXML()); + } + + protected void doGet(HttpServletRequest request, HttpServletResponse response) { + doStatement(request, response); + /* + // Nessuna richiesta evasa, restituisco la risposta standard + doDummy(request, response, ResponseOutcome.PS_NOT_VALID_METHOD_GET); + return; + */ + } + + + protected void doPost(HttpServletRequest request, HttpServletResponse response) { + doStatement(request, response); + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/AbstractHttpFileProxyManager.java b/src/it/softecspa/fileproxy/proxyservices/manager/AbstractHttpFileProxyManager.java new file mode 100644 index 0000000..7ab9867 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/AbstractHttpFileProxyManager.java @@ -0,0 +1,87 @@ +package it.softecspa.fileproxy.proxyservices.manager; + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.proxyservices.manager.core.NullSession; +import it.softecspa.fileproxy.proxyservices.request.AbstractHttpFileProxyRequest; +import it.softecspa.fileproxy.proxyservices.response.AbstractHttpFileProxyResponse; +import it.softecspa.fileproxy.services.ServerCacheFactory; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.core.UniversalManager; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.services.PostmanPat; +import it.softecspa.kahuna.sql.SqlWriter; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.SQLException; + + +public abstract class AbstractHttpFileProxyManager extends UniversalManager > { + + public static final String NULL_VERSION = "0.0.0"; + + // Variabile utilizzata per permetter di saltare i controlli di sessione + boolean jumpSessionValidate; + boolean forceStageMode; + + boolean logRequestInfo; + + + + @Override + protected void initialize() throws ManagerException { + /* Nessuna operazione */ + } + + + @Override + protected NullSession buildAndValidateSession(ServerCacheFactory cacheInfo, boolean stageMode) throws CheckerException, ManagerException { + + //try { + // Creo l'istanza dell'oggetto di sessione DM + session = new NullSession(cacheInfo, request, true, null); + + return session; + /* + } catch (SQLException e) { + throw new ManagerException(e); + } + */ + } + + /** + * Normalizza il percorso passato come parametro + * @param value + * @return + */ + protected String normalizePath(String value) { + String _path; + if (value!=null) { + _path = value; + } else { + // se il parametro path non è passato, parto dalla ROOT configurata + _path = ""; + } + // Tolgo un eventuale primo / + if (!_path.startsWith("/")) _path = "/"+_path; + + // Concateno con la base + return ServerCacheFactory.getInstance().getResourceRoot() + _path; + } + + + + @Override + protected void completeWithSuccess(boolean stage) throws ManagerException { + /* Nessuna operazione */ + } + + @Override + protected void checkAndTraceCheckerExceptionErrorIfExist(CheckerException e) { + /* Nessuna operazione */ + } + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/DeleteManager.java b/src/it/softecspa/fileproxy/proxyservices/manager/DeleteManager.java new file mode 100644 index 0000000..60fc057 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/DeleteManager.java @@ -0,0 +1,48 @@ +package it.softecspa.fileproxy.proxyservices.manager; + +import it.softecspa.fileproxy.proxyservices.request.DeleteRequestType; +import it.softecspa.fileproxy.proxyservices.response.DeleteResponseType; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.kahuna.io.File; + +public class DeleteManager extends AbstractHttpFileProxyManager { + + private File file_to_delete; + + @Override + protected void validateRequest() throws CheckerException, ManagerException { + + // Non si possono cancellare le cartelle + checkRequestMandatory("fileName"); + String path = normalizePath(request.getPath()); + + file_to_delete = new File (path, request.getFileName()); + if (!file_to_delete.exists()) { + log.warn("File do not exist: '"+file_to_delete.getAbsolutePath()+"'"); + throw new CheckerException(ResponseOutcome.FILE_NOT_EXIST); + } + + if (file_to_delete.isDirectory()) { + log.warn("Error deleting file '"+file_to_delete.getAbsolutePath()+"', is a directory"); + throw new CheckerException(ResponseOutcome.FILE_IS_DIRECTORY); + } + + } + + @Override + protected void doService(DeleteRequestType request, DeleteResponseType response) throws ManagerException { + + if (!file_to_delete.delete()) { + log.error("Error deleting file '"+file_to_delete.getAbsolutePath()+"'"); + throw new ManagerException(new CheckerException(ResponseOutcome.ERROR_DELETING_FILE)); + } + log.info("File '"+file_to_delete.getAbsolutePath()+"' deleted!"); + + // Risposta POSITIVA + new ResponseBuilder(response).setReturn(ResponseOutcome.OK); + } + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/DownloadManager.java b/src/it/softecspa/fileproxy/proxyservices/manager/DownloadManager.java new file mode 100644 index 0000000..8b2c247 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/DownloadManager.java @@ -0,0 +1,52 @@ +package it.softecspa.fileproxy.proxyservices.manager; + +import it.softecspa.fileproxy.proxyservices.request.DownloadRequestType; +import it.softecspa.fileproxy.proxyservices.response.DownloadResponseType; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.core.response.body.BodyFileAttach; +import it.softecspa.kahuna.io.File; + +public class DownloadManager extends AbstractHttpFileProxyManager { + + private File file_to_download; + + + @Override + protected void validateRequest() throws CheckerException, ManagerException { + + // Non si possono scaricare le cartelle + checkRequestMandatory("fileName"); + String path = normalizePath(request.getPath()); + + checkRequestIfNullSetDefault("chunk", 0); + checkRequestIfNullSetDefault("inline", Boolean.FALSE); + + + file_to_download = new File (path, request.getFileName()); + if (!file_to_download.exists()) { + log.warn("File do not exist: '"+file_to_download.getAbsolutePath()+"'"); + throw new CheckerException(ResponseOutcome.FILE_NOT_EXIST); + } + + if (file_to_download.isDirectory()) { + log.warn("Error deleting file '"+file_to_download.getAbsolutePath()+"', is a directory"); + throw new CheckerException(ResponseOutcome.FILE_IS_DIRECTORY); + } + + } + + @Override + protected void doService(DownloadRequestType request, DownloadResponseType response) throws ManagerException { + log.info("Request DOWNLOAD file '"+file_to_download.getAbsolutePath()+"' "+(request.getInline()?" (inline)":"") + (request.getChunk()>0?" (chunked:"+request.getChunk()+")":"")); + + BodyFileAttach attach = new BodyFileAttach(file_to_download, request.getInline(), request.getChunk()); + response.addBody(attach); + + // Risposta POSITIVA + new ResponseBuilder(response).setReturn(ResponseOutcome.OK); + } + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/ListManager.java b/src/it/softecspa/fileproxy/proxyservices/manager/ListManager.java new file mode 100644 index 0000000..a6fa8a0 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/ListManager.java @@ -0,0 +1,84 @@ +package it.softecspa.fileproxy.proxyservices.manager; + + +import it.softecspa.fileproxy.proxyservices.request.ListRequestType; +import it.softecspa.fileproxy.proxyservices.response.ListResponseType; +import it.softecspa.fileproxy.proxyservices.xml.output.list.FileElement; +import it.softecspa.fileproxy.proxyservices.xml.output.list.ResponseROOT; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.core.response.body.BodyXML; +import it.softecspa.kahuna.io.File; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.io.UnsupportedEncodingException; +import java.util.List; + +public class ListManager extends AbstractHttpFileProxyManager { + + private String path; + + @Override + protected void validateRequest() throws CheckerException, ManagerException { + + checkRequestIfNullSetDefault("onlyFile", Boolean.FALSE); + checkRequestIfNullSetDefault("showHidden", Boolean.FALSE); + + path = normalizePath(request.getPath()); + } + + + + @Override + protected void doService(ListRequestType request, ListResponseType response) throws ManagerException { + + log.info("Request LIST of folder '"+path+"' (onlyFile="+request.getOnlyFile().booleanValue()+")"); + List files = File.dir(path, request.getOnlyFile().booleanValue()); + if (files==null) { + throw new ManagerException(new CheckerException(ResponseOutcome.PATH_NOT_VALID)); + } + + ResponseROOT xml_response = new ResponseROOT(); + // PATH + xml_response.setPath(request.getPath()); + // FILES + for (File file : files) { + if (file.isHidden()) { + if (!request.getShowHidden().booleanValue()) continue; + } + + FileElement fe = new FileElement(); + if (file.isDirectory()) fe.setDirectory(true); + if (file.isFile()) fe.setFile(true); + if (file.isHidden()) fe.setHidden(true); + fe.setSize(file.length()); + // + EnterpriseCalendar modify = EnterpriseCalendar.newInstance(file.lastModified()); + if (modify!=null) fe.setModify(modify.formatISO8601zulu()); + // + fe.setEntityValue(file.getName()); + xml_response.addFile(fe); + } + // NUMBER + xml_response.setNumber(xml_response.getFiles().size()); + + + + xml_response.applyCData(); + // Converto XmlElement in un byte[] + byte[] xml; + try { + xml = xml_response.generateXML("UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new ManagerException(e); + } + response.addBody(new BodyXML(xml)); + + + // Risposta POSITIVA + new ResponseBuilder(response).setReturn(ResponseOutcome.OK); + } + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/UploadManager.java b/src/it/softecspa/fileproxy/proxyservices/manager/UploadManager.java new file mode 100644 index 0000000..d1ae682 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/UploadManager.java @@ -0,0 +1,40 @@ +package it.softecspa.fileproxy.proxyservices.manager; + +import it.softecspa.fileproxy.proxyservices.request.UploadRequestType; +import it.softecspa.fileproxy.proxyservices.response.UploadResponseType; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; + +public class UploadManager extends AbstractHttpFileProxyManager { + + @Override + protected void initialize() throws ManagerException { + // TODO Auto-generated method stub + + } + + @Override + protected void validateRequest() throws CheckerException, ManagerException { + // TODO Auto-generated method stub + + } + + @Override + protected void doService(UploadRequestType request, UploadResponseType response) throws ManagerException { + // TODO Auto-generated method stub + + } + + @Override + protected void completeWithSuccess(boolean stage) throws ManagerException { + // TODO Auto-generated method stub + + } + + @Override + protected void checkAndTraceCheckerExceptionErrorIfExist(CheckerException e) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/manager/core/NullSession.java b/src/it/softecspa/fileproxy/proxyservices/manager/core/NullSession.java new file mode 100644 index 0000000..d2de4b9 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/manager/core/NullSession.java @@ -0,0 +1,27 @@ +package it.softecspa.fileproxy.proxyservices.manager.core; + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.proxyservices.core.GlobalHttpProxyRequest; +import it.softecspa.fileproxy.services.ServerCacheFactory; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.core.UniversalSession; + +import java.sql.SQLException; + +public class NullSession extends UniversalSession { + + + public NullSession(ServerCacheFactory cache, I request, boolean stage, ConnectionManager cmReadonly) { + super(cache, request, stage, cmReadonly); + } + + @Override + public void validate() throws CheckerException, SQLException { + + + } + + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/request/AbstractHttpFileProxyRequest.java b/src/it/softecspa/fileproxy/proxyservices/request/AbstractHttpFileProxyRequest.java new file mode 100644 index 0000000..3789e30 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/request/AbstractHttpFileProxyRequest.java @@ -0,0 +1,124 @@ +package it.softecspa.fileproxy.proxyservices.request; + + +import it.softecspa.fileproxy.proxyservices.core.GlobalHttpProxyRequest; +import it.softecspa.fileproxy.services.common.comunicator.http.HttpRemote; +import it.softecspa.fileproxy.services.common.core.request.Protocollo; +import it.softecspa.fileproxy.services.common.core.request.RemoteHostRequestInfo; +import it.softecspa.fileproxy.services.common.core.request.TrackRequestInfo; +import it.softecspa.fileproxy.services.common.core.request.UniversalAuthenticatedRequest; + + +public abstract class AbstractHttpFileProxyRequest implements GlobalHttpProxyRequest, RemoteHostRequestInfo, TrackRequestInfo, UniversalAuthenticatedRequest { + + // UniversalRequest + private String language; + private Protocollo protocolVersion; + + // RemoteHostRequestInfo + private HttpRemote remote; + + // TrackRequestInfo + private boolean traceRequestInfo; + + // UniversalAuthenticatedRequest + private String username; + private String password; + private String organization; + + private String accessToken; + + + @Override + public String getUsername() { + return username; + } + + @Override + public void setUsername(String username) { + this.username = username; + } + + @Override + public String getPassword() { + return password; + } + + @Override + public void setPassword(String password) { + this.password = password; + } + + @Override + public String getOrganization() { + return organization; + } + + @Override + public void setOrganization(String organization) { + this.organization = organization; + } + + @Override + public String getAccessToken() { + return accessToken; + } + + @Override + public void setAccessToken(String authToken) { + this.accessToken = authToken; + } + + + @Override + public Protocollo getProtocolVersion() { + return this.protocolVersion; + } + + @Override + public void setProtocolVersion(Protocollo value) { + this.protocolVersion = value; + } + + @Override + public String getLanguage() { + return language; + } + + @Override + public void setLanguage(String value) { + if (value!=null) { + this.language = value.toUpperCase(); + if (this.language.length()>2) { + // 2012-07-21 - Workaround per Engine che passano il valore in modo non corretto + this.language = this.language.substring(0,2); + } + } + } + + + @Override + public HttpRemote takeHttpRemote() { + return remote; + } + + @Override + public void putHttpRemote(HttpRemote value) { + this.remote = value; + } + + + @Override + public boolean isTrackRequestInfo() { + return traceRequestInfo; + } + + @Override + public void trackRequestInfo(boolean value) { + traceRequestInfo = value; + } + + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/request/DeleteRequestType.java b/src/it/softecspa/fileproxy/proxyservices/request/DeleteRequestType.java new file mode 100644 index 0000000..678a5cb --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/request/DeleteRequestType.java @@ -0,0 +1,26 @@ +package it.softecspa.fileproxy.proxyservices.request; + + +public class DeleteRequestType extends AbstractHttpFileProxyRequest{ + + private String path; + private String fileName; + + + public String getFileName() { + return fileName; + } + + public void setFileName(String filename) { + this.fileName = filename; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/request/DownloadRequestType.java b/src/it/softecspa/fileproxy/proxyservices/request/DownloadRequestType.java new file mode 100644 index 0000000..10c6ed9 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/request/DownloadRequestType.java @@ -0,0 +1,44 @@ +package it.softecspa.fileproxy.proxyservices.request; + + +public class DownloadRequestType extends AbstractHttpFileProxyRequest{ + + private String path; + private String fileName; + + private Integer chunk; + private Boolean inline; + + public String getFileName() { + return fileName; + } + + public void setFileName(String filename) { + this.fileName = filename; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Integer getChunk() { + return chunk; + } + + public void setChunk(Integer chunck) { + this.chunk = chunck; + } + + public Boolean getInline() { + return inline; + } + + public void setInline(Boolean inline) { + this.inline = inline; + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/request/ListRequestType.java b/src/it/softecspa/fileproxy/proxyservices/request/ListRequestType.java new file mode 100644 index 0000000..eaf9181 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/request/ListRequestType.java @@ -0,0 +1,34 @@ +package it.softecspa.fileproxy.proxyservices.request; + + +public class ListRequestType extends AbstractHttpFileProxyRequest{ + + private String path; + private Boolean onlyFile; + private Boolean showHidden; + + public String getPath() { + return path; + } + + public void setPath(String filename) { + this.path = filename; + } + + public Boolean getOnlyFile() { + return onlyFile; + } + + public void setOnlyFile(Boolean onlyFile) { + this.onlyFile = onlyFile; + } + + public Boolean getShowHidden() { + return showHidden; + } + + public void setShowHidden(Boolean showHidden) { + this.showHidden = showHidden; + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/request/UploadRequestType.java b/src/it/softecspa/fileproxy/proxyservices/request/UploadRequestType.java new file mode 100644 index 0000000..d00b9e1 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/request/UploadRequestType.java @@ -0,0 +1,55 @@ +package it.softecspa.fileproxy.proxyservices.request; + +import java.io.InputStream; + +import it.softecspa.fileproxy.services.common.core.request.InputStreamReaderXML; +import it.softecspa.kahuna.util.xml.XmlRoot; + +public class UploadRequestType extends AbstractHttpFileProxyRequest implements InputStreamReaderXML{ + + private Boolean overwrite; + private String filename; + + + // InputStreamReaderXML + private InputStream inputStream; + private XmlRoot document; + + @Override + public void putInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + + @Override + public InputStream takeInputStream() { + return inputStream; + } + + @Override + public XmlRoot takeBufferedInputDocument() { + return document; + } + + @Override + public void bufferizeInputDocument(XmlRoot inputDocument) { + this.document = inputDocument; + } + + public Boolean getOverwrite() { + return overwrite; + } + + public void setOverwrite(Boolean override) { + this.overwrite = override; + } + + + public String getFilename() { + return filename; + } + + public void setFilename(String filename) { + this.filename = filename; + } + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/response/AbstractHttpFileProxyResponse.java b/src/it/softecspa/fileproxy/proxyservices/response/AbstractHttpFileProxyResponse.java new file mode 100644 index 0000000..a97f5c0 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/response/AbstractHttpFileProxyResponse.java @@ -0,0 +1,48 @@ +package it.softecspa.fileproxy.proxyservices.response; + +import it.softecspa.fileproxy.proxyservices.core.GlobalHttpProxyResponse; +import it.softecspa.fileproxy.services.common.core.MyReturn; +import it.softecspa.fileproxy.services.common.core.response.body.MyBody; + + +public abstract class AbstractHttpFileProxyResponse implements GlobalHttpProxyResponse { + + private MyReturn myreturn; + private MyBody body; + + + @Override + public String getReturnCode() { + return myreturn.getCode(); + } + + @Override + public String getReturnMessage() { + return myreturn.getMessage(); + } + + + @Override + public void setReturn(MyReturn myreturn) { + this.myreturn = myreturn; + } + + @Override + public MyReturn takeMyReturn() { + return this.myreturn; + } + + + @Override + public MyBody takeBody() { + return this.body; + } + + @Override + public void addBody(MyBody body) { + this.body = body; + } + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/response/DeleteResponseType.java b/src/it/softecspa/fileproxy/proxyservices/response/DeleteResponseType.java new file mode 100644 index 0000000..7a58af4 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/response/DeleteResponseType.java @@ -0,0 +1,5 @@ +package it.softecspa.fileproxy.proxyservices.response; + +public class DeleteResponseType extends AbstractHttpFileProxyResponse { + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/response/DownloadResponseType.java b/src/it/softecspa/fileproxy/proxyservices/response/DownloadResponseType.java new file mode 100644 index 0000000..66830ae --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/response/DownloadResponseType.java @@ -0,0 +1,5 @@ +package it.softecspa.fileproxy.proxyservices.response; + +public class DownloadResponseType extends AbstractHttpFileProxyResponse { + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/response/ListResponseType.java b/src/it/softecspa/fileproxy/proxyservices/response/ListResponseType.java new file mode 100644 index 0000000..4ce718d --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/response/ListResponseType.java @@ -0,0 +1,8 @@ +package it.softecspa.fileproxy.proxyservices.response; + +public class ListResponseType extends AbstractHttpFileProxyResponse { + + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/response/UploadResponseType.java b/src/it/softecspa/fileproxy/proxyservices/response/UploadResponseType.java new file mode 100644 index 0000000..51530ce --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/response/UploadResponseType.java @@ -0,0 +1,5 @@ +package it.softecspa.fileproxy.proxyservices.response; + +public class UploadResponseType extends AbstractHttpFileProxyResponse { + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/xml/output/list/FileElement.java b/src/it/softecspa/fileproxy/proxyservices/xml/output/list/FileElement.java new file mode 100644 index 0000000..c527971 --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/xml/output/list/FileElement.java @@ -0,0 +1,70 @@ +package it.softecspa.fileproxy.proxyservices.xml.output.list; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlElement; +import it.softecspa.kahuna.util.xml.XmlParserException; + + +public class FileElement extends XmlElement { + + private Boolean file; + private Boolean directory; + private Boolean hidden; + + private Long size; + + private String modify; + + public FileElement() { + super("file"); + + } + + @Override + public void parse(NodeElement father) throws XmlParserException { + /* Non valorizzato */ + } + + public Boolean getFile() { + return file; + } + + public void setFile(Boolean file) { + this.file = file; + } + + public Boolean getDirectory() { + return directory; + } + + public void setDirectory(Boolean directory) { + this.directory = directory; + } + + public Boolean getHidden() { + return hidden; + } + + public void setHidden(Boolean hidden) { + this.hidden = hidden; + } + + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + public String getModify() { + return modify; + } + + public void setModify(String modify) { + this.modify = modify; + } + + + +} diff --git a/src/it/softecspa/fileproxy/proxyservices/xml/output/list/ResponseROOT.java b/src/it/softecspa/fileproxy/proxyservices/xml/output/list/ResponseROOT.java new file mode 100644 index 0000000..3c949db --- /dev/null +++ b/src/it/softecspa/fileproxy/proxyservices/xml/output/list/ResponseROOT.java @@ -0,0 +1,53 @@ +package it.softecspa.fileproxy.proxyservices.xml.output.list; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlList; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlRoot; + + +public class ResponseROOT extends XmlRoot { + + private String path; + private Integer number; + + private XmlList files; + + + public ResponseROOT() { + super("list"); + this.files = new XmlList(null); + } + + public void parse(NodeElement father) throws XmlParserException { + /* Non utilizzato */ + } + + + + + public XmlList getFiles() { + return files; + } + + public void addFile(FileElement element) { + this.files.add(element); + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + +} diff --git a/src/it/softecspa/fileproxy/services/ClusterSynchronizer.java b/src/it/softecspa/fileproxy/services/ClusterSynchronizer.java new file mode 100644 index 0000000..70c019b --- /dev/null +++ b/src/it/softecspa/fileproxy/services/ClusterSynchronizer.java @@ -0,0 +1,676 @@ +package it.softecspa.fileproxy.services; + + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.DatabaseBalancer; +import it.softecspa.fileproxy.db.ClusterInfo; +import it.softecspa.fileproxy.db.criterias.ClusterInfoCriteria; +import it.softecspa.fileproxy.services.ServerCacheFactory.PropertiesKey; +import it.softecspa.fileproxy.services.common.EnterpriseLog; +import it.softecspa.jwebber.frameworkImpl.security.RequestSecurityManager; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.net.SafeHttpURLConnection; +import it.softecspa.kahuna.util.Properties; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; +import it.softecspa.portal.ApplicationClusterInfo; +import it.softecspa.portal.Parameters; +import it.softecspa.portal.Version; +import it.softecspa.portal.processRequest.HttpHeader; +import it.softecspa.portal.processRequest.xml.request.master.NodeInfo; +import it.softecspa.portal.processRequest.xml.request.master.NodeNotify; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +/** + * Singleton per la gestione della sincronizzazione tra cluster + * Le informazioni risiedono sul database STAGE + * + * @author m.veroni + * + */ +public class ClusterSynchronizer { + + // Singleton instance + private static ClusterSynchronizer instance; + + + private Logger log = Logger.getLogger(getClass()); + + private ClusterInfo cluster; + private ConnectionManager cmStage; + + private Thread heart; + + private ClusterSynchronizer() { + super(); + synchronized (ClusterSynchronizer.class) { + if (instance == null) { + instance = this; + if (log.isInfoEnabled()) log.info(ClusterSynchronizer.class.getSimpleName()+" instance is starting!"); + cmStage = DatabaseBalancer.getInstance().getStage(); + } + } + } + + public static ClusterSynchronizer getInstance() { + synchronized (ClusterSynchronizer.class) { + if (instance == null) new ClusterSynchronizer(); + } + return instance; + } + + + + /** + * Implementazione del cuore che batte + * @author m.veroni + */ + public class Heart implements Runnable { + + @Override + public void run() { + do { + // Se non è configurato alcun database non posso fare heartbeat + if (!DatabaseBalancer.getInstance().isActive()) return; + + + /* + * Parametro inserito nella configurazione su database + * In questo modo posso variare il "beat rate" a caldo + */ + try { + int heartrate = ServerCacheFactory.getInstance().getDbProperties().getInt(PropertiesKey.HEARTBEAT_DELAY.toString(),60); + if (heartrate<=0) { + log.info("No hearthbeat!"); + return; + } + if (log.isDebugEnabled()) log.debug(">>>>>>> Heart beat delay: "+heartrate+" seconds"); + + + try { + Thread.sleep(heartrate*1000); + } catch (InterruptedException e) { + log.warn("Heartbreak!"); + break; + } + // Registro il battito + heartbeat(); + + } catch (Exception e) { + log.error("Unhandled exception in heartbeat thread!",e); + } + + } while (true); + + } + + + } + + + private enum MasterStageStatement { + + REGISTER("node-register") + , BEAT("node-beat") + , STOP("node-stop") + , DEREGISTER("node-deregister"); + + + private String value; + + private MasterStageStatement(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + } + + + + + public class RemoteCall implements Runnable { + + private URL url; + private String username; + private String password; + + private byte[] xmlInput; + private long delay; + + + public RemoteCall(URL url, String username, String password) { + this(url,username,password,null,0); + } + + public RemoteCall(URL url, String username, String password, byte[] xml, long delay) { + this.url = url; + this.username = username; + this.password = password; + // + this.xmlInput = xml; + this.delay = delay; + + } + + + @Override + public void run() { + try { + // ----------------------------------------------------------------------------- + + if (delay>0) { + log.warn("Delay comunication: "+delay+" seconds"); + try { + Thread.sleep(delay*1000); + } catch (InterruptedException e) { + log.warn("Delay remote comunication!"); + } + + } + + + SafeHttpURLConnection connection; + OutputStream output = null; + BufferedReader bufline = null; + try { + connection = new SafeHttpURLConnection(url); + connection.setRequestProperty(RequestSecurityManager.USERNAME, username); + connection.setRequestProperty(RequestSecurityManager.PASSWORD, password); + if (log.isDebugEnabled()) { + if (username!=null || password!=null) { + log.debug("Call url (with username/password) "+url.toString()); + } else { + log.debug("Call url "+url.toString()); + } + } + + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Length",""+(xmlInput!=null?xmlInput.length:0)); + connection.setRequestProperty("Content-Type","text/xml"); + connection.setDoOutput(true); // posso scrivere! + connection.setDoInput(true); // posso leggere! + connection.setUseCaches(false); + + // Comunico il mio XML a server remoto + connection.write(xmlInput); + + // Analizza la risposta + analyseResponse(connection); + + // bufline = new BufferedReader(new InputStreamReader(connection.getInputStream())); + if (log.isDebugEnabled()) log.debug("Remote call completed!"); + + + } catch (IOException e) { + EnterpriseLog elog = new EnterpriseLog("IO error call url: "+url.toString(),e); + elog.write(); + + } catch (Exception e) { + EnterpriseLog elog = new EnterpriseLog("Unhandled exception call url: "+url.toString(),e); + elog.write(); + + } catch (Error e) { + EnterpriseLog elog = new EnterpriseLog("Unhandled error call url: "+url.toString(),e); + elog.write(); + + } finally { + try { + if (output!=null) output.close(); + } catch (IOException e) { + /* nessuna operazione */ + } + + try { + if (bufline!=null) bufline.close(); + } catch (IOException e) { + /* nessuna operazione */ + } + } + + // ----------------------------------------------------------------------------- + } catch (Exception e) { + /* + * Per risolvere il seguente problema in chiusura/undeploy della webapp: + * + * 3-gen-2013 17.24.34 org.apache.catalina.loader.WebappClassLoader loadClass + * INFO: Illegal access: this web application instance has been stopped already. Could not load it.softecspa.desktopmate.services.common.DatabaseLog. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. + * java.lang.IllegalStateException + * at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1248) + * at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1208) + * at it.softecspa.desktopmate.services.ClusterSynchronizer$RemoteCall.run(ClusterSynchronizer.java:223) + * at java.lang.Thread.run(Thread.java:662) + * + * Nota: + * http://www.javatuning.com/why-catch-throwable-is-evil-real-life-story/ + */ + try { + log.fatal("Very unhandled exception: "+e.toString(), e); + } catch (Exception ei) { + /* Nessuna operazione */ + } catch (Error ei) { + /* Nessuna operazione */ + } + + } catch (Error e) { + /* + * Vedi sopra + */ + try { + log.fatal("Very unhandled error: "+e.toString(), e); + } catch (Exception ei) { + /* Nessuna operazione */ + } catch (Error ei) { + /* Nessuna operazione */ + } + } + } + + + /** + * Analizza la riposta del server remoto e se nagativa la inserisce nel database degli errori + * @param connection + */ + private void analyseResponse(SafeHttpURLConnection connection) { + String url = "?"; + try { + url = connection.getURL().toString(); + } catch (Exception e) { + /* Nessuna operazione */ + } + + try { + int httpCode = connection.getResponseCode(); + if (httpCode!=HttpURLConnection.HTTP_OK) { /* 200 */ + EnterpriseLog elog = new EnterpriseLog("Remote server http response error "+httpCode+" for url "+url,null); + elog.write(); + return; + } + + } catch (IOException e) { + EnterpriseLog elog = new EnterpriseLog("Remote server IOException calling url "+url,e); + elog.write(); + return; + } catch (Exception e) { + EnterpriseLog elog = new EnterpriseLog("Remote server Exception calling url "+url,e); + elog.write(); + return; + } + + + if (log.isDebugEnabled()) log.debug("Analyze response header value"); + String result = connection.getHeaderField(HttpHeader.RESULT); + String message = connection.getHeaderField(HttpHeader.MESSAGE); + + if (XString.isNotBlankNull(result)) { + int res; + try { + res = Integer.parseInt(result); + } catch (Exception e) { + log.warn("Http header value '"+HttpHeader.RESULT+"' is not a number: '"+result+"'"); + return; + } + + if (res<0) { + // TODO prevedere una mail per esiti negativi delle chiamate remote + + EnterpriseLog elog = new EnterpriseLog("Remote server error response ["+res+"]: "+message,null); + elog.write(); + } + } + } + + } + + + public synchronized void init() throws Exception { + if (log.isInfoEnabled()) log.info("Initialize "+this.getClass().getSimpleName()); + + // Recupero l'HostNameMasked da ApplicationClusterInfo + ApplicationClusterInfo acInfo = ApplicationClusterInfo.getInstance(); + + + String public_hostname = acInfo.getPublicHostnameMasked(); + String backplane_hostname = acInfo.getBackplaneHostnameMasked(); + + String context = Parameters.getInstance().get("application.context.name","/"); + if (!context.startsWith("/")) context = "/" + context; + if (!context.endsWith("/")) context = context + "/"; + + + + try { + try { + cluster = new ClusterInfo(cmStage, context, public_hostname); + } catch (Exception e) { + log.error("Impossible to recover host info from database",e); + if (cluster==null) cluster = new ClusterInfo(); + } + /* + * Workaround per cambio nome cluster dev (popolo01) + */ + if (acInfo.getHostName().startsWith("ec2")) { + log.warn("Found Amazon EC2 server name, mark do not use!"); + cluster.setDoNotUse(true); + } + + + cluster.setHostname(public_hostname); + cluster.setContext(context); + cluster.setAddress(acInfo.getHostAddress()); + cluster.setBackplaneHostname(backplane_hostname); + cluster.setLifeStart(EnterpriseCalendar.now()); + cluster.setLastBeat(cluster.getLifeStart()); + cluster.setVersion(Version.getInstance().toString()); + cluster.lifeStart(cmStage); + + } catch (Exception e) { + log.error("Impossible to save host info on database",e); + } + + + if (cluster.getDoNotUse()) { + if (log.isInfoEnabled()) log.info("Heart is broken for this host named "+getPublicHostName()); + // Notifica della deregistrazione del nodo al sistema master + notify2Master(MasterStageStatement.DEREGISTER); + + } else { + heart = new Thread(new Heart(),"Heart "+getPublicHostName()); + heart.start(); + if (log.isInfoEnabled()) log.info("Heart start for "+getPublicHostName()); + + // Notifica dello START al sistema master + notify2Master(MasterStageStatement.REGISTER); + } + } + + + + + /** + * Notifica al server master (se configurato) lo stato del server + * @param statement + */ + private void notify2Master(MasterStageStatement statement) { + + Properties prop = ServerCacheFactory.getInstance().getDbProperties(); + String server = prop.get(PropertiesKey.MASTER_SERVER_URL.toString()); + if (XString.isNotBlankNull(server)) { + + String username = prop.get(PropertiesKey.MASTER_SERVER_USERNAME.toString()); + String password = prop.get(PropertiesKey.MASTER_SERVER_PASSWORD.toString()); + + if (log.isInfoEnabled()) log.info("Notify node info to master server (statement = '"+statement.getValue()+"') with url "+server); + URL url = null; + try { + url = new URL(server+"?statement="+statement.getValue()); + } catch (MalformedURLException e) { + EnterpriseLog elog = new EnterpriseLog("Notify node info to master server "+server,e); + elog.write(); + return; + } + Parameters parameters = Parameters.getInstance(); + + + + + // Composizione XML da trasmettere al server + NodeInfo cluster_info = new NodeInfo(); + // Valido per uttti gli stati + cluster_info.setHostname(cluster.getHostname()); + cluster_info.setContext(cluster.getContext()); + // solo START + if (statement.equals(MasterStageStatement.REGISTER)) { + cluster_info.setAddress(cluster.getAddress()); + cluster_info.setUrl(parameters.getChannelInfo().getDomainName() + + parameters.getChannelInfo().getPortHTTP() + + parameters.getChannelInfo().getContextName()); + // + cluster_info.setDm_version(cluster.getVersion()); + cluster_info.setJava_version(System.getProperty("java.version")); + cluster_info.setOs_version(System.getProperty("os.name") + + " ("+System.getProperty("os.arch")+") " + + System.getProperty("os.version")); + // + cluster_info.setPassword(prop.get(PropertiesKey.CLUSTER_USERNAME.toString())); + cluster_info.setUsername(prop.get(PropertiesKey.CLUSTER_PASSWORD.toString())); + cluster_info.setStart(cluster.getLifeStart()); + // + int heartrate = ServerCacheFactory.getInstance().getDbProperties().getInt(PropertiesKey.HEARTBEAT_DELAY.toString(),60); + heartrate = heartrate*parameters.getInt(PropertiesKey.MASTER_HEARTBEAT_COUNT.toString(),1); + cluster_info.setBeat_delay(heartrate); + } + // valido per START e BEAT + if (statement.equals(MasterStageStatement.BEAT) || + statement.equals(MasterStageStatement.REGISTER)) { + cluster_info.setBeat(cluster.getLastBeat()); + // solo per STOP + } else if (statement.equals(MasterStageStatement.STOP)) { + cluster_info.setStop(cluster.getLifeStop()); + } + + NodeNotify node = new NodeNotify(); + node.setAction(statement.getValue()); + node.setInfo(cluster_info); + + byte[] xml = null; + try { + xml = node.generateXML("UTF-8", log.isDebugEnabled()); + if (log.isTraceEnabled()) { + log.debug("Slave to master trasmission:\n"+new String(xml)); + } + } catch (UnsupportedEncodingException e) { + EnterpriseLog elog = new EnterpriseLog("Notify node info to master server "+server,e); + elog.write(); + return; + } + + // Aggiunto delay di 30 secondi di ritardo per evitare un errore in case di semplice riavvio + if (log.isDebugEnabled()) log.debug("Start new thread for remote call to "+url); + Thread master = new Thread(new RemoteCall(url, username, password, xml, 30),"Master notify to "+server); + master.start(); + } + + + } + + /** + * Registra sul database che il nodo è stato fermato + */ + public void endLife() { + if (log.isInfoEnabled()) log.info("Registered node life stop"); + EnterpriseCalendar adesso = EnterpriseCalendar.now(); + + if (heart!=null) { + if (heart.isAlive()) heart.interrupt(); + } + + if (cluster!=null) { + cluster.setLifeStop(adesso); + try { + cluster.lifeStop(cmStage); + } catch (SQLException e) { + log.warn("Error in register life stop",e); + } + + + if (!cluster.getDoNotUse()) { + // Notifica dello STOP al sistema master + notify2Master(MasterStageStatement.STOP); + } + } + + + } + + public void heartbeat() { + if (log.isInfoEnabled()) log.info("Cluster hartbeat, now!"); + + if (cluster!=null) { + cluster.setLastBeat(EnterpriseCalendar.now()); + try { + cluster.heartBeat(cmStage); + + + // Comunico la cosa al server centrale am con periodicità diversa + Properties prop = ServerCacheFactory.getInstance().getDbProperties(); + int count = prop.getInt(PropertiesKey.MASTER_HEARTBEAT_COUNT.toString(),1); + if (cluster.addBeatCount()>=count) { + cluster.resetBeatCount(); + notify2Master(MasterStageStatement.BEAT); + } + + } catch (SQLException e) { + log.error("SQLException in register hartbeat",e); + + } catch (Exception e) { + log.error("Unhandled exception in register hartbeat",e); + } + } + } + + + public String getHostAddress() { + return cluster.getAddress(); + } + + public String getPublicHostName() { + return cluster.getHostname(); + } + + public String getBackplaneHostName() { + return cluster.getBackplaneHostname(); + } + + + + + /** + * Estrae la lista aggiornata di tutti i cluster attivi e + * chiama il servizio remoto con i parametri richiesti + * E' utilizzata l'autenticazione + * @param requestURI + * @param statement + */ + public void statementReplicator(String servlet, String statement) { + try { + ClusterInfoCriteria criteria = new ClusterInfoCriteria(cmStage); + criteria.setActiveOnly(Boolean.TRUE); + ClusterInfo[] clusters = criteria.select(); + + + Properties prop = ServerCacheFactory.getInstance().getDbProperties(); + String username = prop.get(PropertiesKey.CLUSTER_USERNAME.toString()); + String password = prop.get(PropertiesKey.CLUSTER_PASSWORD.toString()); + + + for (ClusterInfo remote : clusters) { + + if (remote.getHostname().equals(this.cluster.getHostname())) continue; + + URL url = null; + String hostname = (remote.getBackplaneHostname()!=null?remote.getBackplaneHostname():remote.getHostname()); + try { + url = new URL("http://" + hostname + remote.getContext() + servlet +"?"+ statement); + } catch (MalformedURLException e) { + EnterpriseLog elog = new EnterpriseLog("Remote call on "+hostname,e); + elog.write(); + continue; + } + + if (log.isDebugEnabled()) log.debug("Start new thread for remote call to "+url); + Thread thread = new Thread(new RemoteCall(url, username, password)); + thread.start(); + } + + } catch (SQLException e) { + log.error("SQLException reloading remote semaphore",e); + } catch (Exception e) { + log.error("Unhandled exception reloading remote semaphore",e); + } + } + + + + + + /* FIXME da sistemare + + /** + * Ricarica la cache di sistema sui server remoti + * @param balancer + * @param tablename + * / + private void loadRemoteCache(Balancer balancer, String tablename) { + if (log.isInfoEnabled()) { + try { + if (tablename!=null) { + log.info("Launch remote cache reload "+(balancer!=null?"on "+balancer.toString()+" database":"")+" for table '"+tablename+"'"); + } else if (balancer!=null) { + log.info("Launch remote cache reload on "+balancer.toString()+" database"); + } else { + log.info("Launch remote cache reload"); + } + } catch (Exception e) { + log.warn("logger error",e); + } + } + + String statement = ServicesSynchroPR.RELOAD+"="+ServicesSynchroPR.RELOAD_LOCAL_CACHE + + // Database + (balancer!=null?"&"+ServicesSynchroPR.DATABASE+"="+(balancer.equals(Balancer.MASTER)?ServicesSynchroPR.DATABASE_MASTER:ServicesSynchroPR.DATABASE_STAGE):"") + + // Tablename + (tablename!=null?"&"+ServicesSynchroPR.TABLE_NAME+"="+tablename:""); + statementReplicator(ServicesSynchroPR.SERVLET_NAME, statement); + } + + public void reloadRemoteSemaphore() { + String statement = ServicesSynchroPR.RELOAD+"="+ServicesSynchroPR.RELOAD_LOCAL_SEMAPHORE; + ClusterSynchronizer.getInstance().statementReplicator(ServicesSynchroPR.SERVLET_NAME, statement); + } + + + + public void reloadRemoteCacheOnMaster(String tablename) { + loadRemoteCache(Balancer.MASTER, tablename); + } + + public void reloadRemoteCacheOnMaster() { + reloadRemoteCacheOnMaster(null); + } + + public void reloadRemoteCacheOnStage(String tablename) { + loadRemoteCache(Balancer.STAGE, tablename); + } + + public void reloadRemoteCacheOnStage() { + reloadRemoteCacheOnStage(null); + } + + public void reloadRemoteCache() { + loadRemoteCache(null, null); + } + + public void reloadRemoteCache(String tablename) { + loadRemoteCache(null, tablename); + } + + */ + + + + + + +} diff --git a/src/it/softecspa/fileproxy/services/HttpClazzTransformer.java b/src/it/softecspa/fileproxy/services/HttpClazzTransformer.java new file mode 100644 index 0000000..67959e0 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/HttpClazzTransformer.java @@ -0,0 +1,538 @@ +package it.softecspa.fileproxy.services; + +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.UniversalStatementException; +import it.softecspa.fileproxy.services.common.core.request.Protocollo; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.util.HtmlEscape; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendarIT; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendarUTC; + +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Date; +import java.util.StringTokenizer; + +import javax.mail.internet.MimeUtility; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public class HttpClazzTransformer { + + private static Logger log = Logger.getLogger(HttpClazzTransformer.class); + private final boolean maskError = false; + + public enum HttpRequestSource { + HTTP_HEADER + , HTTP_PARAMETER + , HTTP_HEADER_PARAMETER + ; + + public String get(HttpServletRequest request, String prefix, String name) { + if (equals(HTTP_HEADER)) { + // Leggo la variabile dall'HEADER + return request.getHeader(prefix+name); + } else if (equals(HTTP_PARAMETER)) { + // Leggo la variabile dai PARAMETRI + return request.getParameter(name); + } else if (equals(HTTP_HEADER_PARAMETER)) { + // Leggo la variabile sia da HEADER che dai PARAMETRI con precedenza su header + String value = request.getHeader(prefix+name); + if (value!=null) return value; + return request.getParameter(name); + } + return null; + } + + public String getWithoutUppercase(HttpServletRequest request, String prefix, String name) { + name = name.replaceAll("[A-Z]", "-$0").toLowerCase(); + + if (equals(HTTP_HEADER)) { + // Leggo la variabile dall'HEADER + return request.getHeader(prefix+name); + } else if (equals(HTTP_PARAMETER)) { + // Leggo la variabile dai PARAMETRI + return request.getParameter(name); + } else if (equals(HTTP_HEADER_PARAMETER)) { + // Leggo la variabile sia da HEADER che dai PARAMETRI con precedenza su header + String value = request.getHeader(prefix+name); + if (value!=null) return value; + return request.getParameter(name); + } + return null; + } + + } + + public enum HeaderEncoding { + NONE + , HTML_ESCAPE + , RFC2047 + ; + } + + private HttpRequestSource http_source; + private String prefix; + private HeaderEncoding responseHeaderEncoding; + + + public HttpClazzTransformer (HttpRequestSource source) { + this(source,""); + } + + public HttpClazzTransformer (HttpRequestSource source, String prefix) { + this(source, prefix, HeaderEncoding.RFC2047); + } + + public HttpClazzTransformer (HttpRequestSource source, String prefix, HeaderEncoding responseHeaderEncoding) { + this.http_source = source; + this.prefix = prefix; + this.responseHeaderEncoding = responseHeaderEncoding; + } + + + + /** + * @deprecated + * @param statement + * @param value + * @return + * @throws UniversalStatementException + */ + public static Class forName(String statement, String value) throws UniversalStatementException { + return forName(HttpClazzTransformer.class, statement, value); + } + + public static Class forName(Class base, String statement, String value) throws UniversalStatementException { + String classname = base.getPackage().getName()+"."+value+"."+XString.toUpperCaseFirst(statement)+XString.toUpperCaseFirst(value)+"Type"; + + // Se trovo un "-" devo mettere a maiuscolo la lettera seguente + int pos; + while ((pos = classname.indexOf("-"))>=0) { + classname = classname.substring(0,pos)+XString.toUpperCaseFirst(classname.substring(pos+1)); + } + + try { + if (log.isTraceEnabled()) log.trace("Use class named "+classname); + return Class.forName(classname); + } catch (ClassNotFoundException e) { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CLASS_NOT_FOUND.getReturnCode() + , ResponseOutcome.PS_REQUEST_CLASS_NOT_FOUND.getMessage()+" ["+classname+"]"); + } + } + + + /** + * Crea una istanza di una classe recuperando i valori dalle variabili di HEADER + * @param clazz + * @param request + * @return + * @throws UniversalStatementException + */ + public Object newInstance(Class clazz, HttpServletRequest request, boolean skipNull) throws UniversalStatementException { + + K result = newInstance(clazz); + + /* + * Ciclo su tutti i metodi per valorizzarli a partire da quello che trovo nel'header + */ + if (log.isDebugEnabled()) log.debug("<<<< "+http_source.name()+" 2 class conversion for (prefix '"+prefix+"'): "+result.getClass().getName()); + Method[] methods = result.getClass().getMethods(); + for (Method method : methods) { + + if (!method.getName().startsWith("set")) continue; + + Class[] parameterType = method.getParameterTypes(); + //if (parameterType.length!=1) continue; + Object[] value = new Object[parameterType.length]; + + String name = XString.toLowerCaseFirst(method.getName().substring(3)); + + boolean allNull = true; + for (int i=0; i>>> Class 2 HEADER conversion for (prefix '"+prefix+"'): "+object.getClass().getName()); + Method[] methods = object.getClass().getMethods(); + for (Method method : methods) { + + if (!method.getName().startsWith("get")) continue; + if (method.getName().equals("getClass")) continue; + if (log.isTraceEnabled()) log.trace(">> method: "+method.getName()); + + String name = XString.toLowerCaseFirst(method.getName().substring(3)); + Class clazz = method.getReturnType(); + + Object value = null; + try { + value = method.invoke(object, (Object[])null); + } catch (IllegalArgumentException e) { + continue; + } catch (IllegalAccessException e) { + continue; + } catch (InvocationTargetException e) { + continue; + } + + field2Header(prefix ,name, value, clazz, response); + } + + + } + + + + private Object castValue2Class(String valueH, Class type) throws UniversalStatementException { + if (XString.isBlankNullTrim(valueH)) return null; + + if (type.equals(String.class)) { + return new String(valueH); + + } else if (type.equals(Integer.class)) { + try { + return new Integer(valueH.trim()); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2Integer) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(Boolean.class)) { + valueH = valueH.trim(); + if (valueH.equals("1") || valueH.equalsIgnoreCase("true")) { + return Boolean.TRUE; + } + if (valueH.equals("0") || valueH.equalsIgnoreCase("false")) { + return Boolean.FALSE; + } + return null; + + } else if (type.equals(Protocollo.class)) { + try { + return Protocollo.parse(valueH); + } catch (Exception e) { + if (maskError) { + log.warn("something2field (value2Integer) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(EnterpriseCalendar.class)) { + try { + return new EnterpriseCalendar(valueH.trim(), EnterpriseCalendar.PATTERNS_UTC); + } catch (Exception e) { + if (maskError) { + log.warn("something2field (value2EnterpriseCalendar) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(Long.class)) { + try { + return new Long(valueH.trim()); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2Long) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(BigDecimal.class)) { + try { + return new BigDecimal(normalizeCommaPoint(valueH.trim())); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2BigDecimal) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(BigInteger.class)) { + try { + return new BigInteger(valueH.trim()); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2BigInteger) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(Double.class)) { + try { + return new Double(normalizeCommaPoint(valueH.trim())); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2Double) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(Float.class)) { + try { + return new Float(normalizeCommaPoint(valueH.trim())); + } catch (NumberFormatException e) { + if (maskError) { + log.warn("something2field (value2Float) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else if (type.equals(Date.class)) { + try { + EnterpriseCalendar appo = new EnterpriseCalendar(valueH.trim(), "yyyy-MM-dd"); + return new Date(appo.getTimeInMillis()); + } catch (Exception e) { + if (maskError) { + log.warn("something2field (value2Date) :"+e.toString()); + return null; + } else { + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getReturnCode(), ResponseOutcome.PS_REQUEST_CAST_EXCEPTION.getMessage()); + } + } + + } else { + log.error("something2field, unsupported type "+type); + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_UNSUPPORTED_TYPE.getReturnCode() + , ResponseOutcome.PS_REQUEST_UNSUPPORTED_TYPE.getMessage()+": "+type); + } + } + + /** + * Normalizzazione . (punto) e , (virgola) + * @param value + * @return + */ + private String normalizeCommaPoint(String value) { + if (value.indexOf(",")>=0) { + return value.replaceAll(",", "."); + } + return value; + } + + public Object something2field(String name, Class type, HttpServletRequest request) throws UniversalStatementException { + String valueH = http_source.get(request, prefix, name); + if (XString.isBlankNullTrim(valueH)) { + if (name.equals(name.toLowerCase())) return null; + valueH = http_source.getWithoutUppercase(request, prefix, name); + } + if (XString.isBlankNullTrim(valueH)) return null; + try { + if (type.isArray()) { + Class typeI = type.getComponentType(); + StringTokenizer values = new StringTokenizer(valueH,","); + int count = values.countTokens(); + + Object ret[] = null; + if (typeI.equals(String.class)) { + ret = new String[count]; + + } else if (typeI.equals(Integer.class)) { + ret = new Integer[count]; + + } else if (typeI.equals(Long.class)) { + ret = new Long[count]; + + } else if (typeI.equals(Boolean.class)) { + ret = new Boolean[count]; + + } else if (typeI.equals(BigDecimal.class)) { + ret = new BigDecimal[count]; + + } else if (typeI.equals(BigInteger.class)) { + ret = new BigInteger[count]; + + } else if (typeI.equals(Double.class)) { + ret = new Double[count]; + + } else if (typeI.equals(Float.class)) { + ret = new Float[count]; + + } else if (typeI.equals(EnterpriseCalendar.class)) { + ret = new EnterpriseCalendar[count]; + + } else { + log.error("Unsupported type "+type); + throw new UniversalStatementException(ResponseOutcome.PS_REQUEST_UNSUPPORTED_ATYPE.getReturnCode() + , ResponseOutcome.PS_REQUEST_UNSUPPORTED_ATYPE.getMessage()+": "+typeI); + } + if (count==0) return ret; + + for (int i=0;values.hasMoreTokens();) { + ret[i++] = castValue2Class(values.nextToken(), typeI); + } + return ret; + + } else { + return castValue2Class(valueH, type); + } + + } catch (UniversalStatementException e) { + throw new UniversalStatementException((e.getMessage()!=null?e.getMessage():e.toString())+" ['"+name+"']", e); + } + + } + + private void field2Header(String prefix, String name, Object value, Class type, HttpServletResponse response) throws UniversalStatementException { + if (value==null) return; + name = prefix + name; + + if (type.equals(String.class)) { + setEncodedHeader(response, name, (String)value); + + } else if (type.equals(Integer.class)) { + setEncodedHeader(response, name, ((Integer)value).toString()); + + } else if (type.equals(Long.class)) { + setEncodedHeader(response, name, ((Long)value).toString()); + + } else if (type.equals(Boolean.class)) { + setEncodedHeader(response, name, ((Boolean)value).booleanValue()?"1":"0"); + + } else if (type.equals(BigDecimal.class)) { + setEncodedHeader(response, name, ((BigDecimal)value).toString()); + + } else if (type.equals(BigInteger.class)) { + setEncodedHeader(response, name, ((BigInteger)value).toString()); + + } else if (type.equals(Double.class)) { + setEncodedHeader(response, name, ((Double)value).toString()); + + } else if (type.equals(Float.class)) { + setEncodedHeader(response, name, ((Float)value).toString()); + + } else if (type.equals(EnterpriseCalendar.class)) { + setEncodedHeader(response, name, ((EnterpriseCalendar)value).formatISO8601zulu()); + + } else if (type.equals(EnterpriseCalendarUTC.class)) { + setEncodedHeader(response, name, ((EnterpriseCalendar)value).formatISO8601zulu()); + + } else if (type.equals(EnterpriseCalendarIT.class)) { + setEncodedHeader(response, name, ((EnterpriseCalendar)value).formatISO8601zulu()); + + } else { + log.error("Unsupported type "+type); + throw new UniversalStatementException(ResponseOutcome.PS_RESPONSE_UNSUPPORTED_TYPE.getReturnCode() + , ResponseOutcome.PS_RESPONSE_UNSUPPORTED_TYPE.getMessage()+": "+type); + } + + } + + + public void setEncodedHeader(HttpServletResponse response, String key, String value) { + if (responseHeaderEncoding==HeaderEncoding.RFC2047) { + try { + response.setHeader(key, MimeUtility.encodeText(value,"UTF-8",null)); + } catch (UnsupportedEncodingException e) { + log.warn("UnsupportedEncodingException encoding value for key 'key': "+value+""); + response.setHeader(key, value); + } + } else if (responseHeaderEncoding==HeaderEncoding.NONE) { + response.setHeader(key, value); + + } else if (responseHeaderEncoding==HeaderEncoding.HTML_ESCAPE) { + response.setHeader(key, HtmlEscape.escapeSpecial(value)); + } + } + + + @SuppressWarnings("unchecked") + private K newInstance(Class clazz) throws UniversalStatementException { + // Costruisco la classe; + Constructor costructor=null; + try { + costructor = clazz.getConstructor((Class[])null); + } catch (SecurityException e) { + throw new UniversalStatementException("SecurityException with class costructor for "+clazz,e); + } catch (NoSuchMethodException e) { + throw new UniversalStatementException("NoSuchMethodException with class costructor for "+clazz, e); + } + + try { + return (K)costructor.newInstance((Object[])null); + } catch (IllegalArgumentException e) { + throw new UniversalStatementException("IllegalArgumentException with class costructor for "+clazz, e); + } catch (InstantiationException e) { + throw new UniversalStatementException("InstantiationException with class costructor for "+clazz, e); + } catch (IllegalAccessException e) { + throw new UniversalStatementException("IllegalAccessException with class costructor for "+clazz, e); + } catch (InvocationTargetException e) { + throw new UniversalStatementException("InvocationTargetException with class costructor for "+clazz, e); + } + } + + public HeaderEncoding getResponseHeaderEncoding() { + return responseHeaderEncoding; + } + +} diff --git a/src/it/softecspa/fileproxy/services/ServerCacheFactory.java b/src/it/softecspa/fileproxy/services/ServerCacheFactory.java new file mode 100644 index 0000000..c00ab6b --- /dev/null +++ b/src/it/softecspa/fileproxy/services/ServerCacheFactory.java @@ -0,0 +1,337 @@ +package it.softecspa.fileproxy.services; + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.NoRecordFoundException; +import it.softecspa.fileproxy.DatabaseBalancer; +import it.softecspa.fileproxy.DatabaseBalancer.Balancer; +import it.softecspa.fileproxy.cache.CacheContainer; +import it.softecspa.fileproxy.cache.CacheElement; +import it.softecspa.fileproxy.db.ConfigProperties; +import it.softecspa.fileproxy.db.criterias.ConfigPropertiesCriteria; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.util.Properties; + +import java.sql.SQLException; +import java.util.Set; + +import org.apache.log4j.Logger; + + +/** + * Contiene lo stato dei servizi e dei domini attivi * + * @author m.veroni + * @param + */ +public class ServerCacheFactory { + + private static ServerCacheFactory instance; + private Logger log = Logger.getLogger(getClass()); + + + // Contenitore delle strutture in cache + private CacheContainer cacheContainer; + public ListContainer list; + + // Parametri di configurazione su database - T001_CONFIG_PROPERTIES + private Properties dbProperties; + + /** + * Classe fittizia di rapporto + */ + public class ListContainer { + + + /* FIXME esempio + public Collection ofInstances(boolean stage) { + try { + SortedMap container = cacheContainer.getContainer(CacheKey.INSTANCE_ID, getBalancer(stage)); + return container.values(); + } catch (CacheException e) { + log.error("Cache container problem: "+e.toString()); + return null; + } + } + */ + } + + + + private ServerCacheFactory() { + super(); + synchronized (ServerCacheFactory.class) { + if (instance == null) { + instance = this; + // + log.info(ServerCacheFactory.class.getSimpleName()+" instance is starting!"); + instance.reloadAll(); + } + } + } + + + + + + public static ServerCacheFactory getInstance() { + synchronized (ServerCacheFactory.class) { + if (instance == null) new ServerCacheFactory(); + } + return instance; + } + + + /** + * Carica la struttura contenente le abilitazioni al servizio + */ + private synchronized void reload(boolean stage) { + try { + Balancer balancer = getBalancer(stage); + if (!DatabaseBalancer.getInstance().isActive()) { + // non posso ancare avanti se non è presente un database + return; + } + + if (stage) { + loadProperties(); + } + + /* Esempio + cacheContainer.createContainer(new KmTypeRemoteCache(balancer)); + cacheContainer.createContainer(new KmTypeDeviceCache(balancer)); + */ + + /* + } catch (CacheException e) { + log.fatal(e.toString(),e); + */} catch (Exception e) { + log.fatal("Unhandled exception",e); + } + } + + + public synchronized void reloadAll() { + + if (cacheContainer==null) { + if (log.isDebugEnabled()) log.debug("Create instance of " + CacheContainer.class + " service"); + cacheContainer = CacheContainer.getInstance(); + list = new ListContainer(); + } + + reloadOnStage(); + reloadOnMaster(); + } + + + + + public synchronized void reloadOnStage() { + // Estraggo i dati dal database STAGE + log.info("Reload cache on STAGE database"); + reload(true); + } + + public synchronized void reloadOnMaster() { + // Estraggo i dati dal database MASTER + log.info("Reload cache on MASTER database"); + reload(false); + } + + + private Balancer getBalancer(boolean stage) { + return (stage?Balancer.STAGE:Balancer.MASTER); + } + + + /** + * Estrazione parametri di configurazione dal database (MASTER) + * Nota: su STAGE è una vista su MASTER + */ + private void loadProperties() { + ConnectionManager cm = DatabaseBalancer.getInstance().get(Balancer.STAGE); + + try { + log.info("Load 'Properties' configuration list on STAGE"); + ConfigPropertiesCriteria criteria = new ConfigPropertiesCriteria(cm); + ConfigProperties[] lista = criteria.select(); + + if (dbProperties!=null) { + dbProperties.clear(); + } else { + dbProperties = new Properties(); + } + + for (ConfigProperties elemento : lista) { + dbProperties.put(elemento.getKey(), elemento.getValue()); + } + log.info("Loaded configuration from database"); + + + } catch (NoRecordFoundException e) { + log.warn("No properties available on STAGE database, verify configuration"); + + } catch (SQLException e) { + log.fatal("Problem reading database",e); + dbProperties = null; + } + } + + + + + + + /** + * Properties estratte dal database (MASTER) + * @return + */ + public Properties getDbProperties() { + // Controllo inserito per la gestione dei problemi di connettività + if (dbProperties==null) loadProperties(); + + return dbProperties; + } + + + + public enum PropertiesKey { + + CLUSTER_PASSWORD ("cluster_password") + , CLUSTER_USERNAME ("cluster_username") + + , MASTER_SERVER_URL ("master.server.url") + , MASTER_HEARTBEAT_COUNT ("master.heartbeat.count") + , MASTER_SERVER_USERNAME ("master.server.username") + , MASTER_SERVER_PASSWORD ("master.server.password") + + // Url pubblico del semaforo + //, URL_SEMAFORO ("url.semaforo") + , CONSOLE_URL ("url.console") + + // ... + , HEARTBEAT_DELAY ("haertbeat.delay") + , TRIAL_DEFAULT_TYPE ("trial.default.type") + , TRIAL_DEFAULT_VALUE ("trial.default.value") + , DAY_ALERT ("day_alert") + + // Root di filesystem per salvare le risorse + , RESOURCE_ROOT_MASTER ("resource.root") + , RESOURCE_ROOT_STAGE ("resource.root.stage") + //, RESOURCE_THUMB_WIDTH ("resource.thumb.width") + //, RESOURCE_THUMB_HEIGHT ("resource.thumb.height") + + // Root di filesystem per salvare i pacchetti da scaricare + //, DOWNLOAD_ROOT ("download.root") + //, DOWNLOAD_URL ("download.url") + /* + // Email per sincronizzazione + , SYNCHRO_EMAIL_ERROR ("synchro.mail.error") + , SYNCHRO_EMAIL ("synchro.mail") + , SYNCHRO_LOCK_CLIENT ("synchro.lock.client") + */ + /* + // Connettività verso My-DesktopMate + , MYDM_URL ("mydesktopmate.url") + , MYDM_USERNAME ("mydesktopmate.username") + , MYDM_PASSWORD ("mydesktopmate.password") + */ + // Abilitazione/disabilitazione servizi + //, DISABLE_CHECK_HISTORY ("disable.check.history") + + , LANGUAGE_DISABLE_LIST ("language.disable.list") + /* + , SHARE_URL ("share.url") + , MAINTENANCE_ENABLE ("maintenance.enable") + + , PROVISIONING_ALERT ("provisioning.alert") + , DAILY_REPORT_FLUSH_LINE ("daily.report.flush.line") + , DAILY_REPORT_FLUSH_HYML ("daily.report.flush.html") + */ + ; + + + private String value; + + private PropertiesKey(String value) { + this.value = value; + } + + public String toString() { + return value; + } + } + + + public enum CacheKey { + KM_TYPE_REMOTE + , KM_TYPE_DEVICE + ; + + } + + + /** + * @deprecated + * Restituisce la ROOT delle risorse + * @param stagemode + * @return + */ + public String getResourceRoot(boolean stagemode) { + return getDbProperties().get(stagemode?PropertiesKey.RESOURCE_ROOT_STAGE.toString():PropertiesKey.RESOURCE_ROOT_MASTER.toString()); + } + + public String getResourceRoot() { + return getDbProperties().get(PropertiesKey.RESOURCE_ROOT_MASTER.toString()); + } + + + + public Set getCachedList(boolean stagemode) { + return cacheContainer.getCachedTables()[getBalancer(stagemode).index()].keySet(); + } + + + public boolean isCached(String tablename, boolean stagemode) { + if (XString.isBlankNull(tablename)) return true; + return cacheContainer.getCachedTables()[getBalancer(stagemode).index()].containsKey(tablename); + } + + + + + + public synchronized void reloadAll(String tablename) { + reloadOnStage(tablename); + reloadOnMaster(tablename); + } + + + + public void reloadOnStage(String tablename) { + if (XString.isBlankNull(tablename)) { + reloadOnStage(); + return; + } + if (!isCached(tablename, true)) return; + + for (CacheElement element : cacheContainer.getCachedTables()[getBalancer(true).index()].get(tablename)) { + element.flush(); + } + } + + public void reloadOnMaster(String tablename) { + if (XString.isBlankNull(tablename)) { + reloadOnMaster(); + return; + } + if (!isCached(tablename, false)) return; + + for (CacheElement element : cacheContainer.getCachedTables()[getBalancer(false).index()].get(tablename)) { + element.flush(); + } + } + + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/CheckerException.java b/src/it/softecspa/fileproxy/services/common/CheckerException.java new file mode 100644 index 0000000..64a021a --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/CheckerException.java @@ -0,0 +1,103 @@ +package it.softecspa.fileproxy.services.common; + + + +@SuppressWarnings("serial") +public class CheckerException extends Throwable implements TraceableWithIdException { + + private String id; + private ResponseResult result; + + private boolean traceLog; + private boolean traceErrorCall; + + private String supplementaryMessage; + + + public CheckerException(ResponseOutcome outcome) { + this(outcome.getReturnCode(), outcome.getMessage(), null, ResponseResult.ERROR, outcome.isTraceLog(), outcome.isTraceErrorCall()); + } + + public CheckerException(ResponseOutcome outcome, ResponseResult result) { + this(outcome.getReturnCode(), outcome.getMessage(), null, result, outcome.isTraceLog(), outcome.isTraceErrorCall()); + } + + public CheckerException(ResponseOutcome outcome, String supplementary) { + this(outcome.getReturnCode(), outcome.getMessage(), supplementary, null, outcome.isTraceLog(), outcome.isTraceErrorCall()); + } + + public CheckerException(ResponseOutcome outcome, String supplementary , ResponseResult result) { + this(outcome.getReturnCode(), outcome.getMessage(), supplementary, result, outcome.isTraceLog(), outcome.isTraceErrorCall()); + } + + private CheckerException(String id, String message, String supplementary, ResponseResult result, boolean traceLog, boolean traceErrorCall) { + super(message); + this.id = id; + this.result = result; + this.supplementaryMessage = supplementary; + this.traceLog = traceLog; + this.traceErrorCall = traceErrorCall; + } + + + @Override + public String getId() { + return id; + } + + public ResponseResult getResult() { + return result; + } + + + @Override + /** + * Returns the detail and supplementary message string of this throwable. + * + * @return the detail message string of this CheckerException instance. + */ + public String getMessage() { + if (supplementaryMessage==null) { + return super.getMessage(); + } else { + return super.getMessage() +" ["+supplementaryMessage+"]"; + } + } + + /** + * Returns the standard detail message string of this throwable. + * + * @return the detail message string of this CheckerException instance. + */ + public String getStandardMessage() { + return super.getMessage(); + } + + /** + * Returns the supplementary message string of this throwable. + * + * @return the supplementary message string of this CheckerException instance. + * (which may be null). + */ + public String getSupplementaryMessage() { + return supplementaryMessage; + } + + @Override + public String toString() { + String s = getClass().getName(); + String message = getMessage(); + return (message != null) ? (s + ": " + message) : s; + } + + @Override + public boolean isTraceLog() { + return traceLog; + } + + @Override + public boolean isTraceErrorCall() { + return traceErrorCall; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/EnterpriseLog.java b/src/it/softecspa/fileproxy/services/common/EnterpriseLog.java new file mode 100644 index 0000000..08d5300 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/EnterpriseLog.java @@ -0,0 +1,204 @@ +package it.softecspa.fileproxy.services.common; + +import it.softecspa.PortalSettings; +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.DatabaseBalancer; +import it.softecspa.fileproxy.db.Log; +import it.softecspa.fileproxy.services.ClusterSynchronizer; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.log.Ticket; +import it.softecspa.kahuna.services.PostmanPat; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; +import it.softecspa.portal.Parameters; + +import java.sql.SQLException; +import java.util.Calendar; + +import org.apache.log4j.Logger; + +@SuppressWarnings("serial") +public class EnterpriseLog extends Throwable { + + private Logger log = Logger.getLogger(getClass()); + private final int LOG_LIFE = 30; + + + public EnterpriseLog(String message, Throwable e) { + super(message, e); + } + + public EnterpriseLog(String message) { + super(message); + } + + public EnterpriseLog(Throwable e) { + super(e); + } + + + public int write() { + return write(ClusterSynchronizer.getInstance().getPublicHostName(), DatabaseBalancer.getInstance().getStage(), null); + } + + + public int write(String source) { + return write(source, DatabaseBalancer.getInstance().getStage(), null); + } + + /* + public int write(String source, ConnectionManager cm) { + return write(source, cm, null); + } + */ + + /* + public int write(String source, Integer ticket) { + return write(source, DatabaseBalancer.getInstance().getStage(), ticket); + } + */ + + /** + * Scrive l'errore su database nella tabella dei log + * @param source + * @param cm + * @param ticket + * @return + */ + private int write(String source, ConnectionManager cm, Integer ticket) { + try { + String message = getMessage(); + if (ticket==null) ticket = Ticket.generaTicket(); + + try { + + // Metto una traccia nel log + log.error("Traced error on database log with ticket #"+ticket +"\n" + + ">> "+ (message != null ? message : toString()), (this.getCause()!=null?this.getCause():null)); + // + Log elog = new Log(); + elog.setSource(source); + elog.setMessage(message != null ? message : toString()); + elog.setTicket(ticket); + if (this.getCause()!=null) elog.setStacktrace(stringStackTrace(this.getCause())); + elog.insert(cm); + + // Cancella tutti gli errori più vecchi di 30 giorni + EnterpriseCalendar before = EnterpriseCalendar.now(); + before.add(Calendar.DAY_OF_MONTH, -LOG_LIFE); + flushBefore(cm, before); + + + } catch (SQLException e) { + log.fatal("Unhandled SQLException writing error on database log",e); + + } catch (Exception e) { + log.fatal("Unhandled Exception writing error on database log",e); + + } catch (Error e) { + log.fatal("Unhandled Error writing error on database log",e); + } + + return ticket; + } catch (Exception e) { + Logger.getLogger(EnterpriseLog.class).fatal("Very unhandled exception",e); + return -1; + } + } + + + /** + * Invia una mail al gestore del servizio con la segnalazione + */ + public void sendEmail() { + sendEmail("Exception"); + } + + /** + * Invia una mail al gestore del servizio con la segnalazione + * impostando il subject + */ + public void sendEmail(String subject) { + sendEmail(PortalSettings.MAIL_ERROR_ENABLE, subject); + } + + /** + * Invia una mail al gestore del servizio con la segnalazione + * impostando il subject + * @param param + * @param subject + */ + public void sendEmail(String param, String subject) { + if (XString.isNotBlankNullTrim(param)) { + Parameters parameters = Parameters.getInstance(); + if (!parameters.getBoolean(param, false)) return; + } + + PostmanPat pat = new PostmanPat(); + pat.setSubject(subject); + pat.addMessage(getMessage()); + if (getCause()!=null) { + pat.addMessage("\n"+ + stringStackTrace(getCause())); + } + // + pat.send(); + } + + + + + + + /** + * Cancella tutti i messaggi dal log su database + * @param cm + */ + public static void flushAll(ConnectionManager cm) { + try { + Log elog = new Log(); + elog.delete(cm); + } catch (SQLException e) { + Logger.getLogger(EnterpriseLog.class).fatal("Impossible to delete record from "+Log.NAME, e); + } + } + + + /** + * Cancella i messaggi più vecchi della data indicata + * @param cm + * @param before + */ + public static void flushBefore(ConnectionManager cm, EnterpriseCalendar before) { + try { + Log elog = new Log(); + elog.setRecord(before); + elog.deleteBefore(cm); + + } catch (SQLException e) { + Logger.getLogger(EnterpriseLog.class).fatal("Impossible to delete record from "+Log.NAME, e); + } + + } + + + + /** + * Provides programmatic access to the stack trace information printed by + * {@link #stringStackTrace()}. Returns a string of stack trace elements, + * each representing one stack frame. + * + * @return a string of stack trace elements representing the stack trace + * pertaining to this throwable. + */ + public String stringStackTrace(Throwable e) { + String s = e.toString() + "\n"; + StackTraceElement[] trace = e.getStackTrace(); + for (int i = 0; i < trace.length; i++) { + s += "\tat " + trace[i] + "\n"; + } + + if (e.getCause() != null) s += "Caused by: "+stringStackTrace(e.getCause()); + return s; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/ManagerException.java b/src/it/softecspa/fileproxy/services/common/ManagerException.java new file mode 100644 index 0000000..d5b303b --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/ManagerException.java @@ -0,0 +1,18 @@ +package it.softecspa.fileproxy.services.common; + +@SuppressWarnings("serial") +public class ManagerException extends Throwable { + + public ManagerException(Throwable e) { + super(e); + } + + public ManagerException(String message) { + super(message); + } + + public ManagerException(String message, Throwable e) { + super(message, e); + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/RemoteCallException.java b/src/it/softecspa/fileproxy/services/common/RemoteCallException.java new file mode 100644 index 0000000..906f8e9 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/RemoteCallException.java @@ -0,0 +1,49 @@ +package it.softecspa.fileproxy.services.common; + + + + +@SuppressWarnings("serial") +public class RemoteCallException extends Throwable { + + String id; + + public RemoteCallException(Throwable e) { + super(ResponseOutcome.INTERNAL_SERVER_ERROR.getMessage(),e); + id = ResponseOutcome.INTERNAL_SERVER_ERROR.getReturnCode(); + } + + + public RemoteCallException(String message, Throwable e) { + super(message, e); + id = ResponseOutcome.INTERNAL_SERVER_ERROR.getReturnCode(); + } + + private RemoteCallException(String id, String message) { + super(message); + this.id = id; + } + + public RemoteCallException(ResponseOutcome outcome, String add_message) { + this(outcome.getReturnCode(), outcome.getMessage()+": "+add_message); + } + + + public RemoteCallException(ResponseOutcome outcome, Throwable e) { + super(outcome.getMessage(), e); + id = outcome.getReturnCode(); + } + + public RemoteCallException(ResponseOutcome outcome) { + super(outcome.getMessage()); + id = outcome.getReturnCode(); + } + + + public String getId() { + return id; + } + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/ResponseOutcome.java b/src/it/softecspa/fileproxy/services/common/ResponseOutcome.java new file mode 100644 index 0000000..73e4c71 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/ResponseOutcome.java @@ -0,0 +1,526 @@ +package it.softecspa.fileproxy.services.common; + +public enum ResponseOutcome { + // Esito positivo + OK_JUST_NOTIFIED (0,false,false,"Ok, just notified") + , OK (0,false,false,"Ok") + , DRAFT_NO_DATA (0,false,false,"No data found") + + // Errore non definito + , ERROR (1,"Error") + + + // Interfacciamento con My-DesktopMate, classe 50000 + , MYDM_NOT_VALID (50001,"XML request is not valid: 'type' unknown") + , MYDM_CHECKING_EXCEPTION (50002,"XML request is not consistent, verify XML") + , MYDM_REGISTRATION_EMPTY (50003,"XML request is not consistent, add 'registration' to XML") + + , MYDM_MANAGER_EXCEPTION (50010,"Internal server error") + , MYDM_UNHANDLED_EXCEPTION (50011,"Internal server error (unhandled)") + , MYDM_SQL_EXCEPTION (50012,"Internal server error (database)") + + , MASTER_STATUS_NOT_VALID (50020,"Master status operation list: 'statement' unknown") + , MASTER_STATUS_NULL_VALUE (50021,"Master status: node info is null") + + , INPUT_FORWARD_XML_NULL (50101,"Forward XML request is null") + , OUTPUT_FORWARD_XML_NULL (50103,"Forward XML response is null") + + + // Messaggi restituiti dalla connessione al server sso, classe 80000 + , SSO_PROVIDER_NOT_CONFIGURED (80100,"SSO provider not configured") + , SSO_PROVIDER_CONFIG_ERROR (80101,"SSO provider client configuration not valid") + , SSO_PROVIDER_CONFIG_ERROR_IO (80102,"SSO provider client configuration error") + + , SSO_MOBILE_CLIENT_NOT_CONFIGURED (80110,"SSO mobile client not configured") + , SSO_MOBILE_CLIENT_CONFIG_ERROR (80111,"SSO mobile client configuration not valid") + , SSO_MOBILE_CLIENT_CONFIG_ERROR_IO (80112,"SSO mobile client configuration error") + , SSO_MOBILE_CLIENT_CONFIG_ERROR_FACEBOOK (80113,"SSO mobile client configuration error: missing 'facebook.authenticator'") + , SSO_FACEBOOK_APP_ID_NOT_FOUND (80113,"Application configuration error: missing 'faceboob-app-id'") + , SSO_FACEBOOK_SECRET_NOT_FOUND (80114,"Application configuration error: missing 'facebook-secret'") + , SSO_MOBILE_CLIENT_CONFIG_ERROR_TWITTER (80115,"SSO mobile client configuration error: missing 'twitter.authenticator'") + + + , SSO_GENERIC_ERROR (80120,"SSO error") + , SSO_LOGIN_ERROR (80121,"SSO login error") + , SSO_LOGOUT_ERROR (80122,"SSO logout error") + , SSO_CHANGE_PASSWORD_ERROR (80123,"SSO change password error") + , SSO_GET_TOKEN_INFO_ERROR (80124,"SSO get token info error") + , SSO_GET_USER_INFO_ERROR (80125,"SSO get user info error") + , SSO_WRONG_CREDENTIAL (80126,"Wrong credential") + , SSO_TOKEN_INFO_NULL_USERNAME (80127,"SSO get token info without username") + , SSO_TOKEN_INFO_NULL_ORGANIZATION (80128,"SSO get token info without organization") + + + + // Messaggi restituiti dal servizio notifiche, classe 80000 + , SUBSCRIPTION_RENEWAL_NOT_FOUND (80400,"Couple subscrition/renewal not found") + , RENEWAL_NOT_FOUND (80401,"Renewal not found for required renewal") + , ONESHOT_CODE_NOT_FOUND (80402,"One-shot code not found for required renewal") + , ONESHOT_CODE_USED (80403,"One-shot code already used for required renewal") + , ACTIVATION_DM_NOT_FOUND (80404,"DesktopMate activation not found") + , ONESHOT_IMEI_NOT_MATCH (80405,"IMEI code do not match") + , ONESHOT_RENEWAL_NOT_MATCH (80406,"Renewal code do not match") + , STATUS_NOT_VALID_VALUE (80407,"Not valid value for field 'status', accepted 'OK','BURN'") + , RENEWAL_NOT_VALID_INSTANCE (80408,"Renewal not valid, instance do not macth") + + + // Errori principale DM Server + , FIELD_MANDATORY (90401,"Field is mandatory") + , FIELD_EMPTY (90402,"Field is empty (not valid empty string)") + , FIELD_OUT_OF_RANGE (90403,"Field is out of range") + , FIELD_NOT_VALID (90404,"Field is not valid") + , FIELD_OVERFLOW (90405,"Field is in overflow") + , NO_VALID_CURRENCY (90406,"No valid currency value") + , FIELD_TYPE_NOT_VALID (90407,"Field type is not valid (cast exception)") + , INVALID_METHOD_CHECKING (90408,"Internal error, invalid method checking") + , LANGUAGE_IS_MANDATORY (90409,true,true,"Language code is mandatory") + , CUSTOMER_NOT_VALID (90410,true,true,"Customer is not valid") + , CUSTOMER_CANCELLED (90411,true,true,"Customer is not valid (cancelled)") + , INSTANCE_IS_MANDATORY (90412,true,true,"Instance code is mandatory") + , INSTANCE_NOT_VALID (90413,true,true,"Instance is not valid") + , INSTANCE_CANCELLED (90414,true,true,"Instance is not valid (cancelled)") + , INSTANCE_NOT_EXIST (90415,true,true,"Instance is not valid (not exist)") + , TECHNOLOGY_IS_MANDATORY (90416,true,true,"Technology code is mandatory" ) + , CLIENTID_IS_MANDATORY (90417,true,true,"Client id is mandatory") + , TECHNOLOGY_NOT_EXIST (90418,true,true,"Technology not exist") + , TECHNOLOGY_NOT_VALID (90419,true,true,"Technology is not valid") + , TECHNOLOGY_CANCELLED (90420,true,true,"Technology is not valid (cancelled)") + , DEVICE_REGISTERED_FAULT (90421,true,true,"Check device registered table (integrity fault)") + , REGISTRATION_CODE_FAULT (90422,true,true,"Check registration code table (integrity fault)") + , REGISTRATION_CODE_NOT_FOUND (90423,"Registration code not found") + , REGISTRATION_CODE_LIMIT (90424,"Registration code limit overflow") + , REGISTRATION_CODE_NO_ZONE (90425,"Registration code do not have valid zone code") + , REGISTRATION_CANCELLED (90426,"Registration code not found (cancelled)") + , PREREG_DEVICE_NOT_ENABLED (90427,true,true,"Preregistration failed, device id is not valid") + , RESOLUTION_CODE_NOT_VALID (90428,true,true,"Display resolution code not valid") + , RESOLUTION_CODE_NOT_FOUND (90429,true,true,"Display resolution code not found") + , ZONE_NOT_VALID (90430,"Zone is not valid") + , ZONE_CANCELLED (90431,"Zone is not valid (cancelled)") + , ZONE_NOT_VALID_RESTRICTION (90432,"Zone is not valid (activation rule restriction)") + , ZONE_CODE_IS_MANDATORY (90433,"Parameter 'zoneCode' is mandatory") + , CHANGE_ZONE_NOT_PERMITTED (90434,"Change zone not permitted") + , PROFILE_NOT_FOUND (90435,"Profile not found") + , PROFILE_CANCELLED (90436,"Profile is not valid (cancelled)") + , PROFILE_WITHOUT_PACKAGE (90437,"Profile without required package association") + , PACKAGE_NOT_FOUND (90438,"Package not found") + , PACKAGE_NOT_VALID (90439,"Package not valid") + , PACKAGE_CANCELLED (90440,"Package is not valid (cancelled)") + , PACKAGE_WITHOUT_SERVICE (90441,"Package without services") + , PACKAGE_WITH_SERVICE_CANCELLED (90442,"Package with all service cancelled") + , PACKAGE_ZONE_NOT_MATH (90442,"Package not match with registration zone") + , PACKAGE_TECHNOLOGY_NOT_ACTIVE (90444,"No packages activated for this technology") + , NO_TECHNOLOGY_SCREEN_FOUND (90445,true,true,"No technology/screen association found") + , BACKGROUND_SIZE_CODE_NOT_VALID (90446,"Background size code not valid") + , BACKGROUND_SIZE_CODE_NOT_FOUND (90447,"Background size code not found") + , NO_TECH_SCREEN_BKG_FOUND (90448,true,true,"No technology/screen/background association found") + , NORMALIZED_RESOLUTION_NOT_VALID (90449,true,true,"(Normalized) Screen resolution code not valid") + , DEVICE_REGISTRATION_NOT_VALID (90450,true,true,"Device is not valid, verify registration") + , DEVICE_REGISTRATION_CANCELLED (90451,true,true,"Device is not valid, verify registration (cancelled)") + , DEVICE_NO_REGISTRATION (90452,true,true,"Device is not valid, complete registration") + , DEVICE_REGISTRATION_CODE (90453,true,true,"Device is not valid, complete registration with code") + , DEVICE_MAX_NUMBER_REACHED (90454,true,true,"Maximum number of devices reached") + , MENU_TOO_MATCH (90455,true,true,"Found too match valid menu for the instance") + , MENU_NONE_FOUND (90456,"No valid menu found for the instance") + , MENU_ROOT_NONE_FOUND (90457,"Menu structure is not valid, no root found") + , MENU_NOT_VALID_STRUCTURE_ELEMENT (90458,"Menu structure is not valid, no element found") + , MENU_NOT_VALID_STRUCTURE_MODULE (90459,"Menu structure is not valid, no module found") + , MENU_NOT_VALID_STRUCTURE_THEME (90460,"Menu structure is not valid, no theme found") + , MENU_NOT_VALID_STRUCTURE_ROOT (90461,"Menu structure is not valid, root without child") + , MENU_NOT_VALID_STRUCTURE_SERVICE (90462,"Menu structure is not valid, no service found in zone") + , MENU_NOT_VALID_STRUCTURE_IMAGE (90463,"Menu structure is not valid, found element without image") + , MENU_NOT_VALID_STRUCTURE_RENDER (90464,"Menu structure is not valid, found valid element without valid render") + , MENU_NOT_VALID_STRUCTURE_FATHER (90465,"Menu structure is not valid, no father element found") + , MENU_NOT_VALID_STRUCTURE_APP (90466,"Menu structure is not valid, no application found") + , MODULE_APPLICATION_NOT_FOUND (90467,"Model application id is not valid, not found") + , REGISTRATION_CODE_NOT_LOGGED (90468,"Registration code not valid for logged status") + , REGISTRATION_CODE_NOT_ANONIM (90469,"Registration code not valid for anonim status") + , UPLOAD_NO_FILE (90470,"No file to upload") + , UPLOAD_FILE_OVERWRITE_ERROR (90471,"Upload file error; do not overwrite") + , UPLOAD_FILE_DUPLICATE (90472,"Upload file error; duplicate file") + , UPLOAD_FILE_ERROR (90473,"Upload file error!") + , UPLOAD_FILE_NOT_WRITE (90474,"Upload file error; can not write") + , GROUP_CODE_NOT_VALID (90475,true,true,"Group code is not valid") + , GROUP_CODE_IS_MANDATORY (90476,"Group code is mandatory") + , GROUP_CODE_TOO_MANY (90477,true,true,"Group code is not valid (too many records)") + , GROUP_CODE_RECORD_NOT_FOUND (90478,true,true,"Group code record not found") + , CREATE_DIRECTORY_ERROR (90479,"Error create directory") + , UPLOAD_RESOURCE_TYPE_NOT_VALID (90480,"Upload resource type not valid or not managed") + , NOT_VALID_GALLERY_COORDINATE (90481,"Not valid gallery coordinate") + , NOT_VALID_IMAGE_TYPE (90482,"Not valid image extention for selected type") + , NOT_VALID_IMAGE_NOT_INFO (90483,"Not valid image; not valid info") + , DUPLICATED_RESOURCE_FILE (90484,"Duplicated resource file") + , NO_VALID_CREDENTIAL_FIELD (90485,"Not found any valid credential field") + , USER_PASSWORD_NO_VALID (90486,"Username/password not valid") + , USER_PASSWORD_TOO_MANY (90487,"Username/password not valid (too many records)") + , ROLE_NOT_VALID (90488,"Role not valid") + , ROLE_TOO_MANY (90489,"Role not valid (too many records)") + , FILE_FORMAT_NOT_VALID (90490,"File format not valid") + , DRAFT_EMPTY_QUERY (90491,"Empty query") + , DRAFT_SQL_ERROR (90492,"SQL error") + , DRAFT_COLUMN_NOT_MATCH (90493,"Column do not match") + , DRAFT_TYPE_NOT_VALID (90494,"Draft type is not valid") + , USER_NOT_FOUND (90495,"User not valid (not found)") + , REMOTE_PROFILE_FAULT (90496,"Registration code not valid for remote profile (SSO)") + , NO_VALID_DAY_FORMAT (90497,"Not valid day format: 'yyyy-MM-dd' or 'yyyyMMdd'") + , INSTANCE_NOT_ACTIVE (90498,true,true,"Instance is not active") + , REMOTE_IP_RULES_NOT_VALID (90499,true,true,"Remote ip rule not valid") + , REMOTE_IP_RULES_TOO_MATCH (90500,true,true,"Remote ip rule not valid, too match rules") + , REMOTE_IP_LOCK (90501,true,true,"Remote ip filter lock this ip") + , OPERATOR_NO_VALID (90502,"Operator not valid") + , OPERATOR_TOO_MANY (90503,"Operator not valid (too many records)") + , NOT_VALID_FILTER_TYPE (90504,"Not valid filter type") + , NOT_VALID_FILTER_CONDITION (90505,"Not valid (or unknown) filter condition type") + , FILTER_CONDITION_MANDATORY (90506,"Not found mandatory filter condition") + + + , MALFORMD_XML_DOCUMENT (90510,"Malformed XML document") + , XML_ELEMENT_EMPTY (90511,"XML element is empty") + + , MENU_XML_ERROR (90513,"Error building XML menu interface") + , THEME_XML_ERROR (90514,"Error building XML theme interface") + + , MALFORMD_JSON_DOCUMENT (90516,"Malformed JSON document") + + , PROTOCOL_VERSION_MANDATORY (90520,"Protocol version is mandatory") + , PROTOCOL_VERSION_NOT_VALID (90521,true,true,"Protocol version not valid") + , PROTOCOL_VERSION_OUT_OF_RANGE (90522,true,true,"Protocol version out of range") + + , UNIQUE_ID_NO_IMMUTABLE (90530,"Any immutable data are passed, check system!") + , UNIQUE_ID_NOT_VALID (90531,"Client id (unique) not valid, check client process sequence") + , DEVICEID_IS_MANDATORY (90532,"Device id is mandatory") + , UNIQUE_ID_TECH_DO_NOT_MATCH (90533,"Techonology class do not match with unique client id record") + , UNIQUE_ID_IMMUTABLE_DO_NOT_MATCH (90534,"Immutable data do not match with unique client id record") + , GENERATEDID_IS_MANDATORY (90535,"Device generated id (old clientId ) is mandatory") + , NO_VALID_IDENTIFIER (90536,"Non valid identifier for technology!") + , USERTOKEN_NOT_VALID (90537,"User token not valid") + , USERNAME_NOT_MATCH_TOKEN_INFO (90538,"Username not match token info") + , ORGANIZATION_NOT_MATCH_TOKEN_INFO (90539,"Organization not match token info") + , SESSION_LOGIN_WEB_ERROR (90540,"Error loading session login for web") + + , ACCESS_TOKEN_USERNAME_MANDATORY (90545,"AccessToken or Username are mandatory") + , PASSWORD_MANDATORY (90546,"Password mandatory with username") + , TOO_MANY_SSO_LOGIN (90547,"Too many SSO-LOGIN; problem extracting addional") + , NOT_VALID_ADDITIONAL (90548,"Not valid additional json parameter (server)") + + , IMAGE_TYPE_ONLY_FOR_GENERAL (90557,"Image type selected is valid only for general gallery") + , THEME_ID_MUST_BE_NULL (90558,"Theme id must be null") + , NO_LANGUAGE_FOUND_IN_INSTANCE (90559,"Non language found in instance, check configuration") + , RESOURCE_DETAIL_NOT_EXIST (90560,"Resource not exist") + , RESOURCE_DETAIL_NOT_VALID (90561,"Resource is not valid") + , RESOURCE_DETAIL_CANCELLED (90562,"Resource is not valid (cancelled)") + , RESOURCE_DETAIL_NOT_FOUND (90563,"Resource is not valid, file not found") + , THEME_NOT_VALID (90564,true,true,"Theme is not valid") + , THEME_CANCELLED (90565,true,true,"Theme is not valid (cancelled)") + , THEME_NOT_PUBLISHABLE (90566,true,true,"Theme is not valid (not publishable)") + , THEME_RENDERER_NOT_VALID (90567,true,true,"Theme renderer association is not valid") + , THEME_RENDERER_CANCELLED (90568,true,true,"Theme renderer association is not valid (cancelled)") + , THEME_RENDERER_TOO_MATCH (90569,true,true,"Found too match valid theme renderer association") + , RENDERER_NOT_FOUND (90570,"Renderer for menu is not found") + , RENDERER_CANCELLED (90571,"Renderer for menu is not found (cancelled)") + , RENDERER_INFO_NOT_FOUND (90572,"Renderer info for menu/screen not found") + , RENDERER_INFO_CANCELLED (90573,"Renderer info for menu/screen not found (cancelled)") + , RENDERER_IMAGE_NOT_FOUND (90574,"Renderer background image for menu/screen not found") + , TECHNOLOGY_APPLIED_NOT_EXIST (90575,"Instance/Technology not exist") + , TECHNOLOGY_APPLIED_NOT_VALID (90576,"Instance/Technology is not valid") + , TECHNOLOGY_APPLIED_CANCELLED (90577,"Instance/Technology is not valid (cancelled)") + , THEME_NOT_VALID_FOR_INSTANCE (90578,true,true,"Theme is not valid for instance") + , RESOURCE_ID_NOT_FOUND (90579,"Resource id not valid (not found)") + , FEEDBACK_NOT_VALID (90580,"Not valid feedback XML") + , FEEDBACK_NOT_VALID_NUMBER (90581,"Not valid feedback value, number expected") + , FEEDBACK_NOT_VALID_VALUE (90582,"Not valid feedback value") + , FEEDBACK_SERVICE_NOT_NUMBER (90583,"Not valid service id in feedback") + , FEEDBACK_SERVICE_NOT_FOUND (90584,"Not found service id in feedback") + , FEEDBACK_DATE_NOT_FOUND (90585,"Not found data/time value") + , FEEDBACK_DATE_NOT_VALID (90586,"Not valid data/time value format") + , FEEDBACK_ACTION_ID_NOT_VALID (90587,"Feedback action id not valid in XML") + , SERVICE_ID_NOT_VALID (90588,"Service id is not valid") + , SERVICE_ID_NOT_VALID_CANCELLED (90589,"Service id is not valid (cancelled)") + , CREDITS_ID_NUMBER_EXCEPTION (90590,"Not valid id service for credits feedback") + , CREDITS_LEFT_NUMBER_EXCEPTION (90591,"Number format exception on credits left value") + , CREDITS_USED_NUMBER_EXCEPTION (90592,"Number format exception on credits used value") + , SERVICE_ACTION_NOT_VALID (90593,"Service on demand action not valid") + , SERVICE_INSTANCE_NOT_COMPATIBLE (90594,"Service not compatible with instance") + , NO_PACKAGE_FOR_SERVICE (90595,"No package found for service") + , NO_RENEWAL_FOR_SERVICE (90596,"No renewal found for service") + , SERVICE_ID_NOT_ON_DEMAND (90597,"Service is not on demand") + , SERVICE_ID_NOT_ON_DEMAND_CANCELLED(90598,"Service is not on demand (cancelled)") + , SERVICE_CATEGORY_NOT_VALID (90599,"Service/category not valid") + // Classe 90600 + , NOTIFY_IO_EXCEPTION (90600,"I/O error contacting url") + , NOTIFY_URL_EXCEPTION (90601,"Url exception") + , NOTIFY_NOT_VALID_CONTENT_TYPE (90602,"Not valid response content type (text/xml)") + , NOTIFY_NULL_RESPONSE (90603,"Null response from remote server") + , NOTIFY_JDOM_EXCEPTION (90604,"JDOM exception in remote server response") + , NOTIFY_XML_NOT_VALID (90605,"XML is not valid in remote server response") + , NOTIFY_XML_TAG_NOT_VALID (90606,"XML tag is not valid in remote server response") + , NOTIFY_NOT_FOUND (90607,"Notify record not found in table") + , MARKET_ID_CODE_NOT_VALID (90608,"Market code or id non valid for the instance") + , MARKET_ID_CODE_NOT_MATCH (90609,"Market code and id not match the same market") + , REMOTE_KO_HTTP_RESPONSE_CODE (90610,"Remote server ko http response code") + , REMOTE_UNDEFINED_RETURN (90611,"Undefined remote return code and message") + , SEND_MESSAGE_XML_NULL (90612,"Input XML request is null") + , SEND_MESSAGE_XML_NOT_VALID (90613,"Input XML request is not valid") + , SEND_MESSAGE_FILTER_NULL (90614,"Input XML request not valid; FILTER is empty") + , SEND_MESSAGE_CORE_NULL (90615,"Input XML request not valid; MESSAGE is empty") + , SEND_MESSAGE_INSTANCE_NULL (90616,"Input XML request not valid; INSTANCE-CODE or GROUP-CODE is mandatory") + , SEND_MESSAGE_INSTANCE_NOT_VALID (90617,"Input XML request not valid; INSTANCE-CODE not valid") + , MESSAGE_CHANNEL_NOT_VALID (90620,"Push message channel not valid") + , MESSAGE_CHANNEL_CANCELLED (90621,"Push message channel not valid (cancelled)") + , MESSAGE_CHANNEL_NOT_MANAGED (90622,"Push message channel cathegory not managed") + , MESSAGE_IS_TOO_LONG (90623,"Push message is too long") + , MESSAGE_ADVANCED_TARGET_NULL (90624,"Push message target for statement is null") + , MESSAGE_ADVANCED_TARGET_NOT_VALID (90625,"Push message target for statement is not valid") + , GALLERY_ID_NOT_VALID (90626,"Id gallery not valid") + , SEND_MESSAGE_BODY_NULL (90627,"Input XML request not valid; BODY is null") + , SEND_MESSAGE_FILTER_INCONSISTENT (90628,"Input XML request not valid; FILTER is inconsistent") + , PUSH_CERT_FILE_NOT_FOUND (90629,"Push, certificate file not found") + , PUSH_THREAD_NO_MESSAGE_FOUND (90630,"Push message not found in database") + , PUSH_CHANNEL_NOT_CONFIGURED (90631,"Push channel not configured") + , PUSH_CHANNEL_CONFIG_ERROR (90632,"Push channel configuration not valid") + , PUSH_CHANNEL_CONFIG_ERROR_IO (90633,"Push channel configuration error") + , PUSH_PROCESSOR_NOT_FOUND (90634,"Push processor not found for channel category") + , MESSAGE_FEEDBACK_NOT_VALID (90635,"Message feedback not valid") + , CMD_CHECK_NUMBER_NOT_MATCH (90636,"One or more push command is not valid, check XML") + , ARG_CHECK_NUMBER_NOT_MATCH (90637,"One or more argument is not valid, check command XML") + , ARG_MANDATORY_NOT_FOUND (90638,"Mandatory argument not found, check command XML") + , CMD_CHECK_TOO_MANY (90639,"Too many command found in list") + , C2DM_AUTH_KEY_FAIL (90640,"Google auth key null or not valid") + , MOBILE_PROVISION_LOAD_IOERROR (90641,"IOError loading mobile provision file") + + // + , GEOIP_ONLY_ONE_SUPPORTED (90650,"Only one ip in header response") + , GEOIP_DATA_FILE_NOT_FOUND (90651,"GeoIp data file not found") + , GEOIP_IP_IS_MANDATORY (90652,"IP is mandatory") + , GEOIP_IP_IS_NOT_VALID (90653,"IP is not valid") + , GEOIP_LOCATOR_IS_NULL (90654,"GeoIp lookup locator is null") + , GEOIP_LOCATION_IS_NULL (90656,"GeoIp location is null") + , GEOIP_METHOD_NOT_VALID (90657,"GeoIp method is not valid") + // + // + , PUSH_SEND_JSON_NULL (90660,"Input JSON request is null") + , PUSH_SEND_JSON_NOT_VALID (90661,"Input JSON request is not valid") + , PUSH_SEND_JSON_FILTER (90662,"Input JSON request not valid") + , PUSH_SEND_JSON_CORE (90663,"Input JSON request not valid") + , PUSH_SEND_JSON_GROUP_NULL (90664,"Input JSON request not valid; application code or id is mandatory") + , PUSH_SEND_JSON_GROUP_NOT_VALID (90665,"Input JSON request not valid; application code or id not valid") + , PUSH_SEND_JSON_BODY_NULL (90666,"Input XML request not valid; BODY is null") + , PUSH_SEND_JSON_FILTER_INCONSISTENT(90667,"Input XML request not valid; FILTER is inconsistent") + , PUSH_SEND_JSON_BODY (90668,"Input JSON request not valid; body type is null") + , PUSH_ANALYTICS_FILTER_NULL (90669,"Insert a filter: 'tag' or 'messageToken'") + , PUSH_ANALYTICS_FILTER_NOT_FOUND (90670,"No message found with 'tag' or 'messageToken' filter") + + // Classe 90700 + , PUSH_ACTION_NOT_VALID (90720,"Push action not valid") + , PUSH_REFRESH_NOT_VALID (90721,"Device not registered to push service, refresh operation not valid") + , PUSH_REFRESH_NOT_VALID_DELETED (90723,"Device not registered to push service (deleted), refresh operation not valid") + + , USERS_PROVIDER_NOT_PRESENT (90730,"Users provider not valid, check instance configuration or add a call parameter") + , USERS_PROVIDER_CANCELLED (90731,"Users provider not valid (cancelled), check instance configuration") + , USERS_PROVIDER_MYDM_NOT_VALID (90732,"Users provider MyDesktopMate not valid") + , USERS_PROVIDER_MYDM_CANCELLED (90733,"Users provider MyDesktopMate not valid (cancelled)") + , DEVICE_USERS_CORRUPTED_DATA (90734,"Device user not valid (corrupted database)") + , USERS_PROVIDER_URL_NOT_FOUND (90735,"Users provider not found, check URL parameter or server configuration") + , USERS_PROVIDER_NOT_VALID (90736,"Users provider not valid, check call parameter or server configuration") + + + , EXPORT_REQUEST_EXPIRED (90740,"Export request is expired") + , EXPORT_TICKET_NOT_FOUND (90741,"Export bind ticket not found") + , EXPORT_FILE_NOT_FOUND (90742,"Export file not found") + + , SESSION_TOKEN_TOO_SHORT (90748,"Session token not valid (too short, min 10)") + , SESSION_TOKEN_TOO_LONG (90749,"Session token not valid (too long, max 32 )") + , SESSION_TOKEN_NOT_FOUND (90750,"Session token not valid (not found)") + , EVENT_CODE_NOT_VALID (90751,"Event code not valid") + + // Classe 90800 + , PS_NOT_VALID_METHOD_GET (90800,false,false,"HTTP method GET is not supported by this URL") + , PS_STATEMENT_NOT_SPECIFIED (90801,false,false,"Specify a valid statement in request call") + , PS_STATEMENT_NOT_VALID (90802,"Not valid statement in request call") + , PS_STATEMENT_DIFFERENCE (90803,"Difference between header and query string value for statement") + , PS_REQUEST_CLASS_NOT_FOUND (90804,"Request class not found") + , PS_RESPONSE_CLASS_NOT_FOUND (90805,"Response class not found") + , PS_REQUEST_UNSUPPORTED_TYPE (90806,"Internal error, unsupported type class in method") + , PS_RESPONSE_UNSUPPORTED_TYPE (90807,"Internal error, unsupported type class") + , PS_SECURITY_EXCEPTION (90808,"Internal security exception") + , PS_NO_SUCH_METHOD (90809,"Internal error, method not found") + , PS_INSTANSACTION_ERROR (90810,"Internal error, class instantiation error") + , PS_ILLEGAL_ACCESS_ERRROR (90811,"Internal error, class illegal access") + , PS_REQUEST_UNSUPPORTED_ATYPE (90812,"Internal error, unsupported array type class in method") + , PS_RESPONSE_UNSUPPORTED_ATYPE (90813,"Internal error, unsupported array type class") + , PS_REQUEST_CAST_EXCEPTION (90814,"Not valid value, cast exception") + // + + , PS_PRINT_WRITER_ERROR (90817,"Error open servlet print writer") + , PS_OUTPUT_STREAM_ERROR (90818,"Error open servlet output stream") + , PS_INPUT_STREAM_ERROR (90819,"Error reading from input stream") + , PS_NULL_RESPONSE (90820,"Null response is not a valid response") + , PS_RESPONSE_NOT_MATCH (90821,"Response class not match") + // + + // + , SYNCHRO_IN_PROGRESS (90830,"Remote server syncronization in progress, try later") + , SYNCHRO_IN_PROGRESS_SOFTEC (90831,"Remote server syncronization in progress (superadmin), try later") + + // + , INSTANCE_UNIQUE_ID_NOT_VALID (90835,"Identification code not valid") + + // + , VIEWSIZE_NO_VALID_VALUE (90840,"No valid value for 'viewsize': use WIDTHxHEIGTH") + , IMAGE_MODE_REQUEST_NOT_VALID (90841,"Image request mode not valid") + , RESOURCE_SIZE_NOT_VALID (90842,"Image request mode not valid") + , IMAGE_ID_OR_SRC_NULL (90843,"Mandatory field is empty: 'id' or 'src'") + + + , CUSTOMER_INSTANCE_NOT_MATCH (90850,"Customer/Instance do not match") + , SOURCE_CUST_NO_LANG_FOUND (90851,"Source, no languages found for customer") + , SOURCE_INST_NO_LANG_FOUND (90852,"Source, no languages found for instance") + , SOURCE_NO_TECH_FOUND (90853,"Source, no technologies found") + , SOURCE_NO_ZONE_FOUND (90854,"Source, no zones found") + , TARGET_CUSTOMER_EXIST (90855,"Target customer just exists") + , TARGET_CUSTOMER_EXIST_CANCELLED (90856,"Target customer just exists (cancelled)") + , TARGET_INSTANCE_EXIST (90857,"Target instance just exists") + , TARGET_INSTANCE_EXIST_CANCELLED (90858,"Target instance just exists (cancelled)") + , TARGET_CUST_LANG_NOT_VALID (90859,"Target, customer language not valid") + , TARGET_INST_LANG_NOT_VALID (90860,"Target, instance language not valid") + , TARGET_TECH_NOT_VALID (90861,"Target, technology not valid") + , TARGET_ZONE_NOT_VALID (90862,"Target, zone not valid") + , TOO_MANY_RECORDS (90863,"Too many records") + , COMPARE_SOURCE_TARGET_ERROR (90864,"Error compare source/target record") + , COMPARE_SOURCE_TARGET_EMPTY (90865,"Source and target list are empty") + , TARGET_GROUP_EXIST (90866,"Target group just exists") + , TARGET_GROUP_NAME_MANDATORY (90867,"Target group name is mandatory") + , TARGET_INSTANCE_NAME_MANDATORY (90868,"Target instance name is mandatory") + , NO_RECORD_FOUND (90869,"No record found") + , NO_APPLICATION_FOUND (90870,"No application found") + + , NO_PARAMER_FOUND (90875,"No parameter found") + , NO_PARAMER_MISSING (90876,"Mandatory parameter missing") + , NOT_VALID_PARAMER (90877,"Not valid parameter value") + , NOT_VALID_PARAMER_STATE (90878,"Not valid parameter value state") + , NO_VALID_LINK (90879,"No valid link") + + + , SERVER_MAINTENANCE (90888,false,false,"Server maintenance, try later") + + // Classe 90900 + , DEVICE_LOCKED (90970,false,false,"Application locked on this device") + + , REQUEST_NOT_IMPL_ISREADER (90980,"Internal error, request must implements interface to perform operation") + , DB_COMPARE_CLASS_NOT_MAPPED (90981,"Class not managed from database field comparator") + , DB_FILED_NOT_MAPPED (90982,"Database filed not mapped") + , REQUEST_IS_NULL (90983,"Internal error, request is null") + , REQUEST_PHASE_IS_NULL (90984,"Request phase is null") + , REQUEST_PHASE_IS_NOT_VALID (90985,"Request phase is not valid") + , MFD_REQUEST_IO_ERROR (90986,"MultipartFormData request is not valid") + , MDF_REQUEST_UPLOAD_ERROR (90987,"MultipartFormData request upload error") + , MDF_REQUEST_NOT_VALID (90988,"Request is not a valid MultipartFormData") + , DB_VALUE_CLASS_NOT_MAPPED (90989,"Class not managed from database field value function") + , SQL_TIMEOUT (90990,"Error in accessing the database (timeout)") + , INTERNAL_SERVER_ERROR (90991,"Internal server error") + , MANAGER_EXCEPTION (90992,"Server manager exception") + , REMOTE_EXCEPTION (90993,"Problem contacting remote server") + , SQL_EXCEPTION (90994,"Error in accessing the database") + , UNHANDLED_EXCEPTION (90995,"Unhandled error") + , SERVICE_NOT_ACTIVE (90996,"Service is not active") // Servizio disattivato + , SESSION_NOT_VALID (90997,"Session null or not valid") + , REQUEST_NOT_VALID (90998,"Request is not valid") + , RESPONSE_NOT_VALID (90999,"Response is not valid") // Valore di default + // APP IN BICI CUSTOM + , PHONE_NUMBER_NOT_VALID (71000,"Phone number not valid") + , DATE_INVALID_MISSING (71001,"Date invalid or missing") + , MANDATORY_KM_USEFUL (71002,"Km Useful is a mandatory field") + , MANDATORY_KM_USELESS (71003,"Km Useless is a mandatory field") + , MANDATORY_KM_OUT_THRESHOLD (71004,"Km Out Threshold is a mandatory field") + , MANDATORY_TYPE (71005,"Type is a mandatory field") + , MANDATORY_DATE_START (71006,"Date start is a mandatory field") + , MANDATORY_DATE_END (71007,"Date end is a mandatory field") + , SESSION_TOKEN_INVALID (71008,"Invalid Session Token") + //----------------- + + + , PATH_NOT_VALID (30001,"Path not valid or not found") + , FILE_NOT_EXIST (30002,"File do not exist") + , FILE_IS_DIRECTORY (30003,"This is not a file") + , ERROR_DELETING_FILE (30004,"Error deleting file") + + + + + // Warning, CLASSE 100 + + + ; + + // FIXME migliorare con Class "it.softecspa.desktopmate.services.common + public static final String BUNDLE_NAME = "it/softecspa/fileproxy/services/common/lang/ResponseOutcome"; + + + public static boolean checkOK(String value) { + if (value==null) return false; + + if (value.equals(OK.getReturnCode())) return true; + return false; + } + + + + private int id; + private String code; + private String message; + private boolean traceLog; + private boolean traceErrorCall; + + private ResponseOutcome(int id, String message) { + this.id = id; + this.code = Integer.toString(id); + this.message = message; + this.traceLog = true; + this.traceLog = false; + } + + private ResponseOutcome(int id, boolean traceLog, boolean traceErrorCall, String message) { + this.id = id; + this.code = Integer.toString(id); + this.message = message; + this.traceLog = traceLog; + this.traceErrorCall = traceErrorCall; + } + + public String getReturnCode() { + return code; + } + + public String getMessage() { + return message; + } + + public int getId() { + return id; + } + + public boolean isOk() { + return id==OK.getId(); + } + + public String getFullMessage() { + return "("+id+") "+message; + } + + /** + * Indica se l'errore deve essere tracciato in modo completo nel file di log + * @return + */ + public boolean isTraceLog() { + return traceLog; + } + + /** + * Indica se l'errore deve essere traccciato nel database come "error call" + * @return + */ + public boolean isTraceErrorCall() { + return traceErrorCall; + } + + +} diff --git a/src/it/softecspa/fileproxy/services/common/ResponseResult.java b/src/it/softecspa/fileproxy/services/common/ResponseResult.java new file mode 100644 index 0000000..a3fa91f --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/ResponseResult.java @@ -0,0 +1,46 @@ +package it.softecspa.fileproxy.services.common; + +public enum ResponseResult { + // Errori di sistema, CLASSE 900 + ERROR ("error") + , WARN ("warn") + , OK ("ok") + , MAINTENANCE ("maintenance") + + // ----------------------------------------------- + , SAVED ("saved") + //, EXPIRED ("expired") + , BAD_DEVICE ("badDevice") + , REQUIRED_CODE ("requiredCode") + , BAD_SIM ("badSim") + , BAD_CODE ("badCode") + // + , UPDATE ("update") + , UPDATE_NO ("noUpdate") + , DO_LOGOUT ("doLogout") + // + , NO_ZONE ("noZone") + // + , REGISTRATION_CHECK ("registrationCheck") + ; + + private String value; + + + private ResponseResult(String value) { + this.value = value; + } + + + public String toString() { + return value!=null?value:super.toString(); + } + + public String getValue() { + return toString(); + } + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/TraceableWithIdException.java b/src/it/softecspa/fileproxy/services/common/TraceableWithIdException.java new file mode 100644 index 0000000..6980f40 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/TraceableWithIdException.java @@ -0,0 +1,13 @@ +package it.softecspa.fileproxy.services.common; + +public interface TraceableWithIdException { + + public String getId(); + + public boolean isTraceLog(); + + public boolean isTraceErrorCall(); + + public String getMessage(); + +} diff --git a/src/it/softecspa/fileproxy/services/common/UniversalStatementException.java b/src/it/softecspa/fileproxy/services/common/UniversalStatementException.java new file mode 100644 index 0000000..396b79e --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/UniversalStatementException.java @@ -0,0 +1,64 @@ +package it.softecspa.fileproxy.services.common; + + + + +@SuppressWarnings("serial") +public class UniversalStatementException extends Throwable implements TraceableWithIdException { + + private String id; + private boolean trace; + + + public UniversalStatementException(Throwable e) { + super(ResponseOutcome.INTERNAL_SERVER_ERROR.getMessage(),e); + this.id = ResponseOutcome.INTERNAL_SERVER_ERROR.getReturnCode(); + this.trace = ResponseOutcome.INTERNAL_SERVER_ERROR.isTraceLog(); + } + + + public UniversalStatementException(String message, Throwable e) { + super(message, e); + this.id = ResponseOutcome.INTERNAL_SERVER_ERROR.getReturnCode(); + this.trace = ResponseOutcome.INTERNAL_SERVER_ERROR.isTraceLog(); + } + + public UniversalStatementException(String id, String message) { + super(message); + this.id = id; + this.trace = true; + } + + + public UniversalStatementException(ResponseOutcome outcome, Throwable e) { + super(outcome.getMessage(), e); + this.id = outcome.getReturnCode(); + this.trace = outcome.isTraceLog(); + } + + public UniversalStatementException(ResponseOutcome outcome) { + super(outcome.getMessage()); + this.id = outcome.getReturnCode(); + this.trace = outcome.isTraceLog(); + } + + @Override + public String getId() { + return id; + } + + @Override + public boolean isTraceLog() { + return trace; + } + + @Override + public boolean isTraceErrorCall() { + return false; + } + + @Override + public String getMessage() { + return super.getMessage(); + } +} diff --git a/src/it/softecspa/fileproxy/services/common/comunicator/http/Browser.java b/src/it/softecspa/fileproxy/services/common/comunicator/http/Browser.java new file mode 100644 index 0000000..fb7e1ec --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/comunicator/http/Browser.java @@ -0,0 +1,82 @@ +package it.softecspa.fileproxy.services.common.comunicator.http; + +public class Browser { + + // TODO migliorare la ricerca di informazioni + public final String EXPLORER = "MSIE"; + + private boolean explorer; + private boolean firefox; + private boolean opera; + + private int version; + private int revision; + + private String user_agent; + + /* + * ar NS4 = (navigator.appName.indexOf("Netscape")>=0 && + * parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) + * < 5)? true : false; var IE4 = (document.all)? true : false; var NS6 = + * (parseFloat(navigator.appVersion) >= 5 && + * navigator.appName.indexOf("Netscape")>=0 )? true: false; + * + * var IE = IE4 var NS = NS4 || NS6 + */ + + protected Browser(HttpRemote remote) { + /* + * for (Enumeration e= remote.getHeadersName(); e.hasMoreElements();) { + * String p = (String)e.nextElement(); + * System.out.println(p+" = "+remote.get(p)); } + */ + + // Analisi... + user_agent = remote.getUserAgent(); + + int pos = user_agent.indexOf(EXPLORER); + if (pos >= 0) { + // Internet Explorer + explorer = true; + + try { + int limit = user_agent.indexOf(";", pos); + int dot = user_agent.indexOf(".", pos); + + version = new Integer(user_agent.substring(pos + EXPLORER.length() + 1, dot)).intValue(); + revision = new Integer(user_agent.substring(dot + 1, limit)).intValue(); + } catch (Exception e) { /* Nessuna operazione */ + } + + } else { + // ...per adesso Firefox + firefox = true; + // TODO gestire versione + } + + } + + public boolean isExplorer() { + return explorer; + } + + public boolean isFirefox() { + return firefox; + } + + public boolean isOpera() { + return opera; + } + + public int getRevision() { + return revision; + } + + public String getUserAgent() { + return user_agent; + } + + public int getVersion() { + return version; + } +} diff --git a/src/it/softecspa/fileproxy/services/common/comunicator/http/HttpRemote.java b/src/it/softecspa/fileproxy/services/common/comunicator/http/HttpRemote.java new file mode 100644 index 0000000..c63c8cc --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/comunicator/http/HttpRemote.java @@ -0,0 +1,229 @@ +package it.softecspa.fileproxy.services.common.comunicator.http; + +import javax.servlet.http.HttpServletRequest; + +public class HttpRemote { + + /** + * These are some environment variables: + * REMOTE_ADDR - IP address of a client + * + * HTTP_VIA - if it is not empty, then a proxy is used. Value is an + * address (or several addresses) of a proxy server, this variable is added + * by a proxy server itself if you use one. + * + * HTTP_X_FORWARDED_FOR - if it is not empty, then a proxy is used. Value is a real IP address of a client + * (your IP), this variable is also added by a proxy server if you use one. + * + * HTTP_ACCEPT_LANGUAGE - what language is used in browser (what language a + * page should be displayed in) HTTP_USER_AGENT - so called + * "a user's agent". HTTP_HOST - is a web server's name In fact there are + * much more of them. Your anonymity is determined by what environment + * variables "hide" from a web-server. + * + * • Proxy server is not used: REMOTE_ADDR = your IP HTTP_VIA = not + * determined HTTP_X_FORWARDED_FOR = not determined + * + * • Transparent Proxies REMOTE_ADDR = proxy IP HTTP_VIA = proxy IP + * HTTP_X_FORWARDED_FOR = your IP These proxies are not anonymous. They + * don't hide IP-address of a client and let a web server know that you are + * surfing through a proxy server. The task of such proxies, as a rule, is + * information caching and/or support of Internet access for several + * computers via single connection. Such proxies are not applicable for + * security and privacy while surfing on net. You can use them only for + * network speed improvement. + * + * • Anonymous Proxies REMOTE_ADDR = proxy IP HTTP_VIA = proxy IP + * HTTP_X_FORWARDED_FOR = proxy IP These proxies don't show your real IP but + * change the request fields so it is very easy to detect that you are using + * proxy. + * + * • High Anonymous Proxies REMOTE_ADDR = proxy IP HTTP_VIA = not determined + * HTTP_X_FORWARDED_FOR = not determined High Anonymous proxy servers do not + * pass an IP-address of a client and don't send any variables indicating + * that you are using proxy server to host and look like real browser. + */ + + /* + * TODO da valutare + function ipCheck() { + if (getenv('HTTP_CLIENT_IP')) { + $ip = getenv('HTTP_CLIENT_IP'); + } elseif (getenv('HTTP_X_FORWARDED_FOR')) { + $ip = getenv('HTTP_X_FORWARDED_FOR'); + } elseif (getenv('HTTP_X_FORWARDED')) { + $ip = getenv('HTTP_X_FORWARDED'); + } elseif (getenv('HTTP_FORWARDED_FOR')) { + $ip = getenv('HTTP_FORWARDED_FOR'); + } elseif (getenv('HTTP_FORWARDED')) { + $ip = getenv('HTTP_FORWARDED'); + } else { + $ip = $_SERVER['REMOTE_ADDR']; + } + return $ip; + } + */ + + //private HttpServletRequest request; + private boolean proxy; + + private String remoteAddr; + + private String remoteHost; // IP con cui si presenta l'host collegato (IP pubblico) + private String forwarded; // IP dell'host se presente proxy + private String address; // IP del proxy o dell'host se non presente proxy (IP privato) + + private String traceHost; // trace root + + private Browser browser; + private String via; + + + private String remote_user; + private String user_agent; + private String referer; + private String content_type; + private String max_forwards; + + + + + // FIXME aggiungere controllo velocizzatore che elabora i dati alla prima richiesta + public HttpRemote(HttpServletRequest request) { + + remoteAddr = request.getRemoteAddr(); // REMOTE_ADDR + address = request.getRemoteAddr(); // REMOTE_ADDR + + forwarded = request.getHeader("x-forwarded-for"); // HTTP_X_FORWARDED_FOR + via = request.getHeader("Via"); // HTTP_VIA + + if (forwarded != null) { + String remoteIP = null; + String forwardPROXY = null; + if (forwarded.indexOf(",") >= 0) { + int p = forwarded.indexOf(","); + remoteIP = forwarded.substring(0, p).trim(); + forwardPROXY = forwarded.substring(p + 1).trim(); + } else { + remoteIP = forwarded; + } + // Warkaround per hidden proxy + if (remoteIP.equalsIgnoreCase("unknown")) { + remoteIP = address; + forwarded = address; + } + + String xvia = (via != null && !via.equals(forwarded) ? ": " + via : ""); + if (forwarded.equalsIgnoreCase(address)) { + // PROXY ANONIMO + traceHost = forwarded + " (proxy" + xvia + ")"; + } else { + // PROXY TRASPARENTE + if (forwardPROXY != null) { + address = forwardPROXY + ", " + address; // Concateno il + // proxy + // intermedio + traceHost = remoteIP + " [" + address + " (proxy" + xvia + ")]"; + } else { + traceHost = forwarded + " [" + address + " (proxy" + xvia + ")]"; + } + } + proxy = true; + remoteHost = remoteIP; + + } else { + // NO proxy o proxy bloccante + traceHost = address; + proxy = false; + remoteHost = address; + } + + /* + * String headers=""; for (Enumeration + * enumeration=request.getHeaderNames();enumeration.hasMoreElements();) + * { String nome = (String) enumeration.nextElement(); + * headers+=nome+" = "+request.getHeader(nome)+"\n"; } + */ + + remote_user = request.getRemoteUser(); + user_agent = request.getHeader("user-agent"); + referer = request.getHeader("referer"); + content_type = request.getHeader("content-type"); + max_forwards = request.getHeader("max-forwards"); + + } + + + + public String getTraceHost() { + return traceHost; + } + + + /** + * Indirizzo pubblico con cui si presenta l'host remoto + * @return + */ + public String getRemoteHost() { + return remoteHost; + } + + /** + * Indirizzo privato del server da cui proviene la chiamata + * Protebbe essere un proxy + * @return + */ + public String getRemoteAddress() { + return address; + } + + + public String getForwardedFor() { + return forwarded; + } + + public boolean hasProxy() { + return proxy; + } + + public String getRemoteUser() { + return remote_user; + } + + public String getUserAgent() { + return user_agent; + } + + public String getReferer() { + return referer; + } + + public String getContentType() { + return content_type; + } + + public String getMaxForwards() { + return max_forwards; + } + + + public Browser getBrowser() { + if (browser == null) + browser = new Browser(this); + return browser; + } + + public String printlnInfo() { + return getTraceHost() + (getMaxForwards() != null ? " (" + getMaxForwards() + ")" : "") + (getRemoteUser() != null ? " {" + getRemoteUser() + "}" : ""); + } + + + /** + * Returns the Internet Protocol (IP) address of the client or last proxy that sent the request. + * @return + */ + public String getRemoteAddr() { + return remoteAddr; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/comunicator/http/MimeType.java b/src/it/softecspa/fileproxy/services/common/comunicator/http/MimeType.java new file mode 100644 index 0000000..96425d9 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/comunicator/http/MimeType.java @@ -0,0 +1,376 @@ +package it.softecspa.fileproxy.services.common.comunicator.http; + +public enum MimeType { + + _3DM("3dm", "x-world/x-3dmf"), _3DMF("3dmf", "x-world/x-3dmf"), _A("a", "application/octet-stream"), _AAB("aab", "application/x-authorware-bin"), _AAM("aam", "application/x-authorware-map"), _AAS("aas", "application/x-authorware-seg"), _ABC( + "abc", "text/vndabc"), _ACGI("acgi", "text/html"), _AFL("afl", "video/animaflex"), _AI("ai", "application/postscript"), _AIF("aif", "audio/aiff") + // ,_AIF ("aif","audio/x-aiff") + , _AIFC("aifc", "audio/aiff") + // ,_AIFC ("aifc","audio/x-aiff") + , _AIFF("aiff", "audio/aiff") + // ,_AIFF ("aiff","audio/x-aiff") + , _AIM("aim", "application/x-aim"), _AIP("aip", "text/x-audiosoft-intra"), _ANI("ani", "application/x-navi-animation"), _AOS("aos", "application/x-nokia-9000-communicator-add-on-software"), _APS("aps", "application/mime"), _ARC("arc", + "application/octet-stream"), _ARJ("arj", "application/arj") + // ,_ARJ ("arj","application/octet-stream") + , _ART("art", "image/x-jg"), _ASF("asf", "video/x-ms-asf"), _ASM("asm", "text/x-asm"), _ASP("asp", "text/asp"), _ASX("asx", "application/x-mplayer2") + // ,_ASX ("asx","video/x-ms-asf") + // ,_ASX ("asx","video/x-ms-asf-plugin") + , _AU("au", "audio/basic") + // ,_AU ("au","audio/x-au") + // ,_AVI ("avi","application/x-troff-msvideo") + , _AVI("avi", "video/avi") + // ,_AVI ("avi","video/msvideo") + // ,_AVI ("avi","video/x-msvideo") + , _AVS("avs", "video/avs-video"), _BCPIO("bcpio", "application/x-bcpio") + // ,_BIN ("bin","application/mac-binary") + // ,_BIN ("bin","application/macbinary") + // ,_BIN ("bin","application/octet-stream") + , _BIN("bin", "application/x-binary") + // ,_BIN ("bin","application/x-macbinary") + , _BM("bm", "image/bmp"), _BMP("bmp", "image/bmp") + // ,_BMP ("bmp","image/x-windows-bmp") + , _BOO("boo", "application/book"), _BOOK("book", "application/book"), _BOZ("boz", "application/x-bzip2"), _BSH("bsh", "application/x-bsh"), _BZ("bz", "application/x-bzip"), _BZ2("bz2", "application/x-bzip2"), _C("c", "text/plain") + // ,_C ("c","text/x-c") + , _C__("c++", "text/plain"), _CAT("cat", "application/vndms-pkiseccat"), _CC("cc", "text/plain") + // ,_CC ("cc","text/x-c") + , _CCAD("ccad", "application/clariscad"), _CCO("cco", "application/x-cocoa"), _CDF("cdf", "application/cdf") + // ,_CDF ("cdf","application/x-cdf") + // ,_CDF ("cdf","application/x-netcdf") + // ,_CER ("cer","application/pkix-cert") + , _CER("cer", "application/x-x509-ca-cert"), _CHA("cha", "application/x-chat"), _CHAT("chat", "application/x-chat"), _CLASS("class", "application/java") + // ,_CLASS ("class","application/java-byte-code") + // ,_CLASS ("class","application/x-java-class") + , _COM("com", "application/octet-stream") + // ,_COM ("com","text/plain") + , _CONF("conf", "text/plain"), _CPIO("cpio", "application/x-cpio"), _CPP("cpp", "text/x-c"), _CPT("cpt", "application/mac-compactpro") + // ,_CPT ("cpt","application/x-compactpro") + // ,_CPT ("cpt","application/x-cpt") + , _CRL("crl", "application/pkcs-crl") + // ,_CRL ("crl","application/pkix-crl") + // ,_CRT ("crt","application/pkix-cert") + , _CRT("crt", "application/x-x509-ca-cert") + // ,_CRT ("crt","application/x-x509-user-cert") + // ,_CSH ("csh","application/x-csh") + , _CSH("csh", "text/x-scriptcsh") + // ,_CSS ("css","application/x-pointplus") + , _CSS("css", "text/css"), _CXX("cxx", "text/plain"), _DCR("dcr", "application/x-director"), _DEEPV("deepv", "application/x-deepv"), _DEF("def", "text/plain"), _DER("der", "application/x-x509-ca-cert"), _DIF("dif", "video/x-dv"), _DIR("dir", + "application/x-director"), _DL("dl", "video/dl") + // ,_DL ("dl","video/x-dl") + , _DOC("doc", "application/msword"), _DOT("dot", "application/msword"), _DP("dp", "application/commonground"), _DRW("drw", "application/drafting"), _DUMP("dump", "application/octet-stream"), _DV("dv", "video/x-dv"), _DVI("dvi", + "application/x-dvi"), _DWF("dwf", "drawing/x-dwf") + // ,_DWF ("dwf","model/vnddwf") + // ,_DWG ("dwg","application/acad") + // ,_DWG ("dwg","image/vnddwg") + // ,_DWG ("dwg","image/x-dwg") + , _DXF("dxf", "application/dxf") + // ,_DXF ("dxf","image/vnddwg") + // ,_DXF ("dxf","image/x-dwg") + , _DXR("dxr", "application/x-director"), _EL("el", "text/x-scriptelisp") + // ,_ELC ("elc","application/x-bytecodeelisp") + , _ELC("elc", "application/x-elc"), _ENV("env", "application/x-envoy"), _EPS("eps", "application/postscript"), _ES("es", "application/x-esrehber"), _ETX("etx", "text/x-setext"), _EVY("evy", "application/envoy") + // ,_EVY ("evy","application/x-envoy") + , _EXE("exe", "application/octet-stream"), _F("f", "text/plain") + // ,_F ("f","text/x-fortran") + , _F77("f77", "text/x-fortran"), _F90("f90", "text/plain") + // ,_F90 ("f90","text/x-fortran") + , _FDF("fdf", "application/vndfdf") + // ,_FIF ("fif","application/fractals") + , _FIF("fif", "image/fif"), _FLI("fli", "video/fli") + // ,_FLI ("fli","video/x-fli") + , _FLO("flo", "image/florian"), _FLX("flx", "text/vndfmiflexstor"), _FMF("fmf", "video/x-atomic3d-feature"), _FOR("for", "text/plain") + // ,_FOR ("for","text/x-fortran") + , _FPX("fpx", "image/vndfpx") + // ,_FPX ("fpx","image/vndnet-fpx") + , _FRL("frl", "application/freeloader"), _FUNK("funk", "audio/make"), _G("g", "text/plain"), _G3("g3", "image/g3fax"), _GIF("gif", "image/gif"), _GL("gl", "video/gl") + // ,_GL ("gl","video/x-gl") + , _GSD("gsd", "audio/x-gsm"), _GSM("gsm", "audio/x-gsm"), _GSP("gsp", "application/x-gsp"), _GSS("gss", "application/x-gss"), _GTAR("gtar", "application/x-gtar") + // ,_GZ ("gz","application/x-compressed") + , _GZ("gz", "application/x-gzip"), _GZIP("gzip", "application/x-gzip") + // ,_GZIP ("gzip","multipart/x-gzip") + , _H("h", "text/plain") + // ,_H ("h","text/x-h") + , _HDF("hdf", "application/x-hdf"), _HELP("help", "application/x-helpfile"), _HGL("hgl", "application/vndhp-hpgl"), _HH("hh", "text/plain") + // ,_HH ("hh","text/x-h") + // ,_HLB ("hlb","text/x-script") + , _HLP("hlp", "application/hlp") + // ,_HLP ("hlp","application/x-helpfile") + // ,_HLP ("hlp","application/x-winhelp") + , _HPG("hpg", "application/vndhp-hpgl"), _HPGL("hpgl", "application/vndhp-hpgl"), _HQX("hqx", "application/binhex") + // ,_HQX ("hqx","application/binhex4") + // ,_HQX ("hqx","application/mac-binhex") + // ,_HQX ("hqx","application/mac-binhex40") + // ,_HQX ("hqx","application/x-binhex40") + // ,_HQX ("hqx","application/x-mac-binhex40") + , _HTA("hta", "application/hta"), _HTC("htc", "text/x-component"), _HTM("htm", "text/html"), _HTML("html", "text/html"), _HTMLS("htmls", "text/html"), _HTT("htt", "text/webviewhtml"), _HTX("htx", "text/html"), _ICE("ice", + "x-conference/x-cooltalk"), _ICO("ico", "image/x-icon"), _IDC("idc", "text/plain"), _IEF("ief", "image/ief"), _IEFS("iefs", "image/ief"), _IGES("iges", "application/iges") + // ,_IGES ("iges","model/iges") + , _IGS("igs", "application/iges") + // ,_IGS ("igs","model/iges") + , _IMA("ima", "application/x-ima"), _IMAP("imap", "application/x-httpd-imap"), _INF("inf", "application/inf"), _INS("ins", "application/x-internett-signup"), _IP("ip", "application/x-ip2"), _ISU("isu", "video/x-isvideo"), _IT("it", "audio/it"), _IV( + "iv", "application/x-inventor"), _IVR("ivr", "i-world/i-vrml"), _IVY("ivy", "application/x-livescreen"), _JAM("jam", "audio/x-jam"), _JAV("jav", "text/plain") + // ,_JAV ("jav","text/x-java-source") + , _JAVA("java", "text/plain") + // ,_JAVA ("java","text/x-java-source") + , _JCM("jcm", "application/x-java-commerce"), _JFIF("jfif", "image/jpeg") + // ,_JFIF ("jfif","image/pjpeg") + , _JFIF_TB("jfif-tbnl", "image/jpeg"), _JPE("jpe", "image/jpeg") + // ,_JPE ("jpe","image/pjpeg") + , _JPEG("jpeg", "image/jpeg") + // ,_JPEG ("jpeg","image/pjpeg") + , _JPG("jpg", "image/jpeg") + // ,_JPG ("jpg","image/pjpeg") + , _JPS("jps", "image/x-jps"), _JS("js", "application/x-javascript"), _JUT("jut", "image/jutvision"), _KAR("kar", "audio/midi") + // ,_KAR ("kar","music/x-karaoke") + , _KSH("ksh", "application/x-ksh") + // ,_KSH ("ksh","text/x-scriptksh") + , _LA("la", "audio/nspaudio") + // ,_LA ("la","audio/x-nspaudio") + , _LAM("lam", "audio/x-liveaudio"), _LATEX("latex", "application/x-latex"), _LHA("lha", "application/lha") + // ,_LHA ("lha","application/octet-stream") + // ,_LHA ("lha","application/x-lha") + , _LHX("lhx", "application/octet-stream"), _LIST("list", "text/plain"), _LMA("lma", "audio/nspaudio") + // ,_LMA ("lma","audio/x-nspaudio") + , _LOG("log", "text/plain") + // ,_LSP ("lsp","application/x-lisp") + , _LSP("lsp", "text/x-scriptlisp"), _LST("lst", "text/plain"), _LSX("lsx", "text/x-la-asf"), _LTX("ltx", "application/x-latex"), _LZH("lzh", "application/octet-stream") + // ,_LZH ("lzh","application/x-lzh") + // ,_LZX ("lzx","application/lzx") + // ,_LZX ("lzx","application/octet-stream") + // ,_LZX ("lzx","application/x-lzx") + , _M("m", "text/plain") + // ,_M ("m","text/x-m") + , _M1V("m1v", "video/mpeg"), _M2A("m2a", "audio/mpeg"), _M2V("m2v", "video/mpeg"), _M3U("m3u", "audio/x-mpequrl"), _MAN("man", "application/x-troff-man"), _MAP("map", "application/x-navimap"), _MAR("mar", "text/plain"), _MBD("mbd", + "application/mbedlet"), _MC$("mc$", "application/x-magic-cap-package-10"), _MCD("mcd", "application/mcad") + // ,_MCD ("mcd","application/x-mathcad") + , _MCF("mcf", "image/vasa") + // ,_MCF ("mcf","text/mcf") + , _MCP("mcp", "application/netmc"), _ME("me", "application/x-troff-me"), _MHT("mht", "message/rfc822"), _MHTML("mhtml", "message/rfc822") + // ,_MID ("mid","application/x-midi") + , _MID("mid", "audio/midi") + // ,_MID ("mid","audio/x-mid") + // ,_MID ("mid","audio/x-midi") + // ,_MID ("mid","music/crescendo") + // ,_MID ("mid","x-music/x-midi") + // ,_MIDI ("midi","application/x-midi") + , _MIDI("midi", "audio/midi") + // ,_MIDI ("midi","audio/x-mid") + // ,_MIDI ("midi","audio/x-midi") + // ,_MIDI ("midi","music/crescendo") + // ,_MIDI ("midi","x-music/x-midi") + // ,_MIF ("mif","application/x-frame") + , _MIF("mif", "application/x-mif"), _MIME("mime", "message/rfc822") + // ,_MIME ("mime","www/mime") + , _MJF("mjf", "audio/x-vndaudioexplosionmjuicemediafile"), _MJPG("mjpg", "video/x-motion-jpeg"), _MM("mm", "application/base64") + // ,_MM ("mm","application/x-meme") + , _MME("mme", "application/base64"), _MOD("mod", "audio/mod") + // ,_MOD ("mod","audio/x-mod") + , _MOOV("moov", "video/quicktime"), _MOV("mov", "video/quicktime"), _MOVIE("movie", "video/x-sgi-movie"), _MP2("mp2", "audio/mpeg") + // ,_MP2 ("mp2","audio/x-mpeg") + // ,_MP2 ("mp2","video/mpeg") + // ,_MP2 ("mp2","video/x-mpeg") + // ,_MP2 ("mp2","video/x-mpeq2a") + // ,_MP3 ("mp3","audio/mpeg3") + // ,_MP3 ("mp3","audio/x-mpeg-3") + , _MP3("mp3", "audio/mpeg"), _MP4("mp4", "video/mpeg"), _3GP("3gp", "video/mpeg") + // ,_MP3 ("mp3","video/x-mpeg") + // ,_MPA ("mpa","audio/mpeg") + , _MPA("mpa", "video/mpeg"), _MPC("mpc", "application/x-project"), _MPE("mpe", "video/mpeg"), _MPEG("mpeg", "video/mpeg") + // ,_MPG ("mpg","audio/mpeg") + , _MPG("mpg", "video/mpeg"), _MPGA("mpga", "audio/mpeg"), _MPP("mpp", "application/vndms-project"), _MPT("mpt", "application/x-project"), _MPV("mpv", "application/x-project"), _MPX("mpx", "application/x-project"), _MRC("mrc", "application/marc"), _MS( + "ms", "application/x-troff-ms"), _MV("mv", "video/x-sgi-movie"), _MY("my", "audio/make"), _MZZ("mzz", "application/x-vndaudioexplosionmzz"), _NAP("nap", "image/naplps"), _NAPLPS("naplps", "image/naplps"), _NC("nc", "application/x-netcdf"), _NCM( + "ncm", "application/vndnokiaconfiguration-message"), _NIF("nif", "image/x-niff"), _NIFF("niff", "image/x-niff"), _NIX("nix", "application/x-mix-transfer"), _NSC("nsc", "application/x-conference"), _NVD("nvd", "application/x-navidoc"), _O( + "o", "application/octet-stream"), _ODA("oda", "application/oda"), _OMC("omc", "application/x-omc"), _OMCD("omcd", "application/x-omcdatamaker"), _OMCR("omcr", "application/x-omcregerator"), _P("p", "text/x-pascal"), _P10("p10", + "application/pkcs10") + // ,_P10 ("p10","application/x-pkcs10") + , _P12("p12", "application/pkcs-12") + // ,_P12 ("p12","application/x-pkcs12") + , _P7A("p7a", "application/x-pkcs7-signature"), _P7C("p7c", "application/pkcs7-mime") + // ,_P7C ("p7c","application/x-pkcs7-mime") + , _P7M("p7m", "application/pkcs7-mime") + // ,_P7M ("p7m","application/x-pkcs7-mime") + , _P7R("p7r", "application/x-pkcs7-certreqresp"), _P7S("p7s", "application/pkcs7-signature"), _PART("part", "application/pro_eng"), _PAS("pas", "text/pascal"), _PBM("pbm", "image/x-portable-bitmap"), _PCL("pcl", "application/vndhp-pcl") + // ,_PCL ("pcl","application/x-pcl") + , _PCT("pct", "image/x-pict"), _PCX("pcx", "image/x-pcx"), _PDB("pdb", "chemical/x-pdb"), _PDF("pdf", "application/pdf"), _PFUNK("pfunk", "audio/make") + // ,_PFUNK ("pfunk","audio/makemyfunk") + , _PGM("pgm", "image/x-portable-graymap") + // ,_PGM ("pgm","image/x-portable-greymap") + , _PIC("pic", "image/pict"), _PICT("pict", "image/pict"), _PKG("pkg", "application/x-newton-compatible-pkg"), _PKO("pko", "application/vndms-pkipko"), _PL("pl", "text/plain") + // ,_PL ("pl","text/x-scriptperl") + , _PLX("plx", "application/x-pixclscript"), _PM("pm", "image/x-xpixmap") + // ,_PM ("pm","text/x-scriptperl-module") + , _PM4("pm4", "application/x-pagemaker"), _PM5("pm5", "application/x-pagemaker"), _PNG("png", "image/png"), _PNM("pnm", "application/x-portable-anymap") + // ,_PNM ("pnm","image/x-portable-anymap") + , _POT("pot", "application/mspowerpoint") + // ,_POT ("pot","application/vndms-powerpoint") + , _POV("pov", "model/x-pov"), _PPA("ppa", "application/vndms-powerpoint"), _PPM("ppm", "image/x-portable-pixmap"), _PPS("pps", "application/mspowerpoint") + // ,_PPS ("pps","application/vndms-powerpoint") + // ,_PPT ("ppt","application/mspowerpoint") + , _PPT("ppt", "application/powerpoint") + // ,_PPT ("ppt","application/vndms-powerpoint") + // ,_PPT ("ppt","application/x-mspowerpoint") + , _PPZ("ppz", "application/mspowerpoint"), _PRE("pre", "application/x-freelance"), _PRT("prt", "application/pro_eng"), _PS("ps", "application/postscript"), _PSD("psd", "application/octet-stream"), _PVU("pvu", "paleovu/x-pv"), _PWZ("pwz", + "application/vndms-powerpoint"), _PY("py", "text/x-scriptphyton"), _PYC("pyc", "applicaiton/x-bytecodepython"), _QCP("qcp", "audio/vndqcelp"), _QD3("qd3", "x-world/x-3dmf"), _QD3D("qd3d", "x-world/x-3dmf"), _QIF("qif", + "image/x-quicktime"), _QT("qt", "video/quicktime"), _QTC("qtc", "video/x-qtc"), _QTI("qti", "image/x-quicktime"), _QTIF("qtif", "image/x-quicktime"), _RA("ra", "audio/x-pn-realaudio") + // ,_RA ("ra","audio/x-pn-realaudio-plugin") + // ,_RA ("ra","audio/x-realaudio") + , _RAM("ram", "audio/x-pn-realaudio"), _RAS("ras", "application/x-cmu-raster") + // ,_RAS ("ras","image/cmu-raster") + // ,_RAS ("ras","image/x-cmu-raster") + , _RAST("rast", "image/cmu-raster"), _REXX("rexx", "text/x-scriptrexx"), _RF("rf", "image/vndrn-realflash"), _RGB("rgb", "image/x-rgb"), _RM("rm", "application/vndrn-realmedia") + // ,_RM ("rm","audio/x-pn-realaudio") + , _RMI("rmi", "audio/mid"), _RMM("rmm", "audio/x-pn-realaudio"), _RMP("rmp", "audio/x-pn-realaudio") + // ,_RMP ("rmp","audio/x-pn-realaudio-plugin") + , _RNG("rng", "application/ringing-tones") + // ,_RNG ("rng","application/vndnokiaringing-tone") + , _RNX("rnx", "application/vndrn-realplayer"), _ROFF("roff", "application/x-troff"), _RP("rp", "image/vndrn-realpix"), _RPM("rpm", "audio/x-pn-realaudio-plugin"), _RT("rt", "text/richtext") + // ,_RT ("rt","text/vndrn-realtext") + , _RTF("rtf", "application/rtf") + // ,_RTF ("rtf","application/x-rtf") + // ,_RTF ("rtf","text/richtext") + // ,_RTX ("rtx","application/rtf") + , _RTX("rtx", "text/richtext"), _RV("rv", "video/vndrn-realvideo"), _S("s", "text/x-asm"), _S3M("s3m", "audio/s3m"), _SAVEME("saveme", "application/octet-stream"), _SBK("sbk", "application/x-tbook"), _SCM("scm", "application/x-lotusscreencam") + // ,_SCM ("scm","text/x-scriptguile") + // ,_SCM ("scm","text/x-scriptscheme") + // ,_SCM ("scm","video/x-scm") + , _SDML("sdml", "text/plain"), _SDP("sdp", "application/sdp") + // ,_SDP ("sdp","application/x-sdp") + , _SDR("sdr", "application/sounder"), _SEA("sea", "application/sea") + // ,_SEA ("sea","application/x-sea") + , _SET("set", "application/set"), _SGM("sgm", "text/sgml") + // ,_SGM ("sgm","text/x-sgml") + , _SGML("sgml", "text/sgml") + // ,_SGML ("sgml","text/x-sgml") + , _SH("sh", "application/x-bsh") + // ,_SH ("sh","application/x-sh") + // ,_SH ("sh","application/x-shar") + // ,_SH ("sh","text/x-scriptsh") + , _SHAR("shar", "application/x-bsh") + // ,_SHAR ("shar","application/x-shar") + , _SHTML("shtml", "text/html") + // ,_SHTML ("shtml","text/x-server-parsed-html") + , _SID("sid", "audio/x-psid"), _SIT("sit", "application/x-sit") + // ,_SIT ("sit","application/x-stuffit") + , _SKD("skd", "application/x-koan"), _SKM("skm", "application/x-koan"), _SKP("skp", "application/x-koan"), _SKT("skt", "application/x-koan"), _SL("sl", "application/x-seelogo"), _SMI("smi", "application/smil"), _SMIL("smil", "application/smil"), _SND( + "snd", "audio/basic") + // ,_SND ("snd","audio/x-adpcm") + , _SOL("sol", "application/solids"), _SPC("spc", "application/x-pkcs7-certificates") + // ,_SPC ("spc","text/x-speech") + , _SPL("spl", "application/futuresplash"), _SPR("spr", "application/x-sprite"), _SPRITE("sprite", "application/x-sprite"), _SRC("src", "application/x-wais-source"), _SSI("ssi", "text/x-server-parsed-html"), _SSM("ssm", + "application/streamingmedia"), _SST("sst", "application/vndms-pkicertstore"), _STEP("step", "application/step"), _STL("stl", "application/sla") + // ,_STL ("stl","application/vndms-pkistl") + // ,_STL ("stl","application/x-navistyle") + , _STP("stp", "application/step"), _SV4CPIO("sv4cpio", "application/x-sv4cpio"), _SV4CRC("sv4crc", "application/x-sv4crc"), _SVF("svf", "image/vnddwg") + // ,_SVF ("svf","image/x-dwg") + , _SVR("svr", "application/x-world") + // ,_SVR ("svr","x-world/x-svr") + , _SWF("swf", "application/x-shockwave-flash"), _T("t", "application/x-troff"), _TALK("talk", "text/x-speech"), _TAR("tar", "application/x-tar"), _TBK("tbk", "application/toolbook") + // ,_TBK ("tbk","application/x-tbook") + , _TCL("tcl", "application/x-tcl") + // ,_TCL ("tcl","text/x-scripttcl") + , _TCSH("tcsh", "text/x-scripttcsh"), _TEX("tex", "application/x-tex"), _TEXI("texi", "application/x-texinfo"), _TEXINFO("texinfo", "application/x-texinfo") + // ,_TEXT ("text","application/plain") + , _TEXT("text", "text/plain"), _TGZ("tgz", "application/gnutar") + // ,_TGZ ("tgz","application/x-compressed") + , _TIF("tif", "image/tiff") + // ,_TIF ("tif","image/x-tiff") + , _TIFF("tiff", "image/tiff") + // ,_TIFF ("tiff","image/x-tiff") + , _TR("tr", "application/x-troff"), _TSI("tsi", "audio/tsp-audio"), _TSP("tsp", "application/dsptype") + // ,_TSP ("tsp","audio/tsplayer") + , _TSV("tsv", "text/tab-separated-values"), _TURBOT("turbot", "image/florian"), _TXT("txt", "text/plain"), _UIL("uil", "text/x-uil"), _UNI("uni", "text/uri-list"), _UNIS("unis", "text/uri-list"), _UNV("unv", "application/i-deas"), _URI("uri", + "text/uri-list"), _URIS("uris", "text/uri-list"), _USTAR("ustar", "application/x-ustar") + // ,_USTAR ("ustar","multipart/x-ustar") + , _UU("uu", "application/octet-stream") + // ,_UU ("uu","text/x-uuencode") + , _UUE("uue", "text/x-uuencode"), _VCD("vcd", "application/x-cdlink"), _VCS("vcs", "text/x-vcalendar"), _VDA("vda", "application/vda"), _VDO("vdo", "video/vdo"), _VEW("vew", "application/groupwise"), _VIV("viv", "video/vivo") + // ,_VIV ("viv","video/vndvivo") + , _VIVO("vivo", "video/vivo") + // ,_VIVO ("vivo","video/vndvivo") + , _VMD("vmd", "application/vocaltec-media-desc"), _VMF("vmf", "application/vocaltec-media-file"), _VOC("voc", "audio/voc") + // ,_VOC ("voc","audio/x-voc") + , _VOS("vos", "video/vosaic"), _VOX("vox", "audio/voxware"), _VQE("vqe", "audio/x-twinvq-plugin"), _VQF("vqf", "audio/x-twinvq"), _VQL("vql", "audio/x-twinvq-plugin"), _VRML("vrml", "application/x-vrml") + // ,_VRML ("vrml","model/vrml") + // ,_VRML ("vrml","x-world/x-vrml") + , _VRT("vrt", "x-world/x-vrt"), _VSD("vsd", "application/x-visio"), _VST("vst", "application/x-visio"), _VSW("vsw", "application/x-visio"), _W60("w60", "application/wordperfect60"), _W61("w61", "application/wordperfect61"), _W6W("w6w", + "application/msword"), _WAV("wav", "audio/wav") + // ,_WAV ("wav","audio/x-wav") + , _WB1("wb1", "application/x-qpro"), _WBMP("wbmp", "image/vndwapwbmp"), _WEB("web", "application/vndxara"), _WIZ("wiz", "application/msword"), _WK1("wk1", "application/x-123"), _WMF("wmf", "windows/metafile"), _WML("wml", "text/vndwapwml"), _WMLC( + "wmlc", "application/vndwapwmlc"), _WMLS("wmls", "text/vndwapwmlscript"), _WMLSC("wmlsc", "application/vndwapwmlscriptc"), _WORD("word", "application/msword"), _WP("wp", "application/wordperfect"), _WP5("wp5", "application/wordperfect") + // ,_WP5 ("wp5","application/wordperfect60") + , _WP6("wp6", "application/wordperfect"), _WPD("wpd", "application/wordperfect") + // ,_WPD ("wpd","application/x-wpwin") + , _WQ1("wq1", "application/x-lotus"), _WRI("wri", "application/mswrite") + // ,_WRI ("wri","application/x-wri") + , _WRL("wrl", "application/x-world") + // ,_WRL ("wrl","model/vrml") + // ,_WRL ("wrl","x-world/x-vrml") + // ,_WRZ ("wrz","model/vrml") + , _WRZ("wrz", "x-world/x-vrml"), _WSC("wsc", "text/scriplet"), _WSRC("wsrc", "application/x-wais-source"), _WTK("wtk", "application/x-wintalk"), _XBM("xbm", "image/x-xbitmap") + // ,_XBM ("xbm","image/x-xbm") + // ,_XBM ("xbm","image/xbm") + , _XDR("xdr", "video/x-amt-demorun"), _XGZ("xgz", "xgl/drawing"), _XIF("xif", "image/vndxiff"), _XL("xl", "application/excel"), _XLA("xla", "application/excel") + // ,_XLA ("xla","application/x-excel") + // ,_XLA ("xla","application/x-msexcel") + , _XLB("xlb", "application/excel") + // ,_XLB ("xlb","application/vndms-excel") + // ,_XLB ("xlb","application/x-excel") + , _XLC("xlc", "application/excel") + // ,_XLC ("xlc","application/vndms-excel") + // ,_XLC ("xlc","application/x-excel") + , _XLD("xld", "application/excel") + // ,_XLD ("xld","application/x-excel") + , _XLK("xlk", "application/excel") + // ,_XLK ("xlk","application/x-excel") + , _XLL("xll", "application/excel") + // ,_XLL ("xll","application/vndms-excel") + // ,_XLL ("xll","application/x-excel") + , _XLM("xlm", "application/excel") + // ,_XLM ("xlm","application/vndms-excel") + // ,_XLM ("xlm","application/x-excel") + , _XLS("xls", "application/excel") + // ,_XLS ("xls","application/vndms-excel") + // ,_XLS ("xls","application/x-excel") + // ,_XLS ("xls","application/x-msexcel") + , _XLT("xlt", "application/excel") + // ,_XLT ("xlt","application/x-excel") + , _XLV("xlv", "application/excel") + // ,_XLV ("xlv","application/x-excel") + , _XLW("xlw", "application/excel") + // ,_XLW ("xlw","application/vndms-excel") + // ,_XLW ("xlw","application/x-excel") + // ,_XLW ("xlw","application/x-msexcel") + , _XM("xm", "audio/xm"), _XML("xml", "application/xml") + // ,_XML ("xml","text/xml") + , _XMZ("xmz", "xgl/movie"), _XPIX("xpix", "application/x-vndls-xpix") + // ,_XPM ("xpm","image/x-xpixmap") + , _XPM("xpm", "image/xpm"), _X_PNG("x-png", "image/png"), _XSR("xsr", "video/x-amt-showrun"), _XWD("xwd", "image/x-xwd") + // ,_XWD ("xwd","image/x-xwindowdump") + , _XYZ("xyz", "chemical/x-pdb"), _Z("z", "application/x-compress") + // ,_Z ("z","application/x-compressed") + // ,_ZIP ("zip","application/x-compressed") + // ,_ZIP ("zip","application/x-zip-compressed") + , _ZIP("zip", "application/zip") + // ,_ZIP ("zip","multipart/x-zip") + , _ZOO("zoo", "application/octet-stream"), _ZSH("zsh", "text/x-scriptzsh"); + + private String ext; + private String mimetype; + + private MimeType(String ext, String mimetype) { + this.ext = ext; + this.mimetype = mimetype; + } + + public String toString() { + return mimetype; + } + + public String getExt() { + return ext; + } + + public String getMimetype() { + return mimetype; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/BodyResponseException.java b/src/it/softecspa/fileproxy/services/common/core/BodyResponseException.java new file mode 100644 index 0000000..0704131 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/BodyResponseException.java @@ -0,0 +1,10 @@ +package it.softecspa.fileproxy.services.common.core; + +@SuppressWarnings("serial") +public class BodyResponseException extends Throwable { + + public BodyResponseException(Throwable e) { + super(e); + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/DelayedExecution.java b/src/it/softecspa/fileproxy/services/common/core/DelayedExecution.java new file mode 100644 index 0000000..0058757 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/DelayedExecution.java @@ -0,0 +1,89 @@ +package it.softecspa.fileproxy.services.common.core; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.apache.log4j.Logger; + +public abstract class DelayedExecution implements Runnable { + + protected Logger log = Logger.getLogger(getClass()); + protected int millisenconds; + private ScheduledExecutorService executor; + + + public boolean executeNow() { + this.millisenconds = 0; + if (log.isDebugEnabled()) log.debug("Launch deferred action soon as possible: "+getClass().getSimpleName()); + + try { + /* + * Evoluzione 2012-07-04 + * Lancio il complete in modo asincrono + * Questo mi assicura la chiusura della connessione dello stream della chiamata HTTP + */ + Thread thread = new Thread(this, getClass().getSimpleName()); + thread.start(); + return true; + } catch (Exception e) { + log.fatal("Error scheduling "+getClass().getSimpleName()+" thread; run now!",e); + // In caso di errore, eseguo il metodo direttamente enon come THREAD + this.run(); + return false; + } + } + + /** + * @param millisenconds + * @return + */ + public boolean executeWithDelay(int millisenconds) { + if (millisenconds<=0) return executeNow(); + + this.millisenconds = millisenconds; + if (log.isDebugEnabled()) log.debug("Launch deferred action (delay "+millisenconds+" millis): "+getClass().getSimpleName()); + try { + /* + * Evoluzione 2014-05-02 + * Lancio il complete in modo asincrono + * Questo mi assicura la chiusura della connessione dello stream della chiamata HTTP + * Faccio partire il thread con un ritardo + * http://stackoverflow.com/questions/19999231/how-to-start-a-thread-after-specified-time-delay-in-java + * http://stackoverflow.com/questions/3072173/how-to-call-a-method-after-a-delay + */ + executor = Executors.newSingleThreadScheduledExecutor(); + executor.schedule(this, millisenconds, TimeUnit.MILLISECONDS); + return true; + } catch (Exception e) { + log.fatal("Error scheduling "+getClass()+" thread; run now!",e); + // In caso di errore, eseguo il metodo direttamente enon come THREAD + this.run(); + return false; + } + } + + public abstract void core(); + + @Override + public void run() { + if (log.isDebugEnabled()) log.debug("Deferred action start after "+millisenconds+" millis: "+getClass().getSimpleName()); + + try { + core(); + } catch (Exception e) { + log.error("Unhandled exception in "+getClass(),e); + } catch (Error e) { + log.error("Unhandled error in "+getClass(),e); + } finally { + /* + * E' importante fare lo shutdown altrimenti rimane appeso il thread + */ + if (executor!=null) { + executor.shutdown(); + } + } + } + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/ModeRequest.java b/src/it/softecspa/fileproxy/services/common/core/ModeRequest.java new file mode 100644 index 0000000..e8bdaf3 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/ModeRequest.java @@ -0,0 +1,9 @@ +package it.softecspa.fileproxy.services.common.core; + +public enum ModeRequest { + + HEADER + , PARAMETER + , HEADER_OR_PARAMETER + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/ModeResponse.java b/src/it/softecspa/fileproxy/services/common/core/ModeResponse.java new file mode 100644 index 0000000..aa67c6f --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/ModeResponse.java @@ -0,0 +1,9 @@ +package it.softecspa.fileproxy.services.common.core; + +public enum ModeResponse { + + HEADER + //, XML_BODY TODO Da implementare ModeResponse.XML_BODY + //, JSON_BODY TODO Da implementare ModeResponse.JSON_BODY + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/MyHttpServletResponse.java b/src/it/softecspa/fileproxy/services/common/core/MyHttpServletResponse.java new file mode 100644 index 0000000..40102a0 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/MyHttpServletResponse.java @@ -0,0 +1,93 @@ +package it.softecspa.fileproxy.services.common.core; + +import it.softecspa.fileproxy.services.common.comunicator.http.HttpRemote; +import it.softecspa.fileproxy.services.common.core.response.Entry; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MyHttpServletResponse { + + private HttpServletRequest request; + private HttpServletResponse response; + private HttpRemote httpRemote; + + private Entry[] info; + private String statement_key; + private String statement; + + private Object input; + private Object output; + + private EnterpriseCalendar start; + + + public MyHttpServletResponse(HttpServletRequest request, HttpServletResponse response) { + this.request = request; + this.response = response; + this.httpRemote = new HttpRemote(request); + // + this.start = EnterpriseCalendar.now(); + } + + public HttpServletRequest getHttpServletRequest() { + return request; + } + + public HttpServletResponse getHttpServletResponse() { + return response; + } + + public HttpRemote getHttpRemote() { + return httpRemote; + } + + + + public Object getInput() { + return input; + } + + public void setInput(Object input) { + this.input = input; + } + + + public Object getOutput() { + return output; + } + + public void setOutput(Object output) { + this.output = output; + } + + public String getStatement() { + return statement; + } + + public void setStatement(String statement) { + this.statement = statement; + } + + String getStatementKey() { + return statement_key; + } + + void setStatementKey(String statement_key) { + this.statement_key = statement_key; + } + + EnterpriseCalendar getStart() { + return start; + } + + Entry[] getInfo() { + return info; + } + + public void setInfo(Entry[] info) { + this.info = info; + } + +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/services/common/core/MyReturn.java b/src/it/softecspa/fileproxy/services/common/core/MyReturn.java new file mode 100644 index 0000000..fba97be --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/MyReturn.java @@ -0,0 +1,114 @@ +package it.softecspa.fileproxy.services.common.core; + +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.ResponseResult; + +import javax.servlet.http.HttpServletResponse; + + +public class MyReturn { + + private String code; + private String message; + private ResponseResult result; + + private boolean trace; + private boolean positive; + + // Stato della risposta HTTP + private int httpStatus; + + /** + * Risposta recuperata da ResponseOutcome + * @param outcome + */ + public MyReturn(ResponseOutcome outcome, ResponseResult result) { + this(outcome.getReturnCode(), outcome.getMessage(), result, outcome.isOk(), outcome.isTraceLog()); + } + + + /** + * Risposta con esito postivo o negativo + * Taccio sicuramente le ripsote con esito negativo + * @param outcome + */ + public MyReturn(String code, String message, ResponseResult result, boolean positive, boolean trace) { + this.code = code; + this.message = message; + this.result = result; + this.positive = positive; + this.trace = trace; + this.httpStatus = HttpServletResponse.SC_OK; + } + + + + public boolean isPositive() { + return positive; + } + + public boolean isNegative() { + return !positive; + } + + void setPositive(boolean positive) { + this.positive = positive; + } + + + public String toString() { + return "["+code+"] - '"+message+"'"; + } + + + public boolean isTrace() { + return trace; + } + + void setTrace(boolean trace) { + this.trace = trace; + } + + public String getCode() { + return code; + } + + void setCode(String code) { + this.code = code; + } + + + public String getMessage() { + return message; + } + + void setMessage(String message) { + this.message = message; + } + + + public ResponseResult getResult() { + return result; + } + + void setResult(ResponseResult result) { + this.result = result; + } + + + public int getHttpStatus() { + return httpStatus; + } + + public void changeHttpStatus(int httpStatus) { + this.httpStatus = httpStatus; + } + + + + + + + + +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/services/common/core/UniversalManager.java b/src/it/softecspa/fileproxy/services/common/core/UniversalManager.java new file mode 100644 index 0000000..ea56d11 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/UniversalManager.java @@ -0,0 +1,944 @@ +package it.softecspa.fileproxy.services.common.core; + +import it.softecspa.PortalSettings; +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.database.dbconnect.SQLTimeoutException; +import it.softecspa.fileproxy.DatabaseBalancer; +import it.softecspa.fileproxy.services.ServerCacheFactory; +import it.softecspa.fileproxy.services.ServerCacheFactory.PropertiesKey; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.EnterpriseLog; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.RemoteCallException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.ResponseResult; +import it.softecspa.fileproxy.services.common.core.request.AddressableRequest; +import it.softecspa.fileproxy.services.common.core.request.AuthIsMandatory; +import it.softecspa.fileproxy.services.common.core.request.InputStreamReaderJSON; +import it.softecspa.fileproxy.services.common.core.request.InputStreamReaderXML; +import it.softecspa.fileproxy.services.common.core.request.JsonMapper; +import it.softecspa.fileproxy.services.common.core.request.UniversalAuthenticatedRequest; +import it.softecspa.fileproxy.services.common.core.request.UniversalRequest; +import it.softecspa.fileproxy.services.common.core.response.UniversalResponse; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlRoot; +import it.softecspa.sso.common.SsoException; + +import java.io.IOException; +import java.io.Serializable; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.rmi.RemoteException; +import java.sql.SQLException; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class UniversalManager > { + + protected static final int STANDARD_THREAD_DELAY = 2000; + protected Logger log = Logger.getLogger(this.getClass()); + + + // Reqest e resposne della chiamata + protected REQ request; + protected RES response; + protected S session; + + // Istanza della cache di sistema + protected ServerCacheFactory cacheInfo; + + // Gestione della lingua per la risposta + //protected ResourceBundle bundle; + protected String session_language; + protected ResourceBundle session_bundle; + + + // Balancer del database + private DatabaseBalancer balance; + + + // Connection manager da utilizzare "normalizzate" dalla chiamata (MASTER/STAGE) + protected ConnectionManager cmWritable; + protected ConnectionManager cmReadonly; + protected boolean stageMode; + + + + /** + * Metodo invocato prima di eseguire tutte le chiamate. + * La request non è stata ancora verificata e la response ha i valori di default + */ + protected abstract void initialize() throws ManagerException; + + + /** + * Crea e verifica la sessione + * @throws CheckerException + * @throws ManagerException} + */ + protected abstract S buildAndValidateSession(ServerCacheFactory cacheInfo, boolean stageMode) throws CheckerException, ManagerException; + + + /** + * Verifica la corenza dei parametri inseriti + * @throws CheckerException + */ + protected abstract void validateRequest() throws CheckerException, ManagerException; + + + /** + * Core del metodo + * @param request + * @param response + */ + protected abstract void doService(REQ request, RES response) throws ManagerException; + + + /** + * Metodo invocato al termine della sequenza, dopo che è stata valorizzata la response + * e solo se l'esito è positivo + * @param stage + * @throws ManagerException + */ + protected abstract void completeWithSuccess(boolean stage) throws ManagerException; + + + /** + * Crea la response in automatico a partire da {@link Type[]} della definizione della classe + * @return + */ + protected RES createResponse() { + if (log.isDebugEnabled()) log.debug("Auto generate response from class TypeArgument"); + /* + * http://stackoverflow.com/questions/75175/create-instance-of-generic-type-in-java + */ + try { + Type type = getClass().getGenericSuperclass(); + ParameterizedType paramType = (ParameterizedType) type; + @SuppressWarnings("unchecked") + Class clazz = (Class) paramType.getActualTypeArguments()[1]; + + if (log.isDebugEnabled()) log.debug("Create response: "+clazz); + RES instance = clazz.newInstance(); + return instance; + + } catch(Exception e) { + log.error("Error create response from TypeArgument",e); + return null; + } + } + + + /** + * Metodo pubblico di esecuzione + * @param request + * @return + */ + public RES process(REQ _request) { + if (log.isDebugEnabled()) log.debug("Calling '"+this.getClass().getSimpleName()+"' operation"); + balance = DatabaseBalancer.getInstance(); + cacheInfo = ServerCacheFactory.getInstance(); + + // ----------------------------------------------------------------------------------------- + // FASE 0 - Controlli formali + if (log.isDebugEnabled()) log.debug("Validate input/output parameters and values (phase 0)"); + // RESPONSE + this.response = createResponse(); + if (response==null) { + log.fatal("Not valid response, verify 'createResponse' method"); + return null; + } + // Imposto un valore di default per la response + new ResponseBuilder(response).setReturn(ResponseOutcome.RESPONSE_NOT_VALID); + // REQUEST + this.request = _request; + if (this.request==null) { + log.fatal("Null request is not valid"); + return new ResponseBuilder(response).setReturn(ResponseOutcome.REQUEST_NOT_VALID) + .decodeMessageErrorWithBundle(); + } + // -------------------------------------------------------------------------------------------- + + + try { + // ----------------------------------------------------------------------------------------- + // FASE 1 - Inizializzazione + if (log.isDebugEnabled()) log.debug("Inizialize manager (phase 1)"); + session_language = request.getLanguage(); + initialize(); + + // ----------------------------------------------------------------------------------------- + // FASE 2 e 3 - Controllo la validità dei parametri in ingresso e creazione sessione + + // Definizione dell'ambiente a partire dai dai di istanza + stageMode = identifyStageMode(); + validateStageMasterConnection(); + + // FASE 2a - Controllo sessione + if (log.isDebugEnabled()) log.debug("Build and validate private session (phase 2)"); + session = buildAndValidateSession(cacheInfo, stageMode); + if (session==null) { + return new ResponseBuilder(response).setReturn(ResponseOutcome.SESSION_NOT_VALID) + .decodeMessageErrorWithBundle(); + } + if (log.isDebugEnabled()) log.debug("Request from remote server, session created with success"); + if (session_language==null) session.getLanguage(); + + + // Controllo delle credenziali su SSO + if (request instanceof UniversalAuthenticatedRequest) { + if (log.isDebugEnabled()) { + log.debug("Authenticated request, automatic check of credential " + (this.request instanceof AuthIsMandatory?"MANDATORY":"optional")); + } + // Validazione delle credenziali + try { + session.validateCredential(); + /* + * Se queste sono errate o si verifica un errore in questa fase he restituito un HTTP 403 - FORBIDDEN + */ + } catch (CheckerException e) { + MyReturn myReturn = response.takeMyReturn(); + myReturn.changeHttpStatus(HttpServletResponse.SC_FORBIDDEN); + throw e; + } catch (ManagerException e) { + MyReturn myReturn = response.takeMyReturn(); + myReturn.changeHttpStatus(HttpServletResponse.SC_FORBIDDEN); + throw e; + } + } + + + // Controlli custom per ogni singola chiamata + if (log.isDebugEnabled()) log.debug("Validate Request (phase 3)"); + if (request==null) throw new CheckerException(ResponseOutcome.REQUEST_IS_NULL); + validateRequest(); + + } catch (CheckerException e) { + if (log.isDebugEnabled()) { + log.debug("CheckerException, message: "+e.getMessage() + (e.getResult()!=null?"; '"+e.getResult()+"'":"")); + } + checkAndTraceCheckerExceptionErrorIfExist(e); + + // Rispondo al client + return new ResponseBuilder(response).setReturn(e) + .decodeMessageErrorWithBundle(); + + } catch (ManagerException e) { + // CheckerException, nessun invio di mail + if ((e.getCause()!=null && e.getCause() instanceof CheckerException)) { + CheckerException ec = (CheckerException)e.getCause(); + if (log.isDebugEnabled()) { + log.debug("CheckerException, message: "+e.getMessage() + (ec.getResult()!=null?"; '"+ec.getResult()+"'":"")); + } + checkAndTraceCheckerExceptionErrorIfExist(ec); + + // Rispondo al client + return new ResponseBuilder(response).setReturn(ec) + .decodeMessageErrorWithBundle(); + } + + if (e.getCause()!=null) { + log.error("Manager exception checking fields: "+e.getCause().toString(),e); + } else { + log.error("Manager exception checking fields: "+e.toString(),e); + } + + // SQLTimeoutException, nessun invio di mail + if ((e.getCause()!=null && e.getCause() instanceof SQLTimeoutException)) { + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_TIMEOUT) + .decodeMessageErrorWithBundle(); + } + // SQLException, invio della mail + if ((e.getCause()!=null && e.getCause() instanceof SQLException)) { + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_EXCEPTION) + .sendEmailAlert(ResponseOutcome.SQL_EXCEPTION, e.getCause()) + .decodeMessageErrorWithBundle(); + } + // SsoException + if ((e.getCause()!=null && e.getCause() instanceof SsoException)) { + return new ResponseBuilder(response).setReturn(ResponseOutcome.SSO_GENERIC_ERROR) + .sendEmailAlert(ResponseOutcome.SSO_GENERIC_ERROR, e.getCause()) + .decodeMessageErrorWithBundle(); + } + + // ManagerException with cause + if (e.getCause()!=null) { + return new ResponseBuilder(response).setReturn(e).getResponse(); + } + + return new ResponseBuilder(response).setReturn(ResponseOutcome.MANAGER_EXCEPTION) + .decodeMessageErrorWithBundle(); + + } catch (Exception e) { + // SQLTimeoutException, nessun invio di mail + if (e instanceof SQLTimeoutException || + (e.getCause()!=null && e.getCause() instanceof SQLTimeoutException)) { + log.error("SQLTimeoutException checking fields (DB TIMEOUT)"); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_TIMEOUT) + .decodeMessageErrorWithBundle(); + } + // SQLException, invio della mail + if (e instanceof SQLException || + (e.getCause()!=null && e.getCause() instanceof SQLException)) { + log.error("SQLException checking fields",e); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_EXCEPTION) + .sendEmailAlert(ResponseOutcome.SQL_EXCEPTION, e.getCause()) + .decodeMessageErrorWithBundle(); + } + + // Eccezione non gestita e non identificata + log.error("Unhandled exception checking fields",e); + return new ResponseBuilder(response).setReturn(ResponseOutcome.UNHANDLED_EXCEPTION) + .sendEmailAlert(ResponseOutcome.UNHANDLED_EXCEPTION, e) + .decodeMessageErrorWithBundle(); + } + if (log.isDebugEnabled()) log.debug("Validation completed with success!"); + + + // ----------------------------------------------------------------------------------------- + // FASE 4 - Eseguo in core del servizio + if (log.isDebugEnabled()) log.debug("Processing the service (phase 4)"); + try { + doService(request, response); + } catch (ManagerException e) { + // SQLTimeoutException, nessun invio di mail + if ((e.getCause()!=null && e.getCause() instanceof SQLTimeoutException)) { + log.error("SQLTimeoutException processing operation (DB TIMEOUT)"); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_TIMEOUT) + .decodeMessageErrorWithBundle(); + } + // SQLException, invio della mail + if ((e.getCause()!=null && e.getCause() instanceof SQLException)) { + log.error("SQLException processing operation",e.getCause()); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_EXCEPTION) + .sendEmailAlert(ResponseOutcome.SQL_EXCEPTION, e.getCause()) + .decodeMessageErrorWithBundle(); + } + // CheckerException + if ((e.getCause()!=null && e.getCause() instanceof CheckerException)) { + // Stampo direttamente l'errore passato nel check, senza stackTrace + log.error(e.getCause().toString()); + checkAndTraceCheckerExceptionErrorIfExist((CheckerException)e.getCause()); + + // Rispondo al client + return new ResponseBuilder(response).setReturn((CheckerException)e.getCause()) + .decodeMessageErrorWithBundle(); + } + + log.error("ManagerException processing operation",e); + // RemoteException + if ((e.getCause()!=null && e.getCause() instanceof RemoteException)) { + return new ResponseBuilder(response).setReturn(ResponseOutcome.REMOTE_EXCEPTION) + .decodeMessageErrorWithBundle(); + } + // RemoteCallException + if ((e.getCause()!=null && e.getCause() instanceof RemoteCallException)) { + return new ResponseBuilder(response).setReturn((RemoteCallException)e.getCause()) + .decodeMessageErrorWithBundle(); + } + + // ManagerException with cause + if (e.getCause()!=null) { + return new ResponseBuilder(response).setReturn(e).getResponse(); + } + + return new ResponseBuilder(response).setReturn(ResponseOutcome.MANAGER_EXCEPTION) + .decodeMessageErrorWithBundle(); + + } catch (Exception e) { + // SQLTimeoutException, nessun invio di mail + if (e instanceof SQLTimeoutException || + (e.getCause()!=null && e.getCause() instanceof SQLTimeoutException)) { + log.error("SQLTimeoutException processing operation (DB TIMEOUT)"); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_TIMEOUT) + .decodeMessageErrorWithBundle(); + } + // SQLException, invio della mail + if (e instanceof SQLException || + (e.getCause()!=null && e.getCause() instanceof SQLException)) { + log.error("SQLException processing operation",e); + return new ResponseBuilder(response).setReturn(ResponseOutcome.SQL_EXCEPTION) + .decodeMessageErrorWithBundle(); + } + + // Eccezione non gestita e non identificata + log.error("Unhandled exception processing operation",e); + return new ResponseBuilder(response).setReturn(ResponseOutcome.UNHANDLED_EXCEPTION) + .sendEmailAlert(ResponseOutcome.UNHANDLED_EXCEPTION, e) + .decodeMessageErrorWithBundle(); + + } + if (log.isDebugEnabled()) log.debug("Process completed with success!"); + + + // ----------------------------------------------------------------------------------------- + // FASE 5 - Finito + new ActionCompleted(stageMode).executeWithDelay(STANDARD_THREAD_DELAY); + //new ActionCompleted(stageMode).executeNow(); + + + // ----------------------------------------------------------------------------------------- + // FASE 6 - Rispondo al chiamante + if (log.isDebugEnabled()) log.debug("Answer to client: ["+response.getReturnCode()+"] "+response.getReturnMessage()); + return new ResponseBuilder(response).decodeMessageErrorWithBundle(); + } + + + + /** + * Verifica ed eventualemente registra l'errore nella bel + * @param e + */ + protected abstract void checkAndTraceCheckerExceptionErrorIfExist(CheckerException e); + + /** + * Identifica la modalità di gestione piattaforma e la variabile stageMode + * @throws CheckerException + */ + protected boolean identifyStageMode() throws ManagerException, CheckerException { + if (request instanceof AddressableRequest) { + if (log.isDebugEnabled()) log.debug("Identify STAGE/MASTER using specific request attribute"); + if (((AddressableRequest)request).getStage()==null) { + if (log.isDebugEnabled()) log.debug("Addressable request do not specify master/stage, force STAGE"); + stageMode = true; + ((AddressableRequest)request).setStage(true); + } else { + stageMode = ((AddressableRequest)request).getStage(); + if (log.isDebugEnabled()) log.debug("Request forze use of "+(stageMode?"REALTIME":"PUBLICATION")+" mode"); + } + } else { + // Vado esclusivamente su STAGE + if (log.isDebugEnabled()) log.debug("Identify stage/master using default configuration, force STAGE"); + stageMode = true; + } + + return stageMode; + } + + /** + * Identifica l'ambiente e setta il ConnectionManager specifico + */ + private void validateStageMasterConnection() { + /* Vecchia modalità antecedente al protocollo 3, febbraio 2013 + stageMode = Boolean.TRUE.equals(request.getStage()); + */ + + if (stageMode) { + // uso STAGE + if (log.isDebugEnabled()) log.debug("Stage mode request, use only WRITABLE connection manager!"); + cmWritable = balance.getStage(); + cmReadonly = cmWritable; + } else { + if (balance.getMaster()==null) { + // Workaround di protezione da assenza database master + if (log.isDebugEnabled()) log.debug("Stage mode only, use only WRITABLE connection manager!"); + cmWritable = balance.getStage(); + cmReadonly = cmWritable; + } else { + // uso MASTER + cmWritable = balance.getMaster(); + cmReadonly = balance.getMasterReadOnly(); + } + } + } + + + /** + * Set + * @param sorgente + * @param variabile + * @param prefisso + * @return + * @throws CheckerException + */ + protected Object get(Object sorgente, String variabile, String prefisso) throws CheckerException { + String nome = prefisso+XString.toUpperCaseFirst(variabile); + if (log.isDebugEnabled()) log.debug("Acquire value using "+nome+"()"); + try { + Method method = sorgente.getClass().getMethod(nome); + return method.invoke(sorgente); + /* + } catch (IllegalArgumentException e) { + } catch (IllegalAccessException e) { + } catch (InvocationTargetException e) { + } catch (SecurityException e) { + } catch (NoSuchMethodException e) { + } catch (CloneNotSupportedException e) { + */ + } catch (Exception e) { + log.error("Error invoke instance of "+(sorgente!=null?sorgente.getClass().getSimpleName():"..."),e); + throw new CheckerException(ResponseOutcome.INVALID_METHOD_CHECKING,"'"+nome+"'"); + } + } + + + protected void checkRange(String variabile, Integer min, Integer max) throws CheckerException { + try { + Integer ret = (Integer) get(request, variabile, "get"); + + if ((min!=null && ret.intValue()max)) { + if (min==null && max!=null) throw new CheckerException(ResponseOutcome.FIELD_OUT_OF_RANGE, "'"+variabile+"' <= "+max); + if (min!=null && max==null) throw new CheckerException(ResponseOutcome.FIELD_OUT_OF_RANGE, "'"+variabile+"' >= "+min); + throw new CheckerException(ResponseOutcome.FIELD_OUT_OF_RANGE, "'"+variabile+"', range valid ("+min+":"+max+")"); + } + + } catch (ClassCastException e) { + throw new CheckerException(ResponseOutcome.FIELD_NOT_VALID, "'"+variabile+"'"); + } + } + + + @SuppressWarnings("unchecked") + protected K checkRequestIfNullSetDefault(String variabile, K nullValue) throws CheckerException { + K ret = (K) get(request, variabile, "get"); + if (ret==null) { + set(request, variabile, "set", nullValue); + return nullValue; + } + return ret; + } + + + /** + * Restituisce una eccezione in caso di mancata verifica del campo obbligatorio + * @param sorgente + * @param variabile + * @return + * @throws CheckerException + */ + protected void checkRequestMandatory(String variabile) throws CheckerException { + checkMandatory(request, variabile, "get"); + } + + protected void checkRequestMandatory(String variabile, String prefisso) throws CheckerException { + checkMandatory(request, variabile, prefisso); + } + + void checkMandatory(REQ sorgente, String variabile, String prefisso) throws CheckerException { + Object ret = get(sorgente, variabile, prefisso); + //if (log.isTraceEnabled()) log.trace("Checking mandatory: "+nome+"()"); + if (ret==null) { + throw new CheckerException(ResponseOutcome.FIELD_MANDATORY, "'"+variabile+"'"); + } else if (ret instanceof String) { + if (XString.isBlankNullTrim((String)ret)) { + throw new CheckerException(ResponseOutcome.FIELD_EMPTY, "'"+variabile+"'"); + } + } + } + + + + + + + /** + * Valorizza il metodo "set" del bean relativo alla request + * @param + * @param sorgente + * @param variabile + * @param prefisso + * @param value + * @throws CheckerException + */ + private void set(REQ sorgente, String variabile, String prefisso, K value) throws CheckerException { + if (value==null) return; + + String nome = prefisso+XString.toUpperCaseFirst(variabile); + Class clazz = value.getClass(); + if (log.isTraceEnabled()) log.trace("Set default value using "+nome+"("+clazz.getSimpleName()+" value)"); + try { + Method method = request.getClass().getMethod(nome, clazz); + method.invoke(request, value); + /* + } catch (IllegalArgumentException e) { + } catch (IllegalAccessException e) { + } catch (InvocationTargetException e) { + } catch (SecurityException e) { + } catch (NoSuchMethodException e) { + } catch (CloneNotSupportedException e) { + */ + } catch (Exception e) { + log.error("Error invoke method "+nome+"("+clazz.getSimpleName()+" value) of "+(sorgente!=null?sorgente.getClass().getSimpleName():"..."),e); + throw new CheckerException(ResponseOutcome.INVALID_METHOD_CHECKING,"'"+nome+"'"); + } + } + + + protected ResourceBundle getResourceBundle() { + // Inizializza il bundle per la lingua passata a parametro + inizializeBundle(session_language); + return session_bundle; + } + + private void inizializeBundle(String language) { + if (session_bundle!=null) return; + Locale.setDefault(Locale.ENGLISH); + + if (language!=null) { + language = language.toLowerCase(); + + try { + Locale locale = new Locale(language); + if (log.isDebugEnabled()) { + log.debug("Locale: "+locale); + } + + // ----------------------------------------------------------------------------- + try { + // Controllo eventuali dizionari da escludere (in test) + String exclusion = cacheInfo.getDbProperties().get(PropertiesKey.LANGUAGE_DISABLE_LIST.toString(),"ZZ").toLowerCase(); + if (exclusion.indexOf(language)>=0) { + log.warn("Dictionary exclusion: "+locale); + locale = Locale.ENGLISH; + } + } catch (Exception e) { + log.warn("Error in check disable language list:" +e.toString()); + } + // ----------------------------------------------------------------------------- + + session_bundle = ResourceBundle.getBundle(ResponseOutcome.BUNDLE_NAME, locale); + return; + } catch (Exception e) { + log.warn("Error loading resource bundle for language '"+language+"'", e); + } + } + + // ...riprovo in inglese + try { + session_bundle = ResourceBundle.getBundle(ResponseOutcome.BUNDLE_NAME, Locale.ENGLISH); + return; + } catch (Exception e) { + log.warn("Error loading default english (en) resource bundle", e); + } + } + + + public boolean isStageMode() { + return stageMode; + } + + public DatabaseBalancer getDatabaseBalancer() { + return balance; + } + + + + + /** + * Costruttore della risposta al client + */ + public class ResponseBuilder { + + private RES response; + private String detailReturnMessage; + + + public ResponseBuilder(RES response) { + this.response = response; + } + + /** + * Setup di un result custom + * @param result valore di {@link ResponseResult} + * @return + */ + public ResponseBuilder setupResult(ResponseResult result) { + return setReturn(null, null, result); + } + + /** + * Rispondo con un messaggio codificato nelle {@link ResponseOutcome} + * @param outcome + * @return + */ + public ResponseBuilder setReturn(ResponseOutcome outcome) { + return setReturn(outcome,null); + } + + + /** + * Rispondo con un messaggio codificato nelle {@link ResponseOutcome}, valorizzando anche il {@link ResponseResult} + * @param outcome + * @param result + * @return + */ + public ResponseBuilder setReturn(ResponseOutcome outcome, ResponseResult result) { + return setReturn(outcome.getReturnCode(), outcome.getMessage(), result, outcome.isOk(), outcome.isTraceLog()); + } + + /** + * Risposta non codificata, recuperata dall'esterno + * @param code + * @param message + * @param result + * @return + */ + public ResponseBuilder setReturn(String code, String message, ResponseResult result) { + boolean positive = ResponseOutcome.checkOK(code); + return setReturn(code, message, result, positive, !positive); + } + + /** + * Setup della risposta + * @param code + * @param message + * @param result + * @param positive + * @param trace + * @return + */ + private ResponseBuilder setReturn(String code, String message, ResponseResult result, boolean positive, boolean trace) { + if (response.takeMyReturn()!=null) { + // Aggiorno un record precedente + MyReturn myreturn = response.takeMyReturn(); + // ...imposto solo !=null, quindi se cambia + if (code!=null) myreturn.setCode(code); + if (message!=null) myreturn.setMessage(message); + if (result!=null) myreturn.setResult(result); + // + myreturn.setPositive(positive); + myreturn.setTrace(trace); + } else { + response.setReturn(new MyReturn(code, message, result, positive, trace)); + } + + return this; + } + + /** + * Rispondo con una {@link CheckerException} + * @param exception + * @return + */ + protected ResponseBuilder setReturn(CheckerException exception) { + // ...server per la successiva internazionalizzazione + this.detailReturnMessage = exception.getSupplementaryMessage(); + return setReturn(exception.getId(), exception.getStandardMessage(), exception.getResult(), false, exception.isTraceLog()); + } + + /** + * Rispondo con una {@link RemoteCallException} + * @param exception + * @return + */ + protected ResponseBuilder setReturn(RemoteCallException exception) { + return setReturn(exception.getId(), exception.getMessage(), null, false, true); + } + + /** + * Rispondo con un {@link ManagerException} + * @param exception + * @return + */ + protected ResponseBuilder setReturn(ManagerException exception) { + // ...server per la successiva internazionalizzazione + this.detailReturnMessage = exception.getCause().toString(); + return setReturn(ResponseOutcome.MANAGER_EXCEPTION, ResponseResult.ERROR); + } + + + + /** + * Invia una mail al gestore del servizio per segnalare specifici errori + * @param outcome + * @param cause + */ + public ResponseBuilder sendEmailAlert(ResponseOutcome outcome, Throwable cause) { + EnterpriseLog elog = new EnterpriseLog(outcome.getFullMessage(), cause); + if (ResponseOutcome.SQL_EXCEPTION.equals(outcome)) { + elog.sendEmail(PortalSettings.MAIL_SQL_ERROR_ENABLE, outcome.getMessage()); + } else { + elog.sendEmail(PortalSettings.MAIL_ERROR_ENABLE, outcome.getMessage()); + } + return this; + } + + /** + * Decodifica il messaggio di errore passato nella response secondo la lingua passata a parametro + * @param response + * @return + */ + private RES decodeMessageErrorWithBundle() { + if (response==null) return null; + ResourceBundle bundle = getResourceBundle(); + + try { + String text = bundle.getString(response.getReturnCode()); + response.takeMyReturn().setMessage(text); + } catch (Exception e) { + if (bundle!=null) { + if (!bundle.getLocale().equals(Locale.ENGLISH)) { + log.warn("Entry '"+response.getReturnCode()+"' not found in bundle file for language '"+bundle.getLocale().getLanguage()+"'"); + } + } else { + log.error("Not found any buondle file to decode entry '"+response.getReturnCode()+"'"); + } + } + + if (this.detailReturnMessage!=null) { + // Aggiungo il messaggio dettagliato + response.takeMyReturn().setMessage(response.getReturnMessage() + " ["+this.detailReturnMessage+"]"); + } + + return response; + } + + + /** + * Restituisce un puntamento alla RESPONSE + * @return + */ + public RES getResponse() { + return response; + } + } + + + protected REQ getRequest() { + return request; + } + + protected RES getResponse() { + return response; + } + + protected S getSession() { + return session; + } + + + /** + * Esegue il parsing del tracciato Json valorizzando l'opportuna classe + * @param json + * @param clazz + * @return + * @throws ManagerException + */ + protected K parseJson(String json, Class clazz) throws ManagerException { + try { + return new ObjectMapper().readValue(json, clazz); + } catch (JsonParseException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonParseException: " +clazz.getName())); + } catch (JsonMappingException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonMappingException: "+clazz.getName())); + } catch (IOException e) { + throw new ManagerException("IOException parsing json to class "+clazz.getName(),e); + } + } + + @SuppressWarnings("unchecked") + protected J parseJSONInputStream(Class clazz) throws ManagerException { + if (request instanceof InputStreamReaderJSON) { + if (clazz==null) return null; + InputStreamReaderJSON reqJSON = (InputStreamReaderJSON)request; + try { + @SuppressWarnings("rawtypes") + JsonMapper jmapper = new JsonMapper(); + reqJSON.bufferizeInputDocument(jmapper); + return (J) jmapper.readValue(reqJSON.takeInputStream(), clazz); + + } catch (JsonParseException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonParseException: " +clazz.getName())); + } catch (JsonMappingException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonMappingException: "+clazz.getName()+":"+e)); + } catch (IOException e) { + throw new ManagerException("IOException parsing json to class "+clazz.getName(),e); + } + } else { + log.warn("Not valid request: not extends "+InputStreamReaderJSON.class.getName()); + } + + return null; + + } + + @SuppressWarnings("unchecked") + protected X parseXMLInputStream(X root) throws ManagerException, CheckerException { + if (request instanceof InputStreamReaderXML) { + if (root==null) return null; + InputStreamReaderXML reqXML = (InputStreamReaderXML)request; + + if (log.isDebugEnabled()) log.debug("Analyze XML document in request input stream"); + try { + boolean read = root.parseXML(reqXML.takeInputStream()); + reqXML.bufferizeInputDocument(root); + if (!read) { + throw new CheckerException(ResponseOutcome.INPUT_FORWARD_XML_NULL); + } + if (log.isDebugEnabled()) { + String xml = root.extractInputXML(); + if (xml!=null) log.debug("Request XML input stream >>\n"+ + "-[ XML ]------------------------------------------------------------->>\n"+ + xml + + "--------------------------------------------------------------------->>"); + } + } catch (XmlParserException e) { + reqXML.bufferizeInputDocument(root); + if (e.isGrave()) { + throw new ManagerException(e); + } else { + throw new CheckerException(ResponseOutcome.MALFORMD_XML_DOCUMENT,e.getMessage()); + } + } + if (log.isDebugEnabled()) log.debug("Parsing of XML document completed; generated class "+root.getClass().getSimpleName()); + } else { + log.warn("Not valid request: not extends "+InputStreamReaderXML.class.getName()); + } + + return root; + } + + + /** + * Classe private per il lancio asincrono del metodo complete + * Evoluzione 2012-07-04 + * Lancio il complete in modo asincrono + * Questo mi assicura la chiusura della connessione dello stream della chiamta HTTP + * + * @author m.veroni + * + */ + private class ActionCompleted extends DelayedExecution { + + private boolean stage; + + private ActionCompleted (boolean stage) { + this.stage = stage; + } + + @Override + public void core() { + if (log.isDebugEnabled()) log.debug("Launch deferred asynchronous action after completed with success (phase 5)"); + try { + completeWithSuccess(stage); + } catch (ManagerException e) { + log.error("Manager exception in complete method",e); + // ...non blocco il flusso + // Invio una mail al gestore del servizio + new ResponseBuilder(null).sendEmailAlert(ResponseOutcome.UNHANDLED_EXCEPTION, e); + // -------------------------------------- + } catch (Exception e) { + log.error("Unhandled exception in complete method",e); + // ...non blocco il flusso + // Invio una mail al gestore del servizio + new ResponseBuilder(null).sendEmailAlert(ResponseOutcome.UNHANDLED_EXCEPTION, e); + // -------------------------------------- + } + + } + + } + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/UniversalSession.java b/src/it/softecspa/fileproxy/services/common/core/UniversalSession.java new file mode 100644 index 0000000..e43be37 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/UniversalSession.java @@ -0,0 +1,172 @@ +package it.softecspa.fileproxy.services.common.core; + +import it.softecspa.database.dbconnect.ConnectionManager; +import it.softecspa.fileproxy.services.ServerCacheFactory; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.core.request.AuthIsMandatory; +import it.softecspa.fileproxy.services.common.core.request.Protocollo; +import it.softecspa.fileproxy.services.common.core.request.UniversalAuthenticatedRequest; +import it.softecspa.fileproxy.services.common.core.request.UniversalRequest; +import it.softecspa.portal.DMSsoClientSettings; +import it.softecspa.portal.DMSsoProxedSettings; +import it.softecspa.sso.client.HttpSsoController; +import it.softecspa.sso.common.SsoErrorOutcome; +import it.softecspa.sso.common.SsoException; +import it.softecspa.sso.common.TokenInfo; +import it.softecspa.sso.proxy.Authorization; +import it.softecspa.sso.proxy.ProxySsoStub; + +import java.io.IOException; +import java.sql.SQLException; + +import org.apache.log4j.Logger; + +public abstract class UniversalSession { + + + protected Logger log = Logger.getLogger(this.getClass()); + protected ConnectionManager cmReadonly; + + protected ServerCacheFactory cacheInfo; + protected boolean stageMode; + protected String language; + protected Protocollo protocolVersion; + + // Variabile di appoggio per la request + protected I request; + + + public UniversalSession(ServerCacheFactory cache, I request, boolean stage, ConnectionManager cmReadonly) { + this.cacheInfo = cache; + this.stageMode = stage; + preset(request); + // + this.cmReadonly = cmReadonly; + } + + private void preset(I request) { + this.request = request; + + // Bufferizzo la request per chiamate successive + this.language = request.getLanguage(); + + // Setup del default del protocollo + if (request.getProtocolVersion()==null) { + request.setProtocolVersion(Protocollo._1); + } + + protocolVersion = request.getProtocolVersion(); + if (log.isDebugEnabled()) log.debug("Request/response required with protocol version "+protocolVersion); + + } + + public abstract void validate() throws CheckerException, SQLException; + + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + + public ServerCacheFactory getCacheInfo() { + return cacheInfo; + } + + + public boolean isStageMode() { + return stageMode; + } + + + /** + * Restituisce la versione del protocollo della chiamta in corso + * @param protocolVersion + */ + public Protocollo getProtocolVersion() { + return protocolVersion; + } + + + + /** + * Verifica le credenziali immesse nella chiamata + * @param request + * @throws CheckerException + * @throws ManagerException + */ + public void validateCredential() throws CheckerException, ManagerException { + if (!(this.request instanceof UniversalAuthenticatedRequest)) return; + UniversalAuthenticatedRequest request = (UniversalAuthenticatedRequest)this.request; + boolean mandatory = (this.request instanceof AuthIsMandatory); + + if (mandatory) { + if (request.getUsername()!=null) { + if (request.getPassword()==null) + throw new CheckerException(ResponseOutcome.PASSWORD_MANDATORY); + } else if (request.getAccessToken()==null) { + throw new CheckerException(ResponseOutcome.ACCESS_TOKEN_USERNAME_MANDATORY); + } + } + + if (request.getAccessToken()!=null) { + HttpSsoController controller = null; + try { + controller = new HttpSsoController(DMSsoClientSettings.getInstance().getSettings()); + if (request.getOrganization()!=null) { + // Preimposto l'organizzazione di default + if (log.isDebugEnabled()) log.debug("Found 'organization' parameter in request call with value '"+request.getOrganization()+"'"); + controller.presetOrganization(request.getOrganization()); + } + } catch (IOException e) { + throw new ManagerException(e); + } catch (SsoException e) { + throw new ManagerException(e); + } + + + try { + TokenInfo tokenInfo = controller.getSsoStub().acquireTokenInfo(request.getAccessToken()); + request.setUsername(tokenInfo.getName()); + if (tokenInfo.getAttributes()!=null) { + request.setOrganization(tokenInfo.getAttributes().get("organization")); + } + } catch (SsoException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.SSO_GET_TOKEN_INFO_ERROR, e.getLocalizedMessage())); + } + + } else if (request.getUsername()!=null) { + ProxySsoStub proxy = null; + try { + proxy = new ProxySsoStub(DMSsoProxedSettings.getInstance().getSettings()); + } catch (IOException e) { + throw new ManagerException(e); + } catch (SsoException e) { + throw new ManagerException(e); + } + + try { + if (request.getOrganization()!=null) { + if (log.isDebugEnabled()) log.debug("Found 'organization' parameter in request call with value '"+request.getOrganization()+"'"); + } + Authorization auth = proxy.login(request.getOrganization(), request.getUsername(), request.getPassword()); + if (!auth.isLogged()) { + if (auth.getStatusCode().equals(SsoErrorOutcome.WRONG_CREDENTIAL.getReturnCode())) { + throw new ManagerException(new CheckerException(ResponseOutcome.SSO_WRONG_CREDENTIAL)); + } + throw new ManagerException(new CheckerException(ResponseOutcome.SSO_LOGIN_ERROR, auth.getStatusMessage())); + } + request.setAccessToken(auth.getToken().getValue()); + + } catch (SsoException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.SSO_LOGIN_ERROR, e.getLocalizedMessage())); + } + } + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/UniversalStatementHttpServlet.java b/src/it/softecspa/fileproxy/services/common/core/UniversalStatementHttpServlet.java new file mode 100644 index 0000000..c5eb36d --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/UniversalStatementHttpServlet.java @@ -0,0 +1,990 @@ +package it.softecspa.fileproxy.services.common.core; + + +import it.softecspa.fileproxy.services.ClusterSynchronizer; +import it.softecspa.fileproxy.services.HttpClazzTransformer; +import it.softecspa.fileproxy.services.HttpClazzTransformer.HttpRequestSource; +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.ResponseResult; +import it.softecspa.fileproxy.services.common.TraceableWithIdException; +import it.softecspa.fileproxy.services.common.UniversalStatementException; +import it.softecspa.fileproxy.services.common.comunicator.http.HttpRemote; +import it.softecspa.fileproxy.services.common.core.request.InputStreamReaderJSON; +import it.softecspa.fileproxy.services.common.core.request.InputStreamReaderXML; +import it.softecspa.fileproxy.services.common.core.request.JsonMapper; +import it.softecspa.fileproxy.services.common.core.request.MultipartFormDataRequestReader; +import it.softecspa.fileproxy.services.common.core.request.OutputPrintWriter; +import it.softecspa.fileproxy.services.common.core.request.OutputStreamWriter; +import it.softecspa.fileproxy.services.common.core.request.RemoteHostRequestInfo; +import it.softecspa.fileproxy.services.common.core.request.TrackRequestInfo; +import it.softecspa.fileproxy.services.common.core.request.UniversalRequest; +import it.softecspa.fileproxy.services.common.core.response.AbstractDummyResponse; +import it.softecspa.fileproxy.services.common.core.response.Entry; +import it.softecspa.fileproxy.services.common.core.response.UniversalResponse; +import it.softecspa.fileproxy.services.common.core.response.body.BodyNull; +import it.softecspa.fileproxy.services.common.core.response.body.ErrorBody; +import it.softecspa.fileproxy.services.common.core.response.body.MyBody; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.log.Ticket; +import it.softecspa.kahuna.util.Security; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; +import it.softecspa.kahuna.util.xml.XmlRoot; +import it.softecspa.portal.ApplicationClusterInfo; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.List; +import java.util.zip.GZIPInputStream; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import javazoom.upload.MultipartFormDataRequest; +import javazoom.upload.UploadException; + +import org.apache.log4j.Logger; + +@SuppressWarnings("serial") +public abstract class UniversalStatementHttpServlet extends HttpServlet { + + /** + * Classe privata che contiene la configurazione della servlet + * @author m.veroni + */ + private class Configuration { + + // Modalità di acquisizione paramatri in ingresso + ModeRequest config_requestMode; + + // Modalità di risposta al chiamante + ModeResponse config_responseMode; + + // Struttura body di risposta + ErrorBody config_errorBody; + + // Prefisso da utilizzare per il nome delle variabili nell'header http + String config_headerPrefix; + // Flag che indica l'utilizzo della variabile di header "RESULT" + boolean config_useResult; + + + public String getMethodNamePrefix() { + return config_headerPrefix; + } + + public boolean isUseResult() { + return config_useResult; + } + + public ModeRequest getRequestMode() { + return config_requestMode; + } + + public ModeResponse getResponseMode() { + return config_responseMode; + } + + public ErrorBody getErrorBody() { + return config_errorBody; + } + + } + + + /** + * Classe pubblica che consente la modifica della configurazione della servler + * @author m.veroni + */ + public class Configurable extends Configuration { + + public void setHeaderPrefix(String value) { + if (value==null) value = ""; + super.config_headerPrefix = value.trim(); + } + + public void setUseResult(boolean value) { + super.config_useResult = value; + } + + private String formatHeader(HeaderKey value) { + return config_headerPrefix + value.toString(); + } + + + public void setRequestMode(ModeRequest mode) { + super.config_requestMode = mode; + } + + public void setResponseMode(ModeResponse mode) { + super.config_responseMode = mode; + } + + public void setErrorBody(ErrorBody errorBody) { + super.config_errorBody = errorBody; + + } + + + public String toString() { + return "{" + "'"+config_headerPrefix+"'" + + "," + config_useResult + + "," + config_requestMode.name() + + "," + config_responseMode.name() + + "," + (config_errorBody!=null?config_errorBody.getClass().getSimpleName():null) + + "}"; + } + + + + } + + private Configurable myConfig; + private HttpClazzTransformer clazzT; + private ApplicationClusterInfo clusterInfo; + + + private enum HeaderKey { + + STATEMENT ("statement") + /* + // Trasmissione attachment + , CONTENT_LENGTH("Content-Length") + , ATTACH_LENGTH("Attach-Length") + */ + + , HEADER_ENCODING ("header-encoding") + + /* Risposta */ + , RESULT ("result") + , RETURN_CODE ("returnCode") + , RETURN_MESSAGE ("returnMessage") + , JARVIS ("jarvis") + ; + + + private HeaderKey() {} + + private HeaderKey(String value) { + this(); + this.value = value; + } + + private String value; + + public String toString() { + return (value!=null?value:super.toString()); + } + + @SuppressWarnings("unused") + public String getValue() { + return toString(); + } + + } + + public class DummyResponse extends AbstractDummyResponse { + + public DummyResponse(ResponseOutcome outcome) { + super(outcome); + } + + } + + + protected Logger log = Logger.getLogger(getClass()); + private Logger statementLog = Logger.getLogger("it.softecspa.appbike.STATEMENT"); + + + + /** + * Metodo invocato in fase di costruzione della servlet + */ + public void init(ServletConfig config) throws ServletException { + super.init(config); + + log.info("Starting servlet "+getClass().getName()); + // Configurazione dei parametri dei default della servlet + myConfig = new Configurable(); + // + myConfig.setHeaderPrefix("X-"); + myConfig.setUseResult(false); + myConfig.setRequestMode(ModeRequest.HEADER); + myConfig.setResponseMode(ModeResponse.HEADER); + // + configure(myConfig); + log.info("Servlet configuration complete: "+myConfig); + // + afterStart(myConfig, config); + + + // Configurazione e istanza del clazz transformer + if (myConfig.getRequestMode().equals(ModeRequest.PARAMETER)) { + clazzT = new HttpClazzTransformer(HttpRequestSource.HTTP_PARAMETER, myConfig.getMethodNamePrefix()); + } else if (myConfig.getRequestMode().equals(ModeRequest.HEADER)) { + clazzT = new HttpClazzTransformer(HttpRequestSource.HTTP_HEADER, myConfig.getMethodNamePrefix()); + } else /*if (myConfig.getRequestMode().equals(ModeRequest.MIXED))*/ { + // default + clazzT = new HttpClazzTransformer(HttpRequestSource.HTTP_HEADER_PARAMETER, myConfig.getMethodNamePrefix()); + } + + // Recupero l'istanza delle informazioni del cluster + clusterInfo = ApplicationClusterInfo.getInstance(); + } + + + /** + * Configurazione della servlet + * Sono da variare i parametri del bean di configurazione + * @param config + */ + protected abstract void configure(Configurable myConfig); + + + /** + * Attività da aeseguire all'init della servlet + * @param myConfig + * @param config + */ + protected abstract void afterStart(Configurable myConfig, ServletConfig config); + + + /** + * Attività da eseguire alla chiusura della servlet, prima del destroy + */ + protected abstract void beforeDestroy(); + + + /** + * Metodo invocato in fase di distruzione della servlet + */ + public void destroy() { + beforeDestroy(); + // + log.info("Stopping servlet "+getClass().getName()); + super.destroy(); + } + + + /** + * Chiamata in modalità GET + */ + protected abstract void doGet(HttpServletRequest request, HttpServletResponse response); + + /** + * Chiamata in modalità POST + */ + protected abstract void doPost(HttpServletRequest request, HttpServletResponse response); + + /** + * Chiamata in modalità OPTION + */ + protected void doOptions(HttpServletRequest request, HttpServletResponse response) { + response.setHeader("Allow", "GET, POST, OPTIONS"); + } + + + /** + * Restituisce una risposta di default + * @param request + * @param response + * @param outcome + */ + protected void doDummy(HttpServletRequest request, HttpServletResponse response, ResponseOutcome outcome) { + responseReturn(new MyHttpServletResponse(request, response), new MyReturn(outcome, null), new DummyResponse(outcome)); + } + + + /** + * Esecuzione dello statement richiesto + * @param request + * @param response + */ + @SuppressWarnings("unchecked") + protected void doStatement(HttpServletRequest request, HttpServletResponse response) { + // Classe di appoggio per la gestione della response + MyHttpServletResponse myResponse = new MyHttpServletResponse(request, response); + + + // Verifico la validità della operazione cercando un metodo con lo stesso nome + try { + if (log.isDebugEnabled()) log.debug("Analyze operation statement"); + myResponse.setStatementKey(XString.toLowerCaseFirst(checkOperation(request))); + } catch (UniversalStatementException e) { + // Se non trovo uno statement restituisco un ERRORE + responseError(myResponse, e); + return; + } + + + try { + // Estrazione info sul device remoto + HttpRemote remote = myResponse.getHttpRemote(); + if (log.isDebugEnabled()) log.debug("Remote call from "+remote.getTraceHost()); + + if (log.isDebugEnabled()) log.debug("Operation required: '"+myResponse.getStatementKey()+"'"); + // Se trovo un "-" devo mettere a maiuscolo la lettera seguente + int pos; + String statement = new String(myResponse.getStatementKey()!=null?myResponse.getStatementKey():""); + while ((pos = statement.indexOf("-"))>=0) { + statement = statement.substring(0,pos)+XString.toUpperCaseFirst(statement.substring(pos+1)); + } + myResponse.setStatement(statement); + + + // Derivo REQ e RES del metodo dal nome del comando + // e ne verifico l'esistenza + if (log.isDebugEnabled()) log.debug("Statement class implementation is '"+getClass()+"'"); + @SuppressWarnings("rawtypes") + Class statementRequestClazz = HttpClazzTransformer.forName(getClass(), statement, "request"); + @SuppressWarnings("rawtypes") + Class statementResponseClazz = HttpClazzTransformer.forName(getClass(), statement, "response"); + + + Class[] parameterTypes = new Class[1]; + parameterTypes[0] = statementRequestClazz; + + // Verifico l'esistenza di un metodo corrispondente alla operazione + Method method = null; + try { + method = this.getClass().getMethod(statement, parameterTypes); + } catch (SecurityException e) { + log.error("SecurityException",e); + throw new UniversalStatementException(ResponseOutcome.PS_SECURITY_EXCEPTION); + } catch (NoSuchMethodException e) { + log.error("NoSuchMethodException",e); + throw new UniversalStatementException(ResponseOutcome.PS_NO_SUCH_METHOD); + } + + // Valorizzazione della classe di input + Object[] parameterArgs = new Object[1]; + parameterArgs[0] = clazzT.newInstance(statementRequestClazz, request, true); + + // Stampo i parametri di chiamata + myResponse.setInput(parameterArgs[0]); + if (log.isDebugEnabled()) log.debug(requestInfo(myResponse, null)); + + // Valorizza i metodi delle interfacce custom + customizeRequestInterface(myResponse, parameterArgs[0]); + + + // Invoke della operazione nel manager + // ------------------------------------------------------------------------------------------ + Object output = null; + try { + if (log.isDebugEnabled()) log.debug("Invoke operation method"); + output = method.invoke(this, parameterArgs); + myResponse.setOutput(output); + } catch (IllegalArgumentException e) { + log.error("IllegalArgumentException",e); + responseError(myResponse, ResponseOutcome.PS_SECURITY_EXCEPTION); + return; + } catch (IllegalAccessException e) { + log.error("IllegalAccessException",e); + responseError(myResponse, ResponseOutcome.PS_SECURITY_EXCEPTION); + return; + } catch (InvocationTargetException e) { + log.error("InvocationTargetException",e); + responseError(myResponse, ResponseOutcome.PS_SECURITY_EXCEPTION); + return; + } + // ------------------------------------------------------------------------------------------ + + if (output==null) { + responseError(myResponse, ResponseOutcome.PS_NULL_RESPONSE); + return; + } + + + if (log.isTraceEnabled()) { + log.trace("Expected response class is "+statementResponseClazz.getName()); + log.trace(" Output response class is "+output.getClass().getName()); + } + + if (!output.getClass().getName().equals(statementResponseClazz.getName())) { + responseError(myResponse, new CheckerException(ResponseOutcome.PS_RESPONSE_NOT_MATCH, "return "+output.getClass()+", required "+statementResponseClazz.getName())); + return; + } + + + // Esito postitivo + if (log.isDebugEnabled()) log.debug("Create response for class "+statementResponseClazz); + URES res = (URES)output; + if (myConfig.isUseResult()) { + // Valorizzazione automatica del valore "result" in caso di assenza + if (res.takeMyReturn()!=null && res.takeMyReturn().getResult()==null) { + if (ResponseOutcome.checkOK(res.getReturnCode())) { + res.takeMyReturn().setResult(ResponseResult.OK); + } else { + res.takeMyReturn().setResult(ResponseResult.ERROR); + } + if (log.isDebugEnabled()) log.warn("Automatic result value development: "+res.takeMyReturn().getResult()); + } + } + + MyReturn myReturn = res.takeMyReturn(); + if (myReturn==null) { + log.error(MyReturn.class+" null!"); + myReturn = new MyReturn(ResponseOutcome.INTERNAL_SERVER_ERROR, ResponseResult.ERROR); + res.setReturn(myReturn); + } + + + // Imposto il valore del trace in funzione della configurazione + if (!log.isDebugEnabled() && + !myReturn.isNegative() && + myResponse.getInput() instanceof TrackRequestInfo) { + myReturn.setTrace(((TrackRequestInfo)parameterArgs[0]).isTrackRequestInfo()); + } + + /* FIXME aggiungere codice custom per stampare info aggiuntive nel log + // Aggiunta di informazioni accessorie recuperate dalla request + if (myResponse.getInput() instanceof GlobalDeviceRequestHeader) { + // Stampo le info recuperate delle chiamata + GlobalDeviceRequestHeader input = (GlobalDeviceRequestHeader)myResponse.getInput(); + if (input!=null) { + myResponse.setInfo(new Entry[] { new Entry("client", input.getClientId()) + , new Entry("tech", input.getTechnology()) + , new Entry("group", input.getGroupCode()) + , new Entry("instance", input.getInstanceCode()) + , new Entry("protocol", (input.getProtocolVersion()!=null?input.getProtocolVersion():Protocollo._1).toString()) + , new Entry("lang", input.getLanguage()) + }); + } + } + */ + // ---- + responseReturn(myResponse, myReturn, res); + + } catch (UniversalStatementException e) { + responseError(myResponse, e); + return; + } + + } + + + + private void customizeRequestInterface(MyHttpServletResponse myresponse, Object input) { + HttpServletRequest request = myresponse.getHttpServletRequest(); + HttpServletResponse response = myresponse.getHttpServletResponse(); + + /* + * In alcuni casi ho necessità di leggere l'input stream + * Posso farlo solo se la request type del manager implementa InputStreamReader + * + * ...lo passo all'oggetto request type del manager + */ + if (input instanceof InputStreamReaderXML || input instanceof InputStreamReaderJSON) { + if (log.isDebugEnabled()) log.debug("Put servlet input stream in "+input.getClass()); + try { + InputStream instream = null ; + + // Gestione della compressione dello InputStream (GZIP) + // m.veroni, 2012-10-08 introdotto per compatibilità + String contentEncoding = request.getHeader("Content-Encoding"); + if ("gzip".equalsIgnoreCase(contentEncoding)) { + if (log.isDebugEnabled()) log.debug("Compressed input stream: gzip"); + instream = new GZIPInputStream(request.getInputStream()); + } else { + instream = request.getInputStream(); + } + + if (input instanceof InputStreamReaderXML) { + ((InputStreamReaderXML)(input)).putInputStream(instream); + } else if (input instanceof InputStreamReaderXML || input instanceof InputStreamReaderJSON) { + ((InputStreamReaderJSON)(input)).putInputStream(instream); + } + } catch (IOException e) { + responseError(myresponse, new CheckerException(ResponseOutcome.PS_INPUT_STREAM_ERROR, e.toString())); + return; + } + } + + // Ho una richiesta di tipo MULTIPART-FORM-DATA + if (input instanceof MultipartFormDataRequestReader) { + if (log.isDebugEnabled()) log.debug("MultipartFormDataRequest required in http request in "+input.getClass()); + + MultipartFormDataRequest mfdrequest = null; + if (MultipartFormDataRequest.isMultipartFormData(request)) { + try { + mfdrequest = new MultipartFormDataRequest(request); + } catch (IOException e) { + responseError(myresponse, new CheckerException(ResponseOutcome.MFD_REQUEST_IO_ERROR, e.toString())); + return; + } catch (UploadException e) { + responseError(myresponse, new CheckerException(ResponseOutcome.MDF_REQUEST_UPLOAD_ERROR, e.toString())); + return; + } catch (Exception e) { + responseError(myresponse, new CheckerException(ResponseOutcome.MFD_REQUEST_IO_ERROR, e.toString())); + return; + } + + ((MultipartFormDataRequestReader)(input)).putMultipartFormData(mfdrequest); + } + } + + // ...o di aggiungere altre informazioni + if (input instanceof RemoteHostRequestInfo) { + RemoteHostRequestInfo req = (RemoteHostRequestInfo)input; + + // Valorizzazione delle informazioni reltive al "remote host" + req.putHttpRemote(myresponse.getHttpRemote()); + } + + + // --------------------------------------------- + + /* + * In alcuni casi ho necessità di scrivere direttamente nell'output stream + * Posso farlo solo se la response type del manager implementa OutputStreamWriter + * + * ...lo passo all'oggetto response type del manager + */ + if (input instanceof OutputStreamWriter) { + if (log.isDebugEnabled()) log.debug("Put servlet output stream in "+input.getClass()); + try { + ((OutputStreamWriter)(input)).putOutputStream(response.getOutputStream()); + } catch (IOException e) { + responseError(myresponse, new CheckerException(ResponseOutcome.PS_OUTPUT_STREAM_ERROR, e.toString())); + return; + } + } + + /* + * In alcuni casi ho necessità di scrivere direttamente nel print writer + * Posso farlo solo se la response type del manager implementa OutputPrintWriter + * + * ...lo passo all'oggetto response type del manager + */ + if (input instanceof OutputPrintWriter) { + if (log.isDebugEnabled()) log.debug("Put servlet print writer in "+input.getClass()); + try { + response.setCharacterEncoding("utf-8"); + response.setContentType("text/plain; charset=\"utf-8\"" ); + // + ((OutputPrintWriter)(input)).putPrintWriter(response.getWriter()); + } catch (IOException e) { + responseError(myresponse, new CheckerException(ResponseOutcome.PS_OUTPUT_STREAM_ERROR, e.toString())); + return; + } + } + + } + + private String checkOperation(HttpServletRequest request) throws UniversalStatementException { + + // OPERATION + String operationH = request.getHeader(myConfig.formatHeader(HeaderKey.STATEMENT)); + if (XString.isBlankNullTrim(operationH)) { + // Provo a cercare l'operazione nella QueryString + String operationQS = getOperationFromQueryString(request); + if (XString.isBlankNullTrim(operationQS)) { + // Provo a cercare l'operazioencome parametro + String operationP = request.getParameter(HeaderKey.STATEMENT.toString()); + if (XString.isBlankNullTrim(operationP)) { + throw new UniversalStatementException(ResponseOutcome.PS_STATEMENT_NOT_SPECIFIED); + } + return operationP; + } + return operationQS; + } + + String operationQS = getOperationFromQueryString(request); + if (XString.isNotBlankNull(operationQS)) { + if (!operationQS.equals(operationH)) { + throw new UniversalStatementException(ResponseOutcome.PS_STATEMENT_DIFFERENCE); + } + } + return operationH; + } + + /** + * Estra l'operazione dalla queryString della chiamata http + * In caso di chiamata in GET la queryString contine tutti i parametri; lo statemet equivale al primo + * + * @param request + * @return + */ + private String getOperationFromQueryString(HttpServletRequest request) { + String operationQS = request.getQueryString(); + if (operationQS==null || operationQS.length()==0) return null; + + int i = operationQS.indexOf("&"); + if (i>0) operationQS = operationQS.substring(0,i); + i = operationQS.indexOf("="); + if (i>0) operationQS = operationQS.substring(0,i); + return operationQS; + } + + + private void responseError(MyHttpServletResponse response, TraceableWithIdException exception) { + responseReturn(response, new MyReturn(exception.getId(), exception.getMessage(), null, false, exception.isTraceLog()), null); + } + + private void responseError(MyHttpServletResponse response, ResponseOutcome outcome) { + responseReturn(response, new MyReturn(outcome, null), null); + } + + + /** + * Resitituisce la risposta valorizzando le variabili di header + * @param response + * @param return_code + * @param return_message + * @param res + */ + private void responseReturn(MyHttpServletResponse myResponse, MyReturn myReturn, UniversalResponse res) { + // Tracciamento informazioni della REQUEST nel log applicativo + if (myReturn.isNegative()) { + // ERRORE + log.error(requestInfo(myResponse, myReturn)); + } else if (myReturn.isTrace() && !log.isDebugEnabled()) { + // POSITIVO CON MESSAGGIO DA TRACCIARE (no debug) + log.info(requestInfo(myResponse, myReturn)); + } else { + // DEBUG + if (log.isDebugEnabled()) { + HttpRemote remote = myResponse.getHttpRemote(); + HttpServletRequest request = myResponse.getHttpServletRequest(); + // + String statement = myResponse.getStatement(); + String statement_key = myResponse.getStatementKey(); + // + String messaggio = "Response >>\n" + + "-[INFO ]------------------------------------------------------------>> \n" + + "Response: "+ myReturn.toString() + "\n" + + (myReturn.getResult()!=null?"Result: '"+myReturn.getResult()+"'\n":"") + + "Remote host: "+ remote.getTraceHost() + "\n" + + "Request URL: " + request.getRequestURL() + (statement_key!=null && statement_key.length()>0?"?"+statement_key:"") + "\n" + + "Statement: " + (statement!=null && statement.length()>0?statement:"") + "\n" + + "--------------------------------------------------------------------->>"; + log.debug(messaggio); + } + } + + @SuppressWarnings("unused") + HttpServletRequest request = myResponse.getHttpServletRequest(); + HttpServletResponse response = myResponse.getHttpServletResponse(); + /* + // Setup charset encoding UTF-8 + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/xml"); + // + Omesso per evitare problematiche con trasmissione file e flussi non xml + // + */ + + // Encoding della response header + response.setHeader(myConfig.formatHeader(HeaderKey.HEADER_ENCODING), clazzT.getResponseHeaderEncoding().toString()); + + /* Preset dei valori dell'HEADER per la risposta */ + clazzT.setEncodedHeader(response, myConfig.formatHeader(HeaderKey.RETURN_CODE), myReturn.getCode()); + clazzT.setEncodedHeader(response, myConfig.formatHeader(HeaderKey.RETURN_MESSAGE), myReturn.getMessage()); + clazzT.setEncodedHeader(response, myConfig.formatHeader(HeaderKey.JARVIS), clusterInfo.getHostName()); + + // ...gestione dinamica del "Result" + if (myConfig.isUseResult()) { + if (myReturn.getResult()==null) myReturn.setResult(ResponseResult.ERROR); + // Il valore del result DEVE essere presente + clazzT.setEncodedHeader(response, myConfig.formatHeader(HeaderKey.RESULT), myReturn.getResult().toString()); + } else { + // Il valore del result non è obbligatori ma è inserito solo se valorizzato in modo esplicito + if (myReturn.getResult()!=null) { + clazzT.setEncodedHeader(response, myConfig.formatHeader(HeaderKey.RESULT),myReturn.getResult().toString()); + } + } + // .... + + try { + MyBody body = null; + if (res!=null) { + // Converto la risposta in Header value + if (log.isDebugEnabled()) log.debug("Setup header value using response class"); + clazzT.setResponseHeaders(res, response); + if (res.takeBody()!=null) { + body = res.takeBody(); + } + } else { + /* + * Non è stata definita alcuna risposta + * Sono sicuramente in una codizione di errore + */ + } + + if (body==null) { + // In caso di risposta vuota verifico se è presente una risposta di default + if (getMyConfig().getErrorBody()!=null) { + body = getMyConfig().getErrorBody(); + } else { + body = new BodyNull(); + } + } + + // Eseguo prima questa operazione perchè può essere sovrascritta dal bodywrite + try { + body.setMyReturn(myReturn); + body.write(myResponse); + } catch (FileNotFoundException e) { + log.error(e.toString()); + myReturn.changeHttpStatus(HttpServletResponse.SC_NOT_FOUND); + // il segno meno (-) nel codice errore è voluto + responseError(myResponse, new UniversalStatementException(""+(-HttpServletResponse.SC_NOT_FOUND), e.toString())); + } + + // Tracciamento STATEMENT e esito nel log statement (200) + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + + } catch (UnsupportedEncodingException e) { + log.error("Unsupported encoding exception", e); + myReturn.changeHttpStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + + // Tracciamento STATEMENT e esito nel log statement + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + + } catch (IOException e) { + log.error("Comunication exception", e); + myReturn.changeHttpStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + + // Tracciamento STATEMENT e esito nel log statement + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + + } catch (BodyResponseException e) { + log.error("BodyResponseException", e.getCause()); + myReturn.changeHttpStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + + // Tracciamento STATEMENT e esito nel log statement + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + + } catch (UniversalStatementException e) { + log.error("Exception", e); + myReturn.changeHttpStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + + // Tracciamento STATEMENT e esito nel log statement + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + + } catch (Exception e) { + log.error("Unhandled exception", e.getCause()); + myReturn.changeHttpStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + + // Tracciamento STATEMENT e esito nel log statement + traceStatementInfo(myResponse, myReturn); + response.setStatus(myReturn.getHttpStatus()); + } + } + + + + private void traceStatementInfo(MyHttpServletResponse myResponse, MyReturn myReturn) { + try { + if (statementLog.isInfoEnabled()) { + HttpRemote remote = myResponse.getHttpRemote(); + HttpServletRequest request = myResponse.getHttpServletRequest(); + // + String statement = myResponse.getStatement(); + String statement_key = myResponse.getStatementKey(); + + EnterpriseCalendar stop = EnterpriseCalendar.now(); + long life = stop.difference(myResponse.getStart(), EnterpriseCalendar.MILLISECOND); + + String messaggio = ""; + + /* JSON */ + String info = ""; + if (myResponse.getInfo()!=null) { + for (Entry element : myResponse.getInfo()) { + info += (info.length()==0?"":", ") + element.toJson(); + } + } + info = "{"+info+"}"; + + // ID univoco = + String id = Security.toMD5(stop.getTimeInMillis() + getClass().getName() + remote.getTraceHost() + ClusterSynchronizer.getInstance().getPublicHostName() + Ticket.generaTicket()); + /* + * Aggiunto al calclol dell'id univoco un valore random + * Questo p dovuto al fatto che certi device eseguono la stessa richista più volte nello stesso secondo + * + */ + + messaggio += "{" + + "\"_id\":\"" + id + "\", " + + "\"host\":\"" + remote.getTraceHost() + "\", " + + "\"url\":\"" + request.getRequestURL() + (statement_key!=null && statement_key.length()>0?"?"+statement_key:"") + "\", " + + "\"statement\":\"" + (statement!=null && statement.length()>0?statement:"?") + "\", " + + "\"class\":\"" + getClass().getName() + "\", " + + "\"time\":\"" + myResponse.getStart().toStringUTC() + "\", " + + "\"life\":" + life + ", " + + "\"response\":" + myReturn.getHttpStatus() + ", " + + "\"code\":\"" + myReturn.getCode() + "\", " + + //"\"message\":\"" + myReturn.getMessage() + "\", " + + "\"status\":\"" + (myReturn.isNegative()?"ERROR":"VALID") + "\", " + + "\"info\":" + info + + "}"; + statementLog.info(messaggio); + } + } catch (Exception e) { + log.error("Error in statement tracking: "+e.toString(),e); + } + } + + + /** + * Stampa le informazioni presenti nell'header o nei parametri della richiesta + * La stessa chiamta è utilizzata sia in debug che per tracciare gli errori + * @param statement_key + * @param myResponse + * @param myReturn + * @return + */ + private String requestInfo(MyHttpServletResponse myResponse, MyReturn myReturn) { + HttpRemote remote = myResponse.getHttpRemote(); + HttpServletRequest request = myResponse.getHttpServletRequest(); + // + String statement = myResponse.getStatement(); + String statement_key = myResponse.getStatementKey(); + + String messaggio = ""; + if (myReturn!=null && myReturn.isNegative()) { + if (!myReturn.isTrace()) { + // Risposta di errore compatto + messaggio = "Response: " + myReturn.toString() + + (myReturn.getResult()!=null?"; '"+myReturn.getResult()+"'":"") + + " {remote host: "+ remote.getTraceHost() + ", request URL: " + request.getRequestURL() + (statement_key!=null && statement_key.length()>0?"?"+statement_key:"") +"}"; + return messaggio; + } + + messaggio += "Report an error, request info:\n" + + "-[ERROR]------------------------------------------------------------>> \n" + + "Negative response: "+ myReturn.toString() + "\n" + + (myReturn.getResult()!=null?"Result: '"+myReturn.getResult()+"'" + "\n":"") + + "Status http: " + myReturn.getHttpStatus() + "\n"; + + } else if (myReturn!=null && myReturn.isTrace()) { + messaggio += "Tracking call, request info:\n" + + "-[TRACK]----------------------------------------------------------->> \n"; + } else { + messaggio += "Request info\n" + + "-[INFO ]------------------------------------------------------------->> \n"; + } + messaggio += "Remote host: "+ remote.getTraceHost() + "\n" + + "Request URL: " + request.getRequestURL() + (statement_key!=null && statement_key.length()>0?"?"+statement_key:"") + "\n" + + "Statement: " + (statement!=null && statement.length()>0?statement:"") + "\n"; + + + // HEADER + if (myConfig.getRequestMode().equals(ModeRequest.HEADER) || + myConfig.getRequestMode().equals(ModeRequest.HEADER_OR_PARAMETER)) { + // Stampo tutti gli header + String values = ""; + + @SuppressWarnings("unchecked") + List names = Collections.list(request.getHeaderNames()); + Collections.sort(names); + + for (String key : names) { + if (!key.contains("password")) { + values += "- "+key+" = '"+request.getHeader(key)+"'\n"; + } else { + try { + values += "- "+key+" = '"+XString.fillerLeft("", "*", request.getHeader(key).length())+"'\n"; + } catch (NullPointerException en) { + values += "- "+key+" = ''\n"; + } + + } + } + if (values.length()>0) { + messaggio += "HTTP Header values:\n"+ + values; + } + } + + /* + // PARAMETERR + if (myConfig.getRequestMode().equals(ModeRequest.PARAMETER) || + myConfig.getRequestMode().equals(ModeRequest.HEADER_OR_PARAMETER)) { + // Stampo tutti gli header + + String values = ""; + for (@SuppressWarnings("unchecked")Enumeration e = request.getParameterNames(); e.hasMoreElements();) { + String key = e.nextElement(); + if (key.equals(myResponse.getStatementKey())) continue; + values += "- "+key+" = '"+request.getParameter(key)+"'\n"; + } + if (values.length()>0) { + messaggio += "HTTP Parameter values:\n"+ + values; + } + + } + */ + + // INPUT XML (opzionale) + if (myResponse.getInput()!=null) { + if (myResponse.getInput() instanceof InputStreamReaderXML) { + try { + // Stampa il documento XML nel log + @SuppressWarnings("unchecked") + XmlRoot document = ((InputStreamReaderXML) myResponse.getInput()).takeBufferedInputDocument(); + if (document!=null) { + String xml = document.extractInputXML(); + if (XString.isNotBlankNull(xml)) { + messaggio += "Request XML input:\n"+ + "---------------------------------------------------------------------<<\n" + + xml; + } + } + } catch (Exception e) { + log.warn("Exception printing input XML",e); + } catch (Error e) { + log.warn("Error printing input XML",e); + } + } + + if (myResponse.getInput() instanceof InputStreamReaderJSON) { + JsonMapper jmapper = ((InputStreamReaderJSON) myResponse.getInput()).takeJsonDocument(); + if (jmapper!=null) { + String json = jmapper.print(); + if (XString.isNotBlankNull(json)) { + messaggio += "Request JSON input:\n"+ + "---------------------------------------------------------------------<<\n" + + json + "\n"; + } + } + + } + + } + + + messaggio += "--------------------------------------------------------------------->>"; + + return messaggio; + } + + + + + /** + * Configurazione della servlet (readonly) + * @return + */ + public Configuration getMyConfig() { + return (Configuration)myConfig; + } + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/AddressableRequest.java b/src/it/softecspa/fileproxy/services/common/core/request/AddressableRequest.java new file mode 100644 index 0000000..e79f6f0 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/AddressableRequest.java @@ -0,0 +1,17 @@ +package it.softecspa.fileproxy.services.common.core.request; + + +/** + * La richiesta che estende questa interfaccia ha la possibilità di dirottare le chiamate tra master e stage + */ +public interface AddressableRequest { + + public final String REALTIME = "Realtime"; + public final String PUBLICATION = "Publication"; + + + public Boolean getStage(); + + public void setStage(Boolean value); + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/AuthIsMandatory.java b/src/it/softecspa/fileproxy/services/common/core/request/AuthIsMandatory.java new file mode 100644 index 0000000..41520d8 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/AuthIsMandatory.java @@ -0,0 +1,5 @@ +package it.softecspa.fileproxy.services.common.core.request; + +public interface AuthIsMandatory { + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/EnableLoginProfileRequest.java b/src/it/softecspa/fileproxy/services/common/core/request/EnableLoginProfileRequest.java new file mode 100644 index 0000000..be68c16 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/EnableLoginProfileRequest.java @@ -0,0 +1,9 @@ +package it.softecspa.fileproxy.services.common.core.request; + +public interface EnableLoginProfileRequest { + + public String getAccessToken(); + + public void setAccessToken(String accessToken); + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderJSON.java b/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderJSON.java new file mode 100644 index 0000000..edcf2dd --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderJSON.java @@ -0,0 +1,34 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import java.io.InputStream; +import java.io.Serializable; + +public interface InputStreamReaderJSON { + + /** + * Restituisce l'input stream della request + * @return + */ + public InputStream takeInputStream(); + + /** + * Associa l'input stream della request per utilizzi nel corso dell'elaborazione + * @param inputStream + */ + public void putInputStream(InputStream inputStream); + + + /** + * Restituisce il documento JSON letto ed eventualemnte bufferizzato + * @return + */ + public JsonMapper takeJsonDocument(); + + /** + * Memorizza il documento JSON per utilizzi vari nel corso dell'elaborazione + * @param inputDocument + */ + public void bufferizeInputDocument(JsonMapper mapper); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderXML.java b/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderXML.java new file mode 100644 index 0000000..c48f829 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/InputStreamReaderXML.java @@ -0,0 +1,35 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import it.softecspa.kahuna.util.xml.XmlRoot; + +import java.io.InputStream; + +public interface InputStreamReaderXML { + + /** + * Restituisce l'input stream della request + * @return + */ + public InputStream takeInputStream(); + + /** + * Associa l'input stream della request per utilizzi nel corso dell'elaborazione + * @param inputStream + */ + public void putInputStream(InputStream inputStream); + + + /** + * Restituisce il documento XML letto ed eventualmente bufferizzato + * @return + */ + public X takeBufferedInputDocument(); + + /** + * Memorizza il documento XML per utilizzi vari nel corso dell'elaborazione + * @param inputDocument + */ + public void bufferizeInputDocument(X inputDocument); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/JsonMapper.java b/src/it/softecspa/fileproxy/services/common/core/request/JsonMapper.java new file mode 100644 index 0000000..a1bf228 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/JsonMapper.java @@ -0,0 +1,55 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; + +import org.apache.log4j.Logger; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + + +public class JsonMapper { + + private Logger log = Logger.getLogger(getClass()); + private ObjectMapper mapper; + private J object; + + public JsonMapper() { + mapper = new ObjectMapper(); + } + + public ObjectMapper getMapper() { + return mapper; + } + + public J readValue(InputStream inputStream, Classclazz) throws JsonParseException, JsonMappingException, IOException { + object = mapper.readValue(inputStream, clazz); + return object; + } + + public String print() { + if (object==null) return ""; + try { + // http://fasterxml.github.io/jackson-databind/javadoc/2.3.0/com/fasterxml/jackson/databind/SerializationFeature.html + mapper.enable(SerializationFeature.INDENT_OUTPUT); + return mapper.writeValueAsString(object); + } catch (JsonGenerationException e) { + log.error("Error formatting input JSON",e); + } catch (JsonMappingException e) { + log.error("Error formatting input JSON",e); + } catch (IOException e) { + log.error("Error formatting input JSON",e); + } + return null; + } + + public J getJsonObject() { + return object; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/MultipartFormDataRequestReader.java b/src/it/softecspa/fileproxy/services/common/core/request/MultipartFormDataRequestReader.java new file mode 100644 index 0000000..2ce30c5 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/MultipartFormDataRequestReader.java @@ -0,0 +1,20 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import javazoom.upload.MultipartFormDataRequest; + +public interface MultipartFormDataRequestReader { + + /** + * Restituisce l'istanza della MultipartFormDataRequest + * @return + */ + public MultipartFormDataRequest takeMultipartFormData(); + + /** + * Associa l'stanza della MultipartFormDataRequest + * @param request + */ + public void putMultipartFormData(MultipartFormDataRequest request); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/OnlyStageRequest.java b/src/it/softecspa/fileproxy/services/common/core/request/OnlyStageRequest.java new file mode 100644 index 0000000..0369e41 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/OnlyStageRequest.java @@ -0,0 +1,17 @@ +package it.softecspa.fileproxy.services.common.core.request; + + +/** + * La richiesta che estende questa interfaccia ha la possibilità di dirottare le chiamate tra master e stage + */ +public interface OnlyStageRequest { + + public final String REALTIME = "Realtime"; + public final String PUBLICATION = "Publication"; + + + public Boolean getStage(); + + public void setStage(Boolean value); + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/OutputPrintWriter.java b/src/it/softecspa/fileproxy/services/common/core/request/OutputPrintWriter.java new file mode 100644 index 0000000..75a894a --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/OutputPrintWriter.java @@ -0,0 +1,20 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import java.io.PrintWriter; + +public interface OutputPrintWriter { + + /** + * Restituisce il print writer della response + * @return + */ + public PrintWriter takePrintWriter(); + + /** + * Associa il print writer della response per utilizzi nel corso dell'elaborazione + * @param inputStream + */ + public void putPrintWriter(PrintWriter printWriter); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/OutputStreamWriter.java b/src/it/softecspa/fileproxy/services/common/core/request/OutputStreamWriter.java new file mode 100644 index 0000000..324b359 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/OutputStreamWriter.java @@ -0,0 +1,20 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import javax.servlet.ServletOutputStream; + +public interface OutputStreamWriter { + + /** + * Restituisce l'output stream della response + * @return + */ + public ServletOutputStream takeOutputStream(); + + /** + * Associa l'output stream della response per utilizzi nel corso dell'elaborazione + * @param inputStream + */ + public void putOutputStream(ServletOutputStream outputStream); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/Protocollo.java b/src/it/softecspa/fileproxy/services/common/core/request/Protocollo.java new file mode 100644 index 0000000..c00161d --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/Protocollo.java @@ -0,0 +1,132 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; + +public enum Protocollo { + + /* _0 (0,"Sun") + ,*/_1 (1,"Mercury","2.0.0") + , _2 (2,"Venus","2.6.0") + , _3 (3,"Earth","2.7.1") + , _4 (4,"Mars","2.8.0") + , _5 (5,"Jupiter","2.10.8") + ; + + + + private int value; + private String nickname; + private String version; + + + private Protocollo(int value, String nickname, String version) { + this.value = value; + this.nickname = nickname; + this.version = version; + } + + public static Protocollo parse(String value) { + return Protocollo.valueOf("_"+value); + } + + public static Protocollo parse(int value) { + return Protocollo.valueOf("_"+value); + } + + + public void check(Protocollo min, Protocollo max) throws CheckerException { + if ((min!=null && this.valuemax.value())) { + if (min==null && max!=null) throw new CheckerException(ResponseOutcome.PROTOCOL_VERSION_OUT_OF_RANGE, "<="+max); + if (min!=null && max==null) throw new CheckerException(ResponseOutcome.PROTOCOL_VERSION_OUT_OF_RANGE, ">="+min); + throw new CheckerException(ResponseOutcome.PROTOCOL_VERSION_OUT_OF_RANGE, min+":"+max); + } + } + + /** + * Protocollo < del valore di riferimento + * @param compare + * @return + */ + public boolean under(Protocollo compare) { + if (compare==null) return false; + return this.value= del valore di riferimento + * @param compare + * @return + */ + public boolean equalOrOver(Protocollo compare) { + return this.value>=compare.value; + } + + /** + * Protocollo > del valore di riferimento + * @param compare + * @return + */ + public boolean over(Protocollo compare) { + if (compare==null) return false; + return this.value>compare.value; + } + + /** + * Restituisce il valore numerico del protocollo + * @return + */ + public int value() { + return value; + } + + /** + * Restituisce il soprannome del protocollo + * @return + */ + public String getNikname() { + return nickname; + } + + @Override + public String toString() { + return ""+this.value; + } + + public String getVersionFrom() { + return version; + } + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/RemoteHostRequestInfo.java b/src/it/softecspa/fileproxy/services/common/core/request/RemoteHostRequestInfo.java new file mode 100644 index 0000000..5d58638 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/RemoteHostRequestInfo.java @@ -0,0 +1,12 @@ +package it.softecspa.fileproxy.services.common.core.request; + +import it.softecspa.fileproxy.services.common.comunicator.http.HttpRemote; + +public interface RemoteHostRequestInfo { + + public HttpRemote takeHttpRemote(); + + public void putHttpRemote(HttpRemote value); + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/TrackRequestInfo.java b/src/it/softecspa/fileproxy/services/common/core/request/TrackRequestInfo.java new file mode 100644 index 0000000..7a8ba32 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/TrackRequestInfo.java @@ -0,0 +1,15 @@ +package it.softecspa.fileproxy.services.common.core.request; + + +/** + * Interfaccia universale che tutte le classi response devono estendere + * - lingua + * - versione protocollo + */ +public interface TrackRequestInfo { + + public boolean isTrackRequestInfo(); + + public void trackRequestInfo(boolean value); + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/UniversalAuthenticatedRequest.java b/src/it/softecspa/fileproxy/services/common/core/request/UniversalAuthenticatedRequest.java new file mode 100644 index 0000000..51ca557 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/UniversalAuthenticatedRequest.java @@ -0,0 +1,48 @@ +package it.softecspa.fileproxy.services.common.core.request; + + +/** + * Interfaccia universale che tutte le classi request devono estendere nel caso siano autenticate + * - username + * - password + */ +public interface UniversalAuthenticatedRequest { + + /** + * Username utente + * @return + */ + public String getUsername(); + + public void setUsername(String value); + + + /** + * Password dell'utente + * Può essere impostata sia in chiaro che in formato MD5 + * Se in chiaro è subito trasformata nel suo MD5 + * @return + */ + public String getPassword(); + + public void setPassword(String value); + + + /** + * Token di authenticazione rilasciato dal' ID Provider + * @return + */ + public String getAccessToken(); + + public void setAccessToken(String value); + + + /** + * Organizzaone legata al TOKEN da verificare + * @return + */ + public String getOrganization(); + + public void setOrganization(String value); + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/request/UniversalRequest.java b/src/it/softecspa/fileproxy/services/common/core/request/UniversalRequest.java new file mode 100644 index 0000000..e5339ff --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/request/UniversalRequest.java @@ -0,0 +1,24 @@ +package it.softecspa.fileproxy.services.common.core.request; + + +/** + * Interfaccia universale che tutte le classi response devono estendere + * - lingua + * - versione protocollo + */ +public interface UniversalRequest { + + + public String getLanguage(); + + public void setLanguage(String value); + + + + public Protocollo getProtocolVersion(); + + public void setProtocolVersion(Protocollo value); + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/AbstractDummyResponse.java b/src/it/softecspa/fileproxy/services/common/core/response/AbstractDummyResponse.java new file mode 100644 index 0000000..07c572e --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/AbstractDummyResponse.java @@ -0,0 +1,102 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.core.MyReturn; +import it.softecspa.fileproxy.services.common.core.response.body.BodyXML; +import it.softecspa.fileproxy.services.common.core.response.body.MyBody; +import it.softecspa.kahuna.lang.XString; +import it.softecspa.portal.Version; + +import java.io.UnsupportedEncodingException; + +import org.apache.log4j.Logger; + +public class AbstractDummyResponse implements UniversalResponse { + + private Logger log = Logger.getLogger(getClass()); + + private MyReturn myreturn; + private MyBody body; + + + public AbstractDummyResponse(ResponseOutcome outcome) { + this.myreturn = new MyReturn(outcome, null); + + Version versione = Version.getInstance(); + String message = "" + + "" + + "" + outcome.getId() + "" + + "" + outcome.getMessage() + "" + + "" + + ""; + try { + addBody(new BodyXML(generateXML(message, "UTF-8", null, false))); + } catch (UnsupportedEncodingException e) { + log.fatal("Unhandled exception", e); + addBody(new BodyXML(message.getBytes())); + } + } + + private byte[] generateXML(String message, String charsetName, String dtd, boolean pretty) throws UnsupportedEncodingException { + if (log.isDebugEnabled()) log.debug("Translate XmlElement in XML layout"); + + String xml = ""; + if (dtd != null) { + xml += ""; + } + xml += message; + + if (pretty) { + try { + xml = XString.prettyXML(xml); + } catch (Exception e) { + log.warn("Problem \"pretty\" XML response", e); + } + } + + try { + return xml.getBytes(charsetName); + } catch (UnsupportedEncodingException e) { + throw e; + } + } + + + @Override + public String getReturnCode() { + return myreturn.getCode(); + } + + + @Override + public String getReturnMessage() { + return myreturn.getMessage(); + } + + + + @Override + public MyBody takeBody() { + return this.body; + } + + @Override + public void addBody(MyBody body) { + this.body = body; + } + + + + @Override + public void setReturn(MyReturn myreturn) { + this.myreturn = myreturn; + } + + @Override + public MyReturn takeMyReturn() { + return myreturn; + } + + + +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/services/common/core/response/EmptyResponseType.java b/src/it/softecspa/fileproxy/services/common/core/response/EmptyResponseType.java new file mode 100644 index 0000000..1b0d982 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/EmptyResponseType.java @@ -0,0 +1,40 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import it.softecspa.fileproxy.services.common.core.MyReturn; +import it.softecspa.fileproxy.services.common.core.response.body.MyBody; + +public class EmptyResponseType implements UniversalResponse { + + private MyReturn myreturn; + private MyBody body; + + @Override + public String getReturnCode() { + return myreturn.getCode(); + } + + @Override + public String getReturnMessage() { + return myreturn.getMessage(); + } + + @Override + public void setReturn(MyReturn myreturn) { + this.myreturn = myreturn; + } + + @Override + public MyReturn takeMyReturn() { + return this.myreturn; + } + + @Override + public MyBody takeBody() { + return this.body; + } + + @Override + public void addBody(MyBody body) { + this.body = body; + } +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/Entry.java b/src/it/softecspa/fileproxy/services/common/core/response/Entry.java new file mode 100644 index 0000000..e2c811c --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/Entry.java @@ -0,0 +1,35 @@ +package it.softecspa.fileproxy.services.common.core.response; + +public class Entry { + + private String key; + private String value; + + public Entry(String key, String value) { + this.key = key; + this.value = value; + } + + public Entry(String key, Integer value) { + this.key = key; + this.value = (value!=null?value.toString():null); + } + + public String getKey() { + return key; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return key + "=" + (value!=null?"'"+value+"'":""); + } + + public String toJson() { + return "\""+key+"\":\""+(value!=null?value:"")+"\""; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/JsonResponse.java b/src/it/softecspa/fileproxy/services/common/core/response/JsonResponse.java new file mode 100644 index 0000000..0af1038 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/JsonResponse.java @@ -0,0 +1,47 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@SuppressWarnings("serial") +@JsonPropertyOrder({ "status", "message", "result" }) +public abstract class JsonResponse implements Serializable { + + protected String status; + protected String message; + protected String result; + + + public String getStatus() { + return status; + } + + @JsonProperty("status") + public void setStatus(String status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + @JsonProperty("message") + public void setMessage(String message) { + this.message = message; + } + + public String getResult() { + return result; + } + + @JsonProperty("result") + public void setResult(String result) { + this.result = result; + } + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/JsonResponseKO.java b/src/it/softecspa/fileproxy/services/common/core/response/JsonResponseKO.java new file mode 100644 index 0000000..e2f42ae --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/JsonResponseKO.java @@ -0,0 +1,23 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion; + +@SuppressWarnings("serial") +@JsonPropertyOrder(alphabetic = true) +@JsonSerialize(include = Inclusion.NON_NULL) +public class JsonResponseKO extends JsonResponse { + + public JsonResponseKO() { + super(); + } + + @JsonIgnore + public JsonResponseKO(String code, String message) { + this.status = code; + this.message = message; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/UniversalResponse.java b/src/it/softecspa/fileproxy/services/common/core/response/UniversalResponse.java new file mode 100644 index 0000000..0f0947c --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/UniversalResponse.java @@ -0,0 +1,37 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import it.softecspa.fileproxy.services.common.core.MyReturn; +import it.softecspa.fileproxy.services.common.core.response.body.MyBody; + +/** + * Interfaccia universale che tutte le classi response devono estendere + * - return code + * - return message + * - result (opzionale) + * + body + */ +public interface UniversalResponse { + + + public String getReturnCode(); + + public String getReturnMessage(); + + public void setReturn(MyReturn myreturn); + + public MyReturn takeMyReturn(); + + + /** + * Da utilizzare per impostare un body + * @param body + */ + public MyBody takeBody(); + + public void addBody(MyBody body); + + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/XMLResponseKO.java b/src/it/softecspa/fileproxy/services/common/core/response/XMLResponseKO.java new file mode 100644 index 0000000..f0cf8b4 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/XMLResponseKO.java @@ -0,0 +1,90 @@ +package it.softecspa.fileproxy.services.common.core.response; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlElement; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlRoot; + + +public class XMLResponseKO extends XmlRoot { + + + public class Status extends XmlElement { + + @Override + public void parse(NodeElement father) throws XmlParserException { + /* Nessuna operazione */ + } + + } + + public class Message extends XmlElement { + + @Override + public void parse(NodeElement father) throws XmlParserException { + /* Nessuna operazione */ + } + + } + + + public class Result extends XmlElement { + + @Override + public void parse(NodeElement father) throws XmlParserException { + /* Nessuna operazione */ + } + + } + + + protected Status status; + protected Message message; + protected Result result; + + + public XMLResponseKO() { + super("error"); + } + + public XMLResponseKO(String code, String message) { + this(); + + this.status = new Status(); + this.status.setEntityValue(code); + + this.message = new Message(); + this.message.setEntityValue(message); + } + + + @Override + public void parse(NodeElement father) throws XmlParserException { + /* Nessuna operazione */ + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public Message getMessage() { + return message; + } + + public void setMessage(Message message) { + this.message = message; + } + + public Result getResult() { + return result; + } + + public void setResult(Result result) { + this.result = result; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyBase64.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyBase64.java new file mode 100644 index 0000000..a24fe39 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyBase64.java @@ -0,0 +1,58 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; + +import java.io.IOException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; + +public class BodyBase64 extends MyBody { + + private String body; + private String name; + + public BodyBase64(String body) { + super(true); + this.body = body; + } + + public BodyBase64(String body, String name) { + super(); + this.body = body; + this.name = name; + } + + + + @Override + protected void write() throws IOException, BodyResponseException { + if (body==null) return; + if (log.isDebugEnabled()) log.debug("Sending base64 encoded stream in response output"); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/octet-stream"); + if (name!=null) { + response.setHeader("Content-Disposition", "attachment; filename=" + name); + } + response.setHeader("Content-Transfer-Encoding","base64"); + + ServletOutputStream out = response.getOutputStream(); + if (gzip) { + response.setHeader("Content-Encoding","gzip"); + // + byte[] abyte = body.getBytes("UTF-8"); + GZIPOutputStream zipout = new GZIPOutputStream(out); + zipout.write(abyte); + zipout.flush(); + zipout.close(); + } else { + byte[] abyte = body.getBytes("UTF-8"); + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + } + + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyFileAttach.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyFileAttach.java new file mode 100644 index 0000000..3cb081a --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyFileAttach.java @@ -0,0 +1,52 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.kahuna.io.File; + +import java.io.IOException; + +public class BodyFileAttach extends MyBody { + + protected File file; + protected int chunksize; + + protected boolean inline; + + + public BodyFileAttach(File file, int chunksize) { + super(true); + this.file = file; + this.chunksize = chunksize; + } + + public BodyFileAttach(File file, boolean inline, int chunksize) { + super(true); + this.file = file; + this.chunksize = chunksize; + this.inline = inline; + } + + + + @Override + protected void write() throws IOException, BodyResponseException { + if (file==null) return; + if (log.isDebugEnabled()) log.debug("Sending attachment file in response output stream in chunked mode"); + + // set response headers (it is always better to write header's before writing to response stream) + + if (inline) { + // if Content-Disposition header value is set to inline, the response is displayed in browser + response.setHeader("Content-Disposition", "inline; filename=" + file.getName()); + } else { + response.setContentType("application/octet-stream"); + // if Content-Disposition header value is set to attachment, file can be downloaded as attachment + response.setHeader("Content-Disposition", "attachment; filename=" + file.getName()); + } + response.setContentLength(new Long(file.length()).intValue()); + + // + writeFileGeneric(file, chunksize); + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyHTML.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyHTML.java new file mode 100644 index 0000000..0cdd9c5 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyHTML.java @@ -0,0 +1,49 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; + +import java.io.IOException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; + +public class BodyHTML extends MyBody { + + private String html; + + + public BodyHTML(String html) { + super(true); + this.html = html; + } + + + + @Override + protected void write() throws IOException, BodyResponseException { + if (html==null) return; + if (log.isDebugEnabled()) log.debug("Sending "+(gzip?"compressed ":"")+"text message in response output stream"); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/html"); + + ServletOutputStream out = response.getOutputStream(); + if (gzip) { + response.setHeader("Content-Encoding","gzip"); + // + byte[] abyte = html.getBytes("UTF-8"); + GZIPOutputStream zipout = new GZIPOutputStream(out); + zipout.write(abyte); + zipout.flush(); + zipout.close(); + } else { + byte[] abyte = html.getBytes("UTF-8"); + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + //out.close(); + } + + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyJson.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyJson.java new file mode 100644 index 0000000..91a1369 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyJson.java @@ -0,0 +1,116 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.fileproxy.services.common.core.response.JsonResponse; + +import java.io.IOException; +import java.io.Serializable; +import java.io.StringWriter; +import java.io.Writer; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + + +public class BodyJson extends MyBody { + + //private String json; + private J object; + private boolean indent; + + /* + public BodyJson(String json) { + super(true); + this.json = json; + } + */ + + public BodyJson(J object) throws ManagerException { + this(object,true); + } + + public BodyJson(J object, boolean indent) throws ManagerException { + super(true); + this.object = object; + this.indent = indent; + } + + + + @Override + protected void write() throws IOException, BodyResponseException { + if (object instanceof JsonResponse) { + ((JsonResponse)object).setStatus(myReturn.getCode()); + ((JsonResponse)object).setMessage(myReturn.getMessage()); + if (myReturn.getResult()!=null) { + ((JsonResponse)object).setResult(myReturn.getResult().toString()); + } + } + + + String json = null; + try { + json = object2string(object, indent); + } catch (ManagerException e) { + new BodyResponseException(e); + } + + if (json==null) return; + if (log.isDebugEnabled()) log.debug("Sending "+(gzip?"compressed ":"")+"text message in response output stream"); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/json"); + + ServletOutputStream out = response.getOutputStream(); + if (gzip) { + response.setHeader("Content-Encoding","gzip"); + // + byte[] abyte = json.getBytes("UTF-8"); + GZIPOutputStream zipout = new GZIPOutputStream(out); + zipout.write(abyte); + zipout.flush(); + zipout.close(); + } else { + byte[] abyte = json.getBytes("UTF-8"); + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + } + + } + + + public static String object2string(Object object, boolean indent) throws ManagerException { + try { + ObjectMapper mapper = new ObjectMapper(); + Writer strWriter = new StringWriter(); + // + if (indent) mapper.enable(SerializationFeature.INDENT_OUTPUT); + mapper.writeValue(strWriter, object); + // + return strWriter.toString(); + + } catch (JsonGenerationException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonGenerationException: "+object.getClass().getName())); + } catch (JsonMappingException e) { + throw new ManagerException(new CheckerException(ResponseOutcome.MALFORMD_JSON_DOCUMENT,"JsonMappingException: "+object.getClass().getName())); + } catch (IOException e) { + throw new ManagerException("IOException in json serialization object, class "+object.getClass().getName(),e); + } catch (Exception e) { + throw new ManagerException("Unhadled exception in json serialization object, class "+object.getClass().getName(),e); + } + } + + public J getJsonObject() { + return object; + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyNull.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyNull.java new file mode 100644 index 0000000..8072bd8 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyNull.java @@ -0,0 +1,22 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; + +import java.io.IOException; + +public class BodyNull extends MyBody { + + public BodyNull() { + super(true); + } + + + + @Override + public void write() throws IOException, BodyResponseException { + + + + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyText.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyText.java new file mode 100644 index 0000000..b831193 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyText.java @@ -0,0 +1,48 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; + +import java.io.IOException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; + +public class BodyText extends MyBody { + + private String text; + + + public BodyText(String text) { + super(true); + this.text = text; + } + + + + @Override + protected void write() throws IOException, BodyResponseException { + if (text==null) return; + if (log.isDebugEnabled()) log.debug("Sending "+(gzip?"compressed ":"")+"text message in response output stream"); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/plain"); + + ServletOutputStream out = response.getOutputStream(); + if (gzip) { + response.setHeader("Content-Encoding","gzip"); + // + byte[] abyte = text.getBytes("UTF-8"); + GZIPOutputStream zipout = new GZIPOutputStream(out); + zipout.write(abyte); + zipout.flush(); + zipout.close(); + } else { + byte[] abyte = text.getBytes("UTF-8"); + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + } + + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/BodyXML.java b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyXML.java new file mode 100644 index 0000000..eed9f46 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/BodyXML.java @@ -0,0 +1,61 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.kahuna.util.xml.XmlRoot; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.zip.GZIPOutputStream; + +import javax.servlet.ServletOutputStream; + +public class BodyXML extends MyBody { + + private byte[] xml; + + + public BodyXML(byte[] xml) { + super(true); + this.xml = xml; + } + + public BodyXML(String xml) throws UnsupportedEncodingException { + super(true); + if (xml!=null) { + this.xml = xml.getBytes("UTF-8"); + } + } + + public BodyXML(XmlRoot root) throws UnsupportedEncodingException { + super(true); + if (root!=null) { + this.xml = root.generateXML("UTF-8"); + } + } + + + @Override + public void write() throws IOException, BodyResponseException { + if (xml==null) return; + if (log.isDebugEnabled()) log.debug("Send XML as "+(gzip?"compressed ":"")+"byte array throw output stream"); + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/xml"); + response.setContentLength(xml.length); + + ServletOutputStream out = response.getOutputStream(); + if (gzip) { + response.setHeader("Content-Encoding","gzip"); + // + GZIPOutputStream zipout = new GZIPOutputStream(out); + zipout.write(xml); + zipout.flush(); + zipout.close(); + } else { + out.write(xml); + out.flush(); + } + + } + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBody.java b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBody.java new file mode 100644 index 0000000..22d5b3e --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBody.java @@ -0,0 +1,9 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + + +public abstract class ErrorBody extends MyBody { + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyJson.java b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyJson.java new file mode 100644 index 0000000..52dc130 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyJson.java @@ -0,0 +1,38 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.fileproxy.services.common.core.response.JsonResponseKO; + +import java.io.IOException; + +import javax.servlet.ServletOutputStream; + +public class ErrorBodyJson extends ErrorBody { + + @Override + protected void write() throws IOException, BodyResponseException { + + String json; + try { + json = BodyJson.object2string(new JsonResponseKO(myReturn.getCode(),myReturn.getMessage()),true); + } catch (ManagerException e) { + throw new BodyResponseException(e); + } + + response.setCharacterEncoding("UTF-8"); + response.setContentType("application/json"); + + ServletOutputStream out = response.getOutputStream(); + byte[] abyte = json.getBytes("UTF-8"); + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + } + + + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyXML.java b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyXML.java new file mode 100644 index 0000000..4575eef --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/ErrorBodyXML.java @@ -0,0 +1,40 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.fileproxy.services.common.core.response.XMLResponseKO; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import javax.servlet.ServletOutputStream; + +public class ErrorBodyXML extends ErrorBody { + + @Override + protected void write() throws IOException, BodyResponseException { + + byte[] abyte; + try { + XMLResponseKO xml = new XMLResponseKO(myReturn.getCode(),myReturn.getMessage()); + xml.applyCData(); + abyte = xml.generateXML("UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new BodyResponseException(e); + } + + response.setCharacterEncoding("UTF-8"); + response.setContentType("text/xml"); + + ServletOutputStream out = response.getOutputStream(); + + response.setContentLength(abyte.length); + out.write(abyte); + out.flush(); + } + + + + + + +} diff --git a/src/it/softecspa/fileproxy/services/common/core/response/body/MyBody.java b/src/it/softecspa/fileproxy/services/common/core/response/body/MyBody.java new file mode 100644 index 0000000..62578e3 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/core/response/body/MyBody.java @@ -0,0 +1,127 @@ +package it.softecspa.fileproxy.services.common.core.response.body; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; + +import it.softecspa.fileproxy.services.common.UniversalStatementException; +import it.softecspa.fileproxy.services.common.core.BodyResponseException; +import it.softecspa.fileproxy.services.common.core.MyHttpServletResponse; +import it.softecspa.fileproxy.services.common.core.MyReturn; + +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public abstract class MyBody { + + protected Logger log = Logger.getLogger(getClass()); + + protected HttpServletRequest request; + protected HttpServletResponse response; + protected MyReturn myReturn; + + protected boolean gzip; + protected boolean nocache; + + protected MyBody() { + super(); + } + + protected MyBody(boolean nocache) { + super(); + this.nocache = nocache; + } + + public void write(MyHttpServletResponse myresponse) throws IOException, BodyResponseException { + request = myresponse.getHttpServletRequest(); + response = myresponse.getHttpServletResponse(); + + /* + * m.veroni, test del 2012-10-08 + * Il chiamante può gestire le comunicazioni compresse? + * + * String acceptEncoding = request.getHeader("Accept-Encoding"); + * boolean gzip = (acceptEncoding!=null && acceptEncoding.contains("gzip")); + * + * Volutamente messo a FALSE in quanto si è visto un forte rallentamento nella comunicazione + * Questa cosa è stata vista in particolar modo su sistemi IOS + * + */ + gzip = false; + + if (nocache) { + if (log.isDebugEnabled()) log.debug("Response --> Cache-Control: no-cache"); + + // NO-CACHE + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. + response.setHeader("Pragma", "no-cache"); // HTTP 1.0. + response.setDateHeader("Expires", 0); // Proxies. + } + + write(); + } + + + protected abstract void write() throws IOException, BodyResponseException; + + + /** + * Scrive nel BODY della response http il file in attachment + * @param response + * @param file + * @throws IOException + * @throws UniversalStatementException + */ + protected void writeFileGeneric(File file, int chunksize) throws IOException, BodyResponseException { + ServletOutputStream out = response.getOutputStream(); + + FileInputStream fis=null; + try { + try { + fis = new FileInputStream(file); + } catch (FileNotFoundException e) { + log.error("File not found: '"+file.getAbsolutePath()+"'"); + throw new BodyResponseException(e); + } + + response.setContentLength((int) file.length()); + + if (chunksize<=0) { + int len = (int) file.length(); + byte abyte[] = new byte[len]; + fis.read(abyte); + out.write(abyte,0,len); + out.flush(); + + } else { + // Copia i file nelle stream a blocchi di ... + if (log.isDebugEnabled()) log.debug("Chunked transmission with size of "+chunksize+"K"); + + int len = -1; + byte abyte[] = new byte[chunksize]; + while (!((len = fis.read(abyte))==-1)) { + out.write(abyte,0,len); + out.flush(); + } + } + + } finally { + try { + if (fis!=null) fis.close(); + } catch (Exception e) { + /* Nessuna operazione */ + } + } + + } + + public void setMyReturn(MyReturn myReturn) { + this.myReturn = myReturn; + } + + +} diff --git a/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties new file mode 100644 index 0000000..ed1191c --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_en.properties @@ -0,0 +1,327 @@ + +# Messaggi di errore standard - ResponseOutcome + +1 = Error +90401 = The field is mandatory +90402 = The field is empty (an empty field is not valid) +90403 = The field is out of range +90404 = The field is not valid +90405 = The field is in overflow +90406 = The value of currency is not valid +90407 = Field type is not valid (cast exception) +90408 = Internal error, invalid method checking +90409 = Language code is mandatory +90410 = Customer is not valid +90411 = Customer is not valid (cancelled) +90412 = Instance code is mandatory +90413 = Instance is not valid +90414 = Instance is not valid (cancelled) +90415 = Instance is not valid (not exist) +90416 = Technology code is mandatory +90417 = Client id is mandatory +90418 = Technology doesn't exist +90419 = Technology is not valid +90420 = Technology is not valid (cancelled) +90421 = Check the registered device's table (integrity fault) +90422 = Check the registration code's table (integrity fault) +90423 = Registration code is not found +90424 = Registration code limit overflow +90425 = Registration code is not matching with valid zone code +90426 = Registration code not found (cancelled) +90427 = Preregistration failed, device id is not valid +90428 = Display resolution code not valid +90429 = Display resolution code not found +90430 = Zone is not valid +90431 = Zone is not valid (cancelled) +90432 = Zone is not valid (activation rule restriction) +90433 = Parameter 'zoneCode' is mandatory +90434 = Changing zone is not allowed +90435 = Profile not found +90436 = Profile is not valid (cancelled) +90437 = Profile without required package association +90438 = Package not found +90439 = Package not valid +90440 = Package is not valid (cancelled) +90441 = Package without services +90442 = Package with all his service is deleted +90442 = Package not matching with registration zone +90444 = Any activated packages for this technology +90445 = Any technology/display association found +90446 = Background size code not valid +90447 = Background size code not found +90448 = Any technology/display/background association found +90449 = (Normalized) Display resolution code not valid +90450 = Device is not valid, verify registration +90451 = Device is not valid, verify registration (cancelled) +90452 = Device is not valid, complete registration +90453 = Device is not valid, complete registration with code +90454 = Maximum number of devices reached +90455 = Only ione menu is allowed for the istance +90456 = Any valid menu found for this instance +90457 = Menu structure is not valid, any root found +90458 = Menu structure is not valid, any element found +90459 = Menu structure is not valid, any module found +90460 = Menu structure is not valid, any theme found +90461 = Menu structure is not valid, root without any object +90462 = Menu structure is not valid, any service found in this zone +90463 = Menu structure is not valid, found element without image +90464 = Menu structure is not valid, found valid element without valid render +90465 = Menu structure is not valid, any main element found +90466 = Menu structure is not valid, any application found + +90470 = Any file to upload +90471 = Upload file error; do not overwrite +90472 = Upload file error; duplicated file +90473 = Upload file error! +90474 = Upload file error; can not write +90475 = Group code is not valid +90476 = Group code is mandatory +90477 = Group code is not valid (too many records) +90478 = Group code record not found +90479 = Error creating directory +90480 = Upload resource type not valid or not managed +90481 = Not valid gallery coordinate +90482 = Not valid image extention for selected type +90483 = Not valid image; not valid info +90484 = Duplicated resource file +90485 = Any valid credential field are not found +90486 = Username/password not valid +90487 = Username/password not valid (too many records) +90488 = Role not valid +90489 = Role not valid (too many records) +90490 = File format not valid +90491 = Empty query +90492 = SQL error +90493 = Column do not match +90494 = Draft type is not valid +90495 = User not valid (not fonud) + +90510 = Malformed XML document +90511 = XML element is empty +90513 = Error building XML menu interface +90514 = Error building XML theme interface +90520 = Protocol version is mandatory +90521 = Protocol version not valid +90522 = Protocol version out of range +90530 = Any immutable data are passed, check system! +90531 = Client id (unique) not valid, check sequence of client process +90532 = Device id is mandatory +90533 = Techonology class do not match with unique client id record +90534 = Immutable data do not match with unique client id record +90535 = Device generated id (old clientId ) is mandatory +90560 = Resource does not exist +90561 = Resource is not valid +90562 = Resource is not valid (cancelled) +90563 = Resource is not valid, file not found +90564 = Theme is not valid +90565 = Theme is not valid (cancelled) +90566 = Theme is not valid (not publishable) +90567 = Theme renderer association is not valid +90568 = Theme renderer association is not valid (cancelled) +90569 = Found too match valid theme renderer association +90570 = Renderer for menu is not found +90571 = Renderer for menu is not found (cancelled) +90572 = Renderer info for menu/screen not found +90573 = Renderer info for menu/screen not found (cancelled) +90574 = Renderer background image for menu/screen not found +90575 = Instance/Technology does not exist +90576 = Instance/Technology is not valid +90577 = Instance/Technology is not valid (cancelled) +90578 = Theme is not valid for this instance +90579 = Resource id is not valid (not found) +90580 = Any valid feedback XML +90581 = Any valid feedback value, number expected +90582 = Any valid feedback value +90583 = Any valid service id in feedback +90584 = Any service id was found in feedback +90585 = Any data/time value was found +90586 = Any data/time format was found +90587 = Feedback action id is not valid in XML +90588 = Service id is not valid +90589 = Service id is not valid (cancelled) +90590 = Any valid id service for credits feedback +90591 = Number format exception on credits left value +90592 = Number format exception on credits used value +90593 = Service on demand action not valid +90594 = Service not compatible with instance +90595 = Any package found for service +90596 = Any renewal found for service +90597 = Service is not on demand +90598 = Service is not on demand (cancelled) +90599 = Service/category is not valid +90600 = I/O error contacting url +90601 = Url exception +90602 = Any valid response content type (text/xml) +90603 = Null response from remote server +90604 = JDOM exception in remote server response +90605 = XML is not valid in remote server response +90606 = XML tag is not valid in remote server response +90607 = Notify record not found in table +90608 = Market code or id not valid for the instance +90609 = Market code and id not match the same market +90610 = Remote server ko http response code +90611 = Undefined remote return code and message +90612 = Input XML request is null +90613 = Input XML request is not valid +90614 = Input XML request not valid; FILTER is empty +90615 = Input XML request not valid; MESSAGE is empty +90616 = Input XML request not valid; INSTANCE-CODE is mandatory +90617 = Input XML request not valid; INSTANCE-CODE is not valid +90620 = Push message channel not valid +90621 = Push message channel not valid (cancelled) +90622 = Push message channel cathegory not managed +90623 = Push message is too long +90624 = Push message target for statement is null +90625 = Push message target for statement is not valid +90626 = Id gallery is not valid +90627 = Input XML request not valid; BODY is null +90629 = Input XML request not valid; FILTER is inconsistent +90629 = Push, certificate file is not found +90630 = Push message not found in database +90631 = Push channel not configured +90632 = Push channel configuration is not valid +90633 = Push channel configuration error +90634 = Push processor not found for channel category +90635 = Message feedback is not valid +90636 = One or more push command are not valid, check XML +90637 = One or more argument are not valid, check command XML +90638 = Mandatory argument are not found, check command XML +90639 = Too many command was found in the list +90640 = Google auth key null or invalid +90650 = Only one ip in header response +90651 = GeoIp data file not found +90652 = IP is mandatory +90653 = IP is not valid +90654 = GeoIp lookup locator is null +90656 = GeoIp location is null +90657 = GeoIp method is not valid +90720 = Push action is not valid +90721 = Device not registered to push service, refresh operation is not valid +90723 = Device not registered to push service (deleted), refresh operation is not valid +90730 = Users provider not valid, check instance configuration or add a call parameter +90731 = Users provider not valid (cancelled), check instance configuration +90732 = Users provider MyDesktopMate is not valid +90733 = Users provider MyDesktopMate is not valid (cancelled) +90734 = Device user is not valid (corrupted database) +90735 = Users provider not found, check URL parameter or server configuration +90736 = Users provider not valid, check call parameter or server configuration +90740 = Export request is expired +90741 = Export bind ticket is not found +90742 = Export file is not found +90748 = Session token is not valid (too short, min 10) +90749 = Session token is not valid (too long, max 32 ) +90750 = Session token is not valid (not found) +90751 = Event code is not valid +90800 = HTTP method GET is not supported by this URL +90801 = Specify a valid statement in request call +90802 = Any valid statement in request call +90803 = Difference between header and query string value for the statement +90804 = Request class was not found +90805 = Response class was not found +90806 = Internal error, unsupported type class in method +90807 = Internal error, unsupported type class +90808 = Internal security exception +90809 = Internal error, method not found +90810 = Internal error, class instantiation error +90811 = Internal error, class illegal access +90812 = Internal error, unsupported array type class in method +90813 = Internal error, unsupported array type class +90814 = Not valid value, cast exception +90817 = Error open servlet print writer +90818 = Error open servlet output stream +90819 = Error reading from input stream +90820 = Null response is not a valid response +90821 = Response class do not match +90830 = Remote server syncronization in progress, try later +90831 = Remote server syncronization in progress (superadmin), try later +90840 = Any valid value for 'viewsize': use WIDTHxHEIGTH +90841 = Image request mode not valid +90842 = Image request mode not valid +90850 = Customer/Instance do not match +90851 = Source, any languages was found for customer +90852 = Source, any languages was found for instance +90853 = Source, any technologies was found +90854 = Source, any zones was found +90855 = Target customer just exists +90856 = Target customer just exists (cancelled) +90857 = Target instance just exists +90858 = Target instance just exists (cancelled) +90859 = Target, customer language not valid +90860 = Target, instance language not valid +90861 = Target, technology not valid +90862 = Target, zone not valid +90863 = Too many records +90864 = Error compare source/target record +90865 = Source and target list are empty +90866 = Target group already exists +90970 = Application locked on this device +90980 = Internal error, request must implements interface to perform operation +90981 = Class not managed from database field comparator +90982 = Database filed not mapped +90983 = Internal error, request is null +90984 = Request phase is null +90985 = Request phase is not valid +90986 = MultipartFormData request is not valid +90987 = MultipartFormData request upload error +90988 = Request is not a valid MultipartFormData +90989 = Class not managed from database field value function +90990 = Error in accessing the database (timeout) +90991 = Internal server error +90992 = Server manager exception +90993 = Problem contacting remote server +90994 = Error in accessing the database +90995 = Unhandled error +90996 = Service is not active +90997 = Session null or not valid +90998 = Request is not valid +90999 = Response is not valid + +50001 = XML request is not valid: 'type' unknown +50002 = XML request is not consistent, verify XML +50003 = XML request is not consistent, add 'registration' to XML +50010 = Internal server error +50011 = Internal server error (unhandled) +50012 = Internal server error (database) +50020 = Master status operation list: 'statement' unknown +50021 = Master status: node info is null +50101 = Forward XML request is null +50103 = Forward XML response is null + +80100 = SSO provider is not configured +80101 = SSO provider client configuration not valid +80102 = SSO provider client configuration error +80110 = SSO mobile client not configured +80111 = SSO mobile client configuration not valid +80112 = SSO mobile client configuration error +80120 = SSO error +80121 = SSO login error +80122 = SSO logout error +80123 = SSO changing password error +80124 = SSO get token info error +80125 = SSO get user info error +80126 = Wrong credential + +80400 = Couple subscrition/renewal is not found +80401 = Renewal not found for required renewal +80402 = One-shot code not found for required renewal +80403 = One-shot code already used for required renewal +80404 = DesktopMate activation not found +80405 = IMEI code do not match +80406 = Renewal code do not match +80407 = Any valid value for field 'status', accepted 'OK','BURN' +80408 = Renewal not valid, instance do not macth + +91000 = Phone Number not Valid +71001 = Date Missing or invalid +71002 = Km Useful is a mandatory field +71003 = Km Useless is a mandatory field +71004 = Km Out Threshold is a mandatory field +71005 = Type is a mandatory field +71006 = Date start is a mandatory field +71007 = Date end is a mandatory field +71008 = Session Token is Invalid + + +0 = Ok +# 0 = Ok, just notified +#0 = No data found diff --git a/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_it.properties b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_it.properties new file mode 100644 index 0000000..7bc0e82 --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_it.properties @@ -0,0 +1,325 @@ + +# Messaggi di errore standard - ResponseOutcome +# m.veroni - aggiornamento al 30/08/2010 + +1 = Errore +90401 = La compilazione del campo è obbligatoria +90402 = Inserire un valore il campo non può essere vuoto +90403 = Il valore del campo e' fuori dai limiti consentiti +90404 = Il campo non e' valido +90405 = Il valore inserito supera il limite consentito +90406 = L' importo inserito non è valido +90407 = Il valore inserito non è valido (cast exception) +90408 = Errore interno del server, metodo di verifica non valido +90409 = Il codice lingua e' obbligatorio +90410 = Il codice cliente non e' valido +90411 = Il codice cliente non e' valido (eliminato) +90412 = Il codice istanza non e' valido +90413 = Istanza non valida +90414 = Istanza non valida (eliminata) +90415 = Istanza non valida (non esite) +90416 = Codice tecnologia obbligatorio +90417 = Identificativo device obbligatorio +90418 = Codice tecnologia inesistente +90419 = Codice tecnologia non valido +90420 = Codice tecnologia non valido (eliminata) +90421 = Controlla la tebella dei device registrati (errori di integrità) +90422 = Controlla la tabella dei codici di registrazione(errori di integrità) +90423 = Codice di registrazione non trovato +90424 = Superato il limite di utilizzo del codice di registrazione +90425 = Codice di registrazione non abbinato a una zona valida +90426 = Codice di registrazione non trovato (eliminato) +90427 = Preregistrazione fallita, identificativo del device non valido +90428 = Risoluzione display non valida +90429 = Risoluzione display non trovata +90430 = Zona non valida +90431 = Zona non valida (eliminata) +90432 = Zona non valida (presente regola di restrizione) +90433 = Il parametro 'zoneCode' e' obbligatorio +90434 = Il cambio zona non e' permesso +90435 = Profilo non trovato +90436 = Profilo non valido (eliminato) +90437 = Il profilo richiede l'associazione con un pacchetto +90438 = Pacchetto non trovato +90439 = Pacchetto non valido +90440 = Pacchetto non valido (eliminato) +90441 = Pacchetto senza servizi +90442 = Pacchetto con tutti i servizi cancellati +90442 = Il pachetto non coincide con il codice zona +90444 = Nessun pacchetto attivato per questa tecnologia +90445 = L'abbinamento richiesto tecnologia/display non è stato trovato +90446 = Il codice della dimensione dello sfondo non è valido +90447 = Il codice della dimensione dello sfondo non trovato +90448 = Nessuna combinazione technologia/display/sfondo trovata +90449 = Risoluzione display non valida +90450 = Dispositivo non valido, verificare registrazione +90451 = Dispositivo non valido, verificare registrazione (eliminata) +90452 = Dispositivo non valido,completare registrazione +90453 = Dispositivo non valido,completare registrazione con codice +90454 = Numero massimo di device raggiunto +90455 = L'istanza può avere un solo menu +90456 = L'istanza non contiene un menu valido +90457 = Struttura menu non valida, struttura di base non trovata +90458 = Struttura menu non valida, nessun elemento trovato +90459 = Struttura menu non valida, nessun modulo trovato +90460 = Struttura menu non valida, nessun tema trovato +90461 = Struttura menu non valida, Struttura di base senza sottostrutture +90462 = Struttura menu non valida, nessun servizio valido per la zona +90463 = Struttura menu non valida, trovato elemento senza immagine +90464 = Struttura menu non valida, trovato elemento senza proprietà grafiche +90465 = Struttura menu non valida, manca un elemento di base +90466 = Struttura menu non valida, applicazione non trovata + +90470 = Nessun file da caricare +90471 = Errore in caricamento file; impossibile sovrascrivere +90472 = Errore in caricamento file; file duplicato +90473 = Errore in caricamento file! +90474 = Errore in caricamento file; impossibile scrivere +90475 = Il Codice del gruppo non è valido +90476 = Il Codice del gruppo e' obbligatorio +90477 = Il Codice del gruppo non è valido (troppi record) +90478 = Nessun dato trovato per il codice del gruppo +90479 = Errore di creazione della directory +90480 = Dato non valido o non gestito +90481 = Cooordinate della galleria non valide +90482 = Estensione immagine valida per il tipo risorsa selezionata +90483 = Immagine non valida; informazioni non valide +90484 = File duplicato +90485 = Nessun campo di credenziali inserito +90486 = Username/password non valide +90487 = Username/password non valide (estratti troppi record) +90488 = Ruolo non valido +90489 = Ruolo non valido (estratti troppi record) +90490 = Formato file non valido +90491 = Query vuota +90492 = Errore SQL +90493 = Colonna non corrispondente +90494 = Tipo draft no valido +90495 = Utente non valido (non trovato) + +90510 = Documento XML scorretto +90511 = L' elemento dell' XML è vuoto +90513 = Errore nella creazione dell' interfaccia XML +90514 = Errore nella creazione del tema XML +90520 = Versione protocollo obbligatoria +90521 = Versione protocollo obbligatoria non valida +90522 = Versione protocollo obbligatoria fuori dai limiti permessi +90530 = Nessun dato immutabile inviato, controllare il sistema! +90531 = Identificativo device (unique) non valido, controllare sequenza processo +90532 = Identificativo device obbligatorio +90533 = Tecnologia non corrispondente al codice univoco +90534 = Il dato immutabile non coincide con l'id unico del client +90535 = Vecchio codice device (ex clientId) obbligatorio +90560 = Risorsa inesistente +90561 = Risorsa non valida +90562 = Risorsa non valida (cancellata) +90563 = Risorsa non valida, file non trovato +90564 = Tema non valido +90565 = Tema non valido (eliminato) +90566 = Tema non valido (non pubblicabile) +90567 = Associazione tra tema e proprietà grafica non valida +90568 = Associazione tra tema e proprietà grafica non valida (cancellata) +90569 = Una sola associazone permessa tra tema e proprietà grafica +90570 = Proprietà grafica del menu non trovata +90571 = Proprietà grafica del menu non trovata (eliminato) +90572 = Proprietà grafica per menu/display non trovata +90573 = Proprietà grafica per menu/display non trovata (eliminata) +90574 = Immagine di sfondo del menu/display non trovata +90575 = L'associazione instanza/technologia non esiste +90576 = L'associazione instanza/technologia non è valida +90577 = L'associazione instanza/technologia (eliminata) +90578 = Tema non valido per questa istanza +90579 = Id risorsa non valido (non trovato) +90580 = Nessun feedback valido XML +90581 = Nessun valore di feedback valido, atteso un numero +90582 = Nessun valore di feedback valido +90583 = Nessun id di servizio valido nel feedback +90584 = Nessun id di servizio trovato nel feedback +90585 = Nessun valore data/ora trovato +90586 = Nessun formato data/ora trovato +90587 = Il tipo di Feedback presente nell' XML non è valido +90588 = Id del servizio non valido +90589 = Id del servizio non valido (eliminato) +90590 = Id del servizio non valido per il feedback dei crediti +90591 = Valore non valido per i crediti residui +90592 = Valore non valido per i crediti usati +90593 = Azione non valida sui serivizi on demad +90594 = Servizio non compatibile con l'istanza +90595 = Nessun paccheto trovato per il servizio +90596 = Nessun rinnovo trovato per il servizio +90597 = Il servizo non e' on-demand +90598 = Il servizo non e' on-demand (cancellato) +90599 = Associazione servizio/categoria non valida +90600 = Errore di comunicazione il server +90601 = Url errato +90602 = Contenuto della ripsosta non valido (text/xml) +90603 = Risposta null dal server remoto +90604 = Errore JDOM nella risposta del server remoto +90605 = L' XML contenuto nella risposta del server non è valido +90606 = L' etichetta dell' XML contenuta nella risposta del server non è valida +90607 = La notifica del record non è presente nella tabella +90608 = Il Codice o l' id market non è valido per l'istanza +90609 = Il codice del Market e l' id non coincidono con il market stesso +90610 = Il server remoto non risponde +90611 = Codici e messaggi indefiniti in risposta dal server remoto +90612 = La richiesta di Input dell' XML è null +90613 = La richiesta di Input dell' XML non è valida +90614 = La richiesta di Input dell' XML non è valida; il FILTRO è vuoto +90615 = La richiesta di Input dell' XML non è valida; il MESSAGGIO è vuoto +90616 = La richiesta di Input dell' XML non è valida; il CODICE-ISTANZA è obbligatorio +90617 = La richiesta di Input dell' XML non è valida; il CODICE-ISTANZA non è valido +90620 = Canale del messaggio push non valido +90621 = Canale del messaggio push non valido (cancellato) +90622 = Categoria di push message channel non gestito +90623 = Messaggio push troppo lungo +90624 = Target del comando associato al messaggio push nullo +90625 = Target del comando associato al messaggio push non valido +90626 = Id galleria non valido +90627 = La richiesta di Input dell' XML non è valida; BODY is null +90629 = La richiesta di Input dell' XML non è valida; FILTER is inconsistent +90629 = Certificato del canale push non trovato +90630 = Messaggio push non trovato nel database +90631 = Canale invio push non configurato +90632 = Configurazione canale push channel non valido +90633 = Errore in configurazone canale push +90634 = Processatore Push non trovato per questa categoria di canale +90635 = Il Messaggio di feedback non è valido +90636 = Uno o piu' comandi push non sono validi, verificare XML +90637 = Uno o piu' argomenti del messaggio push non sono validi, verificare XML (command) +90638 = Argomenti obbligatori non trovati, verificare XML (command) +90639 = Troppi comandi nella lista +90640 = Google auth key nulla o non valida +90650 = Un solo IP nella risposta dell' header +90651 = Dati di GeoIp non trovati +90652 = IP obbligtorio +90653 = IP non valido +90654 = Il localiazzatore GeoIp è null +90656 = La localizzazione GeoIp è null +90657 = Il metodo di GeoIp non è valido +90720 = L' attivazione Push non è valida +90721 = Dispositivo non registrato al servizio push, operazione di refresh non valida +90723 = Dispositivo non registrato al servizio push (cancellato), operazione di refresh non valida +90730 = Users provider non valido, controllare la configurazione dell' istanza o aggiungere parametro alla chiamata +90731 = Users provider non valido (cancellato), controllare la configurazione dell' istanza +90732 = Users provider MyDesktopMate non valido +90733 = Users provider MyDesktopMate non valido (cancellato) +90734 = Utente di device non valido (database danneggiato) +90735 = Users provider non trovato, controllare il percorso URL o la configurazione del server +90736 = Users provider non valido, controllare tutti i parametri o la configurazione del server +90740 = La richiesta di Export è scaduta +90741 = Il vincolo di Export non è stato trovato +90742 = Il file di Export non è stato trovato +90748 = Token di sessione non valido (troppo corto, min 10) +90749 = Token di sessione non valido (troppo lungo, max 32 ) +90750 = Token di sessione non valido (non trovato) +90751 = Codice evento non valido +#90800 = HTTP method GET is not supported by this URL +#90801 = Specify a valid statement in request call +#90802 = Any valid statement in request call +#90803 = Difference between header and query string value for the statement +#90804 = Request class was not found +#90805 = Response class was not found +#90806 = Internal error, unsupported type class in method +#90807 = Internal error, unsupported type class +#90808 = Internal security exception +#90809 = Internal error, method not found +#90810 = Internal error, class instantiation error +#90811 = Internal error, class illegal access +#90812 = Internal error, unsupported array type class in method +#90813 = Internal error, unsupported array type class +#90814 = Not valid value, cast exception +#90817 = Error open servlet print writer +#90818 = Error open servlet output stream +#90819 = Error reading from input stream +#90820 = Null response is not a valid response +#90821 = Response class do not match +90830 = Sincronizzazione del server in corso, riprova piu' tardi +90831 = Sincronizzazione del server in corso (superadmin), riprova piu' tardi +90840 = Valore non valido per il campo 'viewsize': usa WIDTHxHEIGTH +90841 = Image request mode not valid +90842 = Image request mode not valid +90850 = associazione client/istanza non valida +90851 = Errore dati, nessuna lingua è stata trovata per il cliente +90852 = Errore dati, nessuna lingua è stata trovata per l'istanza +90853 = Errore dati, nessuna tecnologia è stata trovata +90854 = Errore dati, nessuna zona è stata trovata +90855 = Cliente di destinazione gia' presente +90856 = Cliente di destinazione gia' presente (cancellato) +90857 = Istanza di destinazione gia' presente +90858 = Istanza di destinazione gia' presente (cancellata) +90859 = Destinazione, lingua del cliente non valida +90860 = Target, lingua dell' istanza non valida +90861 = Target, tecnologia non valida +90862 = Target, zona non valida +90863 = Troppi record estratti +90864 = Errore di comparazione dati/target +90865 = Le liste di dati e target sono vuote +90866 = Il gruppo di Target è già presente +90970 = Applicazione bloccata su questo dispositivo +90980 = Errore interno, la richiesta deve implementare l' interfaccia per completare l'operazione +90981 = La Classe non è gestita dal comparatore di campi del database +90982 = Database non mappato +90983 = Errore interno del server, richiesta nulla +90984 = Fase della richiesta nulla +90985 = Fase della richiesta non valida +90986 = MultipartFormData la richiesta non è valida +90987 = MultipartFormData errore nella richiesta di upload +90988 = La richiesta non è valida MultipartFormData +90989 = La Classe non è gestita dal valore del campo del database +90990 = Errore in accesso alla base dati (timeout) +90991 = Errore interno del server +90992 = Errore di gestione server +90993 = Problema di connessione con il server +90994 = Errore in accesso alla base dati +90995 = Errore non gestito +90996 = Servizio non attivo +90997 = Sessione nulla o non valida +90998 = Richiesta non valida +90999 = Risposta non valida + +50001 = Richiesta XML non valida: 'type' sconosciuto +50002 = Richiesta XML non consistente, verifica tracciato XML +50003 = Richiesta XML non consistente, aggiungi 'registration' al tracciato XML +50010 = Errore interno del server +50011 = Errore interno del server (sconosciuto) +50012 = Errore interno del server (database) +50020 = Master status operation list: 'statement' unknown +50021 = Master status: node info is null +50101 = Inoltro XML la richiesta è null +50103 = Inoltro XML la risposta è null + +80100 = SSO - provider non configurato corretamente +80101 = SSO - configurazione client non corretta +80102 = SSO - errore in configurazione provider (client) +80110 = SSO - client mobile non configurato +80111 = SSO - configurazione client mobile non valida +80112 = SSO - errore in configurazione client mobile +80120 = SSO - errore non gestito +80121 = SSO - errore in fase di login +80122 = SSO - errore in fase di logout +80123 = SSO - errore durante il cambio password +80124 = SSO - errore in recupero informazioni token +80125 = SSO - errore in recupero informazioni utente +80126 = Credenziali errate + +80400 = Associazione sottoscrizione/rinnovo non trovata +80401 = Rinnovo non trovato +80402 = Codice one-shot non trovato +80403 = Codice one-shot gia' utilizzato +80404 = Attivazione a DesktopMate non trovata +80405 = In codice IMEI non corrisponde +80406 = Il rinnovo non corrisponde +80407 = Valore non valido per il campo 'status', accettato 'OK','BURN' + +91000 = Numero di telefono non valido +71001 = Data mancante o invalida +71002 = Km Utili è un campo obbligatorio +71003 = Km Inutili è un campo obbligatorio +71004 = Km Fuori soglia è un campo obbligatorio +71005 = Tipologia è un campo obbligatorio +71006 = Data inizio è un campo obbligatorio +71007 = Data fine è un campo obbligatorio +71008 = Invalido Session Token +0 = Ok +#0 = Ok, just notified + \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_pt.properties b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_pt.properties new file mode 100644 index 0000000..5279a0a --- /dev/null +++ b/src/it/softecspa/fileproxy/services/common/lang/ResponseOutcome_pt.properties @@ -0,0 +1,324 @@ + +# Messaggi di errore standard - ResponseOutcome + +1 = Erro +90401 = O campo é obrigatório +90402 = O campo é vazio (nome vazio não é válido) +90403 = O campo é fora do range +90404 = O campo não é válido +90405 = O campo é overflow +90406 = O valor da moeda não é válido +90407 = O tipo do campo não é válido (cast exception) +90408 = Erro interno, o método não é válido +90409 = O código do idioma é obrigatório +90410 = O cliente não é válido +90411 = O cliente não é válido (eliminado) +90412 = O código da instância é obrigatório +90413 = A instância não é válida +90414 = A instância não é válida (eliminada) +90415 = A instância não é válida (não existe) +90416 = O código da tecnologia é obrigatório +90417 = O ID do cliente é obrigatório +90418 = A tecnologia não existe +90419 = A tecnologia não é válida +90420 = A tecnologia não é válida (eliminada) +90421 = Controle da tabela do dispositivo registrado (integridade falhou) +90422 = Controle da tabela do registo (integridade falhou) +90423 = O código do registo não foi encontrado +90424 = O limite do código do registo é overflow +90425 = O código do registo não tem um código da área válido +90426 = O código do registo não foi encontrado (eliminado) +90427 = Pre-registo falhou, o dispositivo não é válido +90428 = A resolução da tela não é válido +90429 = A resolução da tela não foi encontrado +90430 = A área não é válida +90431 = A área não é válida (eliminada) +90432 = A área não é válida (regra de ativação - restrição) +90433 = O parâmetro 'zoneCode' é obrigatório +90434 = Não é permitido mudar a área +90435 = O perfil não foi encontrado +90436 = O perfil não foi encontrado (eliminado) +90437 = O perfil é sem associação para um pacote +90438 = O pacote não foi encontrado +90439 = O pacote não é válido +90440 = O pacote não é válido (eliminado) +90441 = O pacote é sem serviço +90442 = O pacote e os seus serviços foi cancelado +90442 = O pacote não corresponde com a área de registo +90444 = Nenhum pacotes foi ativados para este tecnologia +90445 = Nenhum associação tecnologia/tela foi encontrada +90446 = O tamanho do fundo não é válido +90447 = O código do fundo não foi encontrado +90448 = Nenhum associação technologia/tela/fundo foi encontrada +90449 = (Normalizada) O código da resolução da tela não é válido +90450 = O dispositivo não é válido, verifique o registo +90451 = O dispositivo não é válido, verifique o registo (eliminado) +90452 = O dispositivo não é válido, completar o registo +90453 = O dispositivo não é válido, completar o registo com um código +90454 = O número maximo do dispositivo foi chegou +90455 = Chegou muitos menu válido para este instância +90456 = Nenhum menu válido foi encontrado para este instância +90457 = A estrutura do menu não é válida, raiz não encontrada +90458 = A estrutura do menu não é válida, elementos não encontrados +90459 = A estrutura do menu não é válida, módulo não encontrado +90460 = A estrutura do menu não é válida, tema não encontrado +90461 = A estrutura do menu não é válida, raiz sem filho +90462 = A estrutura do menu não é válida, nenhum serviços foi encontrado para este área +90463 = A estrutura do menu não é válida, elementos sem imagens foi encontrados +90464 = A estrutura do menu não é válida, elementos sem válido renderização foi encontrados +90465 = A estrutura do menu não é válida, elemento pai não foi encontrado +90466 = A estrutura do menu não é válida, o app não foi encontrado + +90470 = Nenhum ficheiros para carregar +90471 = Erro no carregamento do ficheiro; não sobrescrever +90472 = Erro no carregamento do ficheiro; ficheiro duplicado +90473 = Erro no carregamento do ficheiro! +90474 = Erro no carregamento do ficheiro; não pode screver +90475 = O código do grupo não é válido +90476 = O código do grupo é obrigatório +90477 = O código do grupo não é válido (muitos record) +90478 = O código do grupo não foi encontrado +90479 = Erro na criação da pasta +90480 = Carregamento tipo recurso não é válido ou não é gerido +90481 = A coordena da galeria não é válida +90482 = A extensão da imagem não é válida para o tipo selecionado +90483 = A imagem não é válida; info não é válida +90484 = Recurso ficheiro duplicado +90485 = O campo do credenciais não foi encontrado +90486 = Username/senha não é válido +90487 = Username/senha não é válido (muitos record) +90488 = A regra não é válida +90489 = A regra não é válida (muitos record) +90490 = O formato do ficheiro não é válido +90491 = Query vazia +90492 = SQL erro +90493 = Coluna não corresponde +90494 = O tipo draft não é válido +90495 = O usuário não é válido (não foi encontrado) + +90510 = Documento XML mal-formato +90511 = O elemento XML é vazio +90513 = Erro compilando o menu interface XML +90514 = Erro compilando o tema XML +90520 = A versão do protocolo é obrigatória +90521 = A versão do protocolo não é válida +90522 = A versão do protocolo è fora do range +90530 = Dados sem possibilidade de mudar passou, controle o sistema! +90531 = O Id do cliente (único) não é válido, controle a seqüência do processo do cliente +90532 = O Id do dispositivo é obrigatório +90533 = A classe da techonologia não corresponde com o Id único do cliente +90534 = Dados sem possibilidade de mudar não corresponde com o Id único do cliente +90535 = Id do dispositivo gerado (velho clientId ) é obrigatório +90560 = O recurso não existe +90561 = O recurso não é válido +90562 = O recurso não é válido (eliminado) +90563 = O recurso não é válido, o ficheiro não foi encontrado +90564 = O tema não é válido +90565 = O tema não é válido (eliminado) +90566 = O tema não é válido (não pode ser publicado) +90567 = A propriedade gráfica do tema não é válida +90568 = A propriedade gráfica do tema não é válida (eliminado) +90569 = A propriedade gráfica do tema foi encontrada +90570 = A propriedade gráfica para o menu não foi encontrada +90571 = A propriedade gráfica para o menu não foi encontrada (eliminado) +90572 = Informações da propriedade gráfica para menu/tela não foi encontrada +90573 = Informações da propriedade gráfica para menu/tela não foi encontrada (eliminado) +90574 = A propriedade gráfica da imagem do fundo para menu/tela não foi encontrada +90575 = Instância/Technologia não existe +90576 = Instância/Technologia não é válida +90577 = Instância/Technologia não é válida (eliminado) +90578 = O tema não é válido para este instância +90579 = O id do recurso não é válido (não encontrado) +90580 = O retorno XML não é válido +90581 = O valor de retorno XML não é válido, esperando um número +90582 = O valor de retorno não é válido +90583 = O retorno do Id serviço não é válido +90584 = O retorno do Id serviço não foi encontrado +90585 = O valor de data/hora não foi encontrado +90586 = O valor de data/hora não é válido +90587 = A ação de reetorno não é válida em XML +90588 = O Id do serviço não é válido +90589 = O Id do serviço não é válido (eliminado) +90590 = O Id do serviço não é válido para retorno de créditos +90591 = O valor dos créditos restante não é válido +90592 = O valor dos créditos usado não é válido +90593 = Serviço on demand não é válido +90594 = Serviço não é compatível com a instância +90595 = Nenhum pacotes para este serviço foi encontrado +90596 = Nenhum renovação para este serviço foi encontrado +90597 = O serviço não é on demand +90598 = O serviço não é on demand (eliminado) +90599 = Serviço/categoria não é válido +90600 = I/O erro contactando o url +90601 = Url exception +90602 = Resposta no texto/conteúdo não é válida (text/xml) +90603 = Resposta Null a partir de Servidor +90604 = JDOM Exclusão a partir de Servidor +90605 = XML não é válido a partir de Servidor +90606 = XML tag não é válido a partir de Servidor +90607 = Record de notificação não foi encontrado em la tabela +90608 = O código do Market ou Id não é válido para este instância +90609 = O código do Market e o Id não corresponde no mesmo market +90610 = Servidor ko http código resposta +90611 = Indefinido código de retorno e mensegem +90612 = Input XML requesta é null +90613 = Input XML requesta não é válida +90614 = Input XML requesta não é válida; FILTRO é vazio +90615 = Input XML requesta não é válida; MENESGEM é vazio +90616 = Input XML requesta não é válida; Instância-Código é obrigatório +90617 = Input XML requesta não é válida; Instância-Código não é válido +90620 = O canal do Mensagem Push não é válido +90621 = O canal do Mensagem Push não é válido (eliminado) +90622 = O canal do Mensagem Push não é gerido +90623 = O Mensagem Push é muito longo +90624 = O objetivo para instrução do Mensagem Push é null +90625 = O objetivo para instrução do Mensagem Push não é válido +90626 = O Id da galeria não é válido +90627 = Input XML requesta não é válido; BODY é null +90629 = Input XML requesta não é válido; FILTRO é inconsistente +90629 = Push, certificado ficheiro não foi encontrado +90630 = Mensagem Push não foi encontrado em database +90631 = Canal Push não foi configurado +90632 = Configuração do canal push não é válida +90633 = Erro na configuração do canal push +90634 = Processador Push não foi encontrado para categoria do canal +90635 = O mensagem de retorno não é válido +90636 = Umo ou mais comandos Push não é válido, controle XML +90637 = Umo ou mais tópico não é válido, controle comando XML +90638 = Tópico obrigatório não foi encontrado, controle comando XML +90639 = Muitos comandos encontrado na lista +90640 = Google auth key null ou não é válida +90650 = Um Ip só em resposta no header +90651 = Ficheiro GeoIp dados não foi encontrado +90652 = O IP é obrigatório +90653 = O IP não é válido +90654 = GeoIp locadores é null +90656 = GeoIp locais é null +90657 = GeoIp método não é válido +90720 = A ação Push não é válido +90721 = O dispositivo não é registrado para o serviço push, a operação de atualização não é válida +90723 = O dispositivo não é registrado para o serviço push (eliminado), a operação de atualização não é válida +90730 = O usuário do provider não é válido, controle a configuração da instância ou adiciona um parâmetro call +90731 = O usuário do provider não é válido (eliminado), controle a configuração da instância +90732 = O usuário do provider MyDesktopMate não é válido +90733 = O usuário do provider MyDesktopMate não é válido (eliminado) +90734 = O usuário do dispositivo não é válido (database corrupto) +90735 = O usuário do provider não foi encontrado, controle o parâmetro do URL ou a configuração do servidor +90736 = O usuário do provider não é válido, controlle o parâmetro do call ou a configuração do servidor +90740 = Requesta de exportar é expirada +90741 = Exportar o ticket ligado não foi encontrado +90742 = Ficheiro para exportar não foi encontrado +90748 = O token da sessão não é válido (muito curto, min 10) +90749 = O token da sessão não é válido (muito longo, max 32 ) +90750 = O token da sessão não é válido (não foi encontrado) +90751 = O código do evento não é válido +90800 = O método HTTP GET method GET não é suportado para este URL +90801 = Especificar uma instrução valida em requesta de chamada +90802 = A instrução em requesta de chamada não é válida +90803 = Diferença entre o valor do header e query para a instrução +90804 = A classe requesta não foi encontrada +90805 = A classe resposta não foi encontrada +90806 = Erro interno, uma classe não suportada em método +90807 = Erro interno, tipo classe não suportado +90808 = Exclusão interna de segurancia +90809 = Erro interno, o método não foi encontrado +90810 = Erro interno, erro de instanciação da classe +90811 = Erro interno, o acesso pela classe é ilegal +90812 = Erro interno, o tipo de array em método não é suportado +90813 = Erro interno, tipo classe do array não é suportado +90814 = O valor não é válido, cast exclusão +90817 = Erro abrendo servlet print writer +90818 = Erro abrendo servlet output stream +90819 = Erro na leitura de input stream +90820 = Uma resposta Null não é um resposta válida +90821 = Resposta class não corresponde +90830 = Sincronização com servidor em progreso, tente mais tarde +90831 = Sincronização com servidor em progresos (superadmin), tente mais tarde +90840 = O valor para 'viewsize' não é válido: usar LARGURAxLONGURA +90841 = Requesta tipo Imagem não é válida +90842 = Requesta tipo Imagem não é válida +90850 = Cliente/Instância sem correspondencia +90851 = Erro dados, nenhum idioma foi encontrado para este cliente +90852 = Erro dados, nenhum idioma foi encontrado para esta instância +90853 = Erro dados, nenhum tecnologia foi encontrada +90854 = Erro dados, nenhum área foi encontrada +90855 = O cliente objetivo ja existe +90856 = O cliente objetivo ja existe (eliminado) +90857 = A instância objetivo ja existe +90858 = A instância objetivo ja existe (eliminado) +90859 = Objetivo, idioma cliente não é válido +90860 = Objetivo, idioma instância não é válido +90861 = Objetivo, a technologia não é válida +90862 = Objetivo, a área não é válida +90863 = Muitos records +90864 = Erro comparar fonte/objetivo record +90865 = A lista da Fonte e do Objetivo é vazia +90866 = O grupo de destino ja existe +90970 = Aplicação bloqueado para este dispositivo +90980 = Erro interno, a requesta precisa ser implementada para completar a operação +90981 = A Classe não é gerida a partir do database +90982 = O campo do Database não é mapeados +90983 = Erro interno, a requesta é null +90984 = A fase requesta é null +90985 = A fase requesta não é válida +90986 = MultipartFormData requesta não é válida +90987 = MultipartFormData requesta erro carregamento +90988 = A requesta não é válida MultipartFormData +90989 = A Classe não é gerida a partir do database no campo valor +90990 = Exclusão serveridor SQL (timeout) +90991 = Erro interno do servidor +90992 = Exclusão do Servidor manager +90993 = Problema contactando o servidor +90994 = Exclusão servidor SQL +90995 = Exclusão inesperada +90996 = O Serviço não é ativo +90997 = Sessão null ou não é válida +90998 = Requesta não é válida +90999 = Resposta não é válida + +50001 = A Requesta XML não é válida: 'type' desconhecido +50002 = A Requesta XML não é válida, verificar XML +50003 = A Requesta XML não é válida, adicionar 'registration' em XML +50010 = Erro interno do servidor +50011 = Erro interno do servidor (inesperada) +50012 = Erro interno do servidor (database) +50020 = Master estado operation lista: 'statement' desconhecido +50021 = Master estado: node info é null +50101 = Adiante XML requesta é null +50103 = Adiante XML resposta é null + +80100 = SSO provider não é configurado +80101 = SSO provider client configuração não é válida +80102 = SSO provider client configuração com erro +80110 = SSO mobile client não é configurado +80111 = SSO mobile client configuração não é válida +80112 = SSO mobile client configuração com erro +80120 = SSO erro +80121 = SSO login erro +80122 = SSO logout erro +80123 = SSO mudar senha erro +80124 = SSO pegar token info erro +80125 = SSO pegar usuário info erro +80126 = Credenciais com erro + +80400 = Casal assinatura/renovação não foi encontrado +80401 = Renovação não foi encontrado para a Renovação requesta +80402 = Uma-vez código não foi encontrado para a Renovação requesta +80403 = Uma-vez código ja foi usado para a Renovação requesta +80404 = DesktopMate ativação não foi encontrado +80405 = IMEI código não tem correspondencia +80406 = Código do Renovação não tem correspondencia +80407 = O valor não é válido para o campo 'status', aceitou 'OK','BURN' +80408 = A Renovaçãonão não é válida, a instância não tem correspondencia + +91000 = Phone Number not Valid +71001 = Date Missing or invalid +71002 = Km Useful is a mandatory field +71003 = Km Useless is a mandatory field +71004 = Km Out Threshold is a mandatory field +71005 = Type is a mandatory field +71008 = Session Token is Invalid + +0 = Ok +# 0 = Ok, ja notificado +# 0 = Os dados não foi encontrados diff --git a/src/it/softecspa/fileproxy/util/ArrayCopy.java b/src/it/softecspa/fileproxy/util/ArrayCopy.java new file mode 100644 index 0000000..1ba1b77 --- /dev/null +++ b/src/it/softecspa/fileproxy/util/ArrayCopy.java @@ -0,0 +1,43 @@ +package it.softecspa.fileproxy.util; + +import java.lang.reflect.Array; + +import org.apache.log4j.Logger; + +public class ArrayCopy { + + private static Logger log = Logger.getLogger(ArrayCopy.class); + + + /** + * Concateno tutti i parametrie estratti + * @param list + * @return + */ + public static K[] buildAll(Class clazz, K[] ... list) { + if (list==null) return null; + if (list.length==1) return list[0]; + if (log.isDebugEnabled()) log.debug("Build unique service list from "+list.length+" sublist: class "+clazz.getName()); + + int l=0; + for (K[] element : list) { + if (element==null) continue; + l += element.length; + } + + if (log.isDebugEnabled()) log.debug("Build new list of "+l+" elements"); + @SuppressWarnings("unchecked") + K[] services = (K[]) Array.newInstance(clazz, l) ; + + + int start = 0; + for (K[] element : list) { + if (element==null) continue; + System.arraycopy(element, 0, services, start, element.length); + start += element.length; + } + + return services; + } + +} diff --git a/src/it/softecspa/fileproxy/util/Convert.java b/src/it/softecspa/fileproxy/util/Convert.java new file mode 100644 index 0000000..09b8889 --- /dev/null +++ b/src/it/softecspa/fileproxy/util/Convert.java @@ -0,0 +1,95 @@ +package it.softecspa.fileproxy.util; + +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +import java.math.BigDecimal; + +/** + * Classe per la conversione dei tipi da e verso le chiamta webservice + * + * @author m.veroni * + */ +public class Convert { + + public static Integer toInteger(String value) { + if (XString.isNotBlankNull(value)) + return new Integer(value); + return null; + } + + public static String toString(Integer value) { + if (value != null) + return value.toString(); + return null; + } + + public static int toIntValue(String value) { + if (XString.isNotBlankNull(value)) + return new Integer(value).intValue(); + return 0; + } + + public static String toString(int value) { + return "" + value; + } + + public static Long toLong(String value) { + if (XString.isNotBlankNull(value)) + return new Long(value); + return null; + } + + public static String toString(Long value) { + if (value != null) + return value.toString(); + return null; + } + + public static long toLongValue(String value) { + if (XString.isNotBlankNull(value)) + return new Long(value).longValue(); + return 0; + } + + public static String toString(long value) { + return "" + value; + } + + public static BigDecimal toBigDecimal(String value) { + if (XString.isNotBlankNull(value)) + return new BigDecimal(value); + return null; + } + + public static String toString(BigDecimal value) { + if (value != null) + return value.toString(); + return null; + } + + + /** + * @deprecated + * @param value + * @return + * @throws Exception + */ + public static EnterpriseCalendar toEnterpriseCalendar(String value) throws Exception { + if (XString.isNotBlankNull(value)) return new EnterpriseCalendar(value, EnterpriseCalendar.PATTERNS_UTC); + return null; + } + + + public static String toString(EnterpriseCalendar value) { + if (value != null) + return value.format(EnterpriseCalendar.PATTERN_UTC_ZULU); + return null; + } + + public static String cdata(String value) { + if (XString.isNotBlankNull(value)) return ""; + return ""; + } + +} diff --git a/src/it/softecspa/fileproxy/util/If.java b/src/it/softecspa/fileproxy/util/If.java new file mode 100644 index 0000000..278e317 --- /dev/null +++ b/src/it/softecspa/fileproxy/util/If.java @@ -0,0 +1,74 @@ +package it.softecspa.fileproxy.util; + +import it.softecspa.kahuna.lang.XString; +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; + +/** + * Classe di utilità spicciola + * @author m.veroni + */ +public class If { + + public static Integer notNull(Integer check, Integer value) { + if (check!=null) return check; + return value; + } + + /** + * @deprecated + */ + public static Integer notNull(Integer check) { + return notNull(check, (Integer)null); + } + + + + public static String notNull(String check, String value) { + if (XString.isNotBlankNullTrim(check)) return check; + return value; + } + + /** + * @deprecated + */ + public static String notNull(String check) { + return notNull(check, (String)null); + } + + + public static EnterpriseCalendar notNull(EnterpriseCalendar check, EnterpriseCalendar value) { + if (check!=null) return check; + return null; + } + + /** + * @deprecated + */ + public static EnterpriseCalendar notNull(EnterpriseCalendar check) { + return notNull(check, (EnterpriseCalendar)null); + } + + public static String notNull(Object check, String value) { + if (check!=null) return check.toString(); + return value; + } + + /** + * @deprecated + */ + public static String notNull(Object check) { + return notNull(check, (String)null); + } + + + public static boolean notNull(Boolean check, boolean value) { + if (check!=null) return check.booleanValue(); + return value; + } + + public static boolean notNull(Boolean check) { + return notNull(check, false); + } + + +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/util/ImageBase64Manager.java b/src/it/softecspa/fileproxy/util/ImageBase64Manager.java new file mode 100644 index 0000000..f296317 --- /dev/null +++ b/src/it/softecspa/fileproxy/util/ImageBase64Manager.java @@ -0,0 +1,81 @@ +package it.softecspa.fileproxy.util; + +import java.awt.image.BufferedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +public class ImageBase64Manager { + + /** + * Decode string to image + * @param imageString The string to decode + * @return decoded image + */ + public static BufferedImage decodeToImage(String imageString) { + + BufferedImage image = null; + byte[] imageByte; + try { + BASE64Decoder decoder = new BASE64Decoder(); + imageByte = decoder.decodeBuffer(imageString); + ByteArrayInputStream bis = new ByteArrayInputStream(imageByte); + image = ImageIO.read(bis); + bis.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return image; + } + + /** + * Encode image to string + * @param image The image to encode + * @param type jpeg, bmp, ... + * @return encoded string + * @throws IOException + */ + public static String encodeToString(BufferedImage image, String type) throws IOException { + ByteArrayOutputStream bos = null; + + try { + bos = new ByteArrayOutputStream(); + ImageIO.write(image, type, bos); + byte[] imageBytes = bos.toByteArray(); + + BASE64Encoder encoder = new BASE64Encoder(); + return encoder.encode(imageBytes); + + } catch (IOException e) { + throw e; + } finally { + if (bos!=null) { + try { + bos.close(); + } catch (IOException e) { + /* Nessuna oparazione */ + } + } + } + + } + + /* + public static void main (String args[]) throws IOException { + // Test image to string and string to image start * + BufferedImage img = ImageIO.read(new File("files/img/TestImage.png")); + BufferedImage newImg; + String imgstr; + imgstr = encodeToString(img, "png"); + System.out.println(imgstr); + newImg = decodeToImage(imgstr); + ImageIO.write(newImg, "png", new File("files/img/CopyOfTestImage.png")); + // Test image to string and string to image finish + } + */ +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/util/ImageResizer.java b/src/it/softecspa/fileproxy/util/ImageResizer.java new file mode 100644 index 0000000..f954390 --- /dev/null +++ b/src/it/softecspa/fileproxy/util/ImageResizer.java @@ -0,0 +1,148 @@ +package it.softecspa.fileproxy.util; + +import it.softecspa.fileproxy.services.common.ManagerException; +import it.softecspa.kahuna.io.File; + +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.io.IOException; + +import javax.imageio.ImageIO; + +public class ImageResizer { + + + private File source; + private BufferedImage original; + private int type; + + private BufferedImage modified; + + + public ImageResizer(String source) { + this.source = new File(source); + } + + public ImageResizer(java.io.File source) { + if (source instanceof File) { + this.source = (File)source; + return; + } + this.source = new File(source); + } + + + + public void read() throws ManagerException { + try { + original = ImageIO.read(source); + } catch (IOException e) { + throw new ManagerException("IOException reading file '"+source.getAbsolutePath()+"'", e); + } + + //type = (original.getType()==0?BufferedImage.TYPE_INT_ARGB:original.getType()); + type = (original.getTransparency() == Transparency.OPAQUE) ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; + + } + + + public BufferedImage getOriginal() { + return original; + } + + + public int getType() { + return type; + } + + public void resize(int width, int height) { + this.modified = resizeImage(original, type, width, height); + } + + public void resizeWithHint(int width, int height, boolean higherQuality) { + this.modified = resizeImageWithHints(original, type, width, height, higherQuality); + } + + + public void overwrite() throws ManagerException { + write(source); + } + + + public void write(java.io.File target) throws ManagerException { + File newfile = (target instanceof File)?new File(target):(File)target; + try { + ImageIO.write(modified, newfile.getExtension(), newfile); + } catch (IOException e) { + throw new ManagerException("Error writing file '"+newfile.getAbsolutePath()+"'"); + } + } + + + + private BufferedImage resizeImage(BufferedImage originalImage, int type, int width, int height) { + BufferedImage resizedImage = new BufferedImage(width, height, type); + + Graphics2D g = resizedImage.createGraphics(); + g.drawImage(originalImage, 0, 0, width, height, null); + g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g.dispose(); + + return resizedImage; + } + + + private BufferedImage resizeImageWithHints(BufferedImage originalImage, int type, int targetWidth, int targetHeight, boolean higherQuality) { + + // Vedi http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html + + BufferedImage resizedImage = (BufferedImage) originalImage; + + int w, h; + if (higherQuality) { + // Use multi-step technique: start with original size, then + // scale down in multiple passes with drawImage() + // until the target size is reached + w = originalImage.getWidth(); + h = originalImage.getHeight(); + } else { + // Use one-step technique: scale directly from original + // size to target size with a single drawImage() call + w = targetWidth; + h = targetHeight; + } + + do { + if (higherQuality && w > targetWidth) { + w /= 2; + if (w < targetWidth) { + w = targetWidth; + } + } + + if (higherQuality && h > targetHeight) { + h /= 2; + if (h < targetHeight) { + h = targetHeight; + } + } + + BufferedImage tmp = new BufferedImage(w, h, type); + Graphics2D g2 = tmp.createGraphics(); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g2.drawImage(resizedImage, 0, 0, w, h, null); + g2.dispose(); + + resizedImage = tmp; + + } while (w != targetWidth || h != targetHeight); + + return resizedImage; + + } + + + +} diff --git a/src/it/softecspa/fileproxy/util/Size.java b/src/it/softecspa/fileproxy/util/Size.java new file mode 100644 index 0000000..92e1bdd --- /dev/null +++ b/src/it/softecspa/fileproxy/util/Size.java @@ -0,0 +1,39 @@ +package it.softecspa.fileproxy.util; + +import it.softecspa.fileproxy.services.common.CheckerException; +import it.softecspa.fileproxy.services.common.ResponseOutcome; +import it.softecspa.kahuna.lang.XString; + +public class Size { + + public int width; + public int height; + + public Size(String dimensioni) throws CheckerException { + if (XString.isBlankNullTrim(dimensioni)) { + throw new CheckerException(ResponseOutcome.VIEWSIZE_NO_VALID_VALUE); + } + + dimensioni = dimensioni.toLowerCase(); // normalizzazione + String[] wxh = dimensioni.split("x"); + if (wxh.length != 2) { + throw new CheckerException(ResponseOutcome.VIEWSIZE_NO_VALID_VALUE); + } + + try { + this.width = Integer.parseInt(wxh[0]); + this.height = Integer.parseInt(wxh[1]); + } catch (NumberFormatException e) { + throw new CheckerException(ResponseOutcome.VIEWSIZE_NO_VALID_VALUE, e.toString()); + } + } + + public Size(int width, int height) { + this.width = width; + this.height = height; + } + + public String toString() { + return width + "x" + height; + } +} \ No newline at end of file diff --git a/src/it/softecspa/fileproxy/util/VersionComparator.java b/src/it/softecspa/fileproxy/util/VersionComparator.java new file mode 100644 index 0000000..3a8d1cf --- /dev/null +++ b/src/it/softecspa/fileproxy/util/VersionComparator.java @@ -0,0 +1,98 @@ +package it.softecspa.fileproxy.util; + +import it.softecspa.kahuna.lang.XString; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; + +public class VersionComparator { + + private Logger log = Logger.getLogger(getClass()); + private Integer normalized; + + + public VersionComparator(String version) { + normalized = normalize(version); + if (normalized==null) throw new NullPointerException(); + } + + + private Integer normalize(String appVersion) { + if (XString.isBlankNullTrim(appVersion)) return null; + + String v = null; + try { + Pattern pattern = Pattern.compile("\\d+[\\.\\d+]+"); + Matcher matcher = pattern.matcher(appVersion); + + if (matcher.find()) { + v = matcher.group(0); + if (log.isDebugEnabled()) log.debug("Match pattern find record: '"+v+"'"); + } + } catch (Exception e) { + log.warn("Error match patter in check version"); + v = appVersion; + } + + if (v==null) return null; + return build(v); + } + + + private Integer build(String v) { + String[] s = v.split("\\."); + if (s.length==0) return null; + int device_version=0; + try { + if (s.length==3) { + device_version = (((Integer.parseInt(s[0])*1000) + Integer.parseInt(s[1]))*1000) + Integer.parseInt(s[2]); + } else if (s.length==2) { + device_version = (((Integer.parseInt(s[0])*1000) + Integer.parseInt(s[1]))*1000); + } else if (s.length==1) { + device_version = ((Integer.parseInt(s[0])*1000)*1000); + } else if (s.length>3) { + device_version = (((Integer.parseInt(s[0])*1000) + Integer.parseInt(s[1]))*1000) + Integer.parseInt(s[2]); + } + } catch (NumberFormatException e) { + log.error("NumberFormatException splitting version number: '"+v+"'"); + return null; + } + return device_version; + } + + private Integer build(int m, int s, int r) { + return new Integer((((m*1000) + s)*1000) + r); + } + + + + public boolean greaterThan(int m, int s, int r) { + return (normalized>build(m,s,r)); + } + + public boolean greaterThan(String version) { + if (version==null) throw new NullPointerException(); + return (normalized>normalize(version)); + } + + public boolean greaterThan(VersionComparator version) { + return (normalized>version.normalized); + } + + + public boolean greaterThanOrEqual(int m, int s, int r) { + return (normalized>=build(m,s,r)); + } + + public boolean greaterThanOrEqual(String version) { + if (version==null) throw new NullPointerException(); + return (normalized>=normalize(version)); + } + + public boolean greaterThanOrEqual(VersionComparator version) { + return (normalized>=version.normalized); + } + +} diff --git a/src/it/softecspa/portal/InitWebApp.java b/src/it/softecspa/portal/InitWebApp.java new file mode 100644 index 0000000..d5da44f --- /dev/null +++ b/src/it/softecspa/portal/InitWebApp.java @@ -0,0 +1,125 @@ +package it.softecspa.portal; + +import it.softecspa.fileproxy.DatabaseBalancer; +import it.softecspa.fileproxy.services.ClusterSynchronizer; +import it.softecspa.fileproxy.services.ServerCacheFactory; +import it.softecspa.mvc.WebApp; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +import org.apache.log4j.Logger; + + + +/** + * Classe di visibilità ed utilità generale per tutta la initWebApp + */ +@SuppressWarnings("serial") +public class InitWebApp extends WebApp { + + + + public void init(ServletConfig config) throws ServletException { + super.init(config); + try { + + log.info("WebApp. Initialization with InitWebApp."); + + //...inserire qui il codice di configurazione custom dell'applicazione! + + + /* + * 1) Chiamata utilizzata soltanto per caricare il singleton + * Bilanciatore database + * Sono bufferizzate le connessioni ai database MASTER e STAGE + * sia in lettura/scrittura che in sola lettura + * + * - Questo servizio dipende da DatabaseManager + */ + if (log.isDebugEnabled()) log.debug("Create instance of " + DatabaseBalancer.class + " service"); + DatabaseBalancer databaseBalancer = DatabaseBalancer.getInstance(); + + + /* + * 2) Chiamata utilizzata soltanto per caricare il singleton + * Caricamento delle strutture dati in cache + * + * - Questo servizio dipende da DatabaseBalancer + */ + if (databaseBalancer.isActive()) { + if (log.isDebugEnabled()) log.debug("Create instance of " + ServerCacheFactory.class + " service"); + ServerCacheFactory.getInstance(); + } + + + + /* + * 3) Chiamata utilizzata per caricare il singleton ed effettuare la prima registrazione + * Gestore cluster + * Il sistema registra se stesso nel "registro" dei cluster + * e attiva il thread "HeartBeat" + * + * - Questo servizio dipende da DatabaseBalancer + */ + if (databaseBalancer.isActive()) { + if (log.isDebugEnabled()) log.debug("Create instance of " + ClusterSynchronizer.class + " service"); + ClusterSynchronizer.getInstance().init(); + } + + + + + // ------------------------------------------------------------------------ + // Tracciamento dei riavvi dei nodi su log specifico, DESTROY + traceReload("PUBLISH"); + // ------------------------------------------------------------------------ + + + + + + + // ------------------------------------------------------------------------------------------------- + log.info("WebApp. Initialization completed with success."); + } catch (Exception e) { + log.error("ERROR: Impossibile to complete WebApp initailization!",e); + } finally { + //log.info("--------------------------------------------------------------------------------"); + } + + } + + + + public void destroy() { + /* + ...inserire qui il codice custom + */ + try { + ClusterSynchronizer.getInstance().endLife(); + } catch (Exception e) { + log.error("Error write end life",e); + } + + // ------------------------------------------------------------------------ + // Tracciamento dei riavvi dei nodi su log specifico, DESTROY + traceReload("DESTROY"); + // ------------------------------------------------------------------------ + + super.destroy(); + } + + + private void traceReload(String status) { + // ------------------------------------------------------------------------ + // Tracciamento dei riavvi dei nodi su log specifico, DESTROY + Parameters parameters = Parameters.getInstance(); + Version versione = Version.getInstance(); + String installation = parameters.get(Parameters.APPLICATION_ENVIRONMENT); + String hostname = ApplicationClusterInfo.getInstance().getHostNameAddress(); + Logger.getLogger("reload").info(parameters.getChannelInfo().getApplicationTitle() +" "+ status + " - Versione " + versione.toString() + " (" + installation + ")" + (hostname != null ? " on host " + hostname : "")); + // ------------------------------------------------------------------------ + } + +} diff --git a/src/it/softecspa/portal/filters/DayReportFilter.java b/src/it/softecspa/portal/filters/DayReportFilter.java new file mode 100644 index 0000000..5b3aa5a --- /dev/null +++ b/src/it/softecspa/portal/filters/DayReportFilter.java @@ -0,0 +1,62 @@ +package it.softecspa.portal.filters; + +import it.softecspa.kahuna.lang.XString; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public class DayReportFilter implements Filter { + + private Logger log = Logger.getLogger(getClass()); + private final String FILTER = "/dailyreport"; + + @Override + public void init(FilterConfig config) throws ServletException { + // + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException { + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + // NO-CACHE + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. + response.setHeader("Pragma", "no-cache"); // HTTP 1.0. + response.setDateHeader("Expires", 0); // Proxies. + // + String requestURI = request.getRequestURI(); + int i = requestURI.indexOf(FILTER); + if (i>=0) { + + String appo = requestURI.substring(i+FILTER.length()); + if (appo.startsWith("/")) appo = appo.substring(1); + if (appo.startsWith("?")) appo = appo.substring(1); + if (!"".equals(appo) && !appo.startsWith("&")) appo = "&" + appo; + + String newURI = "/portal-service-guest/statement?daily-report&noMail=1" + appo; + if (XString.isNotBlankNull(request.getQueryString())) { + newURI += "&" + request.getQueryString(); + } + + if (log.isDebugEnabled()) log.debug("Filter url '"+requestURI+"', forward to '"+newURI+"'"); + req.getRequestDispatcher(newURI).forward(req, res); + } else { + chain.doFilter(req, res); + } + } + + @Override + public void destroy() { + // + } +} \ No newline at end of file diff --git a/src/it/softecspa/portal/filters/ShareFilter.java b/src/it/softecspa/portal/filters/ShareFilter.java new file mode 100644 index 0000000..005aa8e --- /dev/null +++ b/src/it/softecspa/portal/filters/ShareFilter.java @@ -0,0 +1,104 @@ +package it.softecspa.portal.filters; + +import it.softecspa.kahuna.lang.XString; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public class ShareFilter implements Filter { + + private Logger log = Logger.getLogger(getClass()); + private final String FILTER_SHARE = "/share/"; + private final String FILTER_SHARE_FRAME = "/share/frame/"; + private final String FILTER_INCLUDE = "/share/include/"; + + public static String SID = "sid"; + public static String UID = "uid"; + public static String SESSIONID = "t"; + public static String INSTANCE = "i"; + public static String GROUP = "g"; + public static String CONFIG = "c"; + public static String FRAME = "f"; + public static String DEVICE = "d"; + + + + @Override + public void init(FilterConfig config) throws ServletException { + // + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException { + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + // NO-CACHE + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. + response.setHeader("Pragma", "no-cache"); // HTTP 1.0. + response.setDateHeader("Expires", 0); // Proxies. + // + String requestURI = request.getRequestURI(); + + // Pagina 3 - pagina con IFRAME + int i = requestURI.indexOf(FILTER_INCLUDE); + if (i>=0) { + String uid = requestURI.substring(i+FILTER_INCLUDE.length()); + + String newURI = "/dmshare/include.jsp?" + UID + "=" + uid; + if (XString.isNotBlankNull(request.getQueryString())) { + newURI += "&" + request.getQueryString(); + } + if (log.isDebugEnabled()) log.debug("Filter url '"+requestURI+"' with frame, forward to '"+newURI+"'"); + req.getRequestDispatcher(newURI).forward(req, res); + return; + } + + // Pagina 2 - pagina con IFRAME + i = requestURI.indexOf(FILTER_SHARE_FRAME); + if (i>=0) { + String uid = requestURI.substring(i+FILTER_SHARE_FRAME.length()); + + String newURI = "/dmshare/index.jsp?" + UID + "=" + uid + "&" +FRAME + "=1"; + if (XString.isNotBlankNull(request.getQueryString())) { + newURI += "&" + request.getQueryString(); + } + if (log.isDebugEnabled()) log.debug("Filter url '"+requestURI+"' with frame, forward to '"+newURI+"'"); + req.getRequestDispatcher(newURI).forward(req, res); + return; + } + + // Pagina 1 - pagina standard + i = requestURI.indexOf(FILTER_SHARE); + if (i>=0) { + String uid = requestURI.substring(i+FILTER_SHARE.length()); + + String newURI = "/dmshare/index.jsp?" + UID + "=" + uid; + if (XString.isNotBlankNull(request.getQueryString())) { + newURI += "&" + request.getQueryString(); + } + if (log.isDebugEnabled()) log.debug("Filter url '"+requestURI+"', forward to '"+newURI+"'"); + req.getRequestDispatcher(newURI).forward(req, res); + return; + } + + + + // ..sessun match! + chain.doFilter(req, res); + } + + @Override + public void destroy() { + // + } +} \ No newline at end of file diff --git a/src/it/softecspa/portal/filters/StoreFilter.java b/src/it/softecspa/portal/filters/StoreFilter.java new file mode 100644 index 0000000..4cf8495 --- /dev/null +++ b/src/it/softecspa/portal/filters/StoreFilter.java @@ -0,0 +1,80 @@ +package it.softecspa.portal.filters; + +import it.softecspa.kahuna.lang.XString; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public class StoreFilter implements Filter { + + private Logger log = Logger.getLogger(getClass()); + private final String FILTER = "/store/"; + + @Override + public void init(FilterConfig config) throws ServletException { + // + } + + @Override + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException { + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + // NO-CACHE + response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. + response.setHeader("Pragma", "no-cache"); // HTTP 1.0. + response.setDateHeader("Expires", 0); // Proxies. + // + String requestURI = request.getRequestURI(); + int i = requestURI.indexOf(FILTER); + if (i<0) { + chain.doFilter(req, res); + return; + } + if (requestURI.endsWith(FILTER)) { + // FIXME mica ci passa mai di qui!!!!! + // ...questo per accettare anche l'indirizzo con / + req.getRequestDispatcher("/store").forward(req, res); + return; + } + + + /* + * TODO + * aggiungre lettura filtri ?auto + * da passare quando il download avviene da un servizio + * + * tramutare tutti i ? in & + * + * in caso di mancanza del parametro il sistema verifica se: + * 1) andare ugualmente a diritto + * 2) richiedere password specifica + * 3) richiedere autenticazione SSO + * + * + */ + + String newURI = "/dmstore/target.jsp?path=" + requestURI.substring(i+FILTER.length()); + if (XString.isNotBlankNull(request.getQueryString())) { + newURI += "&" + request.getQueryString(); + } + + if (log.isDebugEnabled()) log.debug("Filter url '"+requestURI+"', forward to '"+newURI+"'"); + req.getRequestDispatcher(newURI).forward(req, res); + + } + + @Override + public void destroy() { + // + } +} \ No newline at end of file diff --git a/src/it/softecspa/portal/processRequest/HttpHeader.java b/src/it/softecspa/portal/processRequest/HttpHeader.java new file mode 100644 index 0000000..80225ed --- /dev/null +++ b/src/it/softecspa/portal/processRequest/HttpHeader.java @@ -0,0 +1,11 @@ +package it.softecspa.portal.processRequest; + +public class HttpHeader { + + public final static String RESULT = "dm-result"; + public final static String MESSAGE = "dm-message"; + + public final static String PUBLISH_WIP = "dm-publish-wip"; + public final static String ROLLBACK_WIP = "dm-rollback-wip"; + +} diff --git a/src/it/softecspa/portal/processRequest/xml/request/master/NodeInfo.java b/src/it/softecspa/portal/processRequest/xml/request/master/NodeInfo.java new file mode 100644 index 0000000..5f8294a --- /dev/null +++ b/src/it/softecspa/portal/processRequest/xml/request/master/NodeInfo.java @@ -0,0 +1,174 @@ +package it.softecspa.portal.processRequest.xml.request.master; + +import it.softecspa.kahuna.util.calendar.EnterpriseCalendar; +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlElement; + + +public class NodeInfo extends XmlElement { + + private String hostname; + private String context; + private String address; + private String url; + private String dm_version; + private String java_version; + private String os_version; + + private String username; + private String password; + + private EnterpriseCalendar start; + private EnterpriseCalendar beat; + private EnterpriseCalendar stop; + private Integer beat_delay; + + + + public NodeInfo() { + super("node-info"); + } + + + public String getHostname() { + return hostname; + } + + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + + public String getContext() { + return context; + } + + + public void setContext(String context) { + this.context = context; + } + + + public String getAddress() { + return address; + } + + + public void setAddress(String address) { + this.address = address; + } + + + public String getUsername() { + return username; + } + + + public void setUsername(String username) { + this.username = username; + } + + + public String getPassword() { + return password; + } + + + public void setPassword(String password) { + this.password = password; + } + + + public EnterpriseCalendar getStart() { + return start; + } + + + public void setStart(EnterpriseCalendar start) { + this.start = start; + } + + + public EnterpriseCalendar getBeat() { + return beat; + } + + + public void setBeat(EnterpriseCalendar beat) { + this.beat = beat; + } + + + public EnterpriseCalendar getStop() { + return stop; + } + + + public void setStop(EnterpriseCalendar stop) { + this.stop = stop; + } + + + public String getUrl() { + return url; + } + + + public void setUrl(String url) { + this.url = url; + } + + + public String getDm_version() { + return dm_version; + } + + + public void setDm_version(String dmVersion) { + dm_version = dmVersion; + } + + + public String getJava_version() { + return java_version; + } + + + public void setJava_version(String javaVersion) { + java_version = javaVersion; + } + + + public String getOs_version() { + return os_version; + } + + + public void setOs_version(String osVersion) { + os_version = osVersion; + } + + + public Integer getBeat_delay() { + return beat_delay; + } + + + public void setBeat_delay(Integer beatDelay) { + beat_delay = beatDelay; + } + + + @Override + public void parse(NodeElement father) throws XmlParserException { + // TODO elemento non utilizzato, da utilizzare, introdotto con nuova versione della classe + } + + + + + + +} diff --git a/src/it/softecspa/portal/processRequest/xml/request/master/NodeNotify.java b/src/it/softecspa/portal/processRequest/xml/request/master/NodeNotify.java new file mode 100644 index 0000000..b85bbbb --- /dev/null +++ b/src/it/softecspa/portal/processRequest/xml/request/master/NodeNotify.java @@ -0,0 +1,53 @@ +package it.softecspa.portal.processRequest.xml.request.master; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlRoot; + + +public class NodeNotify extends XmlRoot { + + private String action; + private NodeInfo info; + + + public NodeNotify() { + super("node"); + } + + + public String getAction() { + return action; + } + + + public void setAction(String action) { + this.action = action; + } + + + public NodeInfo getInfo() { + return info; + } + + + public void setInfo(NodeInfo info) { + this.info = info; + } + + + @Override + public void parse(NodeElement father) throws XmlParserException { + // TODO elemento non utilizzato, da utilizzare, introdotto con nuova versione della classe + } + + + + + + + + + + +} diff --git a/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRegistration.java b/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRegistration.java new file mode 100644 index 0000000..4fb8a57 --- /dev/null +++ b/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRegistration.java @@ -0,0 +1,45 @@ +package it.softecspa.portal.processRequest.xml.request.mydm; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlElement; + + +public class MyDesktopmateRegistration extends XmlElement { + + private Integer id; + private Boolean stage; + + + public MyDesktopmateRegistration() { + super("registration"); + } + + + public Integer getId() { + return id; + } + + public void setId(Integer istance) { + this.id = istance; + } + + + public Boolean getStage() { + return stage; + } + + + public void setStage(Boolean stage) { + this.stage = stage; + } + + + @Override + public void parse(NodeElement father) throws XmlParserException { + // TODO elemento non utilizzato, da utilizzare, introdotto con nuova versione della classe + } + + + +} diff --git a/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRequest.java b/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRequest.java new file mode 100644 index 0000000..23a1e1f --- /dev/null +++ b/src/it/softecspa/portal/processRequest/xml/request/mydm/MyDesktopmateRequest.java @@ -0,0 +1,55 @@ +package it.softecspa.portal.processRequest.xml.request.mydm; + +import it.softecspa.kahuna.util.xml.NodeElement; +import it.softecspa.kahuna.util.xml.XmlParserException; +import it.softecspa.kahuna.util.xml.XmlList; +import it.softecspa.kahuna.util.xml.XmlRoot; + + +public class MyDesktopmateRequest extends XmlRoot { + + private String type; + private String language; + + private XmlList registrations; + + + public MyDesktopmateRequest() { + super("request"); + } + + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + public String getLanguage() { + return language; + } + + public void setLanguage(String value) { + this.language = (value!=null?value.toUpperCase():null); + } + + + public XmlList getRegistrations() { + return registrations; + } + + public void setRegistrations(XmlList registrations) { + this.registrations = registrations; + } + + + @Override + public void parse(NodeElement father) throws XmlParserException { + // TODO elemento non utilizzato, da utilizzare, introdotto con nuova versione della classe + } + + +} diff --git a/src/it/softecspa/portal/security/KeyStoreImpl.java b/src/it/softecspa/portal/security/KeyStoreImpl.java new file mode 100644 index 0000000..fe6ab3b --- /dev/null +++ b/src/it/softecspa/portal/security/KeyStoreImpl.java @@ -0,0 +1,44 @@ +package it.softecspa.portal.security; + + +import it.softecspa.mvc.businesslogic.KeyStore; + +import java.util.HashMap; + +/** + * E' il contenitore di chiavi cablate nell'applicazione. Da defaultImplementation + * Prevede che ci siano almeno due chiavi chiamate come segue: + *
    + *
  • chiaveCifraturaSimmetrica + *
  • chiaveCifraturaPassword + *
+ */ +public class KeyStoreImpl implements KeyStore { + + private HashMap keyStore = new HashMap(); + + /** + * Chiave di cifratura di dati (che arrivano da applicazioni esterne) + */ + private static final String chiaveCifraturaSimmetrica = "|||||||||||RIDEFINIRE||||||||||||"; + + /** + * Chiave di cifratura della password degli utenti + */ + private static final String chiaveCifraturaPassword = "|||||||||||RIDEFINIRE||||||||||||"; + + public KeyStoreImpl() { + keyStore.put(KeyStore.CHIAVE_SIMMETRICA_LABEL,chiaveCifraturaSimmetrica); + keyStore.put(KeyStore.CHIAVE_PASSWORD_LABEL,chiaveCifraturaPassword); + } + + /** + * @see it.softecspa.mvc.businesslogic.KeyStore#getKey(java.lang.String) + */ + public String getKey(String chiave) { + return (String)keyStore.get(chiave); + } + + + +} diff --git a/src/it/softecspa/portal/security/MyPolicy.java b/src/it/softecspa/portal/security/MyPolicy.java new file mode 100644 index 0000000..588b480 --- /dev/null +++ b/src/it/softecspa/portal/security/MyPolicy.java @@ -0,0 +1,29 @@ +package it.softecspa.portal.security; + +import it.softecspa.jwebber.CMSConstants; + + +public enum MyPolicy { + + ADMIN_AREA_ACCESS (CMSConstants.POLICY_ADMIN_AREA_ACCESS) // Amministrazione + ,CONTROL ("CONTROL") // Sistema di controllo + ,DOWNLOAD ("DOWNLOAD") // Ha la possibilità di scaricare applicazioni + ,DOWNLOAD_FULL ("DOWNLOAD_FULL") // Ha la possibilità di scaricare tutte le versioni + ,DEVELOP_1 ("DEVELOP_1") // Sviluppatore livello 1 (base) + ,DEVELOP_2 ("DEVELOP_2") // Sviluppatore livello 2 + ,DEVELOP_3 ("DEVELOP_3") // Sviluppatore livello 3 (senior) + ,SA ("SA") // Superamministratore + ; + + private String value; + + private MyPolicy(String value) { + this.value = value; + } + + public String toString() { + return value; + } + + +} diff --git a/src/it/softecspa/portal/version.xml b/src/it/softecspa/portal/version.xml new file mode 100644 index 0000000..1ba8484 --- /dev/null +++ b/src/it/softecspa/portal/version.xml @@ -0,0 +1,12 @@ + + + + Version information + + 1.0.0 + + 18 + 02/03/2010 09:37 + develop + + diff --git a/switch.xml b/switch.xml new file mode 100644 index 0000000..e87e8c4 --- /dev/null +++ b/switch.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Switch context.xml to ${param.title} + + + + + + + + context.xml from ${basedir}/conf/myMETA-INF/${param.source} + + + + + + + + + + Eclipse refresh in progress... + + + + Eclipse refreshed! + + + + Per funzionare deve essere impostato il seguente flag in + "External tool configuration" + JRE > Run in the same JRE as the + workspace + + + + + + + + + + + + + + Include ANT-contrib JAR + + + + + + + + + + + \ No newline at end of file -- libgit2 0.21.4