/** * {@link FilenameResolver} that delegates to {@link PathResolver}. * * @author Ben Alex * @since 1.0 */ @Component @Service public class PathResolvingAwareFilenameResolver implements FilenameResolver { @Reference private PathResolver pathResolver; public String getMeaningfulName(final File file) { Validate.notNull(file, "File required"); return pathResolver.getFriendlyName(FileUtils.getCanonicalPath(file)); } }
@Component(immediate=true) @Service(value=AnalysedTextFactory.class) @Properties(value={ @Property(name=Constants.SERVICE_RANKING,intValue=Integer.MIN_VALUE) }) public class AnalysedTextFactoryImpl extends AnalysedTextFactory { @Override public AnalysedText createAnalysedText(Blob blob) throws IOException { String text = ContentItemHelper.getText(blob); return new AnalysedTextImpl(blob,text); } }
@Component(immediate = true) @Service(PageProvider.class) public class XliffDownloadPageProvider implements PageProvider { @Property(value = "/xliff") static final String PAGE_PATH = PageProvider.MOUNT_PATH_PROPERTY; @Override public Class<? extends Page> getPageClass() { return XliffDownloadPage.class; } }
@SlingServlet(paths = {"/bin/cqsm/history"}, methods = {"GET"}) @Service @Properties({@Property(name = Constants.SERVICE_DESCRIPTION, value = "CQSM History List Servlet"), @Property(name = Constants.SERVICE_VENDOR, value = Cqsm.VENDOR_NAME)}) public class HistoryListServlet extends SlingAllMethodsServlet { @Override protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { List<Entry> executions = request.adaptTo(ExecutionHistoryModel.class).getExecutions(); ServletUtils.writeJson(response, executions); } }
@Component @Service(value=ResourceAccessSecurity.class) @Property(name=ResourceAccessSecurity.CONTEXT, value=ResourceAccessSecurity.PROVIDER_CONTEXT) @Reference(name="ResourceAccessGate", referenceInterface=ResourceAccessGate.class, cardinality=ReferenceCardinality.MANDATORY_MULTIPLE, policy=ReferencePolicy.DYNAMIC, target="(" + ResourceAccessGate.CONTEXT + "=" + ResourceAccessGate.PROVIDER_CONTEXT + ")") public class ProviderResourceAccessSecurityImpl extends ResourceAccessSecurityImpl { public ProviderResourceAccessSecurityImpl() { super(false); } }
/** * Extends {@link PollingFileMonitorService} by making it available as an OSGi * component that automatically monitors the environment's * {@link FileEventListener} components. * * @author Ben Alex * @since 1.1 */ @Component @Service @Reference(name = "fileEventListener", strategy = ReferenceStrategy.EVENT, policy = ReferencePolicy.DYNAMIC, referenceInterface = FileEventListener.class, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE) public class PollingFileMonitorComponent extends PollingFileMonitorService { protected void bindFileEventListener(final FileEventListener listener) { add(listener); } protected void unbindFileEventListener(final FileEventListener listener) { remove(listener); } }
@SlingServlet(paths = {"/bin/cqsm/history"}, methods = {"GET"}) @Service @Properties({@Property(name = Constants.SERVICE_DESCRIPTION, value = "CQSM History List Servlet"), @Property(name = Constants.SERVICE_VENDOR, value = Cqsm.VENDOR_NAME)}) public class HistoryListServlet extends SlingAllMethodsServlet { @Override protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { List<Entry> executions = request.adaptTo(ExecutionHistoryModel.class).getExecutions(); ServletUtils.writeJson(response, executions); } }
@Component @Service(value=ResourceAccessSecurity.class) @Property(name=ResourceAccessSecurity.CONTEXT, value=ResourceAccessSecurity.APPLICATION_CONTEXT) @Reference(name="ResourceAccessGate", referenceInterface=ResourceAccessGate.class, cardinality=ReferenceCardinality.MANDATORY_MULTIPLE, policy=ReferencePolicy.DYNAMIC, target="(" + ResourceAccessGate.CONTEXT + "=" + ResourceAccessGate.APPLICATION_CONTEXT + ")") public class ApplicationResourceAccessSecurityImpl extends ResourceAccessSecurityImpl { public ApplicationResourceAccessSecurityImpl() { super(false); } }
/** * Commands for the 'backup' add-on to be used by the ROO shell. * * @author Stefan Schmidt * @since 1.0 */ @Component @Service public class BackupCommands implements CommandMarker { @Reference private BackupOperations backupOperations; @CliCommand(value = "backup", help = "Backups your project to a zip file located in root directory.") public String backup() { return backupOperations.backup(); } @CliAvailabilityIndicator("backup") public boolean isBackupCommandAvailable() { return backupOperations.isBackupPossible(); } }
@Component(metatype = true) @Property(name = Constants.SERVICE_RANKING, intValue = 1, propertyPrivate = false) @Service(value = { org.apache.jackrabbit.server.io.IOHandler.class, org.apache.jackrabbit.server.io.PropertyHandler.class}) public class TestHandler3 extends AbstractHandler { @Override public String getHandlerName(){ return "test-io-handler-111"; } }
@Component(immediate=true) @Service(value=AnalysedTextFactory.class) @Properties(value={ @Property(name=Constants.SERVICE_RANKING,intValue=Integer.MIN_VALUE) }) public class AnalysedTextFactoryImpl extends AnalysedTextFactory { @Override public AnalysedText createAnalysedText(Blob blob) throws IOException { String text = ContentItemHelper.getText(blob); return new AnalysedTextImpl(blob,text); } }
/** * Shell commands for hinting services. * * @author Ben Alex * @since 1.0 */ @Component @Service public class HintCommands implements CommandMarker { @Reference private HintOperations hintOperations; @CliCommand(value = "hint", help = "Provides step-by-step hints and context-sensitive guidance.") public String hint( @CliOption( key = {"topic", ""}, mandatory = false, unspecifiedDefaultValue = "", optionContext = "disable-string-converter,topics", help = "The topic for which advice should be provided. " + "Possible values are: `controllers`, `eclipse`, `entities`, `fields`, `finders`, `general`, " + "`mvc`, `persistence`, `relationships`, `repositories`, `services`, `start` and `topics`.") final String topic) { return hintOperations.hint(topic); } }
@Component(metatype = true) @Property(name = Constants.SERVICE_RANKING, intValue = 2, propertyPrivate = false) @Service(value = { DeleteHandler.class }) public class TestDeleteHandler2 extends AbstractDeleteHandler { public TestDeleteHandler2() { this.HANDLER_NAME = "test-delete-handler-2"; this.HANDLER_BKP = "backed-up-by-" + HANDLER_NAME; } }
@Component @Service @Properties({@Property(name = Constants.SERVICE_DESCRIPTION, value = "Resolves the instance type"), @Property(name = Constants.SERVICE_VENDOR, value = Cqsm.VENDOR_NAME)}) public class InstanceTypeProviderImpl implements InstanceTypeProvider { private static final String RUNMODE_AUTHOR = "author"; @Reference private SlingSettingsService settingsService; @Override public boolean isOnAuthor() { return settingsService.getRunModes().contains(RUNMODE_AUTHOR); } }