private void writeEndpointLifecycle ( Definition def , Writer out , int indent ) throws IOException { writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * This is called during the activation of a message endpoint.\n" ) ; writeWithIndent ( out , indent , " *\n" ) ; writeWithIndent ( out , indent , " * @param endpointFactory A message endpoint factory instance.\n" ) ; writeWithIndent ( out , indent , " * @param spec An activation spec JavaBean instance.\n" ) ; writeWithIndent ( out , indent , " * @throws ResourceException generic exception \n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public void endpointActivation(MessageEndpointFactory endpointFactory,\n" ) ; writeWithIndent ( out , indent + 1 , "ActivationSpec spec) throws ResourceException" ) ; writeLeftCurlyBracket ( out , indent ) ; if ( def . isSupportInbound ( ) ) { writeIndent ( out , indent + 1 ) ; out . write ( def . getActivationClass ( ) + " activation = new " + def . getActivationClass ( ) + "(this, endpointFactory, (" + def . getAsClass ( ) + ")spec);\n" ) ; writeWithIndent ( out , indent + 1 , "activations.put((" + def . getAsClass ( ) + ")spec, activation);\n" ) ; writeWithIndent ( out , indent + 1 , "activation.start();\n\n" ) ; } writeLogging ( def , out , indent + 1 , "trace" , "endpointActivation" , "endpointFactory" , "spec" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; writeWithIndent ( out , indent , "/**\n" ) ; writeWithIndent ( out , indent , " * This is called when a message endpoint is deactivated. \n" ) ; writeWithIndent ( out , indent , " *\n" ) ; writeWithIndent ( out , indent , " * @param endpointFactory A message endpoint factory instance.\n" ) ; writeWithIndent ( out , indent , " * @param spec An activation spec JavaBean instance.\n" ) ; writeWithIndent ( out , indent , " */\n" ) ; writeWithIndent ( out , indent , "public void endpointDeactivation(MessageEndpointFactory endpointFactory,\n" ) ; writeWithIndent ( out , indent + 1 , "ActivationSpec spec)" ) ; writeLeftCurlyBracket ( out , indent ) ; if ( def . isSupportInbound ( ) ) { writeIndent ( out , indent + 1 ) ; out . write ( def . getActivationClass ( ) + " activation = activations.remove(spec);\n" ) ; writeWithIndent ( out , indent + 1 , "if (activation != null)\n" ) ; writeWithIndent ( out , indent + 2 , "activation.stop();\n\n" ) ; } writeLogging ( def , out , indent + 1 , "trace" , "endpointDeactivation" , "endpointFactory" ) ; writeRightCurlyBracket ( out , indent ) ; writeEol ( out ) ; }
Output EndpointLifecycle method