Skip to content
Browse files

remove it again after finishing the experiment

git-svn-id: https://svn.apache.org/repos/asf/cocoon/tags/cocoon-apples@486755 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 74c2be8 commit 28044e98e75950aa5bbef17afcf145cda9a1a191 @reinhard reinhard committed Dec 13, 2006
Showing with 0 additions and 2,066 deletions.
  1. +0 −44 cocoon-apples-2-tagbase-experiment/cocoon-apples-impl/pom.xml
  2. +0 −40 ...nt/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleController.java
  3. +0 −45 ...riment/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleHelper.java
  4. +0 −62 ...iment/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleRequest.java
  5. +0 −32 ...ment/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
  6. +0 −149 ...nt/cocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
  7. +0 −69 ...ocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleRequest.java
  8. +0 −63 ...coon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java
  9. +0 −45 ...on-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
  10. +0 −27 ...-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/StatelessAppleController.java
  11. +0 −34 ...gbase-experiment/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf
  12. +0 −90 cocoon-apples-2-tagbase-experiment/cocoon-apples-impl/status.xml
  13. +0 −88 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/pom.xml
  14. +0 −313 ...ples-sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/BindingWoodyApple.java
  15. +0 −124 ...pples-sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/CalculationApple.java
  16. +0 −74 ...-apples-sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/GuessGameApple.java
  17. +0 −123 ...coon-apples-sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/HanoiApple.java
  18. +0 −27 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/apples.xsamples
  19. +0 −36 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/guess/guess.jx
  20. +0 −34 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/guess/success.jx
  21. +0 −48 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/hanoi.jx
  22. +0 −202 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/hanoi.xsl
  23. +0 −47 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/intro.jx
  24. +0 −165 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/sitemap.xmap
  25. +0 −40 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/welcome.xml
  26. +0 −45 cocoon-apples-2-tagbase-experiment/pom.xml
View
44 cocoon-apples-2-tagbase-experiment/cocoon-apples-impl/pom.xml
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!--+
- | @version $Id$
- |
- +-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-apples</artifactId>
- <version>2-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-apples-impl</artifactId>
- <version>1.0.0-M2-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Apples Block Implementation</name>
- <description/>
- <dependencies>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-core</artifactId>
- <version>2.2.0-M3-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
View
40 ...n-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleController.java
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.AppleResponse;
-
-/**
- * AppleController declares the main processing interfaces for the stateful
- * controller objects.
- * <p>
- * Implementations are advised to implement Avalon lifecycle interfaces.
- *
- * @version $Id$
- */
-public interface AppleController {
- /**
- * Allows the AppleController implementation to make some business
- * decissions in a given web application flow.
- * <p>
- * Typically those decissions will be based upon what it can find inside the
- * passed {@link AppleRequest} and result into setting specific aspects of
- * the {@link AppleResponse}
- */
- void process(AppleRequest req, AppleResponse res) throws Exception;
-}
View
45 ...ocoon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleHelper.java
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cocoon.components.flow.Interpreter.Argument;
-
-/**
- * AppleHelper holds some static utility classes used in the Apples flow
- * implementation.
- *
- * @version $Id$
- */
-public class AppleHelper {
- /**
- * Translates a List of Interpreter.Argument objects into a classic
- * {@link java.util.Map}
- */
- public static Map makeMapFromArguments(List params) {
- Map retMap = new HashMap();
- for (Iterator iter = params.iterator(); iter.hasNext();) {
- Argument element = (Argument) iter.next();
- retMap.put(element.name, element.value);
- }
- return retMap;
- }
-}
View
62 ...coon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleRequest.java
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import java.util.Set;
-
-import org.apache.cocoon.environment.Request;
-
-/**
- * AppleRequest defines the services an AppleController can collect from the
- * current request.
- *
- * @version $Id$
- */
-public interface AppleRequest {
- /**
- * @return the wrapped cocoon environment Request
- */
- public Request getCocoonRequest();
-
- /**
- * @return Set of String's listing all available sitemap-parameters passed.
- */
- public Set getSitemapParameterNames();
-
- /**
- * Finds a named parameter in the request.
- *
- * @param key
- * of parameter to lookup
- * @return the parameter-value
- */
- public String getSitemapParameter(String key);
-
- /**
- * Finds a named parameter in the request using the overloaded method
- * {@link #getSitemapParameter(String)} but lets the returned value default
- * to the second argument in case the delegation resulted into
- * <code>null</code>
- *
- * @param key
- * of parameter to lookup
- * @param defaultValue
- * return-value in case the lookup returned <code>null</code>
- * @return the parameter-value or if that was null: the defaultValue passed.
- */
- public String getSitemapParameter(String key, String defaultValue);
-}
View
32 ...oon-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/AppleResponse.java
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import org.apache.cocoon.environment.Response;
-
-/**
- * AppleResponse defines the parts of the 'response' an AppleController can set.
- *
- * @version $Id$
- */
-public interface AppleResponse {
- public void sendPage(String uri, Object bizData);
-
- public void redirectTo(String uri);
-
- public Response getCocoonResponse();
-}
View
149 ...n-apples-impl/src/main/java/org/apache/cocoon/components/flow/apples/ApplesProcessor.java
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import java.util.List;
-
-import org.apache.avalon.framework.CascadingRuntimeException;
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.DefaultContext;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.cocoon.components.ContextHelper;
-import org.apache.cocoon.components.LifecycleHelper;
-import org.apache.cocoon.components.flow.AbstractInterpreter;
-import org.apache.cocoon.components.flow.ContinuationsDisposer;
-import org.apache.cocoon.components.flow.InvalidContinuationException;
-import org.apache.cocoon.components.flow.WebContinuation;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.DefaultAppleRequest;
-import org.apache.cocoon.components.flow.apples.DefaultAppleResponse;
-import org.apache.cocoon.components.flow.apples.StatelessAppleController;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.cocoon.environment.Redirector;
-import org.apache.cocoon.environment.Request;
-import org.apache.cocoon.environment.Response;
-
-/**
- * ApplesProcessor is the core Cocoon component that provides the 'Apples' flow
- * implementation.
- *
- * @version $Id$
- */
-public class ApplesProcessor extends AbstractInterpreter implements ContinuationsDisposer {
-
- public void callFunction(String className, List params, Redirector redirector) throws Exception {
- AppleController app = instantiateController(className);
-
- WebContinuation wk = null;
- if (!(app instanceof StatelessAppleController)) {
- wk = this.continuationsMgr.createWebContinuation(app, null, 0, getInterpreterID(), this);
- if (getLogger().isDebugEnabled())
- getLogger().debug("Instantiated a stateful apple, continuationid = " + wk.getId());
- }
-
- DefaultContext appleContext = new DefaultContext(avalonContext);
- if (wk != null) {
- appleContext.put("continuation-id", wk.getId());
- }
-
- // Use the current sitemap's service manager for components
- ServiceManager sitemapManager;
- try {
- sitemapManager = (ServiceManager) avalonContext.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
- } catch (ContextException e) {
- throw new CascadingRuntimeException("Cannot get sitemap service manager", e);
- }
-
- LifecycleHelper.setupComponent(app, getLogger(), appleContext, sitemapManager, null, true);
- processApple(params, redirector, app, wk);
- }
-
- public void handleContinuation(String continuationId, List params, Redirector redirector) throws Exception {
-
- WebContinuation wk = this.continuationsMgr.lookupWebContinuation(continuationId, getInterpreterID());
- if (wk == null) {
- // Throw an InvalidContinuationException to be handled inside the
- // <map:handle-errors> sitemap element.
- throw new InvalidContinuationException("The continuation ID " + continuationId + " is invalid.");
- }
-
- AppleController app = (AppleController) wk.getContinuation();
-
- getLogger().debug("found apple from continuation: " + app);
-
- // TODO access control checks? exception to be thrown for illegal
- // access?
- processApple(params, redirector, app, wk);
-
- }
-
- protected AppleController instantiateController(String className) throws Exception {
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
- Object o = clazz.newInstance();
- return (AppleController) o;
- }
-
- private void processApple(List params, Redirector redirector, AppleController app, WebContinuation wk)
- throws Exception {
- Request cocoonRequest = ObjectModelHelper.getRequest(this.processInfoProvider.getObjectModel());
- AppleRequest req = new DefaultAppleRequest(params, cocoonRequest);
- Response cocoonResponse = ObjectModelHelper.getResponse(this.processInfoProvider.getObjectModel());
- DefaultAppleResponse res = new DefaultAppleResponse(cocoonResponse);
-
- try {
- app.process(req, res);
- } finally {
- if (wk == null) {
- // dispose stateless apple immediatelly
- if (app instanceof Disposable) {
- try {
- ((Disposable) app).dispose();
- } catch (Exception e) {
- getLogger().error("Error disposing Apple instance.", e);
- }
- }
- }
- }
-
- if (res.isRedirect()) {
- redirector.redirect(false, res.getURI());
- } else {
- String uri = res.getURI();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(
- "Apple forwards to " + uri + " with bizdata= " + res.getData()
- + (wk != null ? " and continuationid= " + wk.getId() : " without continuationid"));
- }
-
- // Note: it is ok for wk to be null
- this.forwardTo(uri, res.getData(), wk, redirector);
- }
-
- // TODO allow for AppleResponse to set some boolean saying the use case
- // is completed and the continuation can be invalidated ?
- }
-
- public void disposeContinuation(WebContinuation webContinuation) {
- AppleController app = (AppleController) webContinuation.getContinuation();
- if (app instanceof Disposable) {
- ((Disposable) app).dispose();
- }
-
- }
-}
View
69 ...ples-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleRequest.java
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cocoon.environment.Request;
-
-/**
- * DefaultAppleRequest wraps the nested &lt;map:paramater&gt; 's and the active
- * Cocoon Environment Request to implement the service of the
- * {@link AppleRequest} interface.
- *
- * @version $Id$
- */
-public class DefaultAppleRequest implements AppleRequest {
- private final Map params;
- private final Request cocoonRequest;
-
- /**
- * Constructs DefaultAppleRequest
- *
- * @param params
- * the nested <code>&lt;map:parameter&gt;</code>'s from the
- * sitemap
- * @param request
- * the active cocoon request
- */
- public DefaultAppleRequest(List params, Request request) {
- this.params = AppleHelper.makeMapFromArguments(params);
- this.cocoonRequest = request;
- }
-
- public Request getCocoonRequest() {
- return cocoonRequest;
- }
-
- public Set getSitemapParameterNames() {
- return this.params.keySet();
- }
-
- public String getSitemapParameter(String key, String defaultValue) {
- String value = getSitemapParameter(key);
- if (value == null) {
- value = defaultValue;
- }
- return value;
- }
-
- public String getSitemapParameter(String key) {
- return (String) this.params.get(key);
- }
-}
View
63 ...les-impl/src/main/java/org/apache/cocoon/components/flow/apples/DefaultAppleResponse.java
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import org.apache.cocoon.environment.Response;
-
-/**
- * DefaultAppleResponse provides a default implementation for the
- * {@link AppleResponse}.
- *
- * @version $Id$
- */
-public class DefaultAppleResponse implements AppleResponse {
- private String uri;
- private Object data;
- private boolean redirect = false;
- private Response cocoonResponse;
-
- public DefaultAppleResponse(Response cocoonResponse) {
- this.cocoonResponse = cocoonResponse;
- }
-
- public void sendPage(String uri, Object bizData) {
- this.uri = uri;
- this.data = bizData;
- this.redirect = false;
- }
-
- public void redirectTo(String uri) {
- this.uri = uri;
- this.redirect = true;
- }
-
- protected boolean isRedirect() {
- return redirect;
- }
-
- protected String getURI() {
- return uri;
- }
-
- protected Object getData() {
- return data;
- }
-
- public Response getCocoonResponse() {
- return cocoonResponse;
- }
-}
View
45 ...s-impl/src/main/java/org/apache/cocoon/components/flow/apples/ServiceApplesProcessor.java
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples;
-
-import org.apache.cocoon.ProcessingException;
-
-/**
- * A special version of ApplesProcessor that interprets the parameter passed to
- * instantiateController as service/bean name instead of classname. The class is
- * probably most useful with spring container integration.
- *
- * Declare your flow in sitemap as &lt;map:flow language=&quot;service-apples&quot/&gt>
- * Define your AppleController beans in block/config/spring/ and call them from
- * sitemap by &lt;map:call function=&quot;beanName&quot/&gt>
- *
- * Please remember to declare your StatelessAppleControllers as singletons. If
- * you wish to use continuations beans have to be declared as non-singletons.
- *
- * You are of course free to use any container features in your beans like
- * dependency injection.
- *
- * @version $Id$
- */
-public class ServiceApplesProcessor extends ApplesProcessor {
- protected AppleController instantiateController(String beanName) throws Exception {
- Object bean = this.manager.lookup(beanName);
- if (!(bean instanceof AppleController))
- throw new ProcessingException("The bean called is not a AppleController");
- return (AppleController) bean;
- }
-}
View
27 ...impl/src/main/java/org/apache/cocoon/components/flow/apples/StatelessAppleController.java
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cocoon.components.flow.apples;
-
-/**
- * This interface can be impemented by Apples that do not wish to be stored, and
- * thus don't have a continuation ID assosociated with them.
- *
- * @version $Id$
- */
-public interface StatelessAppleController extends AppleController {
-}
View
34 ...periment/cocoon-apples-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-apples.xconf
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!--+
- |
- | SVN $Id$
- +-->
-<components>
- <flow-interpreters>
- <component-instance
- class="org.apache.cocoon.components.flow.apples.ApplesProcessor"
- name="apples" logger="apples">
- </component-instance>
- <component-instance
- class="org.apache.cocoon.components.flow.apples.ServiceApplesProcessor"
- name="service-apples" logger="service-apples">
- </component-instance>
- </flow-interpreters>
-</components>
View
90 cocoon-apples-2-tagbase-experiment/cocoon-apples-impl/status.xml
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!DOCTYPE status [
-<!ELEMENT status (developers, todo, changes)>
-<!ELEMENT developers (person+)>
-<!ELEMENT person EMPTY>
-<!ATTLIST person
- name CDATA #REQUIRED
- email CDATA #REQUIRED
- id CDATA #REQUIRED
->
-<!ELEMENT todo (actions+)>
-<!ELEMENT actions (action+)>
-<!ATTLIST actions
- priority (high | medium | low) #REQUIRED
->
-<!ELEMENT changes (release+)>
-<!ELEMENT release (action+)>
-<!ATTLIST release
- version CDATA #REQUIRED
- date CDATA #REQUIRED
->
-<!ELEMENT action (#PCDATA | link | br | code | ul | strong)*>
-<!ATTLIST action
- context (build | code | docs) #IMPLIED
- assigned-to CDATA #IMPLIED
- dev CDATA #IMPLIED
- type (add | fix | remove | update) #IMPLIED
- fixes-bug CDATA #IMPLIED
- due-to CDATA #IMPLIED
- due-to-email CDATA #IMPLIED
->
-<!ELEMENT code (#PCDATA)>
-<!ELEMENT br EMPTY>
-<!ELEMENT strong (#PCDATA)>
-<!ELEMENT link (#PCDATA)>
-<!ATTLIST link
- href CDATA #REQUIRED
->
-<!ELEMENT ul (li)+>
-<!ELEMENT li (#PCDATA | link | br | code | ul)*>
-<!ENTITY eacute "&#x000E9;">
-<!ENTITY ouml "&#x000F6;">
-<!ENTITY uuml "&#x000FC;">
-<!ENTITY ccedil "&#x000E7;">
-]>
-
-<!-- SVN $Id$ -->
-
-<status>
- <!-- The following list contains the changes since the latest 2.1.x version. -->
- <changes>
- <release version="@version@" date="@date@">
- <action dev="JHS" type="fix" fixes-bug="COCOON-1728" due-to="Paul Focke" due-to-email="paul@outerthought.org">
- Apples can now access components declared in mounted sitemaps.
- </action>
- <action dev="LG" type="add">
- Service apples:<br/>
- in applicationContext.xml:<br/>
- &lt;bean id="orderCreateApple" class="com.mobilebox.gemini.web.apples.OrderCreateApple"&gt;<br/>
- &lt;property name="orderRequestParser" ref="orderRequestParserService"/&gt;<br/>
- &lt;property name="orderService" ref="orderService"/&gt;<br/>
- &lt;/bean&gt;<br/>
- in sitemap.xmap
- &lt;map:flow language="service-apples"/&gt;
- &lt;.../&gt;
- &lt;map:match pattern="orderCreate"&gt;
- &lt;map:call function="orderCreateApple"/&gt;
- &lt;/map:match&gt;
- </action>
- </release>
- </changes>
-
-</status>
-
View
88 cocoon-apples-2-tagbase-experiment/cocoon-apples-sample/pom.xml
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!--+
- | @version $Id$
- |
- +-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-apples</artifactId>
- <version>2-SNAPSHOT</version>
- </parent>
- <artifactId>cocoon-apples-sample</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <name>Apples Block Samples</name>
- <description/>
- <build>
- <finalName>cocoon-apples-sample</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-deployer-plugin</artifactId>
- <version>1.0.0-M2-SNAPSHOT</version>
- </plugin>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty6-plugin</artifactId>
- <version>6.0.0beta10</version>
- <configuration>
- <connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
- <port>8888</port>
- <maxIdleTime>30000</maxIdleTime>
- </connector>
- </connectors>
- <webAppSourceDirectory>target/cocoon-apples-sample</webAppSourceDirectory>
- <contextPath>/</contextPath>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-apples-impl</artifactId>
- <version>1.0.0-M2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-core-main-sample</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-template-impl</artifactId>
- <version>1.0.0-M3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-forms-impl</artifactId>
- <version>1.0.0-M2-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-samples-style-default</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
View
313 ...ple/src/main/java/org/apache/cocoon/components/flow/apples/samples/BindingWoodyApple.java
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples.samples;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.AppleResponse;
-import org.apache.cocoon.forms.FormContext;
-import org.apache.cocoon.forms.FormManager;
-import org.apache.cocoon.forms.binding.Binding;
-import org.apache.cocoon.forms.binding.BindingManager;
-import org.apache.cocoon.forms.formmodel.Form;
-import org.apache.cocoon.forms.transformation.FormsPipelineConfig;
-import org.apache.cocoon.xml.dom.DOMStreamer;
-import org.apache.excalibur.source.ModifiableSource;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.xml.dom.DOMParser;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-
-/**
- * BindingWoodyApple
- */
-public class BindingWoodyApple extends AbstractLogEnabled implements AppleController, Serviceable {
-
- private static final boolean CONTINUE = false;
- private static final boolean FINISHED = true;
-
- private Form form;
- private Binding binding;
- private Document document;
- private ServiceManager serviceManager;
- private String formPipeURI;
- private String validPipeURI;
- private String backendURI;
- private Map wrapperContextMap;
- private State state;
-
- private interface State {
- public void processRequest(AppleRequest req, AppleResponse res) throws ProcessingException;
- }
-
- private final State initializationDelegate = new State() {
- public void processRequest(AppleRequest req, AppleResponse res) throws ProcessingException {
- BindingWoodyApple.this.processInitialization(req, res);
- }
- };
-
- private final State validationDelegate = new State() {
- public void processRequest(AppleRequest req, AppleResponse res) throws ProcessingException {
- BindingWoodyApple.this.processValidation(req, res);
- }
- };
-
- {
- state = initializationDelegate;
- }
-
-
- public void process(AppleRequest req, AppleResponse res) throws ProcessingException {
- this.state.processRequest(req, res);
- }
-
- protected void processInitialization(AppleRequest req, AppleResponse res) throws ProcessingException {
-
- String formURI = req.getSitemapParameter("form-src");
- String bindURI = req.getSitemapParameter("binding-src");
- this.backendURI = req.getSitemapParameter("documentURI");
- this.formPipeURI = req.getSitemapParameter("form-pipe");
- this.validPipeURI = req.getSitemapParameter("valid-pipe");
-
- FormManager formManager = null;
- BindingManager binderManager = null;
- SourceResolver resolver = null;
- Source formSource = null;
- Source bindSource = null;
- Source documentSource = null;
-
- try {
- formManager = (FormManager) this.serviceManager.lookup(FormManager.ROLE);
- binderManager = (BindingManager) this.serviceManager.lookup(BindingManager.ROLE);
- resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
-
- formSource = resolver.resolveURI(formURI);
- this.form = formManager.createForm(formSource);
-
- bindSource = resolver.resolveURI(bindURI);
- this.binding = binderManager.createBinding(bindSource);
-
- documentSource = resolver.resolveURI(this.backendURI);
- this.document = loadDocumentFromSource(documentSource);
- this.binding.loadFormFromModel(this.form, this.document);
-
- this.getLogger().debug("apple initialisation finished .. ");
- this.state = validationDelegate;
-
- completeResult(res, this.formPipeURI, CONTINUE);
- } catch (Exception e) {
- throw new ProcessingException("Failed to initialize BindingWoodyApple. ", e);
- } finally {
- if (formManager != null) {
- this.serviceManager.release(formManager);
- }
- if (binderManager != null) {
- this.serviceManager.release(binderManager);
- }
- if (resolver != null) {
- if (formSource != null) {
- resolver.release(formSource);
- }
- if (bindSource != null) {
- resolver.release(bindSource);
- }
- if (documentSource != null) {
- resolver.release(documentSource);
- }
- this.serviceManager.release(resolver);
- }
- }
- }
-
- protected void processValidation(AppleRequest req, AppleResponse res) throws ProcessingException {
-
- Source documentTarget = null;
- SourceResolver resolver = null;
-
- try {
- FormContext formContext = new FormContext(req.getCocoonRequest(), Locale.US);
-
- if (!this.form.process(formContext)) {
- // form is not valid or there was just an event handled
- completeResult(res, this.formPipeURI, CONTINUE);
- } else {
-
- resolver = (SourceResolver) this.serviceManager.lookup(SourceResolver.ROLE);
- documentTarget = resolver.resolveURI(makeTargetURI(this.backendURI));
-
- this.binding.saveFormToModel(this.form, this.document);
- saveDocumentToSource(documentTarget, this.document);
-
- completeResult(res, this.validPipeURI, FINISHED);
- }
-
- getLogger().debug("apple processing done .. ");
- } catch (Exception e) {
- throw new ProcessingException("Error processing BindingWoodyApple", e);
- } finally {
- if (resolver != null) {
- if (documentTarget != null) {
- resolver.release(documentTarget);
- }
- this.serviceManager.release(resolver);
- }
- }
- }
-
- private void completeResult(AppleResponse res, String uri, boolean finished) {
- res.sendPage(uri, getContextMap());
- // TODO think about transferring the fact that the use case has ended.
- }
-
- private Map getContextMap() {
- if (this.wrapperContextMap == null) {
- if (this.form != null) {
- this.wrapperContextMap = new HashMap();
- this.wrapperContextMap.put(FormsPipelineConfig.CFORMSKEY, this.form);
- }
- }
- return this.wrapperContextMap;
- }
-
-
- /**
- * Translate source path into target path so we keep a clean source XML
- *
- * @param path
- */
- private String makeTargetURI(String path) {
- final String sfx = ".xml";
- final String newSfx = "-result.xml";
- if (path.endsWith(sfx)) {
- path = path.substring(0, path.length() - sfx.length());
- }
- return path + newSfx;
- }
-
-
- /**
- * Saves (and serializes) the given Document to the path indicated by the
- * specified Source.
- *
- * @param docTarget must be the ModifieableSource where the doc will be
- * serialized to.
- * @param doc org.w3c.dom.Document to save
- * @throws ProcessingException
- */
- private void saveDocumentToSource(Source docTarget, Document doc)
- throws ProcessingException {
- DOMParser parser = null;
- OutputStream os = null;
- String uri = docTarget.getURI();
-
- try {
- parser =
- (DOMParser) this.serviceManager.lookup(DOMParser.ROLE);
- getLogger().debug("request to save file " + uri);
- TransformerFactory tf = TransformerFactory.newInstance();
-
- if (docTarget instanceof ModifiableSource
- && tf.getFeature(SAXTransformerFactory.FEATURE)) {
-
- ModifiableSource ws = (ModifiableSource) docTarget;
- os = ws.getOutputStream();
- SAXTransformerFactory stf = (SAXTransformerFactory) tf;
- TransformerHandler th = stf.newTransformerHandler();
- Transformer t = th.getTransformer();
- t.setOutputProperty(OutputKeys.INDENT, "true");
- t.setOutputProperty(OutputKeys.METHOD, "xml");
- th.setResult(new StreamResult(os));
-
- DOMStreamer streamer = new DOMStreamer(th);
- streamer.stream(doc);
- } else {
- getLogger().error("Cannot not write to source " + uri);
- }
- } catch (Exception e) {
- getLogger().error("Error parsing mock file " + uri, e);
- throw new ProcessingException(
- "Error parsing mock file " + uri,
- e);
- } finally {
- if (parser != null) {
- this.serviceManager.release(parser);
- }
- if (os != null) {
- try {
- os.flush();
- os.close();
- } catch (IOException e1) {
- getLogger().warn(
- "Failed to flush/close the outputstream. ",
- e1);
- }
- }
- }
- }
-
-
- /**
- * Loads (and parses) the Document from the specified Source
- *
- * @param documentSrc
- * @throws ProcessingException
- */
- private Document loadDocumentFromSource(Source documentSrc)
- throws ProcessingException {
- DOMParser parser = null;
- try {
- parser =
- (DOMParser) this.serviceManager.lookup(DOMParser.ROLE);
- getLogger().debug(
- "request to load file " + documentSrc.getURI());
- InputSource input = new InputSource(documentSrc.getURI());
- return parser.parseDocument(input);
- } catch (Exception e) {
- throw new ProcessingException(
- "failed to load file to bind to: ",
- e);
- } finally {
- if (parser != null) {
- this.serviceManager.release(parser);
- }
- }
- }
-
-
- public void service(ServiceManager serviceManager) throws ServiceException {
- this.serviceManager = serviceManager;
- }
-}
View
124 ...mple/src/main/java/org/apache/cocoon/components/flow/apples/samples/CalculationApple.java
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples.samples;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.AppleResponse;
-
-/**
- * CalculationApple shows an easy Apple example implementation for a Calculator.
- * <p>
- * It is explicitely designed to show the difference with flowscript by
- * remembering the 'lookahead' information from the previous path that entered
- * already the other data.
- * <p>
- * In other words this shows that Apples are not building a complete tree of
- * continuations like flowscript is doing. But the initial argument of course was
- * that some cases simply don't need it.
- */
-public class CalculationApple extends AbstractLogEnabled implements AppleController {
-
- BigDecimal inputA;
- BigDecimal inputB;
- String inputOp;
- BigDecimal output;
-
-
- public String toString() {
- return "CalculationApple[ a=" + this.inputA + " | b=" + this.inputB
- + " | op = " + this.inputOp + " | result = " + this.output + "]";
- }
-
- public void process(AppleRequest req, AppleResponse res) throws ProcessingException {
- String changeTo = processRequest(req);
- getLogger().debug(toString());
- showNextState(res, changeTo);
- }
-
- private String processRequest(AppleRequest req) {
- String changeRequest = req.getCocoonRequest().getParameter("change");
-
- String newA = req.getCocoonRequest().getParameter("a");
- if (newA != null) {
- this.inputA = new BigDecimal(newA);
- // explicitely do not set inputB and inputOp to null !
- }
- String newB = req.getCocoonRequest().getParameter("b");
- if (newB != null) {
- this.inputB = new BigDecimal(newB);
- // explicitely do not set inputOp to null !
- }
- String newOp = req.getCocoonRequest().getParameter("operator");
- if (newOp != null) {
- this.inputOp = newOp;
- }
- //explicitely always do the calculation
- calculate();
-
- return changeRequest;
- }
-
-
- private void calculate() {
- if (this.inputA == null || this.inputB == null) {
- this.output = null;
- } else if("plus".equals(this.inputOp)) {
- this.output = this.inputA.add(this.inputB);
- } else if("minus".equals(this.inputOp)) {
- this.output = this.inputA.add(this.inputB.negate());
- } else if("multiply".equals(this.inputOp)) {
- this.output = this.inputA.multiply(this.inputB);
- } else if("divide".equals(this.inputOp)) {
- this.output = this.inputA.divide(this.inputB, BigDecimal.ROUND_HALF_EVEN);
- } else { //not a valid operator
- this.output = null;
- }
- }
-
- private void showNextState(AppleResponse res, String changeTo) {
- Object bizdata = buildBizData();
-
- if (changeTo != null) {
- res.sendPage("calc/get" + changeTo, bizdata);
- } else if (this.inputA == null) {
- res.sendPage("calc/getNumberA", null);
- } else if (this.inputB == null) {
- res.sendPage("calc/getNumberB", bizdata);
- } else if (this.inputOp == null) {
- res.sendPage("calc/getOperator", bizdata);
- } else {
- res.sendPage("calc/displayResult", bizdata);
- }
- }
-
- private Object buildBizData() {
- Map bizdata = new HashMap();
- bizdata.put("a", this.inputA);
- bizdata.put("b", this.inputB);
- bizdata.put("operator", this.inputOp);
- bizdata.put("result", this.output);
- return bizdata;
- }
-
-}
View
74 ...sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/GuessGameApple.java
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples.samples;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Random;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.AppleResponse;
-
-/**
- * GuessGameApple shows an easy Apples implementation for a number guessing game.
- */
-public class GuessGameApple extends AbstractLogEnabled implements AppleController {
-
- private final int random = (new Random()).nextInt(10) + 1;
- private int guesses = 0;
-
- public String toString() {
- return "GuessGameApple[ random=" + this.random + " | guesses=" + this.guesses + "]";
- }
-
- public void process(AppleRequest req, AppleResponse res) throws ProcessingException {
-
- String hint = "No hints yet.";
- String targetURI = "guess/guess.jx";
-
- int newGuess = -1;
- String newGuessString = req.getCocoonRequest().getParameter("guess");
-
- if (newGuessString != null) {
- newGuess = Integer.parseInt(newGuessString);
- this.guesses++;
-
- if (this.random == newGuess) {
- targetURI = "guess/success.jx";
- } else {
- if (this.random < newGuess) {
- hint = "Try lower.";
- } else {
- hint = "Try higher.";
- }
- }
- }
-
- getLogger().debug(toString());
-
- Map bizdata = new HashMap();
- bizdata.put("random" , "" + this.random);
- bizdata.put("guesses", "" + this.guesses);
- bizdata.put("hint" , hint);
-
- res.sendPage(targetURI, bizdata);
- }
-
-}
View
123 ...les-sample/src/main/java/org/apache/cocoon/components/flow/apples/samples/HanoiApple.java
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.components.flow.apples.samples;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.cocoon.ProcessingException;
-import org.apache.cocoon.components.flow.apples.AppleController;
-import org.apache.cocoon.components.flow.apples.AppleRequest;
-import org.apache.cocoon.components.flow.apples.AppleResponse;
-
-/**
- * HanoiApple shows an apple maintaining the state of the fanous puzzle.
- */
-public class HanoiApple extends AbstractLogEnabled implements AppleController {
-
- public static final int NONE = -1;
- public static final int SRC = 0;
- public static final int AUX = 1;
- public static final int DST = 2;
-
- // full state of the puzzle is in the following variables
- public Stack[] stacks;
- public Object floatingDisk = null;
- public int moves = 0;
- public int puzzleSize = 0;
-
-
- public String toString() {
- return "HanoiApple[ stacks=" + this.stacks + " | floatingDisk=" + this.floatingDisk
- + " | moves = " + this.moves + "]";
- }
-
-
- public void process(AppleRequest req, AppleResponse res) throws ProcessingException {
-
- // processing
- if (stacks == null) {
- String requestSize = req.getCocoonRequest().getParameter("size");
- if (requestSize != null) {
- try {
- int size = Integer.parseInt(requestSize);
- intializeStacks(size);
- } catch (NumberFormatException ignore) {
- }
- }
- } else {
- // decide selected column
- String requestStack = req.getCocoonRequest().getParameter("stack");
- if (requestStack != null) {
- try {
- int stackNdx = Integer.parseInt(requestStack);
- if (this.floatingDisk != null) {
- // we are in the middle of a move --> complete move if it is allowed
- if ( this.stacks[stackNdx].size() == 0
- || ((Integer)this.floatingDisk).intValue() < ((Integer)this.stacks[stackNdx].peek()).intValue()) {
-
- this.stacks[stackNdx].push(this.floatingDisk);
- this.floatingDisk = null;
- this.moves++;
- }
- } else {
- if (this.stacks[stackNdx].size() != 0) {
- this.floatingDisk = this.stacks[stackNdx].pop();
- }
- }
- } catch (RuntimeException ignore) {
- //NUMBERFORMAT
- //ARRAYINDEXOUTOFBOUNDS
- }
- }
- }
-
- getLogger().debug(toString());
-
- //view generation
- if (stacks == null) {
- res.sendPage("hanoi/intro.jx", null);
- } else {
- Map bizdata = new HashMap();
- bizdata.put("stacks" , this.stacks);
- bizdata.put("moves" , "" + this.moves);
- bizdata.put("floatingDisk", this.floatingDisk);
- bizdata.put("nextMove" , this.floatingDisk==null ? "Lift it!" : "Drop it!");
- bizdata.put("puzzleSize" , "" + this.puzzleSize);
-
- res.sendPage("hanoi/hanoi.jx", bizdata);
- }
-
- }
-
-
- private void intializeStacks(int size) {
- if (size > 2) {
- this.stacks = new Stack[3];
- for (int i = 0; i < 3; i++) {
- this.stacks[i] = new Stack();
- }
- for (int i = size; i > 0; i--) {
- this.stacks[0].push(new Integer(i));
- }
- this.puzzleSize = size;
- }
- }
-
-}
View
27 ...ples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/apples.xsamples
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<xsamples xpath="/samples" unless="group[@name='Apples']">
-
- <group name="Apples">
- <sample name="Apples Block" href="apples/">
- Apples (an alternative flow implementation) examples.
- </sample>
- </group>
-
-</xsamples>
View
36 ...pples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/guess/guess.jx
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
-
- <title>Number Guessing Game</title>
-
- <content>
-
- <para>Guess the Number Between 1 and 10</para>
- <para>${hint}</para>
- <para>You've guessed ${guesses} times.</para>
-
- <form method="post" action="${cocoon.continuation.id}.continue">
- <input type="text" name="guess"/>
- <input type="submit" value="Guess!"/>
- </form>
-
- </content>
-
-</page>
View
34 ...les-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/guess/success.jx
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
-
- <title>Number Guessing Game</title>
-
- <content>
-
- <para>Success!</para>
- <para>The number was indeed: ${random}</para>
- <para>It took you ${guesses} tries.</para>
-
- <para/>
-
- <para><a href="guess.flow">Play again</a></para>
-
- </content>
-
-</page>
View
48 ...pples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/hanoi.jx
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
-
- <title>Tower of Hanoi Puzzle</title>
-
- <content>
-
- <para>For some background on the puzzle, see:
- <a href="http://www.cut-the-knot.org/recurrence/hanoi.shtml">http://www.cut-the-knot.org/recurrence/hanoi.shtml</a>
- </para>
-
- <para>You've currently used ${moves} moves.</para>
-
-
- <para>The current state of the stacks is:</para>
-
- <hn:hanoi height="${puzzleSize}" xmlns:hn="http://apache.org/cocoon/apples/samples/hanoi">
- <hn:float size="${floatingDisk}"/>
- <hn:stacks>
- <jx:forEach var="stack" items="${stacks}">
- <hn:stack>
- <jx:forEach var="disc" items="${stack}">
- <hn:disc size="${disc}" />
- </jx:forEach>
- </hn:stack>
- </jx:forEach>
- </hn:stacks>
- </hn:hanoi>
-
- </content>
-
-</page>
View
202 ...ples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/hanoi.xsl
@@ -1,202 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:hn="http://apache.org/cocoon/apples/samples/hanoi">
-
-
-
-
- <xsl:template match="hn:hanoi">
-
- <xsl:variable name="stacks" select="hn:stacks"/>
- <xsl:variable name="height" select="@height"/>
- <xsl:variable name="cols-per-stack" select="($height)*2 + 1"/>
- <xsl:variable name="cols-total" select="($cols-per-stack)*3"/>
- <xsl:variable name="on-the-move" select="boolean(hn:float/@size != '')"/>
-
- <center>
- <table border="0">
- <!-- fixing col-widths row -->
- <tr>
- <xsl:call-template name="fix-cells" >
- <xsl:with-param name="remaining" select="$cols-total" />
- </xsl:call-template>
- </tr>
- <!-- /fixing col-widths row -->
-
- <!-- title-row -->
- <tr>
- <td colspan="{$cols-total}">
- <center>-- Towers of Hanoi Puzzle --</center>
- <hr width="70%" />
- </td>
- </tr>
- <!-- /title-row -->
-
- <!-- moving-disc-row -->
- <tr>
- <td colspan="{$cols-total}"><center>Disc on the move:</center></td>
- </tr>
- <tr bgcolor="#ffffff" height="5px">
- <td colspan="{$cols-per-stack}"/>
- <xsl:call-template name="disc">
- <xsl:with-param name="disc" select="hn:float" />
- <xsl:with-param name="max_size" select="$height"/>
- <xsl:with-param name="disc_color">#996633</xsl:with-param>
- </xsl:call-template>
- <td colspan="{$cols-per-stack}"/>
- </tr>
-
- <tr>
- <td colspan="{$cols-total}"><hr width="70%"/></td>
- </tr>
- <!-- /moving-disc-row -->
-
- <!-- stack-header-row -->
- <tr>
- <xsl:choose>
- <xsl:when test="$on-the-move" >
- <td colspan="{$cols-per-stack}"><center><a href="?stack=0">Drop It!</a></center></td>
- <td colspan="{$cols-per-stack}"><center><a href="?stack=1">Drop It!</a></center></td>
- <td colspan="{$cols-per-stack}"><center><a href="?stack=2">Drop It!</a></center></td>
- </xsl:when>
- <xsl:otherwise>
- <td colspan="{$cols-per-stack}"><center><a href="?stack=0">Lift It!</a></center></td>
- <td colspan="{$cols-per-stack}"><center><a href="?stack=1">Lift It!</a></center></td>
- <td colspan="{$cols-per-stack}"><center><a href="?stack=2">Lift It!</a></center></td>
- </xsl:otherwise>
- </xsl:choose>
- </tr>
- <!-- /stack-header-row -->
-
-
- <!-- stack-rows -->
- <xsl:call-template name="remaining-stack-rows">
- <xsl:with-param name="remaining" select="$height"/>
- <xsl:with-param name="max_size" select="$height"/>
- <xsl:with-param name="cols-per-stack" select="$cols-per-stack"/>
- <xsl:with-param name="stacks" select="$stacks"/>
- </xsl:call-template>
- <!-- /stack-rows -->
-
- </table>
- </center>
- </xsl:template>
-
-
- <xsl:template name="remaining-stack-rows">
- <xsl:param name="remaining"/>
- <xsl:param name="max_size"/>
- <xsl:param name="cols-per-stack"/>
- <xsl:param name="stacks"/>
-
- <xsl:call-template name="stack-row">
- <xsl:with-param name="row-number" select="$remaining"/>
- <xsl:with-param name="max_size" select="$max_size"/>
- <xsl:with-param name="cols-per-stack" select="$cols-per-stack"/>
- <xsl:with-param name="stacks" select="$stacks"/>
- </xsl:call-template>
-
- <xsl:if test="$remaining &gt; 1">
- <xsl:call-template name="remaining-stack-rows">
- <xsl:with-param name="remaining" select="$remaining - 1"/>
- <xsl:with-param name="max_size" select="$max_size"/>
- <xsl:with-param name="cols-per-stack" select="$cols-per-stack"/>
- <xsl:with-param name="stacks" select="$stacks"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
-
- <xsl:template name="stack-row">
- <xsl:param name="row-number"/>
- <xsl:param name="max_size"/>
- <xsl:param name="cols-per-stack"/>
- <xsl:param name="stacks"/>
-
- <tr height="5px" bgcolor="#ffffff">
- <xsl:for-each select="$stacks/hn:stack">
- <xsl:variable name="stack-ndx" select="position()"/>
-
- <xsl:call-template name="disc">
- <xsl:with-param name="disc" select="hn:disc[number($row-number)]" />
- <xsl:with-param name="max_size" select="$max_size"/>
- <xsl:with-param name="disc_color">#2C6D91</xsl:with-param>
- </xsl:call-template>
- </xsl:for-each>
- </tr>
- </xsl:template>
-
-
-
- <xsl:template name="disc">
- <xsl:param name="disc" />
- <xsl:param name="max_size" />
- <xsl:param name="disc_color" />
-
- <xsl:variable name="size" select="$disc/@size" />
-
- <xsl:choose>
- <xsl:when test="$size &gt; 0" >
- <xsl:choose>
- <xsl:when test="($max_size - $size) &gt; 0" >
- <td colspan="{$max_size - $size}" bgcolor="#ffffff"/>
- <td colspan="{$size}" bgcolor="{$disc_color}"/>
- <td bgcolor="#000000"/>
- <td colspan="{$size}" bgcolor="{$disc_color}"/>
- <td colspan="{$max_size - $size}" bgcolor="#ffffff"/>
- </xsl:when>
- <xsl:otherwise>
- <td colspan="{$size}" bgcolor="{$disc_color}"/>
- <td bgcolor="#000000"/>
- <td colspan="{$size}" bgcolor="{$disc_color}"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <td colspan="{$max_size}" bgcolor="#ffffff"/>
- <td bgcolor="#000000"/>
- <td colspan="{$max_size}" bgcolor="#ffffff"/>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:template>
-
-
- <xsl:template name="fix-cells">
- <xsl:param name="remaining"/>
-
- <td width="5px" />
-
- <xsl:if test="$remaining &gt; 1">
- <xsl:call-template name="fix-cells">
- <xsl:with-param name="remaining" select="$remaining - 1"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:template>
-
-
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
-
-
-</xsl:stylesheet>
View
47 ...pples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/hanoi/intro.jx
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<page xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
-
- <title>Tower of Hanoi Puzzle</title>
-
- <content>
-
- <para>For some background on the puzzle, see:
- <a href="http://www.cut-the-knot.org/recurrence/hanoi.shtml">http://www.cut-the-knot.org/recurrence/hanoi.shtml</a>
- </para>
-
- <para>To start the puzzle interaction you need to initilaize the number of discs: </para>
-
- <form method="post" action="${cocoon.continuation.id}.continue">
-
- <select name="size">
- <option>3</option>
- <option selected="selected">4</option>
- <option>5</option>
- <option>6</option>
- <option>7</option>
- <option>8</option>
- </select>
-
- <input type="submit" value="Start!"/>
-
- </form>
-
- </content>
-
-</page>
View
165 ...-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/sitemap.xmap
@@ -1,165 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!--+
- | Apples block samples sitemap
- |
- | CVS $Id$
- +-->
-
-<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
- <map:components>
- <map:transformers default="xslt">
- <map:transformer name="i18n" src="org.apache.cocoon.transformation.I18nTransformer">
- <catalogues default="forms">
- <catalogue id="other" name="OtherMessages" location="messages"/>
- <catalogue id="forms" name="FormsMessages" location="messages"/>
- </catalogues>
- <cache-at-startup>true</cache-at-startup>
- </map:transformer>
- </map:transformers>
- </map:components>
-
-<!-- =========================== Views =================================== -->
-
- <map:views>
- <map:view from-label="content" name="content">
- <map:serialize type="xml"/>
- </map:view>
-
- <map:view from-label="content" name="pretty-content">
- <map:transform src="block:cocoon-samples-style-default:stylesheets/system/xml2html.xslt"/>
- <map:serialize type="html"/>
- </map:view>
-
- <map:view from-position="last" name="links">
- <map:serialize type="links"/>
- </map:view>
- </map:views>
-
- <map:resources>
- <map:resource name="serialize-jx-screen" >
- <map:transform src="block:cocoon-samples-style-default:common/style/xsl/html/simple-page2html.xsl">
- <map:parameter name="servletPath" value="{request:servletPath}"/>
- <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
- <map:parameter name="contextPath" value="/blocks/cocoon-samples-style-default"/>
- <map:parameter name="file" value="/samples/apples/{screen-src}"/>
- <map:parameter name="remove" value="{0}"/>
- </map:transform>
- <map:serialize type="html" />
- </map:resource>
- </map:resources>
-
- <map:flow language="apples"/>
-
- <map:pipelines>
- <map:pipeline>
-
- <map:match pattern="">
- <map:generate src="welcome.xml"/>
- <map:transform src="block:cocoon-samples-style-default:common/style/xsl/html/simple-samples2html.xsl">
- <map:parameter name="contextPath" value="/blocks/cocoon-samples-style-default"/>
- </map:transform>
- <map:serialize/>
- </map:match>
-
- <map:match pattern="*.continue">
- <map:call continuation="{1}"/>
- </map:match>
-
- <map:match pattern="continue.*">
- <map:call continuation="{1}"/>
- </map:match>
-
- <!--+
- | Binding form sample, reuses pipelines stolen from Cocoon Forms
- +-->
-
- <!--map:match pattern="form2xml.flow">
- <map:call function="org.apache.cocoon.components.flow.apples.samples.BindingWoodyApple">
- <map:parameter name="form-src" value="block:cocoon-samples-style-default:blocks/forms/forms/form2_model.xml"/>
- <map:parameter name="binding-src" value="block:cocoon-forms-sample:forms-data/form2_bind_xml.xml"/>
- <map:parameter name="documentURI" value="block:cocoon-forms-sample:forms-data/form2_data.xml"/>
- <map:parameter name="form-pipe" value="block:cocoon-forms-sample:forms/form2-display-pipeline"/>
- <map:parameter name="valid-pipe" value="block:cocoon-forms-sample:forms/form2-success-pipeline"/>
- </map:call>
- </map:match-->
-
-
- <!--+
- | Calculator sample, uses stolen and modified xsp's from flowscript sample
- +-->
-
- <map:match pattern="calc.flow">
- <map:call function="org.apache.cocoon.components.flow.apples.samples.CalculationApple"/>
- </map:match>
-
- <!--map:match pattern="calc/*">
- <map:generate type="jx" src="block:cocoon-core-samples-main-sample:flow/jxcalc/screens/{1}.xml"/>
- <map:transform src="block:cocoon-samples-style-default:common/style/xsl/html/simple-page2html.xsl">
- <map:parameter name="servletPath" value="{request:servletPath}"/>
- <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
- <map:parameter name="contextPath" value="{request:contextPath}"/>
- <map:parameter name="file" value="block:cocoon-core-samples-main-sample:flow/jxcalc/screens/{1}.xml"/>
- <map:parameter name="remove" value="{0}"/>
- </map:transform>
- <map:serialize/>
- </map:match-->
-
-
- <!--+
- | Guess Game sample, borrowed setup from the uses stolen and modified xsp's from flowscript
- +-->
-
- <map:match pattern="guess.flow">
- <map:call function="org.apache.cocoon.components.flow.apples.samples.GuessGameApple"/>
- </map:match>
-
-
- <!--+
- | Tower of Hanoi Puzzle sample.
- +-->
-
- <map:match pattern="hanoi.flow">
- <map:call function="org.apache.cocoon.components.flow.apples.samples.HanoiApple"/>
- </map:match>
-
-
- <!--+
- | JX screen pipes
- +-->
-
- <map:match pattern="hanoi/hanoi.jx">
- <map:generate type="jx" src="hanoi/hanoi.jx"/>
- <map:transform src="hanoi/hanoi.xsl" />
- <map:call resource="serialize-jx-screen">
- <map:parameter name="screen-src" value="hanoi/hanoi.jx"/>
- </map:call>
- </map:match>
-
- <map:match pattern="*/*.jx">
- <map:generate type="jx" src="{1}/{2}.jx"/>
- <map:call resource="serialize-jx-screen">
- <map:parameter name="screen-src" value="{1}/{2}.jx"/>
- </map:call>
- </map:match>
-
- </map:pipeline>
- </map:pipelines>
-</map:sitemap>
View
40 ...n-apples-2-tagbase-experiment/cocoon-apples-sample/src/main/resources/COB-INF/welcome.xml
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<samples xmlns:xlink="http://www.w3.org/1999/xlink" name="Apples Block Samples">
-
- <group name="Back">
- <sample name="Back" href="../..">to Cocoon Samples main page</sample>
- <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
- <note>
- Apples is a new flow implementation for Cocoon that allows you to write your
- deciding flow components (business logic) in pure OO Java.
- Apples is currently still alpha software and under active development. Your
- feedback is very much welcome on the Cocoon mailing lists.
- </note>
- <sample name="Apples Documentation" href="http://wiki.cocoondev.org/Wiki.jsp?page=Apples">
- Currently there is no documentation available (not even on the Cocoon Wiki).</sample>
- </group>
-
- <group name="Apples Samples">
- <sample name="Cocoon Forms XML Binding." href="form2xml.flow">An Apple controlling a form for just editing an XML file.</sample>
- <sample name="Calculation." href="calc.flow">Simplistic calculator implementation.</sample>
- <sample name="Number Guessing." href="guess.flow">Number Guessing game.</sample>
- <sample name="Tower of Hanoi puzzle." href="hanoi.flow">The popular mind puzzle.</sample>
- </group>
-
-</samples>
View
45 cocoon-apples-2-tagbase-experiment/pom.xml
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<!--+
- | @version $Id$
- +-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-blocks-modules</artifactId>
- <version>2</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-apples</artifactId>
- <version>2-tagbase-experiment</version>
- <packaging>pom</packaging>
- <name>Cocoon Apples Block [modules]</name>
- <modules>
- <module>cocoon-apples-impl</module>
- <module>cocoon-apples-sample</module>
- </modules>
-
- <scm>
- <connection>scm:svn:https://svn.apache.org/repos/asf/cocoon/tags/cocoon-apples/cocoon-apples-2-tagbase-experiment</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/cocoon/tags/cocoon-apples/cocoon-apples-2-tagbase-experiment</developerConnection>
- <url>https://svn.apache.org/repos/asf/cocoon/tags/cocoon-apples/cocoon-apples-2-tagbase-experiment</url>
- </scm>
-</project>

0 comments on commit 28044e9

Please sign in to comment.
Something went wrong with that request. Please try again.