From 36579eb8fd59113a683c88939ce96e71041e4039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mat=C4=9Bj=C4=8Dek?= Date: Mon, 13 Mar 2023 17:52:32 +0100 Subject: [PATCH] EjbBundleDescriptorImpl cleanup - old deprecations, javadoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Unused methods removed - Used methods documented (at least minimal notes) - Deprecated XML nodes from GF 3.1 marked as deprecated and removed code which used them but was worthless. Now they should be just tolerated. Signed-off-by: David Matějček --- .../deployment/xml/RuntimeTagNames.java | 453 +++++++++--------- .../descriptor/EjbBundleDescriptorImpl.java | 427 ++++++++--------- .../IASPersistenceManagerDescriptor.java | 14 +- .../runtime/PersistenceManagerInUse.java | 2 + .../deployment/node/RelationshipsNode.java | 24 +- .../node/runtime/PMDescriptorNode.java | 10 +- .../node/runtime/PMDescriptorsNode.java | 40 +- .../deployment/node/runtime/PMInUseNode.java | 12 +- .../deployment/util/EjbBundleValidator.java | 3 +- .../util/InterceptorBindingTranslator.java | 228 +++------ .../descriptor/LocalStrings.properties | 1 - 11 files changed, 547 insertions(+), 667 deletions(-) diff --git a/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/xml/RuntimeTagNames.java b/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/xml/RuntimeTagNames.java index ea4f72a02a1d..bfeffdaa0851 100644 --- a/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/xml/RuntimeTagNames.java +++ b/appserver/deployment/dol/src/main/java/com/sun/enterprise/deployment/xml/RuntimeTagNames.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -17,40 +18,39 @@ package com.sun.enterprise.deployment.xml; /** - * I hold the tag names of the runtime binding information of a J2EE - * application. + * I hold the tag names of the runtime binding information of a Jakarta EE application. + * * @author Danny Coward */ - public interface RuntimeTagNames extends TagNames { - public final static String S1AS_EJB_RUNTIME_TAG = "sun-ejb-jar"; - public final static String S1AS_APPCLIENT_RUNTIME_TAG = "sun-application-client"; - public final static String S1AS_APPLICATION_RUNTIME_TAG = "sun-application"; - public final static String S1AS_WEB_RUNTIME_TAG = "sun-web-app"; - public final static String S1AS_CONNECTOR_RUNTIME_TAG = "sun-connector"; + String S1AS_EJB_RUNTIME_TAG = "sun-ejb-jar"; + String S1AS_APPCLIENT_RUNTIME_TAG = "sun-application-client"; + String S1AS_APPLICATION_RUNTIME_TAG = "sun-application"; + String S1AS_WEB_RUNTIME_TAG = "sun-web-app"; + String S1AS_CONNECTOR_RUNTIME_TAG = "sun-connector"; - public final static String WLS_EJB_RUNTIME_TAG = "weblogic-ejb-jar"; - public final static String WLS_APPCLIENT_RUNTIME_TAG = "weblogic-application-client"; - public final static String WLS_APPLICATION_RUNTIME_TAG = "weblogic-application"; - public final static String WLS_WEB_RUNTIME_TAG = "weblogic-web-app"; - public final static String WLS_CONNECTOR_RUNTIME_TAG = "weblogic-connector"; + String WLS_EJB_RUNTIME_TAG = "weblogic-ejb-jar"; + String WLS_APPCLIENT_RUNTIME_TAG = "weblogic-application-client"; + String WLS_APPLICATION_RUNTIME_TAG = "weblogic-application"; + String WLS_WEB_RUNTIME_TAG = "weblogic-web-app"; + String WLS_CONNECTOR_RUNTIME_TAG = "weblogic-connector"; - public final static String GF_EJB_RUNTIME_TAG = "glassfish-ejb-jar"; - public final static String GF_APPCLIENT_RUNTIME_TAG = "glassfish-application-client"; - public final static String GF_APPLICATION_RUNTIME_TAG = "glassfish-application"; - public final static String GF_WEB_RUNTIME_TAG = "glassfish-web-app"; + String GF_EJB_RUNTIME_TAG = "glassfish-ejb-jar"; + String GF_APPCLIENT_RUNTIME_TAG = "glassfish-application-client"; + String GF_APPLICATION_RUNTIME_TAG = "glassfish-application"; + String GF_WEB_RUNTIME_TAG = "glassfish-web-app"; String AS_CONTEXT = "as-context"; String AUTH_METHOD = "auth-method"; String CALLER_PROPAGATION = "caller-propagation"; String CONFIDENTIALITY = "confidentiality"; - public static final String DURABLE_SUBSCRIPTION = "jms-durable-subscription-name"; + String DURABLE_SUBSCRIPTION = "jms-durable-subscription-name"; String ESTABLISH_TRUST_IN_CLIENT = "establish-trust-in-client"; String ESTABLISH_TRUST_IN_TARGET = "establish-trust-in-target"; String INTEGRITY = "integrity"; String IOR_CONFIG = "ior-security-config"; - public static final String MDB_CONNECTION_FACTORY = "mdb-connection-factory"; + String MDB_CONNECTION_FACTORY = "mdb-connection-factory"; String MESSAGE_DESTINATION = "message-destination"; String MESSAGE_DESTINATION_NAME = "message-destination-name"; String REALM = "realm"; @@ -65,250 +65,257 @@ public interface RuntimeTagNames extends TagNames { String ACTIVATION_CONFIG_PROPERTY_NAME = "activation-config-property-name"; String ACTIVATION_CONFIG_PROPERTY_VALUE = "activation-config-property-value"; - public static final String APPLICATION_CLIENT = "app-client"; - public static final String CMP = "cmp"; - public static final String CMPRESOURCE = "cmpresource"; - public static final String DEFAULT_RESOURCE_PRINCIPAL = "default-resource-principal"; - public static final String DISPLAY_NAME = "display-name"; - public static final String EJB = "ejb"; - public static final String EJB_NAME = "ejb-name"; - public static final String EJB20_CMP = "ejb20-cmp"; - public static final String EJBS = "enterprise-beans"; - public static final String FIELD = "field"; - - public static final String GROUP = "group"; - public static final String GROUPS = "groups"; - public static final String JOIN_OBJECT = "join-object"; - public static final String JNDI_NAME = "jndi-name"; - public static final String LOCAL_PART = "localpart"; - public static final String MAIL_CONFIG = "mail-configuration"; - public static final String MAIL_FROM = "mail-from"; - public static final String MAIL_HOST = "mail-host"; - public static final String METHOD = "method"; - public static final String NAME = "name"; - public static final String NAMESPACE_URI = "namespace-uri"; - public static final String OPERATION = "operation"; - - public static final String PASSWORD = "password"; - public static final String PRINCIPALS = "principals"; - public static final String PRINCIPAL = "principal"; - public static final String REMOTE_ENTITY = "remote-entity"; - public static final String ROLE = "role"; - public static final String ROLE_MAPPING = "rolemapping"; - public static final String ROLE_ENTRY = "role"; - public static final String SERVER_NAME = "server-name"; - - public static final String SERVLET = "servlet"; - public static final String SERVLET_NAME = "servlet-name"; - public static final String SOURCE = "source"; - public static final String SINK = "sink"; - public static final String SQL = "sql"; - public static final String SQL_STATEMENT = "sql-statement"; - public static final String TABLE_CREATE = "table-create-sql"; - public static final String TABLE_REMOVE = "table-remove-sql"; - - - public static final String UNIQUE_ID = "unique-id"; - public static final String WEB = "web"; - public static final String WEB_SERVICE_ENDPOINT = "web-service-endpoint"; - - - public static final String EJB_IMPL = "ejb-impl"; - public static final String REMOTE_IMPL = "remote-impl"; - public static final String LOCAL_IMPL = "local-impl"; - public static final String REMOTE_HOME_IMPL = "remote-home-impl"; - public static final String LOCAL_HOME_IMPL = "local-home-impl"; - public static final String STATE_IMPL = "state-impl"; - public static final String GEN_CLASSES = "gen-classes"; + String APPLICATION_CLIENT = "app-client"; + String CMP = "cmp"; + String CMPRESOURCE = "cmpresource"; + String DEFAULT_RESOURCE_PRINCIPAL = "default-resource-principal"; + String DISPLAY_NAME = "display-name"; + String EJB = "ejb"; + String EJB_NAME = "ejb-name"; + String EJB20_CMP = "ejb20-cmp"; + String EJBS = "enterprise-beans"; + String FIELD = "field"; + + String GROUP = "group"; + String GROUPS = "groups"; + String JOIN_OBJECT = "join-object"; + String JNDI_NAME = "jndi-name"; + String LOCAL_PART = "localpart"; + String MAIL_CONFIG = "mail-configuration"; + String MAIL_FROM = "mail-from"; + String MAIL_HOST = "mail-host"; + String METHOD = "method"; + String NAME = "name"; + String NAMESPACE_URI = "namespace-uri"; + String OPERATION = "operation"; + + String PASSWORD = "password"; + String PRINCIPALS = "principals"; + String PRINCIPAL = "principal"; + String REMOTE_ENTITY = "remote-entity"; + String ROLE = "role"; + String ROLE_MAPPING = "rolemapping"; + String ROLE_ENTRY = "role"; + String SERVER_NAME = "server-name"; + + String SERVLET = "servlet"; + String SERVLET_NAME = "servlet-name"; + String SOURCE = "source"; + String SINK = "sink"; + String SQL = "sql"; + String SQL_STATEMENT = "sql-statement"; + String TABLE_CREATE = "table-create-sql"; + String TABLE_REMOVE = "table-remove-sql"; + + + String UNIQUE_ID = "unique-id"; + String WEB = "web"; + String WEB_SERVICE_ENDPOINT = "web-service-endpoint"; + + + String EJB_IMPL = "ejb-impl"; + String REMOTE_IMPL = "remote-impl"; + String LOCAL_IMPL = "local-impl"; + String REMOTE_HOME_IMPL = "remote-home-impl"; + String LOCAL_HOME_IMPL = "local-home-impl"; + String STATE_IMPL = "state-impl"; + String GEN_CLASSES = "gen-classes"; // acceptable values - public static final String TRUE = "true"; - public static final String FALSE = "false"; + String TRUE = "true"; + String FALSE = "false"; // SECURITY related - public static final String SECURITY_ROLE_MAPPING = "security-role-mapping"; - public static final String SECURITY_ROLE_ASSIGNMENT = "security-role-assignment"; - public static final String ROLE_NAME = "role-name"; - public static final String PRINCIPAL_NAME = "principal-name"; - public static final String GROUP_NAME = "group-name"; - public static final String EXTERNALLY_DEFINED = "externally-defined"; + String SECURITY_ROLE_MAPPING = "security-role-mapping"; + String SECURITY_ROLE_ASSIGNMENT = "security-role-assignment"; + String ROLE_NAME = "role-name"; + String PRINCIPAL_NAME = "principal-name"; + String GROUP_NAME = "group-name"; + String EXTERNALLY_DEFINED = "externally-defined"; // common - public static final String EJB_REF = "ejb-ref"; - public static final String RESOURCE_REF = "resource-ref"; - public static final String RESOURCE_ENV_REF = "resource-env-ref"; + String EJB_REF = "ejb-ref"; + String RESOURCE_REF = "resource-ref"; + String RESOURCE_ENV_REF = "resource-env-ref"; // S1AS specific - public static final String PASS_BY_REFERENCE = "pass-by-reference"; - public static final String JMS_MAX_MESSAGES_LOAD = "jms-max-messages-load"; - public static final String IS_READ_ONLY_BEAN = "is-read-only-bean"; - public static final String REFRESH_PERIOD_IN_SECONDS = "refresh-period-in-seconds"; - public static final String COMMIT_OPTION = "commit-option"; - public static final String CMT_TIMEOUT_IN_SECONDS = "cmt-timeout-in-seconds"; - public static final String USE_THREAD_POOL_ID = "use-thread-pool-id"; - public static final String AVAILABILITY_ENABLED = "availability-enabled"; - public static final String DISABLE_NONPORTABLE_JNDI_NAMES = "disable-nonportable-jndi-names"; - public static final String PER_REQUEST_LOAD_BALANCING = "per-request-load-balancing"; + String PASS_BY_REFERENCE = "pass-by-reference"; + String JMS_MAX_MESSAGES_LOAD = "jms-max-messages-load"; + String IS_READ_ONLY_BEAN = "is-read-only-bean"; + String REFRESH_PERIOD_IN_SECONDS = "refresh-period-in-seconds"; + String COMMIT_OPTION = "commit-option"; + String CMT_TIMEOUT_IN_SECONDS = "cmt-timeout-in-seconds"; + String USE_THREAD_POOL_ID = "use-thread-pool-id"; + String AVAILABILITY_ENABLED = "availability-enabled"; + String DISABLE_NONPORTABLE_JNDI_NAMES = "disable-nonportable-jndi-names"; + String PER_REQUEST_LOAD_BALANCING = "per-request-load-balancing"; // CMP related - public static final String CMP_RESOURCE = "cmp-resource"; - public static final String MAPPING_PROPERTIES = "mapping-properties"; - public static final String IS_ONE_ONE_CMP = "is-one-one-cmp"; - public static final String ONE_ONE_FINDERS = "one-one-finders"; - public static final String METHOD_NAME = "method-name"; - public static final String QUERY_PARAMS = "query-params"; - public static final String QUERY_FILTER = "query-filter"; - public static final String QUERY_VARIABLES = "query-variables"; - public static final String QUERY_ORDERING = "query-ordering"; - public static final String FINDER = "finder"; - public static final String CREATE_TABLES_AT_DEPLOY = "create-tables-at-deploy"; - public static final String DROP_TABLES_AT_UNDEPLOY = "drop-tables-at-undeploy"; - public static final String DATABASE_VENDOR_NAME = "database-vendor-name"; - public static final String SCHEMA_GENERATOR_PROPERTIES = "schema-generator-properties"; - + String CMP_RESOURCE = "cmp-resource"; + String MAPPING_PROPERTIES = "mapping-properties"; + String IS_ONE_ONE_CMP = "is-one-one-cmp"; + String ONE_ONE_FINDERS = "one-one-finders"; + String METHOD_NAME = "method-name"; + String QUERY_PARAMS = "query-params"; + String QUERY_FILTER = "query-filter"; + String QUERY_VARIABLES = "query-variables"; + String QUERY_ORDERING = "query-ordering"; + String FINDER = "finder"; + String CREATE_TABLES_AT_DEPLOY = "create-tables-at-deploy"; + String DROP_TABLES_AT_UNDEPLOY = "drop-tables-at-undeploy"; + String DATABASE_VENDOR_NAME = "database-vendor-name"; + String SCHEMA_GENERATOR_PROPERTIES = "schema-generator-properties"; // PM-DESCRIPTORS related - public static final String PM_DESCRIPTORS = "pm-descriptors"; - public static final String PM_DESCRIPTOR = "pm-descriptor"; - public static final String PM_IDENTIFIER = "pm-identifier"; - public static final String PM_VERSION = "pm-version"; - public static final String PM_CONFIG = "pm-config"; - public static final String PM_CLASS_GENERATOR = "pm-class-generator"; - public static final String PM_MAPPING_FACTORY = "pm-mapping-factory"; - public static final String PM_INUSE = "pm-inuse"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_DESCRIPTORS = "pm-descriptors"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_DESCRIPTOR = "pm-descriptor"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_IDENTIFIER = "pm-identifier"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_VERSION = "pm-version"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_CONFIG = "pm-config"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_CLASS_GENERATOR = "pm-class-generator"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_MAPPING_FACTORY = "pm-mapping-factory"; + @Deprecated(forRemoval = true, since = "3.1") + String PM_INUSE = "pm-inuse"; // BEAN-POOL related - public static final String BEAN_POOL = "bean-pool"; - public static final String STEADY_POOL_SIZE = "steady-pool-size"; - public static final String POOL_RESIZE_QUANTITY = "resize-quantity"; - public static final String MAX_POOL_SIZE = "max-pool-size"; - public static final String POOL_IDLE_TIMEOUT_IN_SECONDS = "pool-idle-timeout-in-seconds"; - public static final String MAX_WAIT_TIME_IN_MILLIS = "max-wait-time-in-millis"; + String BEAN_POOL = "bean-pool"; + String STEADY_POOL_SIZE = "steady-pool-size"; + String POOL_RESIZE_QUANTITY = "resize-quantity"; + String MAX_POOL_SIZE = "max-pool-size"; + String POOL_IDLE_TIMEOUT_IN_SECONDS = "pool-idle-timeout-in-seconds"; + String MAX_WAIT_TIME_IN_MILLIS = "max-wait-time-in-millis"; // BEAN-CACHE related - public static final String BEAN_CACHE = "bean-cache"; - public static final String MAX_CACHE_SIZE = "max-cache-size"; - public static final String RESIZE_QUANTITY = "resize-quantity"; - public static final String IS_CACHE_OVERFLOW_ALLOWED = "is-cache-overflow-allowed"; - public static final String CACHE_IDLE_TIMEOUT_IN_SECONDS = "cache-idle-timeout-in-seconds"; - public static final String REMOVAL_TIMEOUT_IN_SECONDS = "removal-timeout-in-seconds"; - public static final String VICTIM_SELECTION_POLICY = "victim-selection-policy"; + String BEAN_CACHE = "bean-cache"; + String MAX_CACHE_SIZE = "max-cache-size"; + String RESIZE_QUANTITY = "resize-quantity"; + String IS_CACHE_OVERFLOW_ALLOWED = "is-cache-overflow-allowed"; + String CACHE_IDLE_TIMEOUT_IN_SECONDS = "cache-idle-timeout-in-seconds"; + String REMOVAL_TIMEOUT_IN_SECONDS = "removal-timeout-in-seconds"; + String VICTIM_SELECTION_POLICY = "victim-selection-policy"; // thread-pool related - public static final String THREAD_CORE_POOL_SIZE = "thread-core-pool-size"; - public static final String THREAD_MAX_POOL_SIZE = "thread-max-pool-size"; - public static final String THREAD_KEEP_ALIVE_SECONDS = "thread-keep-alive-seconds"; - public static final String THREAD_QUEUE_CAPACITY = "thread-queue-capacity"; - public static final String ALLOW_CORE_THREAD_TIMEOUT = "allow-core-thread-timeout"; - public static final String PRESTART_ALL_CORE_THREADS = "prestart-all-core-threads"; + String THREAD_CORE_POOL_SIZE = "thread-core-pool-size"; + String THREAD_MAX_POOL_SIZE = "thread-max-pool-size"; + String THREAD_KEEP_ALIVE_SECONDS = "thread-keep-alive-seconds"; + String THREAD_QUEUE_CAPACITY = "thread-queue-capacity"; + String ALLOW_CORE_THREAD_TIMEOUT = "allow-core-thread-timeout"; + String PRESTART_ALL_CORE_THREADS = "prestart-all-core-threads"; // flush-at-end-of-method - public static final String FLUSH_AT_END_OF_METHOD = + String FLUSH_AT_END_OF_METHOD = "flush-at-end-of-method"; // checkpointed-methods, support backward compatibility with 7.1 - public static final String CHECKPOINTED_METHODS = + String CHECKPOINTED_METHODS = "checkpointed-methods"; // checkpoint-at-end-of-method, equivalent element of // checkpointed-methods in 8.1 and later releases - public static final String CHECKPOINT_AT_END_OF_METHOD = + String CHECKPOINT_AT_END_OF_METHOD = "checkpoint-at-end-of-method"; // prefetch-disabled - public static final String PREFETCH_DISABLED = + String PREFETCH_DISABLED = "prefetch-disabled"; - public static final String QUERY_METHOD = "query-method"; + String QUERY_METHOD = "query-method"; // Connector related - public static final String RESOURCE_ADAPTER = "resource-adapter"; - public static final String ROLE_MAP = "role-map"; - public static final String IDLE_TIMEOUT_IN_SECONDS = "idle-timeout-in-seconds"; - public static final String PROPERTY = "property"; - public static final String MAP_ELEMENT = "map-element"; - public static final String MAP_ID = "map-id"; - public static final String BACKEND_PRINCIPAL = "backend-principal"; - public static final String USER_NAME = "user-name"; - public static final String CREDENTIAL = "credential"; + String RESOURCE_ADAPTER = "resource-adapter"; + String ROLE_MAP = "role-map"; + String IDLE_TIMEOUT_IN_SECONDS = "idle-timeout-in-seconds"; + String PROPERTY = "property"; + String MAP_ELEMENT = "map-element"; + String MAP_ID = "map-id"; + String BACKEND_PRINCIPAL = "backend-principal"; + String USER_NAME = "user-name"; + String CREDENTIAL = "credential"; // application related - public static final String WEB_URI = "web-uri"; - public static final String CONTEXT_ROOT = "context-root"; // also used in java web start support - public final static String ARCHIVE_NAME = "archive-name"; - public final static String COMPATIBILITY = "compatibility"; - public final static String KEEP_STATE = "keep-state"; - public static final String VERSION_IDENTIFIER = "version-identifier"; - public final static String APPLICATION_PARAM = "application-param"; - public static final String PARAM_NAME = "param-name"; - public static final String PARAM_VALUE = "param-value"; - public final static String MODULE = "module"; - public final static String TYPE = "type"; - public final static String PATH = "path"; + String WEB_URI = "web-uri"; + String CONTEXT_ROOT = "context-root"; // also used in java web start support + String ARCHIVE_NAME = "archive-name"; + String COMPATIBILITY = "compatibility"; + String KEEP_STATE = "keep-state"; + String VERSION_IDENTIFIER = "version-identifier"; + String APPLICATION_PARAM = "application-param"; + String PARAM_NAME = "param-name"; + String PARAM_VALUE = "param-value"; + String MODULE = "module"; + String TYPE = "type"; + String PATH = "path"; // Web - public static final String CACHE_MAPPING = "cache-mapping"; - public static final String CACHE_HELPER = "cache-helper"; - public static final String CACHE_HELPER_REF = "cache-helper-ref"; - public static final String CLASS_NAME = "class-name"; - public static final String COOKIE_PROPERTIES = "cookie-properties"; - public static final String CONSTRAINT_FIELD = "constraint-field"; - public static final String CONSTRAINT_FIELD_VALUE = "constraint-field-value"; - public static final String LOCALE_CHARSET_INFO = "locale-charset-info"; - public static final String DEFAULT_LOCALE = "default-locale"; - public static final String DEFAULT_HELPER = "default-helper"; - public static final String LOCALE = "locale"; - public static final String MAX_ENTRIES = "max-entries"; - public static final String TIMEOUT_IN_SECONDS = "timeout-in-seconds"; - public static final String ENABLED = "enabled"; - public static final String AGENT = "agent"; - public static final String CHARSET = "charset"; - public static final String LOCALE_CHARSET_MAP = "locale-charset-map"; - public static final String PARAMETER_ENCODING = "parameter-encoding"; - public static final String FORM_HINT_FIELD = "form-hint-field"; - public static final String DEFAULT_CHARSET = "default-charset"; - public static final String STORE_PROPERTIES = "store-properties"; - public static final String MANAGER_PROPERTIES = "manager-properties"; - public static final String REFRESH_FIELD = "refresh-field"; - public static final String SESSION_MANAGER = "session-manager"; - public static final String SESSION_PROPERTIES = "session-properties"; - public static final String SESSION_CONFIG = "session-config"; - public static final String TIMEOUT = "timeout"; - public static final String PERSISTENCE_TYPE = "persistence-type"; - public static final String JSP_CONFIG = "jsp-config"; - public static final String CLASS_LOADER = "class-loader"; - public static final String EXTRA_CLASS_PATH = "extra-class-path"; - public static final String DELEGATE = "delegate"; - public static final String DYNAMIC_RELOAD_INTERVAL = + String CACHE_MAPPING = "cache-mapping"; + String CACHE_HELPER = "cache-helper"; + String CACHE_HELPER_REF = "cache-helper-ref"; + String CLASS_NAME = "class-name"; + String COOKIE_PROPERTIES = "cookie-properties"; + String CONSTRAINT_FIELD = "constraint-field"; + String CONSTRAINT_FIELD_VALUE = "constraint-field-value"; + String LOCALE_CHARSET_INFO = "locale-charset-info"; + String DEFAULT_LOCALE = "default-locale"; + String DEFAULT_HELPER = "default-helper"; + String LOCALE = "locale"; + String MAX_ENTRIES = "max-entries"; + String TIMEOUT_IN_SECONDS = "timeout-in-seconds"; + String ENABLED = "enabled"; + String AGENT = "agent"; + String CHARSET = "charset"; + String LOCALE_CHARSET_MAP = "locale-charset-map"; + String PARAMETER_ENCODING = "parameter-encoding"; + String FORM_HINT_FIELD = "form-hint-field"; + String DEFAULT_CHARSET = "default-charset"; + String STORE_PROPERTIES = "store-properties"; + String MANAGER_PROPERTIES = "manager-properties"; + String REFRESH_FIELD = "refresh-field"; + String SESSION_MANAGER = "session-manager"; + String SESSION_PROPERTIES = "session-properties"; + String SESSION_CONFIG = "session-config"; + String TIMEOUT = "timeout"; + String PERSISTENCE_TYPE = "persistence-type"; + String JSP_CONFIG = "jsp-config"; + String CLASS_LOADER = "class-loader"; + String EXTRA_CLASS_PATH = "extra-class-path"; + String DELEGATE = "delegate"; + String DYNAMIC_RELOAD_INTERVAL = "dynamic-reload-interval"; - public static final String CACHE = "cache"; - public static final String KEY_FIELD = "key-field"; - public static final String URL_PATTERN = "url-pattern"; - public static final String HTTP_METHOD = "http-method"; - public static final String DISPATCHER = "dispatcher"; - public static final String SCOPE = "scope"; - public static final String CACHE_ON_MATCH = "cache-on-match"; - public static final String CACHE_ON_MATCH_FAILURE = "cache-on-match-failure"; - public static final String MATCH_EXPR = "match-expr"; - public static final String VALUE = "value"; - public static final String IDEMPOTENT_URL_PATTERN = "idempotent-url-pattern"; - public static final String ERROR_URL = "error-url"; - public static final String HTTPSERVLET_SECURITY_PROVIDER = "httpservlet-security-provider"; - public static final String NUM_OF_RETRIES = "num-of-retries"; - - public static final String JAVA_METHOD = "java-method"; - public final static String METHOD_PARAMS = "method-params"; - public final static String METHOD_PARAM = "method-param"; - - public final static String VALVE = "valve"; + String CACHE = "cache"; + String KEY_FIELD = "key-field"; + String URL_PATTERN = "url-pattern"; + String HTTP_METHOD = "http-method"; + String DISPATCHER = "dispatcher"; + String SCOPE = "scope"; + String CACHE_ON_MATCH = "cache-on-match"; + String CACHE_ON_MATCH_FAILURE = "cache-on-match-failure"; + String MATCH_EXPR = "match-expr"; + String VALUE = "value"; + String IDEMPOTENT_URL_PATTERN = "idempotent-url-pattern"; + String ERROR_URL = "error-url"; + String HTTPSERVLET_SECURITY_PROVIDER = "httpservlet-security-provider"; + String NUM_OF_RETRIES = "num-of-retries"; + + String JAVA_METHOD = "java-method"; + String METHOD_PARAMS = "method-params"; + String METHOD_PARAM = "method-param"; + + String VALVE = "valve"; // Java Web Start-support related - public final static String JAVA_WEB_START_ACCESS = "java-web-start-access"; - public final static String ELIGIBLE = "eligible"; - public final static String VENDOR = "vendor"; - public final static String JNLP_DOC = "jnlp-doc"; + String JAVA_WEB_START_ACCESS = "java-web-start-access"; + String ELIGIBLE = "eligible"; + String VENDOR = "vendor"; + String JNLP_DOC = "jnlp-doc"; // also uses CONTEXT_ROOT defined above in the application-related section // Weblogic specific - public static final String RESOURCE_DESCRIPTION = "resource-description"; - public static final String RESOURCE_ENV_DESCRIPTION = "resource-env-description"; - public static final String EJB_REFERENCE_DESCRIPTION = "ejb-reference-description"; + String RESOURCE_DESCRIPTION = "resource-description"; + String RESOURCE_ENV_DESCRIPTION = "resource-env-description"; + String EJB_REFERENCE_DESCRIPTION = "ejb-reference-description"; } diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/EjbBundleDescriptorImpl.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/EjbBundleDescriptorImpl.java index 428566b79a5a..f036e510b10c 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/EjbBundleDescriptorImpl.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/EjbBundleDescriptorImpl.java @@ -18,6 +18,7 @@ package org.glassfish.ejb.deployment.descriptor; import com.sun.enterprise.deployment.EjbBundleDescriptor; +//import com.sun.enterprise.deployment.EjbDescriptor; import com.sun.enterprise.deployment.NameValuePairDescriptor; import com.sun.enterprise.deployment.ResourceReferenceDescriptor; import com.sun.enterprise.deployment.RoleReference; @@ -26,7 +27,6 @@ import com.sun.enterprise.deployment.util.ComponentVisitor; import com.sun.enterprise.deployment.util.DOLUtils; import com.sun.enterprise.deployment.util.EjbBundleVisitor; -import com.sun.enterprise.util.LocalStringManagerImpl; import java.lang.System.Logger; import java.lang.System.Logger.Level; @@ -37,7 +37,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; -import java.util.Vector; import org.glassfish.deployment.common.Descriptor; import org.glassfish.deployment.common.DescriptorVisitor; @@ -48,35 +47,25 @@ import org.glassfish.ejb.deployment.util.EjbBundleValidator; import org.glassfish.security.common.Role; -public class EjbBundleDescriptorImpl extends EjbBundleDescriptor { +public final class EjbBundleDescriptorImpl extends EjbBundleDescriptor { private static final long serialVersionUID = 1L; private static final Logger LOG = DOLUtils.getLogger(); - private static final LocalStringManagerImpl I18N = new LocalStringManagerImpl(EjbBundleDescriptorImpl.class); - private Set ejbIDs; - private final Set relationships = new HashSet<>(); - private String relationshipsDescription; private String ejbClientJarUri; - // list of configured persistence manager - private Vector configured_pms; - private PersistenceManagerInUse pm_inuse; - // the resource (database) to be used for persisting CMP EntityBeans // the same resource is used for all beans in this ejb jar. private ResourceReferenceDescriptor cmpResourceReference; - - - - private final List roleMaps = new ArrayList<>(); - - private LinkedList interceptorBindings = new LinkedList<>(); - private final List enterpriseBeansProperties = new ArrayList<>(); + private final LinkedList interceptorBindings = new LinkedList<>(); + private String relationshipsDescription; + private final Set relationships = new HashSet<>(); + private final List roleMaps = new ArrayList<>(); - + // non-descriptor runtime fields + private Set ejbIDs; @Override public String getDefaultSpecVersion() { @@ -96,34 +85,6 @@ public String getName() { } - // temporary solution until we change the hierarchy to more consistent to be able to use getEjbs - @Override - public Set getEjbs() { - return (Set) super.getEjbs(); - } - - - @Override - public EjbDescriptor getEjbByName(String name) { - return (EjbDescriptor) super.getEjbByName(name); - } - - - @Override - public EjbDescriptor getEjbByName(String name, boolean isCreateDummy) { - return (EjbDescriptor) super.getEjbByName(name, isCreateDummy); - } - - - @Override - protected DummyEjbDescriptor createDummyEjbDescriptor(String ejbName) { - LOG.log(Level.DEBUG, "Construct a Dummy EJB Descriptor with name {0}", ejbName); - DummyEjbDescriptor dummyEjbDesc = new DummyEjbDescriptor(); - dummyEjbDesc.setName(ejbName); - return dummyEjbDesc; - } - - /** * @return the empty String or the entry name of the ejb client JAR in my archive if I have one. */ @@ -141,195 +102,280 @@ public void setEjbClientJarUri(String ejbClientJarUri) { } + /** + * @return the Resource I use for CMP. + */ + public ResourceReferenceDescriptor getCMPResourceReference() { + return cmpResourceReference; + } + + /** + * @param resourceReference the resource reference I use for CMP. + */ + public void setCMPResourceReference(ResourceReferenceDescriptor resourceReference) { + this.cmpResourceReference = resourceReference; + } + /** + * @return list of enterprise beans properties + */ + public List getEnterpriseBeansProperties() { + return enterpriseBeansProperties; + } /** - * Setup EJB Ids during deployment and shouldn't be called at runtime + * @param key + * @return property value of enterprise beans */ - public void setupDataStructuresForRuntime() { - Set ids = new HashSet<>(); - for (EjbDescriptor ejbDescriptor : getEjbs()) { - ids.add(ejbDescriptor.getUniqueId()); + public String getEnterpriseBeansProperty(String key) { + for (NameValuePairDescriptor property : enterpriseBeansProperties) { + if (property.getName().equals(key)) { + return property.getValue(); + } } - ejbIDs = Collections.unmodifiableSet(ids); + return null; } /** - * - * @return Collection of unique ID of EJBs within the same module + * @param newProp property of enterprise beans */ - public Collection getDescriptorIds() { - return ejbIDs; + // Reflection in EnterpriseBeansRuntimeNode + public void addEnterpriseBeansProperty(NameValuePairDescriptor newProp) { + enterpriseBeansProperties.add(newProp); } /** - * @return true if this bundle descriptor contains at least one CMP - * EntityBean + * @return list of {@link InterceptorBindingDescriptor} */ - public boolean containsCMPEntity() { - Set ejbs = getEjbs(); - for (EjbDescriptor ejb : ejbs) { - if (ejb instanceof EjbCMPEntityDescriptor) { - return true; - } - } - return false; + public List getInterceptorBindings() { + return interceptorBindings; } + /** + * Adds the binding as the first in the internal list. + * + * @param binding + */ public void prependInterceptorBinding(InterceptorBindingDescriptor binding) { interceptorBindings.addFirst(binding); } + /** + * Adds the binding as the last in the internal list. + * + * @param binding + */ + // Used by EjbBundleNode public void appendInterceptorBinding(InterceptorBindingDescriptor binding) { interceptorBindings.addLast(binding); } - public List getInterceptorBindings() { - return new LinkedList<>(interceptorBindings); - } - - + /** + * Clears the internal list and adds all bindings in the same order. + * + * @param bindings + */ public void setInterceptorBindings(List bindings) { - interceptorBindings = new LinkedList<>(); + interceptorBindings.clear(); interceptorBindings.addAll(bindings); } + /** - * @return true if all ejb role references link to roles specified here. - */ - public boolean areResourceReferencesValid() { - // run through each of the ejb's role references, checking that the roles exist in this bundle - for (EjbDescriptor ejbDescriptor : getEjbs()) { - for (RoleReference element : ejbDescriptor.getRoleReferences()) { - Role referredRole = element.getRole(); - Set roles = getRoles(); - if (!referredRole.getName().isEmpty() && !roles.contains(referredRole)) { - LOG.log(Level.WARNING, "Bad role reference to {0}, roles: {1}", referredRole, roles); - return false; - } - } - } - return true; + * @return description for relationships element. + */ + public String getRelationshipsDescription() { + return relationshipsDescription; } /** - * @return true if I have Roles to which method permissions have been assigned. + * @param relationshipsDescription EJB2.0: set description for relationships element. */ - public boolean hasPermissionedRoles() { - for (EjbDescriptor ejb : getEjbs()) { - if (!ejb.getPermissionedMethodsByPermission().isEmpty()) { - return true; - } - } - return false; + // Reflection in RelationshipsNode + public void setRelationshipsDescription(String relationshipsDescription) { + this.relationshipsDescription = relationshipsDescription; } /** - * @return true if any of my ejb's methods have been assigned transaction attributes. + * @return true if there are some definitions of relationships */ - public boolean hasContainerTransactions() { - for (EjbDescriptor ejb : getEjbs()) { - if (!ejb.getMethodContainerTransactions().isEmpty()) { - return true; - } - } - return false; + public boolean hasRelationships() { + return !relationships.isEmpty(); } /** - * @return true if I have roles, permissioned roles or container transactions. + * Get all relationships in this ejb-jar. + * + * @return a Set of {@link RelationshipDescriptor}s. */ - public boolean hasAssemblyInformation() { - return (!getRoles().isEmpty()) || hasPermissionedRoles() || hasContainerTransactions(); + public Set getRelationships() { + return relationships; } /** - * Add a RelationshipDescriptor which describes a CMR field - * between a bean/DO/entityRef in this ejb-jar. + * Add a RelationshipDescriptor which describes a CMR field between a bean/DO/entityRef + * in this ejb-jar. + * + * @param relationship */ - public void addRelationship(RelationshipDescriptor relDesc) { - relationships.add(relDesc); + public void addRelationship(RelationshipDescriptor relationship) { + relationships.add(relationship); + } + + /** + * Remove a {@link RelationshipDescriptor}. Does nothing if it is not present. + * + * @param relationship + */ + public void removeRelationship(RelationshipDescriptor relationship) { + relationships.remove(relationship); } /** - * Add a RelationshipDescriptor which describes a CMR field - * between a bean/DO/entityRef in this ejb-jar. + * Adds the mapping. + * + * @param roleMapping {@link SecurityRoleMapping} */ - public void removeRelationship(RelationshipDescriptor relDesc) { - relationships.remove(relDesc); + public void addSecurityRoleMapping(SecurityRoleMapping roleMapping) { + roleMaps.add(roleMapping); + } + + /** + * @return a list of {@link SecurityRoleMapping}s + */ + public List getSecurityRoleMappings() { + return roleMaps; } /** - * EJB2.0: get description for element. + * Setup EJB Ids during deployment and shouldn't be called at runtime */ - public String getRelationshipsDescription() { - if (relationshipsDescription == null) { - relationshipsDescription = ""; + public void setupDataStructuresForRuntime() { + Set ids = new HashSet<>(); + for (EjbDescriptor ejbDescriptor : getEjbs()) { + ids.add(ejbDescriptor.getUniqueId()); } - return relationshipsDescription; + ejbIDs = Collections.unmodifiableSet(ids); } /** - * EJB2.0: set description for element. + * @return Collection of unique ID of EJBs within the same module */ - public void setRelationshipsDescription(String relationshipsDescription) { - this.relationshipsDescription = relationshipsDescription; + public Collection getDescriptorIds() { + return ejbIDs; + } + + + // temporary solution until we change the hierarchy to more consistent to be able to use getEjbs + @Override + public Set getEjbs() { + return (Set) super.getEjbs(); + } + + + @Override + public EjbDescriptor getEjbByName(String name) { + return (EjbDescriptor) super.getEjbByName(name); + } + + + @Override + public EjbDescriptor getEjbByName(String name, boolean isCreateDummy) { + return (EjbDescriptor) super.getEjbByName(name, isCreateDummy); + } + + + @Override + protected DummyEjbDescriptor createDummyEjbDescriptor(String ejbName) { + LOG.log(Level.DEBUG, "Construct a Dummy EJB Descriptor with name {0}", ejbName); + DummyEjbDescriptor dummyEjbDesc = new DummyEjbDescriptor(); + dummyEjbDesc.setName(ejbName); + return dummyEjbDesc; } /** - * Get all relationships in this ejb-jar. - * - * @return a Set of RelationshipDescriptors. - */ - public Set getRelationships() { - return relationships; + * @return true if all ejb role references link to roles specified here. + */ + public boolean areResourceReferencesValid() { + // run through each of the ejb's role references, checking that the roles exist in this bundle + for (EjbDescriptor ejbDescriptor : getEjbs()) { + for (RoleReference element : ejbDescriptor.getRoleReferences()) { + Role referredRole = element.getRole(); + Set roles = getRoles(); + if (!referredRole.getName().isEmpty() && !roles.contains(referredRole)) { + LOG.log(Level.WARNING, "Bad role reference to {0}, roles: {1}", referredRole, roles); + return false; + } + } + } + return true; } - public boolean hasRelationships() { - return !relationships.isEmpty(); + /** + * @return true if this bundle descriptor contains at least one CMP + * EntityBean + */ + public boolean containsCMPEntity() { + Set ejbs = getEjbs(); + for (EjbDescriptor ejb : ejbs) { + if (ejb instanceof EjbCMPEntityDescriptor) { + return true; + } + } + return false; } /** - * Returns true if given relationship is already part of this - * ejb-jar. + * @return true if I have roles, permissioned roles or container transactions. */ - public boolean hasRelationship(RelationshipDescriptor rd) { - return relationships.contains(rd); + public boolean hasAssemblyInformation() { + return (!getRoles().isEmpty()) || hasPermissionedRoles() || hasContainerTransactions(); } + /** - * Return the Resource I use for CMP. + * @return true if any of my ejb's methods have been assigned transaction attributes. */ - public ResourceReferenceDescriptor getCMPResourceReference() { - return cmpResourceReference; + public boolean hasContainerTransactions() { + for (EjbDescriptor ejb : getEjbs()) { + if (!ejb.getMethodContainerTransactions().isEmpty()) { + return true; + } + } + return false; } /** - * Sets the resource reference I use for CMP. + * @return true if I have Roles to which method permissions have been assigned. */ - public void setCMPResourceReference(ResourceReferenceDescriptor resourceReference) { - this.cmpResourceReference = resourceReference; + public boolean hasPermissionedRoles() { + for (EjbDescriptor ejb : getEjbs()) { + if (!ejb.getPermissionedMethodsByPermission().isEmpty()) { + return true; + } + } + return false; } @@ -364,10 +410,20 @@ public ComponentVisitor getBundleVisitor() { } + // Used by reflection in PMDescriptorsNode + @Deprecated(forRemoval = true, since = "3.1") + public void setPersistenceManagerInUse(PersistenceManagerInUse inuse) { + // ignored + } + + + // Used by reflection in PMDescriptorsNode + @Deprecated(forRemoval = true, since = "3.1") + public void addPersistenceManager(IASPersistenceManagerDescriptor pmDesc) { + // ignored + } + - /** - * Returns a formatted String representing my state. - */ @Override public void print(StringBuffer toStringBuffer) { toStringBuffer.append("EjbBundleDescriptor\n"); @@ -383,87 +439,4 @@ public void print(StringBuffer toStringBuffer) { toStringBuffer.append("\n------------"); } } - - - public void setPersistenceManagerInuse(String id, String ver) { - LOG.log(Level.DEBUG, "setPersistenceManagerInuse(id={0}, ver={1})", id, ver); - pm_inuse = new PersistenceManagerInUse(id, ver); - } - - - public void setPersistenceManagerInUse(PersistenceManagerInUse inuse) { - pm_inuse = inuse; - } - - - public PersistenceManagerInUse getPersistenceManagerInUse() { - return pm_inuse; - } - - - public void addPersistenceManager(IASPersistenceManagerDescriptor pmDesc) { - if (configured_pms == null) { - configured_pms = new Vector<>(); - } - configured_pms.add(pmDesc); - } - - - public IASPersistenceManagerDescriptor getPreferredPersistenceManager() { - if (configured_pms == null || configured_pms.isEmpty()) { - // return the default persistence manager descriptor - return null; - } - - String pminuse_id = pm_inuse.get_pm_identifier().trim(); - String pminuse_ver = pm_inuse.get_pm_version().trim(); - int size = configured_pms.size(); - for (int i = 0; i < size; i++) { - IASPersistenceManagerDescriptor pmdesc = configured_pms.elementAt(i); - String pmdesc_id = pmdesc.getPersistenceManagerIdentifier(); - String pmdesc_ver = pmdesc.getPersistenceManagerVersion(); - if (pmdesc_id.trim().equals(pminuse_id) && pmdesc_ver.trim().equals(pminuse_ver)) { - return pmdesc; - } - } - throw new IllegalArgumentException( - I18N.getLocalString( - "enterprise.deployment.nomatchingpminusefound", - "No PersistenceManager found that matches specified PersistenceManager in use.")); - } - - - public Vector getPersistenceManagers() { - return configured_pms; - } - - - public void addSecurityRoleMapping(SecurityRoleMapping roleMapping) { - roleMaps.add(roleMapping); - } - - - public List getSecurityRoleMappings() { - return roleMaps; - } - - - public String getEnterpriseBeansProperty(String key) { - for (NameValuePairDescriptor p : enterpriseBeansProperties) { - if (p.getName().equals(key)) { - return p.getValue(); - } - } - return null; - } - - - public void addEnterpriseBeansProperty(NameValuePairDescriptor newProp) { - enterpriseBeansProperties.add(newProp); - } - - - public List getEnterpriseBeansProperties() { - return enterpriseBeansProperties; - } } diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/IASPersistenceManagerDescriptor.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/IASPersistenceManagerDescriptor.java index 001bcac61ffa..bb993d0e79cd 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/IASPersistenceManagerDescriptor.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/IASPersistenceManagerDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -27,6 +27,7 @@ * * @author Prashant Jamkhedkar */ +@Deprecated(forRemoval = true, since = "3.1") public class IASPersistenceManagerDescriptor extends Descriptor { private static final long serialVersionUID = 1L; @@ -36,11 +37,12 @@ public class IASPersistenceManagerDescriptor extends Descriptor { public static final String PM_CLASS_GENERATOR_DEFAULT = "com.sun.jdo.spi.persistence.support.ejb.ejbc.JDOCodeGenerator"; // NOI18N public static final String PM_CLASS_GENERATOR_DEFAULT_OLD = "com.iplanet.ias.persistence.internal.ejb.ejbc.JDOCodeGenerator"; //NOI18N public static final String PM_MAPPING_FACTORY_DEFAULT = "com.sun.ffj.MyFactory"; // NOI18N - private String pm_identifier = null; - private String pm_version = null; - private String pm_config = null; - private String pm_class_generator = null; - private String pm_mapping_factory = null; + + private String pm_identifier; + private String pm_version; + private String pm_config; + private String pm_class_generator; + private String pm_mapping_factory; public IASPersistenceManagerDescriptor() { pm_identifier = PM_IDENTIFIER_DEFAULT; diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/PersistenceManagerInUse.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/PersistenceManagerInUse.java index 0dc7695139ef..15c09be2d353 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/PersistenceManagerInUse.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/descriptor/runtime/PersistenceManagerInUse.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -18,6 +19,7 @@ import org.glassfish.deployment.common.Descriptor; +@Deprecated(forRemoval = true, since = "3.1") public class PersistenceManagerInUse extends Descriptor { private String pm_identifier; diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/RelationshipsNode.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/RelationshipsNode.java index 296d2f8e8104..2c4933b6d657 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/RelationshipsNode.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/RelationshipsNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -36,17 +36,6 @@ */ public class RelationshipsNode extends DeploymentDescriptorNode { - public static Node writeRelationships(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) { - Node relationshipsNode = appendChild(parent, nodeName); - appendTextChild(relationshipsNode, TagNames.DESCRIPTION, descriptor.getRelationshipsDescription()); - EjbRelationNode subNode = new EjbRelationNode(); - for (RelationshipDescriptor rd : descriptor.getRelationships()) { - subNode.writeDescriptor(relationshipsNode, EjbTagNames.EJB_RELATION, rd); - } - return relationshipsNode; - } - - public RelationshipsNode() { registerElementHandler(new XMLElement(EjbTagNames.EJB_RELATION), EjbRelationNode.class); } @@ -71,4 +60,15 @@ protected Map getDispatchTable() { table.put(TagNames.DESCRIPTION, "setRelationshipsDescription"); return table; } + + + public static Node writeRelationships(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) { + Node relationshipsNode = appendChild(parent, nodeName); + appendTextChild(relationshipsNode, TagNames.DESCRIPTION, descriptor.getRelationshipsDescription()); + EjbRelationNode subNode = new EjbRelationNode(); + for (RelationshipDescriptor rd : descriptor.getRelationships()) { + subNode.writeDescriptor(relationshipsNode, EjbTagNames.EJB_RELATION, rd); + } + return relationshipsNode; + } } diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorNode.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorNode.java index e07f6bb9645d..136e82d042d9 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorNode.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorNode.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -16,11 +17,12 @@ package org.glassfish.ejb.deployment.node.runtime; +import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode; +import com.sun.enterprise.deployment.xml.RuntimeTagNames; + import java.util.HashMap; import java.util.Map; -import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode; -import com.sun.enterprise.deployment.xml.RuntimeTagNames; import org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor; import org.w3c.dom.Node; @@ -28,8 +30,8 @@ * This node handles the pm-descriptor runtime xml element * * @author Jerome Dochez - * @version */ +@Deprecated(forRemoval = true, since = "3.1") public class PMDescriptorNode extends RuntimeDescriptorNode { private IASPersistenceManagerDescriptor descriptor; @@ -45,7 +47,7 @@ public IASPersistenceManagerDescriptor getDescriptor() { @Override protected Map getDispatchTable() { - Map table = new HashMap(); + Map table = new HashMap<>(); table.put(RuntimeTagNames.PM_IDENTIFIER, "setPersistenceManagerIdentifier"); table.put(RuntimeTagNames.PM_VERSION, "setPersistenceManagerVersion"); table.put(RuntimeTagNames.PM_CONFIG, "setPersistenceManagerConfig"); diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorsNode.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorsNode.java index ecf33f253624..d53ca218bb20 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorsNode.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMDescriptorsNode.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -16,24 +17,20 @@ package org.glassfish.ejb.deployment.node.runtime; -import java.util.Iterator; -import java.util.Vector; - import com.sun.enterprise.deployment.node.XMLElement; import com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode; import com.sun.enterprise.deployment.xml.RuntimeTagNames; + import org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl; -import org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor; -import org.glassfish.ejb.deployment.descriptor.runtime.PersistenceManagerInUse; import org.w3c.dom.Node; /** * This node handles the pm-descriptors runtime xml element * - * @author Jerome Dochez - * @version + * @author Jerome Dochez */ -public class PMDescriptorsNode extends RuntimeDescriptorNode { +@Deprecated(forRemoval = true, since = "3.1") +public class PMDescriptorsNode extends RuntimeDescriptorNode { public PMDescriptorsNode() { registerElementHandler(new XMLElement(RuntimeTagNames.PM_DESCRIPTOR), PMDescriptorNode.class, "addPersistenceManager"); @@ -41,31 +38,8 @@ public PMDescriptorsNode() { } - /** - * write the descriptor class to a DOM tree and return it - * - * @param parent node for the DOM tree - * @param node name - * @param the descriptor to write - * @return the DOM tree top node - */ + @Override public Node writeDescriptor(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) { - Node pms = null; - Vector pmDescriptors = descriptor.getPersistenceManagers(); - if (pmDescriptors != null && !pmDescriptors.isEmpty()) { - pms = super.writeDescriptor(parent, nodeName, descriptor); - PMDescriptorNode pmNode = new PMDescriptorNode(); - - for (Iterator pmIterator = pmDescriptors.iterator(); pmIterator.hasNext();) { - IASPersistenceManagerDescriptor pmDescriptor = (IASPersistenceManagerDescriptor) pmIterator.next(); - pmNode.writeDescriptor(pms, RuntimeTagNames.PM_DESCRIPTOR, pmDescriptor); - } - PersistenceManagerInUse inUse = descriptor.getPersistenceManagerInUse(); - if (inUse != null) { - PMInUseNode inUseNode = new PMInUseNode(); - inUseNode.writeDescriptor(pms, RuntimeTagNames.PM_INUSE, inUse); - } - } - return pms; + return null; } } diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMInUseNode.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMInUseNode.java index 060a6d55d880..f4734c5ddf81 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMInUseNode.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/node/runtime/PMInUseNode.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -27,23 +28,24 @@ /** * This node handles the pm-inuse runtime xml element * - * @author Jerome Dochez - * @version + * @author Jerome Dochez */ - +@Deprecated(forRemoval = true, since = "3.1") public class PMInUseNode extends RuntimeDescriptorNode { private PersistenceManagerInUse descriptor; @Override public PersistenceManagerInUse getDescriptor() { - if (descriptor == null) descriptor = new PersistenceManagerInUse(); + if (descriptor == null) { + descriptor = new PersistenceManagerInUse(); + } return descriptor; } @Override protected Map getDispatchTable() { - Map table = new HashMap(); + Map table = new HashMap<>(); table.put(RuntimeTagNames.PM_IDENTIFIER, "set_pm_identifier"); table.put(RuntimeTagNames.PM_VERSION, "set_pm_version"); return table; diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/EjbBundleValidator.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/EjbBundleValidator.java index 994924228e21..35e9009d6356 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/EjbBundleValidator.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/EjbBundleValidator.java @@ -38,7 +38,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.LinkedList; import java.util.List; import java.util.Set; import java.util.logging.Level; @@ -170,7 +169,7 @@ private void handleOverloadedInterceptorMethodBindings(EjbBundleDescriptorImpl b } ClassLoader cl = bundleDesc.getClassLoader(); - List newBindings = new LinkedList<>(); + List newBindings = new ArrayList<>(); for (InterceptorBindingDescriptor next : origBindings) { if (!next.getNeedsOverloadResolution()) { newBindings.add(next); diff --git a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/InterceptorBindingTranslator.java b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/InterceptorBindingTranslator.java index f14189c06e6a..913b8e70e03f 100644 --- a/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/InterceptorBindingTranslator.java +++ b/appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/deployment/util/InterceptorBindingTranslator.java @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -16,62 +17,52 @@ package org.glassfish.ejb.deployment.util; +import com.sun.enterprise.deployment.EjbInterceptor; +import com.sun.enterprise.deployment.MethodDescriptor; + +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; -import com.sun.enterprise.deployment.EjbInterceptor; -import com.sun.enterprise.deployment.MethodDescriptor; import org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl; import org.glassfish.ejb.deployment.descriptor.InterceptorBindingDescriptor; import org.glassfish.ejb.deployment.descriptor.InterceptorBindingDescriptor.BindingType; public class InterceptorBindingTranslator { - private List interceptorBindings; - private EjbBundleDescriptorImpl ejbBundle; - - private List defaultInterceptorChain = - new LinkedList(); + private final List interceptorBindings; + private final EjbBundleDescriptorImpl ejbBundle; - private List classInterceptorChain = - new LinkedList(); + private final List defaultInterceptorChain = new LinkedList<>(); + private final List classInterceptorChain = new LinkedList<>(); - private boolean hasTotalClassLevelOrdering = false; - private List totalClassLevelOrdering = - new LinkedList(); + private boolean hasTotalClassLevelOrdering; + private final List totalClassLevelOrdering = new LinkedList<>(); - private Map> methodInterceptorsMap = - new HashMap>(); + private final Map> methodInterceptorsMap = new HashMap<>(); // true if there are 0 bindings. private boolean isEmpty; public InterceptorBindingTranslator(EjbBundleDescriptorImpl bundle) { - ejbBundle = bundle; - interceptorBindings = ejbBundle.getInterceptorBindings(); - - if( interceptorBindings.isEmpty() ) { + interceptorBindings = new ArrayList<>(ejbBundle.getInterceptorBindings()); + if (interceptorBindings.isEmpty()) { isEmpty = true; - } else { - validateInterceptors(); - } - - } - public TranslationResults apply(String ejbName) { - if( isEmpty ) { + public TranslationResults apply(String ejbName) { + if (isEmpty) { return new TranslationResults(); } @@ -84,88 +75,65 @@ public TranslationResults apply(String ejbName) { methodInterceptorsMap.clear(); // Do a pass through default interceptor bindings. - for(InterceptorBindingDescriptor binding : interceptorBindings) { - - if( binding.getBindingType() == BindingType.DEFAULT ) { - defaultInterceptorChain.addAll - (binding.getInterceptorClasses()); + for (InterceptorBindingDescriptor binding : interceptorBindings) { + if (binding.getBindingType() == BindingType.DEFAULT) { + defaultInterceptorChain.addAll(binding.getInterceptorClasses()); } - } // Do a pass through Class level bindings. - for(InterceptorBindingDescriptor binding : interceptorBindings) { - - if( binding.getBindingType() == BindingType.CLASS ) { - - if( binding.getEjbName().equals(ejbName) ) { + for (InterceptorBindingDescriptor binding : interceptorBindings) { + if (binding.getBindingType() == BindingType.CLASS) { + if (binding.getEjbName().equals(ejbName)) { processClassLevelBinding(binding); } } - } // Now do method-level bindings. - - Map> - methodBindings = new HashMap>(); + Map> methodBindings = new HashMap<>(); // First build a map of all business methods for the current // ejb that have binding information, and their associated // bindings. - for(InterceptorBindingDescriptor binding : interceptorBindings) { - - if( (binding.getEjbName().equals(ejbName)) && - (binding.getBindingType() == BindingType.METHOD) ) { - + for (InterceptorBindingDescriptor binding : interceptorBindings) { + if ((binding.getEjbName().equals(ejbName)) && (binding.getBindingType() == BindingType.METHOD)) { MethodDescriptor method = binding.getBusinessMethod(); - - List methodBindingDescs = - methodBindings.get(method); - if( methodBindingDescs == null ) { - methodBindingDescs = - new LinkedList(); + List methodBindingDescs = methodBindings.get(method); + if (methodBindingDescs == null) { + methodBindingDescs = new LinkedList<>(); } - methodBindingDescs.add(binding); - methodBindings.put(method, methodBindingDescs); } - } - for(Map.Entry> next - : methodBindings.entrySet()) { + for (Entry> next : methodBindings.entrySet()) { processMethod(next.getKey(), next.getValue()); } - TranslationResults results = buildResults(); - return results; } - private void processClassLevelBinding(InterceptorBindingDescriptor - binding) { - if( binding.getExcludeDefaultInterceptors() ) { + private void processClassLevelBinding(InterceptorBindingDescriptor binding) { + if (binding.getExcludeDefaultInterceptors()) { defaultInterceptorChain.clear(); } - if( binding.getIsTotalOrdering() ) { - + if (binding.getIsTotalOrdering()) { hasTotalClassLevelOrdering = true; totalClassLevelOrdering.clear(); totalClassLevelOrdering.addAll(binding.getInterceptorClasses()); // totalClassLevelOrdering will take precedence, but keep // classInterceptorChain updated to contain class-level, but not - // default-level, interceptors. These might be needed during + // default-level, interceptors. These might be needed during // method-level exclude-class-interceptors processing. - for(String next : binding.getInterceptorClasses()) { - if( !defaultInterceptorChain.contains(next) ) { - if( !classInterceptorChain.contains(next) ) { + for (String next : binding.getInterceptorClasses()) { + if (!defaultInterceptorChain.contains(next)) { + if (!classInterceptorChain.contains(next)) { classInterceptorChain.add(next); } } @@ -173,159 +141,111 @@ private void processClassLevelBinding(InterceptorBindingDescriptor } else { classInterceptorChain.addAll(binding.getInterceptorClasses()); } - } - private void processMethod(MethodDescriptor businessMethod, - List bindings) { - - LinkedList tempDefaultInterceptorChain = - new LinkedList(); - LinkedList tempClassInterceptorChain = - new LinkedList(); - - LinkedList tempMethodInterceptorChain = - new LinkedList(); - - if( hasTotalClassLevelOrdering ) { + private void processMethod(MethodDescriptor businessMethod, List bindings) { + LinkedList tempDefaultInterceptorChain = new LinkedList<>(); + LinkedList tempClassInterceptorChain = new LinkedList<>(); + LinkedList tempMethodInterceptorChain = new LinkedList<>(); + if (hasTotalClassLevelOrdering) { tempClassInterceptorChain.addAll(totalClassLevelOrdering); } else { tempDefaultInterceptorChain.addAll(defaultInterceptorChain); tempClassInterceptorChain.addAll(classInterceptorChain); } - for(InterceptorBindingDescriptor nextBinding : bindings) { - - if( nextBinding.getExcludeDefaultInterceptors() ) { - if( hasTotalClassLevelOrdering ) { - tempClassInterceptorChain.removeAll - (defaultInterceptorChain); + for (InterceptorBindingDescriptor nextBinding : bindings) { + if (nextBinding.getExcludeDefaultInterceptors()) { + if (hasTotalClassLevelOrdering) { + tempClassInterceptorChain.removeAll(defaultInterceptorChain); } else { tempDefaultInterceptorChain.clear(); } } - if( nextBinding.getExcludeClassInterceptors() ) { - if( hasTotalClassLevelOrdering ) { - tempClassInterceptorChain.removeAll - (classInterceptorChain); + if (nextBinding.getExcludeClassInterceptors()) { + if (hasTotalClassLevelOrdering) { + tempClassInterceptorChain.removeAll(classInterceptorChain); } else { tempClassInterceptorChain.clear(); } } - if( nextBinding.getIsTotalOrdering() ) { + if (nextBinding.getIsTotalOrdering()) { tempDefaultInterceptorChain.clear(); tempClassInterceptorChain.clear(); tempMethodInterceptorChain.clear(); } - tempMethodInterceptorChain.addAll - (nextBinding.getInterceptorClasses()); - + tempMethodInterceptorChain.addAll(nextBinding.getInterceptorClasses()); } - LinkedList methodInterceptors = new LinkedList(); + LinkedList methodInterceptors = new LinkedList<>(); methodInterceptors.addAll(tempDefaultInterceptorChain); methodInterceptors.addAll(tempClassInterceptorChain); methodInterceptors.addAll(tempMethodInterceptorChain); - methodInterceptorsMap.put(businessMethod, methodInterceptors); - } - private TranslationResults buildResults() { + private TranslationResults buildResults() { TranslationResults results = new TranslationResults(); - - if( hasTotalClassLevelOrdering ) { - - for(String next : totalClassLevelOrdering ) { - EjbInterceptor interceptor = - ejbBundle.getInterceptorByClassName(next); + if (hasTotalClassLevelOrdering) { + for (String next : totalClassLevelOrdering) { + EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next); results.allInterceptorClasses.add(interceptor); results.classInterceptorChain.add(interceptor); } - } else { - - for(String next : defaultInterceptorChain) { - EjbInterceptor interceptor = - ejbBundle.getInterceptorByClassName(next); - + for (String next : defaultInterceptorChain) { + EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next); results.allInterceptorClasses.add(interceptor); results.classInterceptorChain.add(interceptor); } - - for(String next : classInterceptorChain) { - EjbInterceptor interceptor = - ejbBundle.getInterceptorByClassName(next); - + for (String next : classInterceptorChain) { + EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(next); results.allInterceptorClasses.add(interceptor); results.classInterceptorChain.add(interceptor); } } - Iterator>> entryIterator = - methodInterceptorsMap.entrySet().iterator(); - while(entryIterator.hasNext()) { - Map.Entry> entry = entryIterator.next(); + for (Entry> entry : methodInterceptorsMap.entrySet()) { List interceptorClassChain = entry.getValue(); - - List interceptorChain = - new LinkedList(); - - for(String nextClass : interceptorClassChain) { - EjbInterceptor interceptor = - ejbBundle.getInterceptorByClassName(nextClass); - + List interceptorChain = new LinkedList<>(); + for (String nextClass : interceptorClassChain) { + EjbInterceptor interceptor = ejbBundle.getInterceptorByClassName(nextClass); results.allInterceptorClasses.add(interceptor); interceptorChain.add(interceptor); - } - results.methodInterceptorsMap.put(entry.getKey(), interceptorChain); } - return results; } - private void validateInterceptors() { + private void validateInterceptors() { // Make sure there's an interceptor defined for every interceptor // class name listed in the bindings. - for(InterceptorBindingDescriptor binding : interceptorBindings) { - - for(String interceptor : binding.getInterceptorClasses()) { - - if(ejbBundle.getInterceptorByClassName(interceptor) == null) { - throw new IllegalStateException - ("Interceptor binding contains an interceptor class " + - " name = " + interceptor + - " that is not defined as an interceptor"); + for (InterceptorBindingDescriptor binding : interceptorBindings) { + for (String interceptor : binding.getInterceptorClasses()) { + if (ejbBundle.getInterceptorByClassName(interceptor) == null) { + throw new IllegalStateException("Interceptor binding contains an interceptor class " + " name = " + + interceptor + " that is not defined as an interceptor"); } } } - } public static class TranslationResults { public Set allInterceptorClasses; - public List classInterceptorChain; - - public Map> - methodInterceptorsMap; + public Map> methodInterceptorsMap; public TranslationResults() { - allInterceptorClasses = new HashSet(); - classInterceptorChain = new LinkedList(); - methodInterceptorsMap = - new HashMap>(); + allInterceptorClasses = new HashSet<>(); + classInterceptorChain = new LinkedList<>(); + methodInterceptorsMap = new HashMap<>(); } - } - } - diff --git a/appserver/ejb/ejb-container/src/main/resources/org/glassfish/ejb/deployment/descriptor/LocalStrings.properties b/appserver/ejb/ejb-container/src/main/resources/org/glassfish/ejb/deployment/descriptor/LocalStrings.properties index 9539a6f97d9e..ae0c3ad62780 100644 --- a/appserver/ejb/ejb-container/src/main/resources/org/glassfish/ejb/deployment/descriptor/LocalStrings.properties +++ b/appserver/ejb/ejb-container/src/main/resources/org/glassfish/ejb/deployment/descriptor/LocalStrings.properties @@ -17,7 +17,6 @@ enterprise.deployment.noonmessagemethod=onMessage() is not defined for EJB class enterprise.deployment.msgbeantxattrnotvalid=Invalid transaction attribute for message-driven bean enterprise.deployment.exceptionunknowncontainertxtype=Unknown ContainerTransaction type [{0}] -enterprise.deployment.nomatchingpminusefound=No PersistenceManager found that matches specified PersistenceManager in use. enterprise.deployment.exceptiontxattrbtnotspecifiedinbeanwithtxtype=Method level transaction attributes may not be specified on a bean with transaction type [{0}] enterprise.deployment.exceptioncannotaddrolesdescriptor=Cannot add roles when the descriptor is not part of a bundle enterprise.deployment.exceptioncannotaddrolesbundle=Cannot add roles when the bundle does not have them