public class ConsoleViewerMixin implements LogServiceListener { @Service private LoggingService service; }
public class SwingViewer extends JFrame { @Service private Iterable<LoggingService> services; }
public class SQLStateChangeListener implements StateChangeListener { @Service private SQLIndexing _indexing; @Override public void notifyChanges( Iterable<EntityState> changedStates ) { try { this._indexing.indexEntities( changedStates ); } catch( SQLException sqle ) { // TODO is UoWException right one for this? throw new UnitOfWorkException( SQLUtil.withAllSQLExceptions( sqle ) ); } } }
abstract class Mixin implements AlarmEvent { @Service private AlarmModel model; @Override public String name( Locale locale ) { ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get().toString(), locale ); return bundle.getString( systemName().get() ); } @Override public String description( Locale locale ) { ResourceBundle bundle = ResourceBundle.getBundle( ((ServiceComposite) model).identity().get().toString(), locale ); String eventDescriptionId = "EVENT_" + systemName().get().toUpperCase() + "_DESCRIPTION"; return bundle.getString( eventDescriptionId ); } } }
abstract class Mixin implements ConstraintService { @Service private ServiceReference<ConstraintService> myRef; @Override public ConstraintMapping buildConstraintMapping() { ConstraintMapping csMapping = null; ConstraintInfo constraintInfo = myRef.metaInfo( ConstraintInfo.class ); if ( constraintInfo != null && constraintInfo.getConstraint() != null ) { Constraint constraint = new Constraint(); csMapping = new ConstraintMapping(); csMapping.setConstraint( constraint ); csMapping.setPathSpec( constraintInfo.getPath() ); if ( constraintInfo.getOmittedHttpMethods() != null && constraintInfo.getOmittedHttpMethods().length > 0 ) { csMapping.setMethodOmissions( HttpMethod.toStringArray( constraintInfo.getOmittedHttpMethods() ) ); } } return csMapping; } }
abstract class Mixin implements ConstraintService { @Service private ServiceReference<ConstraintService> myRef; @Override public ConstraintMapping buildConstraintMapping() { ConstraintMapping csMapping = null; ConstraintInfo constraintInfo = myRef.metaInfo( ConstraintInfo.class ); if ( constraintInfo != null && constraintInfo.getConstraint() != null ) { Constraint constraint = new Constraint(); csMapping = new ConstraintMapping(); csMapping.setConstraint( constraint ); csMapping.setPathSpec( constraintInfo.getPath() ); if ( constraintInfo.getOmittedHttpMethods() != null && constraintInfo.getOmittedHttpMethods().length > 0 ) { csMapping.setMethodOmissions( HttpMethod.toStringArray( constraintInfo.getOmittedHttpMethods() ) ); } } return csMapping; } }
public SecureJettyMixin( @This HasIdentity meAsIdentity, @Service Server jettyServer, @Service Iterable<ServiceReference<ServletContextListener>> contextListeners, @Service Iterable<ServiceReference<Servlet>> servlets, @Service Iterable<ServiceReference<Filter>> filters, @Optional @Service MBeanServer mBeanServer ) { super( meAsIdentity.identity().get(), jettyServer, contextListeners, servlets, filters, mBeanServer ); }
public JettyMixin( @This HasIdentity meAsIdentity, @Service Server jettyServer, @Service Iterable<ServiceReference<ServletContextListener>> contextListeners, @Service Iterable<ServiceReference<Servlet>> servlets, @Service Iterable<ServiceReference<Filter>> filters, @Optional @Service MBeanServer mBeanServer ) { super( meAsIdentity.identity().get(), jettyServer, contextListeners, servlets, filters, mBeanServer ); }
public SecureJettyMixin( @This HasIdentity meAsIdentity, @Service Server jettyServer, @Service Iterable<ServiceReference<ServletContextListener>> contextListeners, @Service Iterable<ServiceReference<Servlet>> servlets, @Service Iterable<ServiceReference<Filter>> filters, @Optional @Service MBeanServer mBeanServer ) { super( meAsIdentity.identity().get(), jettyServer, contextListeners, servlets, filters, mBeanServer ); }
public JettyMixin( @This HasIdentity meAsIdentity, @Service Server jettyServer, @Service Iterable<ServiceReference<ServletContextListener>> contextListeners, @Service Iterable<ServiceReference<Servlet>> servlets, @Service Iterable<ServiceReference<Filter>> filters, @Optional @Service MBeanServer mBeanServer ) { super( meAsIdentity.identity().get(), jettyServer, contextListeners, servlets, filters, mBeanServer ); }
class Mixin implements MyEntity { @Service private YourService service; @Override public void logic() { YourEntity result = service.get(); } } }
public static class ServiceConsumer { private @Service TestService service; public TestService getService() { return service; } }
public static class UnderTestMixin implements UnderTest { @Service private UuidService service; public String generateUuid( int len ) { return service.generateUuid( len ); } } }
abstract class IdentityMixin<T extends HasIdentity> implements ServerResource<T> { @This private Parameters<T> parameters; @Service private IdentityManager identityManager; @Override public Identity identity() { return identityManager.generate( parameters.entityType().get(), parameters.id().get() ); } }
public static class UnderTestMixin implements UnderTest { @Service private Sequencing service; public long nextValue() { return service.newSequenceValue(); } public long currentValue() { return service.currentSequenceValue(); } } }
public static class UnderTestMixin implements UnderTest { @Service private Sequencing service; public long nextValue() { return service.newSequenceValue(); } public long currentValue() { return service.currentSequenceValue(); } } }
public class JavaxJsonConvertersSerializationTest extends AbstractConvertersSerializationTest { @Override public void assemble( ModuleAssembly module ) { new JavaxJsonSerializationAssembler().assemble( module ); super.assemble( module ); } @Service private JavaxJsonFactories jsonFactories; @Override protected String getStringFromValueState( String state, String key ) throws Exception { JsonObject jsonObject = jsonFactories.readerFactory().createReader( new StringReader( state ) ).readObject(); return jsonObject.getString( key ); } }
abstract class RdfQueryParserFactoryMixin implements RdfQueryParserFactory { @Structure private PolygeneSPI spi; @Service private JsonSerializer stateSerializer; @Override public RdfQueryParser newQueryParser( QueryLanguage language ) { if( language.equals( QueryLanguage.SPARQL ) ) { return new RdfQueryParserImpl( spi, stateSerializer ); } throw new UnsupportedLanguageException( language ); } } }
abstract class RdfQueryParserFactoryMixin implements RdfQueryParserFactory { @Structure private PolygeneSPI spi; @Service private JsonSerializer stateSerializer; @Override public RdfQueryParser newQueryParser( QueryLanguage language ) { if( language.equals( QueryLanguage.SPARQL ) ) { return new RdfQueryParserImpl( spi, stateSerializer ); } throw new UnsupportedLanguageException( language ); } } }
class Mixin implements HasUoWFile { @Service private UoWFileFactory uowFileFactory; @This private UoWFileLocator locator; @Override public File attachedFile() { return locator.locateAttachedFile(); } @Override public File managedFile() { return uowFileFactory.createCurrentUoWFile( locator.locateAttachedFile() ).asFile(); } } // START SNIPPET: contract