Return-Path: Delivered-To: apmail-geronimo-dev-archive@www.apache.org Received: (qmail 58496 invoked from network); 2 Jul 2007 16:22:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jul 2007 16:22:41 -0000 Received: (qmail 1675 invoked by uid 500); 2 Jul 2007 16:22:31 -0000 Delivered-To: apmail-geronimo-dev-archive@geronimo.apache.org Received: (qmail 1627 invoked by uid 500); 2 Jul 2007 16:22:31 -0000 Mailing-List: contact dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list dev@geronimo.apache.org Received: (qmail 1607 invoked by uid 99); 2 Jul 2007 16:22:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 09:22:31 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of shivahr@gmail.com designates 66.249.92.170 as permitted sender) Received: from [66.249.92.170] (HELO ug-out-1314.google.com) (66.249.92.170) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 09:22:27 -0700 Received: by ug-out-1314.google.com with SMTP id 44so1372184uga for ; Mon, 02 Jul 2007 09:22:05 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=eimg/Ld2LBT+N8LOo1JoT97o1N9X6Grc6opyj+ZaROhUsLR4xyMPETZEOX0ft/BIL1N1bzQtxrRDQomImMwuiO8p/n1zufc9WLXIEwY0Idn3q6m/0uBpYtyqqm517q49U8basRYFsxjbVY8vb0RVeA9zKGcmZpzvSrPxFj4mf0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=fm7a7FzaPCnzwxe8da6lC+dSLNkllAsTnVMH3AJAnu3AsXGj9NtEoQi48s7V5L8gSLec4c3tgSkWL6Y+W+sGcpXpCqwNFjIEjzSKGXHdVypBAQFg48U7YkhhtHv5AVTDshz8vKT2wXEY8eB+X46wXkYG9eptXsmP9lUC+H6kbM8= Received: by 10.78.149.15 with SMTP id w15mr3018751hud.1183393325390; Mon, 02 Jul 2007 09:22:05 -0700 (PDT) Received: by 10.78.138.8 with HTTP; Mon, 2 Jul 2007 09:22:05 -0700 (PDT) Message-ID: <5da94e5a0707020922x493951c0j3953c975f7d6b62a@mail.gmail.com> Date: Mon, 2 Jul 2007 21:52:05 +0530 From: "Shiva Kumar H R" To: dev@geronimo.apache.org Subject: Re: Stuck in discovering Annotations - Please Help! In-Reply-To: <5da94e5a0706262202j5bebad12k87b9bf459c1ef836@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_61694_9170366.1183393325345" References: <5da94e5a0706260813s4975fe27s732ef3b49615a44b@mail.gmail.com> <446ED95C-7C98-4498-A0F9-32BA05654509@yahoo.com> <5da94e5a0706262202j5bebad12k87b9bf459c1ef836@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_61694_9170366.1183393325345 Content-Type: multipart/alternative; boundary="----=_Part_61695_10839984.1183393325345" ------=_Part_61695_10839984.1183393325345 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Following the working of NamingBuilders, I have arrived at the following piece of code: 1) Code called from Portlet: private static void parseAnnotations(AnnotatedApp annotatedApp, ClassFinder classFinder) throws Exception { ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, EnvEntryRefProcessor.INSTANCE); WebServiceRefAnnotationHelper.processAnnotations(annotatedApp, classFinder); HandlerChainAnnotationHelper.processAnnotations(annotatedApp, classFinder); ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, ServiceRefProcessor.INSTANCE); ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, AdminObjectRefProcessor.INSTANCE); ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, ResourceRefProcessor.INSTANCE); PersistenceContextAnnotationHelper.processAnnotations(annotatedApp, classFinder); PersistenceUnitAnnotationHelper.processAnnotations(annotatedApp, classFinder); EJBAnnotationHelper.processAnnotations(annotatedApp, classFinder); if (annotatedApp instanceof AnnotatedWebApp) { SecurityAnnotationHelper.processAnnotations(((AnnotatedWebApp) annotatedApp).getWebApp(), classFinder); } } private static Module createModule(PortletRequest request, URL moduleUrl) throws Exception { Object[] builders = PortletManager.getGBeansImplementing(request, ConfigurationBuilder.class); ConfigurationBuilder configurationBuilder = null; for (int i = 0; i < builders.length; i++) { ObjectName objectName = PortletManager.getNameFor(request, builders[i]).getObjectName(); if ("EARBuilder".equalsIgnoreCase(objectName.getKeyProperty( NameFactory.J2EE_NAME))) { configurationBuilder = (ConfigurationBuilder) builders[i]; break; } } JarFile moduleJar = DeploymentUtil.createJarFile(new File( moduleUrl.toURI())); ApplicationInfo applicationInfo = (ApplicationInfo) configurationBuilder.getDeploymentPlan(null, moduleJar, new ModuleIDBuilder()); Module module = (Module) (applicationInfo.getModules ().toArray()[0]); return module; } // function called from Portlet Handler public static void parseWarReferences(PortletRequest request, WARConfigData data, URL warUrl) throws Exception { WebDeployable webDeployable = new WebDeployable(warUrl); Module module = createModule(request, warUrl); WebAppType webApp = (WebAppType) module.getSpecDD(); ClassLoader classLoader = webDeployable.getModuleLoader(); ClassFinder classFinder = null; try { classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader); // classFinder = new ClassFinder(webDeployable.getModuleLoader ()); } catch (NoClassDefFoundError e1) { // Some of the class types referred in the WAR cannot be resolved. // A typical case would be references to EJBs already deployed into the system, and // hence not packaged inside WEB-INF/lib directory of WAR. // try adding all EJBs deployed in the system as parents of this WAR, and // see if referred classes can now be succesfully resolved //TODO create a new class loader with deployed-ejbs as parents MultiParentClassLoader newClassLoader = null; //TODO try { classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader); } catch (NoClassDefFoundError e2) { return; } } AnnotatedApp annotatedApp = module.getAnnotatedApp(); parseAnnotations(annotatedApp, classFinder); EjbRefType[] ejbRefs = annotatedApp.getEjbRefArray(); for (int i = 0; i < ejbRefs.length; i++) { String refName = ejbRefs[i].getEjbRefName().getStringValue(); data.getEjbRefs().add(new ReferenceData(refName)); } EjbLocalRefType[] ejbLocalRefs = annotatedApp.getEjbLocalRefArray(); for (int i = 0; i < ejbLocalRefs.length; i++) { String refName = ejbLocalRefs[i].getEjbRefName().getStringValue(); data.getEjbLocalRefs().add(new ReferenceData(refName)); } ResourceRefType[] resourceRefs = annotatedApp.getResourceRefArray(); for(int i = 0; i < resourceRefs.length; i++) { String refName = resourceRefs[i].getResRefName().getStringValue(); String refType = resourceRefs[i].getResType().getStringValue(); if ("javax.sql.DataSource".equalsIgnoreCase(refType)) { data.getJdbcPoolRefs().add(new ReferenceData(refName)); } else if ("javax.jms.ConnectionFactory ".equalsIgnoreCase(refType) || "javax.jms.QueueConnectionFactory ".equalsIgnoreCase(refType) || "javax.jms.TopicConnectionFactory".equalsIgnoreCase(refType)) { data.getJmsConnectionFactoryRefs().add(new ReferenceData(refName)); } } ResourceEnvRefType[] resourceEnvRefs = annotatedApp.getResourceEnvRefArray(); for(int i = 0; i < resourceEnvRefs.length; i++) { String refName = resourceEnvRefs[i].getResourceEnvRefName().getStringValue(); ReferenceData refData = new ReferenceData(refName); refData.setRefLink(refName); data.getJmsDestinationRefs().add(refData); } if(annotatedApp instanceof AnnotatedWebApp) { MessageDestinationType[] messageDestinations = ((AnnotatedWebApp)annotatedApp).getWebApp().getMessageDestinationArray(); for(int i = 0; i < messageDestinations.length; i++) { String refName = messageDestinations[i].getMessageDestinationName().getStringValue(); ReferenceData refData = new ReferenceData(refName); refData.setRefLink(refName); data.getMessageDestinations().add(refData); } } } 2) Changes required to AdminObjectRefBuilder and AbstractWebModuleBuilder: With my limited set of test WARs, I observe that although this code works for @Resource annotations (references to JMS Connection Factories, JMS Destinations and JDBC Connection Pools), it fails for @EJB annotations as explained below. Please suggest if above code would be acceptable. Suggestions/Hints of doing it better is welcome. I suspect there might be better ways of creating 'Module' object (with a proper EARContext, yet not deploying it in the system) and 'ClassFinder' objects. Here is one failure scenario for EJB references: Input WAR has a Servelt that references an EJB as below: @EJB(name = "ejb/Converter") private Converter converter; The referenced EJB ('Converter') is already deployed in the system. When function "parseWarReferences()" above is called for this WAR, it would fail at "classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader);" with a ClassNotFoundError for "Converter" EJB. Following is the solution I can think of: Try adding all EJBs deployed in the system as dependencies of this WAR (temporarily), and see if referred classes can now be succesfully resolved while creating ClassFinder object. The question then would be "given the pattern name for an EJB JAR (like 'default/CurrencyConverterEJB/1.0/jar' how do I obtain a reference to this deployed EJB-JAR's classloader?" Any hints will be helpful. Thanks, Shiva On 6/27/07, Shiva Kumar H R wrote: > > Thanks David. Will look into the working of NamingBuilders. > > - Shiva > > On 6/26/07, David Jencks wrote: > > > > > > On Jun 26, 2007, at 8:13 AM, Shiva Kumar H R wrote: > > > > This is with regard to auto generation of Geronimo deployment plans (http://issues.apache.org/jira/browse/GERONIMO-3254). > > One problem where I am currently stuck is in the discovery of Annotations. > > > > User input to my wizard/portlet would be the Java EE module > > (WAR/EJB-JAR/EAR) and output would be the Geronimo deployment plan. An > > important step in this process is to discover all references declared in the > > Java EE module and then ask the user to resolve them ( http://issues.apache.org/jira/secure/attachment/12360303/3ResolveReferences.gif > > ). > > > > References declared in the spec deployment descriptor ( > > web.xml/ejb-jar.xml) can easily be discovered by parsing the spec DD > > (lines 921 to 959 of > > http://issues.apache.org/jira/secure/attachment/12360289/PoC.patch). > > References declared as Annotations in java code (with probably no mention in > > the spec DD) is what is posing the problem now. > > > > Are there any standard APIs that simplify the job of discovering these > > Annotations (and optionally get them into the spec DD)? Please note that > > this must be achieved without the need for actually deploying the Java EE > > module onto the server (user is in the process of still creating the > > Geronimo deployment plan using wizard/portlet). > > > > Any help and hints is greatly appreciated. > > > > > > roughly the first thing the NamingBuilders do is find all the relevant > > annotations and modify the spec dd by adding xml with the same meaning (when > > not already overridden). I recommend you figure out how this works and use > > the NamingBuilders to do this. You might need to expose another method on > > the naming builders for your portlet to call. > > > > thanks > > david jencks > > > > > > Thanks, > > Shiva > > > > > > > ------=_Part_61695_10839984.1183393325345 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Following the working of NamingBuilders, I have arrived at the following piece of code:

1) Code called from Portlet:
    private static void parseAnnotations(AnnotatedApp annotatedApp, ClassFinder classFinder) throws Exception {
        ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, EnvEntryRefProcessor.INSTANCE);
        WebServiceRefAnnotationHelper.processAnnotations(annotatedApp, classFinder);
        HandlerChainAnnotationHelper.processAnnotations (annotatedApp, classFinder);
        ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, ServiceRefProcessor.INSTANCE);
        ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, AdminObjectRefProcessor.INSTANCE);
        ResourceAnnotationHelper.processAnnotations(annotatedApp, classFinder, ResourceRefProcessor.INSTANCE);
        PersistenceContextAnnotationHelper.processAnnotations(annotatedApp, classFinder);
        PersistenceUnitAnnotationHelper.processAnnotations(annotatedApp, classFinder);
        EJBAnnotationHelper.processAnnotations(annotatedApp, classFinder);
        if (annotatedApp instanceof AnnotatedWebApp) {
            SecurityAnnotationHelper.processAnnotations(((AnnotatedWebApp) annotatedApp).getWebApp(), classFinder);
        }
    }

    private static Module createModule(PortletRequest request, URL moduleUrl) throws Exception {
        Object[] builders = PortletManager.getGBeansImplementing(request, ConfigurationBuilder.class);
        ConfigurationBuilder configurationBuilder = null;
        for (int i = 0; i < builders.length; i++) {
            ObjectName objectName = PortletManager.getNameFor(request, builders[i]).getObjectName();
            if ("EARBuilder".equalsIgnoreCase(objectName.getKeyProperty(NameFactory.J2EE_NAME))) {
                configurationBuilder = (ConfigurationBuilder) builders[i];
                break;
            }
        }
        JarFile moduleJar = DeploymentUtil.createJarFile(new File(moduleUrl.toURI()));
        ApplicationInfo applicationInfo = (ApplicationInfo) configurationBuilder.getDeploymentPlan (null, moduleJar, new ModuleIDBuilder());
        Module module = (Module) (applicationInfo.getModules().toArray()[0]);
        return module;
    }

    // function called from Portlet Handler
    public static void parseWarReferences(PortletRequest request, WARConfigData data, URL warUrl)
            throws Exception {
        WebDeployable webDeployable = new WebDeployable(warUrl);

        Module module = createModule(request, warUrl);
        WebAppType webApp = (WebAppType) module.getSpecDD();
        ClassLoader classLoader = webDeployable.getModuleLoader();
        ClassFinder classFinder = null;
        try {
            classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader);
            // classFinder = new ClassFinder(webDeployable.getModuleLoader());
        } catch (NoClassDefFoundError e1) {
            // Some of the class types referred in the WAR cannot be resolved.
            // A typical case would be references to EJBs already deployed into the system, and
            // hence not packaged inside WEB-INF/lib directory of WAR.
            // try adding all EJBs deployed in the system as parents of this WAR, and
            // see if referred classes can now be succesfully resolved

            //TODO create a new class loader with deployed-ejbs as parents
            MultiParentClassLoader newClassLoader = null; //TODO
            try {
                classFinder = AbstractWebModuleBuilder.createWebAppClassFinder(webApp, classLoader);
            } catch (NoClassDefFoundError e2) {
                return;
            }
        }
        AnnotatedApp annotatedApp = module.getAnnotatedApp();
        parseAnnotations(annotatedApp, classFinder);

        EjbRefType[] ejbRefs = annotatedApp.getEjbRefArray();
        for (int i = 0; i < ejbRefs.length; i++) {
            String refName = ejbRefs[i].getEjbRefName().getStringValue();
            data.getEjbRefs().add(new ReferenceData(refName));
        }

        EjbLocalRefType[] ejbLocalRefs = annotatedApp.getEjbLocalRefArray();
        for (int i = 0; i < ejbLocalRefs.length; i++) {
            String refName = ejbLocalRefs[i].getEjbRefName().getStringValue();
            data.getEjbLocalRefs().add(new ReferenceData(refName));
        }

        ResourceRefType[] resourceRefs = annotatedApp.getResourceRefArray();
        for(int i = 0; i < resourceRefs.length; i++) {
            String refName = resourceRefs[i].getResRefName().getStringValue();
            String refType = resourceRefs[i].getResType().getStringValue();
            if ("javax.sql.DataSource".equalsIgnoreCase(refType)) {
                data.getJdbcPoolRefs().add(new ReferenceData(refName));
            } else if ("javax.jms.ConnectionFactory".equalsIgnoreCase(refType)
                    || "javax.jms.QueueConnectionFactory".equalsIgnoreCase(refType)
                    || " javax.jms.TopicConnectionFactory".equalsIgnoreCase(refType)) {
                data.getJmsConnectionFactoryRefs().add(new ReferenceData(refName));
            }
        }

        ResourceEnvRefType[] resourceEnvRefs = annotatedApp.getResourceEnvRefArray();
        for(int i = 0; i < resourceEnvRefs.length; i++) {
            String refName = resourceEnvRefs[i].getResourceEnvRefName().getStringValue();
            ReferenceData refData = new ReferenceData(refName);
            refData.setRefLink(refName);
            data.getJmsDestinationRefs().add(refData);
        }
        if(annotatedApp instanceof AnnotatedWebApp) {
            MessageDestinationType[] messageDestinations = ((AnnotatedWebApp)annotatedApp).getWebApp().getMessageDestinationArray();
            for(int i = 0; i < messageDestinations.length; i++) {
                String refName = messageDestinations[i].getMessageDestinationName().getStringValue();
                ReferenceData refData = new ReferenceData(refName);
                refData.setRefLink(refName);
                data.getMessageDestinations().add(refData);
            }
        }
    }

2) Changes required to AdminObjectRefBuilder and AbstractWebModuleBuilder:
<please see attached file AdminObjectRefBuilder.patch>

With my limited set of test WARs, I observe that although this code works for @Resource annotations (references to JMS Connection Factories, JMS Destinations and JDBC Connection Pools), it fails for @EJB annotations as explained below.

Please suggest if above code would be acceptable. Suggestions/Hints of doing it better is welcome. I suspect there might be better ways of creating 'Module' object (with a proper EARContext, yet not deploying it in the system) and 'ClassFinder' objects.

Here is one failure scenario for EJB references:
Input WAR has a Servelt that references an EJB as below:
    @EJB(name = "ejb/Converter")
    private Converter converter;
The referenced EJB ('Converter') is already deployed in the system.

When function "parseWarReferences()" above is called for this WAR, it would fail at
"classFinder = AbstractWebModuleBuilder.createWebAppClassFinder (webApp, classLoader);"
with a ClassNotFoundError for "Converter" EJB.

Following is the solution I can think of:
Try adding all EJBs deployed in the system as dependencies of this WAR (temporarily), and see if referred classes can now be succesfully resolved while creating ClassFinder object.

The question then would be "given the pattern name for an EJB JAR (like 'default/CurrencyConverterEJB/1.0/jar' how do I obtain a reference to this deployed EJB-JAR's classloader? " Any hints will be helpful.

Thanks,
Shiva

On 6/27/07, Shiva Kumar H R <shivahr@gmail.com > wrote:
Thanks David. Will look into the working of NamingBuilders.

- Shiva


On 6/26/07, David Jencks < david_jencks@yahoo.com > wrote:

On Jun 26, 2007, at 8:13 AM, Shiva Kumar H R wrote:

This is with regard to auto generation of Geronimo deployment plans ( http://issues.apache.org/jira/browse/GERONIMO-3254). One problem where I am currently stuck is in the discovery of Annotations.

User input to my wizard/portlet would be the Java EE module (WAR/EJB-JAR/EAR) and output would be the Geronimo deployment plan. An important step in this process is to discover all references declared in the Java EE module and then ask the user to resolve them ( http://issues.apache.org/jira/secure/attachment/12360303/3ResolveReferences.gif ).

References declared in the spec deployment descriptor (web.xml/ejb-jar.xml) can easily be discovered by parsing the spec DD (lines 921 to 959 of http://issues.apache.org/jira/secure/attachment/12360289/PoC.patch). References declared as Annotations in java code (with probably no mention in the spec DD) is what is posing the problem now.

Are there any standard APIs that simplify the job of discovering these Annotations (and optionally get them into the spec DD)? Please note that this must be achieved without the need for actually deploying the Java EE module onto the server (user is in the process of still creating the Geronimo deployment plan using wizard/portlet).

Any help and hints is greatly appreciated.

roughly the first thing the NamingBuilders do is find all the relevant annotations and modify the spec dd by adding xml with the same meaning (when not already overridden).  I recommend you figure out how this works and use the NamingBuilders to do this.  You might need to expose another method on the naming builders for your portlet to call.  

thanks
david jencks


Thanks,
Shiva



------=_Part_61695_10839984.1183393325345-- ------=_Part_61694_9170366.1183393325345 Content-Type: application/octet-stream; name=AdminObjectRefBuilder.patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_f3n4r8t4 Content-Disposition: attachment; filename="AdminObjectRefBuilder.patch" SW5kZXg6IGdlcm9uaW1vLWNvbm5lY3Rvci1idWlsZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNo ZS9nZXJvbmltby9jb25uZWN0b3IvZGVwbG95bWVudC9BZG1pbk9iamVjdFJlZkJ1aWxkZXIuamF2 YQ0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PQ0KLS0tIGdlcm9uaW1vLWNvbm5lY3Rvci1idWlsZGVyL3NyYy9tYWluL2ph dmEvb3JnL2FwYWNoZS9nZXJvbmltby9jb25uZWN0b3IvZGVwbG95bWVudC9BZG1pbk9iamVjdFJl ZkJ1aWxkZXIuamF2YQkocmV2aXNpb24gNTUyNDEzKQ0KKysrIGdlcm9uaW1vLWNvbm5lY3Rvci1i dWlsZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nZXJvbmltby9jb25uZWN0b3IvZGVwbG95 bWVudC9BZG1pbk9iamVjdFJlZkJ1aWxkZXIuamF2YQkod29ya2luZyBjb3B5KQ0KQEAgLTMwMCw2 ICszMDAsOCBAQA0KICAgICB9CiAKICAgICBwdWJsaWMgc3RhdGljIGNsYXNzIEFkbWluT2JqZWN0 UmVmUHJvY2Vzc29yIGV4dGVuZHMgUmVzb3VyY2VBbm5vdGF0aW9uSGVscGVyLlJlc291cmNlUHJv Y2Vzc29yIHsKKyAgICAgICAgcHVibGljIHN0YXRpYyBmaW5hbCBBZG1pbk9iamVjdFJlZlByb2Nl c3NvciBJTlNUQU5DRSA9IG5ldyBBZG1pbk9iamVjdFJlZlByb2Nlc3NvcihudWxsLCBudWxsLCBu dWxsKTsKKwogICAgICAgICBwcml2YXRlIGZpbmFsIEVBUkNvbnRleHQgZWFyQ29udGV4dDsKICAg ICAgICAgcHJpdmF0ZSBmaW5hbCBNYXA8U3Rya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V0dXJuIHRy dWU7CiAgICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgIC8vaWYgaXQgbWFwcyB0 byBhIHJlc291cmNlLWVudi1yZWYgaW4gdGhlIGdlcm9uaW1vIHBsYW4sIGl0J3MgYSByZXNvdXJj ZS1yZWYKLSAgICAgICAgICAgICAgICBHZXJSZXNvdXJjZUVudlJlZlR5cGUgcmVzb3VyY2VFbnZS ZWZUeXBlID0gcmVmTWFwLmdldChyZXNvdXJjZU5hbWUpOworICAgICAgICAgICAgICAgIEdlclJl c291cmNlRW52UmVmVHlwZSByZXNvdXJjZUVudlJlZlR5cGUgPSBudWxsOworICAgICAgICAgICAg ICAgIGlmIChyZWZNYXAgIT0gbnVsbCkgeworICAgICAgICAgICAgICAgICAgICByZXNvdXJjZUVu dlJlZlR5cGUgPSByZWZNYXAuZ2V0KHJlc291cmNlTmFtZSk7CisgICAgICAgICAgICAgICAgfQog ICAgICAgICAgICAgICAgIGlmIChyZXNvdXJjZUVudlJlZlR5cGUgIT0gbnVsbCB8fCByZXNvdXJj ZVR5cGUuZXF1YWxzKCJqYXZheC50cmFuc2FjdGlvbi5Vc2VyVHJhbnNhY3Rpb24iKSkgewogICAg ICAgICAgICAgICAgICAgICAvL21hcHBlZCByZXNvdXJjZS1lbnYtcmVmCiAgICAgICAgICAgICAg ICAgICAgIGFkZFJlc291cmNlRW52UmVmKGFubm90YXRlZEFwcCwgcmVzb3VyY2VOYW1lLCByZXNv dXJjZVR5cGUsIG1ldGhvZCwgZmllbGQsIGFubm90YXRpb24pOwogICAgICAgICAgICAgICAgICAg ICByZXR1cm4gdHJ1ZTsKICAgICAgICAgICAgICAgICB9IGVsc2UgewotICAgICAgICAgICAgICAg ICAgICAvL2xvb2sgZm9yIGFuIEpDQUFkbWluT2JqZWN0IGdiZWFuIHdpdGggdGhlIHJpZ2h0IG5h bWUKLSAgICAgICAgICAgICAgICAgICAgQWJzdHJhY3ROYW1lUXVlcnkgY29udGFpbmVySWQgPSBi dWlsZEFic3RyYWN0TmFtZVF1ZXJ5KG51bGwsIG51bGwsIHJlc291cmNlTmFtZSwgTmFtZUZhY3Rv cnkuSkNBX0FETUlOX09CSkVDVCwgTmFtZUZhY3RvcnkuUkVTT1VSQ0VfQURBUFRFUl9NT0RVTEUp OwotICAgICAgICAgICAgICAgICAgICB0cnkgewotICAgICAgICAgICAgICAgICAgICAgICAgZWFy Q29udGV4dC5maW5kR0JlYW4oY29udGFpbmVySWQpOwotICAgICAgICAgICAgICAgICAgICB9IGNh dGNoIChHQmVhbk5vdEZvdW5kRXhjZXB0aW9uIGUpIHsKLSAgICAgICAgICAgICAgICAgICAgICAg IC8vbm90IGlkZW50aWZpYWJsZSBhcyBhbiBhZG1pbiBvYmplY3QgcmVmCi0gICAgICAgICAgICAg ICAgICAgICAgICByZXR1cm4gZmFsc2U7CisgICAgICAgICAgICAgICAgICAgIGlmIChlYXJDb250 ZXh0ICE9IG51bGwpIHsKKyAgICAgICAgICAgICAgICAgICAgICAgIC8vIGxvb2sgZm9yIGFuIEpD QUFkbWluT2JqZWN0IGdiZWFuIHdpdGggdGhlIHJpZ2h0IG5hbWUKKyAgICAgICAgICAgICAgICAg ICAgICAgIEFic3RyYWN0TmFtZVF1ZXJ5IGNvbnRhaW5lcklkID0gYnVpbGRBYnN0cmFjdE5hbWVR dWVyeShudWxsLCBudWxsLCByZXNvdXJjZU5hbWUsCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIE5hbWVGYWN0b3J5LkpDQV9BRE1JTl9PQkpFQ1QsIE5hbWVGYWN0b3J5LlJFU09VUkNF X0FEQVBURVJfTU9EVUxFKTsKKyAgICAgICAgICAgICAgICAgICAgICAgIHRyeSB7CisgICAgICAg ICAgICAgICAgICAgICAgICAgICAgZWFyQ29udGV4dC5maW5kR0JlYW4oY29udGFpbmVySWQpOwor ICAgICAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoR0JlYW5Ob3RGb3VuZEV4Y2VwdGlvbiBl KSB7CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbm90IGlkZW50aWZpYWJsZSBhcyBh biBhZG1pbiBvYmplY3QgcmVmCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZh bHNlOworICAgICAgICAgICAgICAgICAgICAgICAgfQorICAgICAgICAgICAgICAgICAgICB9IGVs c2UgeworICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoImphdmF4Lmptcy5RdWV1ZSIuZXF1 YWxzKHJlc291cmNlVHlwZSkgfHwgImphdmF4Lmptcy5Ub3BpYyIuZXF1YWxzKHJlc291cmNlVHlw ZSkgCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHx8ICJqYXZheC5qbXMuRGVzdGlu YXRpb24iLmVxdWFscyhyZXNvdXJjZVR5cGUpKSkgeworICAgICAgICAgICAgICAgICAgICAgICAg ICAgIC8vIG5vdCBpZGVudGlmaWFibGUgYXMgYW4gYWRtaW4gb2JqZWN0IHJlZgorICAgICAgICAg ICAgICAgICAgICAgICAgICAgIHJldHVybiBmYWxzZTsKKyAgICAgICAgICAgICAgICAgICAgICAg IH0KICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICBhZGRSZXNvdXJj ZUVudlJlZihhbm5vdGF0ZWRBcHAsIHJlc291cmNlTmFtZSwgcmVzb3VyY2VUeXBlLCBtZXRob2Qs IGZpZWxkLCBhbm5vdGF0aW9uKTsKICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7Cklu ZGV4OiBnZXJvbmltby13ZWItMi41LWJ1aWxkZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dl cm9uaW1vL3dlYjI1L2RlcGxveW1lbnQvQWJzdHJhY3RXZWJNb2R1bGVCdWlsZGVyLmphdmENCj09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT0NCi0tLSBnZXJvbmltby13ZWItMi41LWJ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