Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleJava Imports
// Suggested: import alma.<Module>.<Interface>Impl; //But anything, really
package <ChosenPackage>;

// Base component implementation, including container services and component lifecycle infrastructure
import alma.acs.component.ComponentImplBase;

// Skeleton interface for server implementation
import alma.<Module>.<Interface>Operations;

// Error definitions for catching exceptions
import alma.SYSTEMErr.<ExceptionName>Ex;
import alma.<Interface>Err.<ExceptionName>Ex;

// Error definitions for raising exceptions
import alma.SYSTEMErr.wrappers.AcsJ<ExceptionName>Ex;
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;

...

Code Block
languagejava
titleJava Server Class Definition
// ClassName usually is <Interface>Impl, but can be anything
public class <ClassName> extends ComponentImplBase implements <Interface>Operations {

...

Code Block
languagejava
titleJava Server Class Definition
// Replace package alma.<Module>.<Interface>Impl; //for:
package alma.<PackageChosenForComponentHelper>;

// Replace import alma.Observatory.<Interface>Impl.<Interface>Impl; //for:
import alma.<PackageChosenForComponentImpl>.<ClassNameForComponentImpl>;

// Replace return new <Interface>Impl(); // for
return new <ClassNameForComponentImpl>();

...

Code Block
languagejava
titleJava Types Usage
// From IDL <Module>::<EnumName>::<VALUE>
import alma.<Module>.<EnumName>;
<EnumName>.<VALUE>;

// From IDL <Module>::<Interface>::<Enumname>::<VALUE>
import alma.<Module>.<Interface>Package.<EnumName>;
<EnumName>.<VALUE>;

import alma.TYPES.<TypeName>;

...

Code Block
languagejava
titleJava Component Interaction
// Shared
import alma.<Module>.<Interface>;
import alma.<Module>.<Interface>Helper;

// By Name
<Interface> comp = <Interface>Helper.narrow(this.m_containerServices.getComponent("<Name>"));

// By Interface. Must be at least one component configured as default!
<Interface> comp = <Interface>Helper.narrow(this.m_containerServices.getDefaultComponent("IDL:alma/<Module>/<Interface>:1.0"));

// Release Components
m_containerServies.releaseComponent(comp.name());

...

Code Block
languagejava
titleJava Error Handling
// For catching exceptions
import alma.<Interface>Err.<ExceptionName>Ex;
catch (<ExceptionName>Ex e) {

// For raising exceptions
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
throw new AcsJ<ExceptionName>Ex("<CustomMessage>").to<ExceptionName>Ex();

// For raising exceptions with parameters
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
AcsJ<ExceptionName>Ex err = new AcsJ<ExceptionName>Ex("<CustomMessage>");
err.set<ParamName>(<Value>);
throw err.to<ExceptionName>Ex();

// For logging an error message from the exceptions
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
AcsJ<ExceptionName>Ex err = <Interface>ErrImpl.<ExceptionName>ExImpl()
err.log(m_logger);
throw err.to<ExceptionName>Ex();

...