@Override public void reroute(OfficeFlowSourceNode flowSourceNode) { this.officeArchitect.link(flowSourceNode, this.routingSection.getOfficeSectionInput(HANDLER_INPUT_NAME)); }
@Override public CompileError addIssue(String issueDescription) { return officeArchitect.addIssue(issueDescription); } };
@Override public WebTemplate addGovernance(OfficeGovernance governance) { this.section.addGovernance(governance); return this; } }
@Override public OfficeManagedObject addHttpApplicationObject(Class<?> objectClass, String bindName) { // Determine if already registered bindName = getBindName(objectClass, bindName); OfficeManagedObject object = this.httpApplicationObjects.get(bindName); if (object != null) { return object; // return the already registered object } // Not registered, so register OfficeManagedObjectSource mos = this.officeArchitect.addOfficeManagedObjectSource(bindName, HttpApplicationObjectManagedObjectSource.class.getName()); mos.addProperty(HttpApplicationObjectManagedObjectSource.PROPERTY_CLASS_NAME, objectClass.getName()); if ((bindName != null) && (bindName.trim().length() > 0)) { mos.addProperty(HttpApplicationObjectManagedObjectSource.PROPERTY_BIND_NAME, bindName); } object = mos.addOfficeManagedObject(bindName, ManagedObjectScope.PROCESS); this.httpApplicationObjects.put(bindName, object); // Return the object return object; }
@Override public OfficeFlowSinkNode secureFlow(Class<?> argumentType, OfficeFlowSinkNode secureFlowSink, OfficeFlowSinkNode insecureFlowSink) { // Obtain the office architect OfficeArchitect office = HttpSecurityArchitectEmployer.this.officeArchitect; // Create the section to handle access logic String sectionName = HttpSecurityArchitectEmployer.this.nextUniqueName(); OfficeSection section = office.addOfficeSection(sectionName, new HttpFlowSecurerSectionSource( new HttpFlowSecurerAnnotation(qualifier, anyRoles, allRoles, argumentType)), null); // Link office.link(section.getOfficeSectionOutput(HttpFlowSecurerSectionSource.SECURE_OUTPUT_NAME), secureFlowSink); office.link(section.getOfficeSectionOutput(HttpFlowSecurerSectionSource.INSECURE_OUTPUT_NAME), insecureFlowSink); // Return the sink to secure flow decision return section.getOfficeSectionInput(HttpFlowSecurerSectionSource.INPUT_NAME); } });
@Override public OfficeManagedObject addHttpObject(Class<?> objectClass, String... acceptedContentTypes) { // Determine if already registered OfficeManagedObject object = this.httpObjects.get(objectClass); if (object == null) { // Not registered, so register OfficeManagedObjectSource mos = this.officeArchitect.addOfficeManagedObjectSource(objectClass.getName(), new HttpObjectManagedObjectSource<>(objectClass, acceptedContentTypes, this.singletonObjectParserList)); object = mos.addOfficeManagedObject(objectClass.getName(), ManagedObjectScope.PROCESS); this.httpObjects.put(objectClass, object); } // Return the object return object; }
@Override public OfficeSectionOutput getOutput(String outputName) { return this.section.getOfficeSectionOutput(outputName); }
/** * Instantiate. * * @param securityName {@link HttpSecurity} name. * @param properties {@link PropertyList}. */ private HttpSecurityBuilderImpl(String securityName, HttpSecuritySource<A, AC, C, O, F> securitySource, PropertyList properties) { this.name = securityName; this.source = securitySource; this.properties = properties; // Create the section for the HTTP Security this.section = HttpSecurityArchitectEmployer.this.officeArchitect .addOfficeSection(securityName + "_HttpSecurity", new HttpSecuritySectionSource<>(this), null); }
@Override public void loadWoofTeamsUsage(WoofTeamsUsageContext context) throws Exception { // Obtain the architect and extension context OfficeArchitect architect = context.getOfficeArchitect(); // Load the teams this.loadWoofTeams(() -> context.getConfiguration(), () -> architect.enableAutoWireTeams(), (teamName, teamSize, teamSourceClassName, typeQualifications, teamModel) -> { // Add the team OfficeTeam team = architect.addOfficeTeam(teamName); // Load the type qualification for (AutoWire autoWire : typeQualifications) { team.addTypeQualification(autoWire.getQualifier(), autoWire.getType()); } }); }
@Override public OfficeSectionInput getAuthenticateInput() { return this.section.getOfficeSectionInput(HttpSecuritySectionSource.INPUT_AUTHENTICATE); }
@Override public String getText(Object element) { // Return description if (element instanceof OfficeSubSectionType) { return "Section: " + ((OfficeSubSection) element).getOfficeSectionName(); } else if (element instanceof OfficeTaskType) { return "Task: " + ((OfficeTaskType) element).getOfficeTaskName(); } else { // Unknown type return "UNKNOWN TYPE: " + element + " [" + (element == null ? null : element.getClass().getName()) + "]"; } } }
@Override public OfficeManagedObject addHttpSessionObject(Class<?> objectClass, String bindName) { // Determine if already registered bindName = getBindName(objectClass, bindName); OfficeManagedObject object = this.httpSessionObjects.get(bindName); if (object != null) { return object; // return the already registered object } // Not registered, so register OfficeManagedObjectSource mos = this.officeArchitect.addOfficeManagedObjectSource(bindName, HttpSessionObjectManagedObjectSource.class.getName()); mos.addProperty(HttpSessionObjectManagedObjectSource.PROPERTY_CLASS_NAME, objectClass.getName()); if ((bindName != null) && (bindName.trim().length() > 0)) { mos.addProperty(HttpSessionObjectManagedObjectSource.PROPERTY_BIND_NAME, bindName); } object = mos.addOfficeManagedObject(bindName, ManagedObjectScope.PROCESS); this.httpSessionObjects.put(bindName, object); // Return the object return object; }
/** * Instantiate. * * @param isSecure * Indicates if requires secure {@link ServerHttpConnection} to * render the {@link WebTemplate}. * @param applicationPath * Application path for the {@link WebTemplate}. * @param webTemplateSectionSource * {@link WebTemplateSectionSource}. * @param templateSection * {@link OfficeSection} for the {@link WebTemplate}. * @param properties * {@link PropertyList}. */ private WebTemplateImpl(boolean isSecure, String applicationPath, WebTemplateSectionSource webTemplateSectionSource, OfficeSection templateSection, PropertyList properties) { super(webTemplateSectionSource, isSecure, applicationPath, properties, WebTemplateArchitectEmployer.this.officeArchitect); this.section = templateSection; // Configure the input this.sectionInput = this.section.getOfficeSectionInput(WebTemplateSectionSource.RENDER_TEMPLATE_INPUT_NAME); this.templateInput = WebTemplateArchitectEmployer.this.webArchitect.getHttpInput(isSecure, applicationPath); WebTemplateArchitectEmployer.this.officeArchitect.link(this.templateInput.getInput(), this.sectionInput); }
@Override public OfficeManagedObject addHttpArgument(String parameterName, HttpValueLocation location) { // Obtain the bind name String bindName = "HTTP_" + (location == null ? "ANY" : location.name()) + "_" + parameterName; OfficeManagedObject object = this.httpArguments.get(bindName); if (object != null) { return object; // return the already register object } // Not registered, so register OfficeManagedObjectSource mos = this.officeArchitect.addOfficeManagedObjectSource(bindName, new HttpArgumentManagedObjectSource(parameterName, location)); object = mos.addOfficeManagedObject(bindName, ManagedObjectScope.PROCESS); this.httpArguments.put(bindName, object); // Return the object return object; }
@Override public OfficeFlowSourceNode getOutput(String outputName) { return this.section.getOfficeSectionOutput(outputName); }
@Override protected WebTemplate addTemplate(boolean isSecure, String applicationPath, PropertyList properties) { // Add the section for the template WebTemplateSectionSource webTemplateSectionSource = new WebTemplateSectionSource(); OfficeSection templateSection = this.officeArchitect.addOfficeSection(applicationPath, webTemplateSectionSource, applicationPath); // Add the template WebTemplateImpl template = new WebTemplateImpl(isSecure, applicationPath, webTemplateSectionSource, templateSection, properties); this.templates.add(template); // Return the template return template; }
@Override public OfficeManagedObject addHttpRequestObject(Class<?> objectClass, boolean isLoadParameters, String bindName) { // Determine if already registered bindName = getBindName(objectClass, bindName); OfficeManagedObject object = this.httpRequestObjects.get(bindName); if (object == null) { // Not registered, so register OfficeManagedObjectSource mos = this.officeArchitect.addOfficeManagedObjectSource(bindName, HttpRequestObjectManagedObjectSource.class.getName()); mos.addProperty(HttpRequestObjectManagedObjectSource.PROPERTY_CLASS_NAME, objectClass.getName()); if ((bindName != null) && (bindName.trim().length() > 0)) { mos.addProperty(HttpRequestObjectManagedObjectSource.PROPERTY_BIND_NAME, bindName); } object = mos.addOfficeManagedObject(bindName, ManagedObjectScope.PROCESS); this.httpRequestObjects.put(bindName, object); // Determine if load HTTP parameters if (isLoadParameters) { // Add the property to load parameters mos.addProperty(HttpRequestObjectManagedObjectSource.PROPERTY_IS_LOAD_HTTP_PARAMETERS, String.valueOf(true)); } } // Return the object return object; }
@Override public HttpUrlContinuation link(boolean isSecure, String applicationPath, Class<?> sectionClass) { // Add the section OfficeSection section = this.addSection("GET_" + applicationPath, sectionClass); // Return the link to the section service method HttpUrlContinuation continuation = this.webArchitect.getHttpInput(isSecure, applicationPath); this.officeArchitect.link(continuation.getInput(), section.getOfficeSectionInput("service")); return continuation; } }
/** * Instantiate. * * @param isSecure * Indicates if secure. * @param httpMethod * {@link HttpMethod}. * @param applicationPath * Application path. */ private HttpInputImpl(boolean isSecure, HttpMethod httpMethod, String applicationPath) { this.isSecure = isSecure; this.httpMethod = httpMethod; this.applicationPath = applicationPath; this.routeInput = WebArchitectEmployer.this.routing.addRoute(isSecure, this.httpMethod, this.applicationPath); this.input = WebArchitectEmployer.this.routingSection .getOfficeSectionOutput(this.routeInput.getOutputName()); }
@Override public HttpInput link(boolean isSecure, String httpMethodName, String applicationPath, Class<?> sectionClass) { // Add the section OfficeSection section = this.addSection(httpMethodName + "_" + applicationPath, sectionClass); // Create the link to the section service method HttpInput input = this.webArchitect.getHttpInput(isSecure, httpMethodName, applicationPath); this.officeArchitect.link(input.getInput(), section.getOfficeSectionInput("service")); return input; }