1 /*
2 * #%L
3 * wcm.io
4 * %%
5 * Copyright (C) 2014 wcm.io
6 * %%
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * #L%
19 */
20 package io.wcm.handler.url.integrator;
21
22 import org.jetbrains.annotations.NotNull;
23
24 /**
25 * Default integrator modes sufficient for the most usecases.
26 */
27 public enum IntegratorModes implements IntegratorMode {
28
29 /**
30 * Simple mode. All URLs are automatically externalized to full URLs (if site URL is configured), and
31 * the protocol is detected automatically.
32 */
33 SIMPLE {
34
35 @Override
36 public @NotNull String getId() {
37 return "simple";
38 }
39
40 @Override
41 public boolean isUseUrlPlaceholders() {
42 return false;
43 }
44
45 @Override
46 public boolean isDetectProtocol() {
47 // in simple mode the protocol is detected automatically or read from the integrator page
48 return true;
49 }
50
51 },
52
53 /**
54 * Extended mode. Placeholders are used when externalizing all URLs, they have to be replaced by the
55 * integrating application. No automatic proctocol detection takes place.
56 */
57 EXTENDED {
58
59 @Override
60 public @NotNull String getId() {
61 return "extended";
62 }
63
64 @Override
65 public boolean isUseUrlPlaceholders() {
66 return true;
67 }
68
69 @Override
70 public boolean isDetectProtocol() {
71 // in extended mode the protocol has to be defined externally when replacing the URL placeholders
72 return false;
73 }
74
75 };
76
77 }