You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/09/25 12:42:49 UTC
[14/33] tomee git commit: Align SNAPSHOT versions & reformat examples
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/repository/jpa/AbstractGenericJpaRepository.java
----------------------------------------------------------------------
diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/repository/jpa/AbstractGenericJpaRepository.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/repository/jpa/AbstractGenericJpaRepository.java
index 7f570c4..e660084 100644
--- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/repository/jpa/AbstractGenericJpaRepository.java
+++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/repository/jpa/AbstractGenericJpaRepository.java
@@ -1,97 +1,97 @@
-/*
- * 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.superbiz.myfaces.repository.jpa;
-
-import org.superbiz.myfaces.domain.AbstractDomainObject;
-import org.superbiz.myfaces.repository.GenericRepository;
-
-import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Abstract repository class which provides default implementations for common repository methods.
- */
-public abstract class AbstractGenericJpaRepository<T extends AbstractDomainObject> implements GenericRepository<T> {
-
- protected final Class<? extends AbstractDomainObject> entityClass;
-
- @Inject
- protected EntityManager entityManager;
-
- public AbstractGenericJpaRepository() {
- Class currentClass = getClass();
-
- if (currentClass.getName().contains("$$")) { //we are in a proxy
- currentClass = currentClass.getSuperclass();
- }
-
- for (Type interfaceClass : currentClass.getGenericInterfaces()) {
- for (Type genericInterfaceClass : ((Class) interfaceClass).getGenericInterfaces()) {
- if (genericInterfaceClass instanceof ParameterizedType &&
- GenericRepository.class.isAssignableFrom((Class) ((ParameterizedType) genericInterfaceClass).getRawType())) {
- for (Type parameterizedType : ((ParameterizedType) genericInterfaceClass).getActualTypeArguments()) {
- if (AbstractDomainObject.class.isAssignableFrom((Class) parameterizedType)) {
- this.entityClass = (Class<? extends AbstractDomainObject>) parameterizedType;
- return;
- }
- }
- }
- }
- }
-
- throw new IllegalStateException("Entity type of " + currentClass.getName() + " not detected!");
- }
-
- @Override
- public T createNewEntity() {
- try {
- return (T) this.entityClass.newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void save(T entity) {
- if (entity.isTransient()) {
- this.entityManager.persist(entity);
- } else {
- this.entityManager.merge(entity);
- }
- }
-
- public void remove(T entity) {
- if (entity.isTransient()) {
- throw new IllegalStateException("entity is not persistent");
- }
-
- this.entityManager.remove(loadById(entity.getId()));
- }
-
- public List<T> loadAll() {
- return (List<T>) this.entityManager.createQuery("select entity from " + this.entityClass.getSimpleName() + " entity")
- .getResultList();
- }
-
- public T loadById(Long id) {
- return (T) this.entityManager.find(this.entityClass, id);
- }
+/*
+ * 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.superbiz.myfaces.repository.jpa;
+
+import org.superbiz.myfaces.domain.AbstractDomainObject;
+import org.superbiz.myfaces.repository.GenericRepository;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.List;
+
+/**
+ * Abstract repository class which provides default implementations for common repository methods.
+ */
+public abstract class AbstractGenericJpaRepository<T extends AbstractDomainObject> implements GenericRepository<T> {
+
+ protected final Class<? extends AbstractDomainObject> entityClass;
+
+ @Inject
+ protected EntityManager entityManager;
+
+ public AbstractGenericJpaRepository() {
+ Class currentClass = getClass();
+
+ if (currentClass.getName().contains("$$")) { //we are in a proxy
+ currentClass = currentClass.getSuperclass();
+ }
+
+ for (Type interfaceClass : currentClass.getGenericInterfaces()) {
+ for (Type genericInterfaceClass : ((Class) interfaceClass).getGenericInterfaces()) {
+ if (genericInterfaceClass instanceof ParameterizedType &&
+ GenericRepository.class.isAssignableFrom((Class) ((ParameterizedType) genericInterfaceClass).getRawType())) {
+ for (Type parameterizedType : ((ParameterizedType) genericInterfaceClass).getActualTypeArguments()) {
+ if (AbstractDomainObject.class.isAssignableFrom((Class) parameterizedType)) {
+ this.entityClass = (Class<? extends AbstractDomainObject>) parameterizedType;
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ throw new IllegalStateException("Entity type of " + currentClass.getName() + " not detected!");
+ }
+
+ @Override
+ public T createNewEntity() {
+ try {
+ return (T) this.entityClass.newInstance();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void save(T entity) {
+ if (entity.isTransient()) {
+ this.entityManager.persist(entity);
+ } else {
+ this.entityManager.merge(entity);
+ }
+ }
+
+ public void remove(T entity) {
+ if (entity.isTransient()) {
+ throw new IllegalStateException("entity is not persistent");
+ }
+
+ this.entityManager.remove(loadById(entity.getId()));
+ }
+
+ public List<T> loadAll() {
+ return (List<T>) this.entityManager.createQuery("select entity from " + this.entityClass.getSimpleName() + " entity")
+ .getResultList();
+ }
+
+ public T loadById(Long id) {
+ return (T) this.entityManager.find(this.entityClass, id);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java
----------------------------------------------------------------------
diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java
index 37c1131..857cd19 100644
--- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java
+++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/startup/ExtValLifecycleFactory.java
@@ -32,54 +32,44 @@ import javax.faces.lifecycle.LifecycleFactory;
import java.util.Iterator;
//TODO remove it after upgrading to ExtVal r8+
-public class ExtValLifecycleFactory extends LifecycleFactory
-{
+public class ExtValLifecycleFactory extends LifecycleFactory {
private final LifecycleFactory wrapped;
- public ExtValLifecycleFactory(LifecycleFactory wrapped)
- {
+ public ExtValLifecycleFactory(LifecycleFactory wrapped) {
this.wrapped = wrapped;
}
@Override
- public void addLifecycle(String lifecycleId, Lifecycle lifecycle)
- {
+ public void addLifecycle(String lifecycleId, Lifecycle lifecycle) {
wrapped.addLifecycle(lifecycleId, lifecycle);
}
@Override
- public Lifecycle getLifecycle(String lifecycleId)
- {
+ public Lifecycle getLifecycle(String lifecycleId) {
return new LifecycleWrapper(wrapped.getLifecycle(lifecycleId));
}
@Override
- public Iterator<String> getLifecycleIds()
- {
+ public Iterator<String> getLifecycleIds() {
return wrapped.getLifecycleIds();
}
@Override
- public LifecycleFactory getWrapped()
- {
+ public LifecycleFactory getWrapped() {
return wrapped;
}
- private static class LifecycleWrapper extends Lifecycle
- {
+ private static class LifecycleWrapper extends Lifecycle {
private final Lifecycle wrapped;
private static boolean firstPhaseListener = true;
- private LifecycleWrapper(Lifecycle wrapped)
- {
+ private LifecycleWrapper(Lifecycle wrapped) {
this.wrapped = wrapped;
}
@Override
- public void addPhaseListener(PhaseListener listener)
- {
- if (firstPhaseListener)
- {
+ public void addPhaseListener(PhaseListener listener) {
+ if (firstPhaseListener) {
//forced order independent of any other config
firstPhaseListener = false;
wrapped.addPhaseListener(new ExtValStartupListener());
@@ -88,35 +78,29 @@ public class ExtValLifecycleFactory extends LifecycleFactory
}
@Override
- public void execute(FacesContext context) throws FacesException
- {
+ public void execute(FacesContext context) throws FacesException {
wrapped.execute(context);
}
@Override
- public PhaseListener[] getPhaseListeners()
- {
+ public PhaseListener[] getPhaseListeners() {
return wrapped.getPhaseListeners();
}
@Override
- public void removePhaseListener(PhaseListener listener)
- {
+ public void removePhaseListener(PhaseListener listener) {
wrapped.removePhaseListener(listener);
}
@Override
- public void render(FacesContext context) throws FacesException
- {
+ public void render(FacesContext context) throws FacesException {
wrapped.render(context);
}
}
- public static class ExtValStartupListener extends AbstractStartupListener
- {
+ public static class ExtValStartupListener extends AbstractStartupListener {
@Override
- protected void init()
- {
+ protected void init() {
ExtValCoreConfiguration.use(new DefaultExtValCoreConfiguration() {
@Override
public ProxyHelper proxyHelper() {
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/RegistrationPage.java
----------------------------------------------------------------------
diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/RegistrationPage.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/RegistrationPage.java
index b664f80..e2dc312 100644
--- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/RegistrationPage.java
+++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/RegistrationPage.java
@@ -1,101 +1,101 @@
-/*
- * 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.superbiz.myfaces.view;
-
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessScoped;
-import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
-import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
-import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
-import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
-import org.superbiz.myfaces.domain.User;
-import org.superbiz.myfaces.domain.validation.Full;
-import org.superbiz.myfaces.repository.UserRepository;
-import org.superbiz.myfaces.view.config.Pages;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.io.Serializable;
-
-import static org.apache.myfaces.extensions.cdi.message.api.payload.MessageSeverity.ERROR;
-
-@Named
-@ViewAccessScoped
-public class RegistrationPage implements Serializable {
-
- private static final long serialVersionUID = 3844502441069448490L;
-
- @Inject
- private UserRepository userRepository;
-
- @Inject
- private Conversation conversation;
-
- @Inject
- private
- @Jsf
- MessageContext messageContext;
-
- private User user = new User();
-
- @Inject
- private UserHolder userHolder;
-
- @Equals("user.password")
- private String repeatedPassword;
-
- @BeanValidation(useGroups = Full.class) //triggers UniqueUserNameValidator
- public Class<? extends Pages> register() {
- this.userRepository.save(this.user);
- this.messageContext.message()
- .text("{msgUserRegistered}")
- .namedArgument("userName", this.user.getUserName())
- .add();
-
- //in order to re-use the page-bean for the login-page
- this.conversation.close();
-
- return Pages.Login.class;
- }
-
- public Class<? extends Pages> login() {
- User user = this.userRepository.loadUser(this.user.getUserName());
- if (user != null && user.getPassword().equals(this.user.getPassword())) {
- this.messageContext.message().text("{msgLoginSuccessful}").add();
- this.userHolder.setCurrentUser(user);
- return Pages.About.class;
- }
-
- this.messageContext.message().text("{msgLoginFailed}").payload(ERROR).add();
-
- return null;
- }
-
- public User getUser() {
- return user;
- }
-
- public String getRepeatedPassword() {
- return repeatedPassword;
- }
-
- public void setRepeatedPassword(String repeatedPassword) {
- this.repeatedPassword = repeatedPassword;
- }
+/*
+ * 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.superbiz.myfaces.view;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessScoped;
+import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
+import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+import org.apache.myfaces.extensions.validator.crossval.annotation.Equals;
+import org.superbiz.myfaces.domain.User;
+import org.superbiz.myfaces.domain.validation.Full;
+import org.superbiz.myfaces.repository.UserRepository;
+import org.superbiz.myfaces.view.config.Pages;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.Serializable;
+
+import static org.apache.myfaces.extensions.cdi.message.api.payload.MessageSeverity.ERROR;
+
+@Named
+@ViewAccessScoped
+public class RegistrationPage implements Serializable {
+
+ private static final long serialVersionUID = 3844502441069448490L;
+
+ @Inject
+ private UserRepository userRepository;
+
+ @Inject
+ private Conversation conversation;
+
+ @Inject
+ private
+ @Jsf
+ MessageContext messageContext;
+
+ private User user = new User();
+
+ @Inject
+ private UserHolder userHolder;
+
+ @Equals("user.password")
+ private String repeatedPassword;
+
+ @BeanValidation(useGroups = Full.class) //triggers UniqueUserNameValidator
+ public Class<? extends Pages> register() {
+ this.userRepository.save(this.user);
+ this.messageContext.message()
+ .text("{msgUserRegistered}")
+ .namedArgument("userName", this.user.getUserName())
+ .add();
+
+ //in order to re-use the page-bean for the login-page
+ this.conversation.close();
+
+ return Pages.Login.class;
+ }
+
+ public Class<? extends Pages> login() {
+ User user = this.userRepository.loadUser(this.user.getUserName());
+ if (user != null && user.getPassword().equals(this.user.getPassword())) {
+ this.messageContext.message().text("{msgLoginSuccessful}").add();
+ this.userHolder.setCurrentUser(user);
+ return Pages.About.class;
+ }
+
+ this.messageContext.message().text("{msgLoginFailed}").payload(ERROR).add();
+
+ return null;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public String getRepeatedPassword() {
+ return repeatedPassword;
+ }
+
+ public void setRepeatedPassword(String repeatedPassword) {
+ this.repeatedPassword = repeatedPassword;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/config/Pages.java
----------------------------------------------------------------------
diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/config/Pages.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/config/Pages.java
index 2589dcc..424ef06 100644
--- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/config/Pages.java
+++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/config/Pages.java
@@ -1,66 +1,66 @@
-/*
- * 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.superbiz.myfaces.view.config;
-
-import org.apache.myfaces.extensions.cdi.core.api.config.view.DefaultErrorView;
-import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
-import org.apache.myfaces.extensions.cdi.core.api.security.Secured;
-import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
-import org.apache.myfaces.extensions.cdi.jsf.api.config.view.PageBean;
-import org.superbiz.myfaces.view.FeedbackPage;
-import org.superbiz.myfaces.view.InfoPage;
-import org.superbiz.myfaces.view.security.LoginAccessDecisionVoter;
-
-import static org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page.NavigationMode.REDIRECT;
-
-@Page(navigation = REDIRECT)
-public interface Pages extends ViewConfig {
-
- @Page
- class Index implements Pages {
-
- }
-
- @InfoPage
- @Page
- class About implements Pages {
-
- }
-
- @Page
- class Registration implements Pages {
-
- }
-
- @Page
- class Login extends DefaultErrorView implements Pages /*just to benefit from the config*/ {
-
- }
-
- @Secured(LoginAccessDecisionVoter.class)
- //@Secured(value = LoginAccessDecisionVoter.class, errorView = Login.class)
- interface Secure extends Pages {
-
- @PageBean(FeedbackPage.class)
- @Page
- class FeedbackList implements Secure {
-
- }
- }
-}
+/*
+ * 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.superbiz.myfaces.view.config;
+
+import org.apache.myfaces.extensions.cdi.core.api.config.view.DefaultErrorView;
+import org.apache.myfaces.extensions.cdi.core.api.config.view.ViewConfig;
+import org.apache.myfaces.extensions.cdi.core.api.security.Secured;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.PageBean;
+import org.superbiz.myfaces.view.FeedbackPage;
+import org.superbiz.myfaces.view.InfoPage;
+import org.superbiz.myfaces.view.security.LoginAccessDecisionVoter;
+
+import static org.apache.myfaces.extensions.cdi.jsf.api.config.view.Page.NavigationMode.REDIRECT;
+
+@Page(navigation = REDIRECT)
+public interface Pages extends ViewConfig {
+
+ @Page
+ class Index implements Pages {
+
+ }
+
+ @InfoPage
+ @Page
+ class About implements Pages {
+
+ }
+
+ @Page
+ class Registration implements Pages {
+
+ }
+
+ @Page
+ class Login extends DefaultErrorView implements Pages /*just to benefit from the config*/ {
+
+ }
+
+ @Secured(LoginAccessDecisionVoter.class)
+ //@Secured(value = LoginAccessDecisionVoter.class, errorView = Login.class)
+ interface Secure extends Pages {
+
+ @PageBean(FeedbackPage.class)
+ @Page
+ class FeedbackList implements Secure {
+
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/util/InfoBean.java
----------------------------------------------------------------------
diff --git a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/util/InfoBean.java b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/util/InfoBean.java
index e75b494..02a0416 100644
--- a/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/util/InfoBean.java
+++ b/examples/myfaces-codi-demo/src/main/java/org/superbiz/myfaces/view/util/InfoBean.java
@@ -1,128 +1,128 @@
-/*
- * 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.superbiz.myfaces.view.util;
-
-import org.apache.myfaces.extensions.cdi.core.api.CodiInformation;
-import org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage;
-import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
-import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
-import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
-import org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor;
-import org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigResolver;
-import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
-import org.apache.myfaces.extensions.validator.ExtValInformation;
-import org.superbiz.myfaces.view.InfoPage;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.faces.context.FacesContext;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.persistence.Persistence;
-import javax.validation.Validation;
-import java.io.Serializable;
-
-@Named
-@SessionScoped
-public class InfoBean implements Serializable {
-
- private static final long serialVersionUID = -1748909261695527800L;
-
- @Inject
- private
- @Jsf
- MessageContext messageContext;
-
- @Inject
- private ProjectStage projectStage;
-
- @Inject
- private ViewConfigResolver viewConfigResolver;
-
- @Inject
- private FacesContext facesContext;
-
- private String applicationMessageVersionInfo;
-
- private String beanValidationVersion;
-
- private String jpaVersion;
-
- @PostConstruct
- protected void showWelcomeMessage() {
- String versionString = ClassUtils.getJarVersion(InfoBean.class);
-
- if (versionString != null) {
- this.applicationMessageVersionInfo = " (v" + versionString + ")";
- }
-
- this.beanValidationVersion =
- ClassUtils.getJarVersion(Validation.buildDefaultValidatorFactory().getValidator().getClass());
-
- this.jpaVersion =
- ClassUtils.getJarVersion(Persistence.createEntityManagerFactory("demoApplicationPU").getClass());
-
- if (!ProjectStage.IntegrationTest.equals(this.projectStage)) {
- this.messageContext.message().text("{msgWelcome}").add();
- }
- }
-
- public boolean isInfoPage() {
- ViewConfigDescriptor viewConfigDescriptor =
- this.viewConfigResolver.getViewConfigDescriptor(this.facesContext.getViewRoot().getViewId());
-
- if (viewConfigDescriptor == null) {
- return false;
- }
-
- return !viewConfigDescriptor.getMetaData(InfoPage.class).isEmpty();
- }
-
- public String getProjectStage() {
- return this.projectStage.toString();
- }
-
- public String getApplicationVersion() {
- return this.applicationMessageVersionInfo;
- }
-
- public String getCodiVersion() {
- return CodiInformation.VERSION;
- }
-
- public String getCdiVersion() {
- return ClassUtils.getJarVersion(BeanManagerProvider.getInstance().getBeanManager().getClass());
- }
-
- public String getExtValVersion() {
- return ExtValInformation.VERSION;
- }
-
- public String getJsfVersion() {
- return ClassUtils.getJarVersion(FacesContext.class);
- }
-
- public String getBeanValidationVersion() {
- return this.beanValidationVersion;
- }
-
- public String getJpaVersion() {
- return this.jpaVersion;
- }
-}
+/*
+ * 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.superbiz.myfaces.view.util;
+
+import org.apache.myfaces.extensions.cdi.core.api.CodiInformation;
+import org.apache.myfaces.extensions.cdi.core.api.projectstage.ProjectStage;
+import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
+import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import org.apache.myfaces.extensions.cdi.jsf.api.Jsf;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigDescriptor;
+import org.apache.myfaces.extensions.cdi.jsf.api.config.view.ViewConfigResolver;
+import org.apache.myfaces.extensions.cdi.message.api.MessageContext;
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.superbiz.myfaces.view.InfoPage;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.Persistence;
+import javax.validation.Validation;
+import java.io.Serializable;
+
+@Named
+@SessionScoped
+public class InfoBean implements Serializable {
+
+ private static final long serialVersionUID = -1748909261695527800L;
+
+ @Inject
+ private
+ @Jsf
+ MessageContext messageContext;
+
+ @Inject
+ private ProjectStage projectStage;
+
+ @Inject
+ private ViewConfigResolver viewConfigResolver;
+
+ @Inject
+ private FacesContext facesContext;
+
+ private String applicationMessageVersionInfo;
+
+ private String beanValidationVersion;
+
+ private String jpaVersion;
+
+ @PostConstruct
+ protected void showWelcomeMessage() {
+ String versionString = ClassUtils.getJarVersion(InfoBean.class);
+
+ if (versionString != null) {
+ this.applicationMessageVersionInfo = " (v" + versionString + ")";
+ }
+
+ this.beanValidationVersion =
+ ClassUtils.getJarVersion(Validation.buildDefaultValidatorFactory().getValidator().getClass());
+
+ this.jpaVersion =
+ ClassUtils.getJarVersion(Persistence.createEntityManagerFactory("demoApplicationPU").getClass());
+
+ if (!ProjectStage.IntegrationTest.equals(this.projectStage)) {
+ this.messageContext.message().text("{msgWelcome}").add();
+ }
+ }
+
+ public boolean isInfoPage() {
+ ViewConfigDescriptor viewConfigDescriptor =
+ this.viewConfigResolver.getViewConfigDescriptor(this.facesContext.getViewRoot().getViewId());
+
+ if (viewConfigDescriptor == null) {
+ return false;
+ }
+
+ return !viewConfigDescriptor.getMetaData(InfoPage.class).isEmpty();
+ }
+
+ public String getProjectStage() {
+ return this.projectStage.toString();
+ }
+
+ public String getApplicationVersion() {
+ return this.applicationMessageVersionInfo;
+ }
+
+ public String getCodiVersion() {
+ return CodiInformation.VERSION;
+ }
+
+ public String getCdiVersion() {
+ return ClassUtils.getJarVersion(BeanManagerProvider.getInstance().getBeanManager().getClass());
+ }
+
+ public String getExtValVersion() {
+ return ExtValInformation.VERSION;
+ }
+
+ public String getJsfVersion() {
+ return ClassUtils.getJarVersion(FacesContext.class);
+ }
+
+ public String getBeanValidationVersion() {
+ return this.beanValidationVersion;
+ }
+
+ public String getJpaVersion() {
+ return this.jpaVersion;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/persistence-fragment/src/main/java/org/superbiz/injection/jpa/Movie.java
----------------------------------------------------------------------
diff --git a/examples/persistence-fragment/src/main/java/org/superbiz/injection/jpa/Movie.java b/examples/persistence-fragment/src/main/java/org/superbiz/injection/jpa/Movie.java
index 9eb94fc..6157287 100644
--- a/examples/persistence-fragment/src/main/java/org/superbiz/injection/jpa/Movie.java
+++ b/examples/persistence-fragment/src/main/java/org/superbiz/injection/jpa/Movie.java
@@ -1,70 +1,70 @@
-/**
- * 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.superbiz.injection.jpa;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
-public class Movie {
-
- @Id
- @GeneratedValue
- private long id;
- private String director;
- private String title;
- private int year;
-
- public Movie() {
- // no-op
- }
-
- public Movie(String director, String title, int year) {
- this.director = director;
- this.title = title;
- this.year = year;
- }
-
- public long getId() {
- return id;
- }
-
- public String getDirector() {
- return director;
- }
-
- public void setDirector(String director) {
- this.director = director;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public int getYear() {
- return year;
- }
-
- public void setYear(int year) {
- this.year = year;
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.injection.jpa;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Movie {
+
+ @Id
+ @GeneratedValue
+ private long id;
+ private String director;
+ private String title;
+ private int year;
+
+ public Movie() {
+ // no-op
+ }
+
+ public Movie(String director, String title, int year) {
+ this.director = director;
+ this.title = title;
+ this.year = year;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getDirector() {
+ return director;
+ }
+
+ public void setDirector(String director) {
+ this.director = director;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public int getYear() {
+ return year;
+ }
+
+ public void setYear(int year) {
+ this.year = year;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/persistence-fragment/src/test/java/org/superbiz/injection/jpa/MoviesTest.java
----------------------------------------------------------------------
diff --git a/examples/persistence-fragment/src/test/java/org/superbiz/injection/jpa/MoviesTest.java b/examples/persistence-fragment/src/test/java/org/superbiz/injection/jpa/MoviesTest.java
index aedbe0e..63e6b04 100644
--- a/examples/persistence-fragment/src/test/java/org/superbiz/injection/jpa/MoviesTest.java
+++ b/examples/persistence-fragment/src/test/java/org/superbiz/injection/jpa/MoviesTest.java
@@ -1,50 +1,50 @@
-/**
- * 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.superbiz.injection.jpa;
-
-import org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.PersistenceUnit;
-import java.util.Properties;
-
-import static org.junit.Assert.assertTrue;
-
-public class MoviesTest {
-
- @PersistenceUnit
- private EntityManagerFactory emf;
-
- @Test
- public void test() throws Exception {
- final Properties p = new Properties();
- p.put("movieDatabase", "new://Resource?type=DataSource");
- p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
- p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
-
- final EJBContainer container = EJBContainer.createEJBContainer(p);
- final Context context = container.getContext();
- context.bind("inject", this);
-
- assertTrue(((ReloadableEntityManagerFactory) emf).getManagedClasses().contains(Movie.class.getName()));
-
- container.close();
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.injection.jpa;
+
+import org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnit;
+import java.util.Properties;
+
+import static org.junit.Assert.assertTrue;
+
+public class MoviesTest {
+
+ @PersistenceUnit
+ private EntityManagerFactory emf;
+
+ @Test
+ public void test() throws Exception {
+ final Properties p = new Properties();
+ p.put("movieDatabase", "new://Resource?type=DataSource");
+ p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
+ p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
+
+ final EJBContainer container = EJBContainer.createEJBContainer(p);
+ final Context context = container.getContext();
+ context.bind("inject", this);
+
+ assertTrue(((ReloadableEntityManagerFactory) emf).getManagedClasses().contains(Movie.class.getName()));
+
+ container.close();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/PojoWS.java
----------------------------------------------------------------------
diff --git a/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/PojoWS.java b/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/PojoWS.java
index 15fb025..ca093da 100644
--- a/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/PojoWS.java
+++ b/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/PojoWS.java
@@ -1,45 +1,45 @@
-/**
- * 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.superbiz.ws.pojo;
-
-import javax.annotation.Resource;
-import javax.jws.WebService;
-import javax.transaction.UserTransaction;
-import javax.xml.ws.WebServiceContext;
-
-@WebService
-public class PojoWS implements WS {
-
- @Resource
- private WebServiceContext webServiceContext;
-
- @Resource
- private UserTransaction userTransaction;
-
- @Override
- public String ws() {
- return webServiceContext + " & " + userTransaction;
- }
-
- public void setWebServiceContext(WebServiceContext webServiceContext) {
- this.webServiceContext = webServiceContext;
- }
-
- public void setUserTransaction(UserTransaction userTransaction) {
- this.userTransaction = userTransaction;
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.ws.pojo;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.transaction.UserTransaction;
+import javax.xml.ws.WebServiceContext;
+
+@WebService
+public class PojoWS implements WS {
+
+ @Resource
+ private WebServiceContext webServiceContext;
+
+ @Resource
+ private UserTransaction userTransaction;
+
+ @Override
+ public String ws() {
+ return webServiceContext + " & " + userTransaction;
+ }
+
+ public void setWebServiceContext(WebServiceContext webServiceContext) {
+ this.webServiceContext = webServiceContext;
+ }
+
+ public void setUserTransaction(UserTransaction userTransaction) {
+ this.userTransaction = userTransaction;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/WS.java
----------------------------------------------------------------------
diff --git a/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/WS.java b/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/WS.java
index 75b4a9f..4773495 100644
--- a/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/WS.java
+++ b/examples/pojo-webservice/src/main/java/org/superbiz/ws/pojo/WS.java
@@ -1,25 +1,25 @@
-/**
- * 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.superbiz.ws.pojo;
-
-import javax.jws.WebService;
-
-@WebService
-public interface WS {
-
- String ws();
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.superbiz.ws.pojo;
+
+import javax.jws.WebService;
+
+@WebService
+public interface WS {
+
+ String ws();
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/Client.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/Client.java b/examples/polling-parent/polling-client/src/main/java/jug/client/Client.java
index 419b9eb..65f4c2f 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/Client.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/Client.java
@@ -1,84 +1,84 @@
-/**
- * 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 jug.client;
-
-import jline.ConsoleReader;
-import jline.FileNameCompletor;
-import jline.SimpleCompletor;
-import jug.client.command.api.AbstractCommand;
-import jug.client.util.CommandManager;
-import org.apache.xbean.recipe.ObjectRecipe;
-import org.apache.xbean.recipe.Option;
-
-import java.io.OutputStreamWriter;
-import java.util.Map;
-
-public class Client {
-
- private static final String PROMPT = System.getProperty("user.name") + " @ jug > ";
- private static final String EXIT_CMD = "exit";
-
- private Client() {
- // no-op
- }
-
- public static void main(final String[] args) throws Exception {
- if (args.length != 1) {
- System.err.println("Pass the base url as parameter");
- return;
- }
-
- final ConsoleReader reader = new ConsoleReader(System.in, new OutputStreamWriter(System.out));
- reader.addCompletor(new FileNameCompletor());
- reader.addCompletor(new SimpleCompletor(CommandManager.keys().toArray(new String[CommandManager.size()])));
-
- String line;
- while ((line = reader.readLine(PROMPT)) != null) {
- if (EXIT_CMD.equals(line)) {
- break;
- }
-
- Class<?> cmdClass = null;
- for (Map.Entry<String, Class<?>> cmd : CommandManager.getCommands().entrySet()) {
- if (line.startsWith(cmd.getKey())) {
- cmdClass = cmd.getValue();
- break;
- }
- }
-
- if (cmdClass != null) {
- final ObjectRecipe recipe = new ObjectRecipe(cmdClass);
- recipe.setProperty("url", args[0]);
- recipe.setProperty("command", line);
- recipe.setProperty("commands", CommandManager.getCommands());
-
- recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
- recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
- recipe.allow(Option.NAMED_PARAMETERS);
-
- try {
- final AbstractCommand cmdInstance = (AbstractCommand) recipe.create();
- cmdInstance.execute(line);
- } catch (Exception e) {
- e.printStackTrace();
- }
- } else {
- System.err.println("sorry i don't understand '" + line + "'");
- }
- }
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client;
+
+import jline.ConsoleReader;
+import jline.FileNameCompletor;
+import jline.SimpleCompletor;
+import jug.client.command.api.AbstractCommand;
+import jug.client.util.CommandManager;
+import org.apache.xbean.recipe.ObjectRecipe;
+import org.apache.xbean.recipe.Option;
+
+import java.io.OutputStreamWriter;
+import java.util.Map;
+
+public class Client {
+
+ private static final String PROMPT = System.getProperty("user.name") + " @ jug > ";
+ private static final String EXIT_CMD = "exit";
+
+ private Client() {
+ // no-op
+ }
+
+ public static void main(final String[] args) throws Exception {
+ if (args.length != 1) {
+ System.err.println("Pass the base url as parameter");
+ return;
+ }
+
+ final ConsoleReader reader = new ConsoleReader(System.in, new OutputStreamWriter(System.out));
+ reader.addCompletor(new FileNameCompletor());
+ reader.addCompletor(new SimpleCompletor(CommandManager.keys().toArray(new String[CommandManager.size()])));
+
+ String line;
+ while ((line = reader.readLine(PROMPT)) != null) {
+ if (EXIT_CMD.equals(line)) {
+ break;
+ }
+
+ Class<?> cmdClass = null;
+ for (Map.Entry<String, Class<?>> cmd : CommandManager.getCommands().entrySet()) {
+ if (line.startsWith(cmd.getKey())) {
+ cmdClass = cmd.getValue();
+ break;
+ }
+ }
+
+ if (cmdClass != null) {
+ final ObjectRecipe recipe = new ObjectRecipe(cmdClass);
+ recipe.setProperty("url", args[0]);
+ recipe.setProperty("command", line);
+ recipe.setProperty("commands", CommandManager.getCommands());
+
+ recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
+ recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
+ recipe.allow(Option.NAMED_PARAMETERS);
+
+ try {
+ final AbstractCommand cmdInstance = (AbstractCommand) recipe.create();
+ cmdInstance.execute(line);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ System.err.println("sorry i don't understand '" + line + "'");
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/AbstractCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/AbstractCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/AbstractCommand.java
index b4fc913..0078349 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/AbstractCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/AbstractCommand.java
@@ -1,88 +1,88 @@
-/**
- * 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 jug.client.command.api;
-
-import jug.client.util.ClientNameHolder;
-import org.apache.cxf.helpers.IOUtils;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.codehaus.jettison.util.StringIndenter;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-
-public abstract class AbstractCommand {
-
- protected String command;
- protected String url;
-
- protected WebClient client;
-
- public void execute(final String cmd) {
- final Response response = invoke(cmd);
- if (response == null) {
- return;
- }
-
- System.out.println("Status: " + response.getStatus());
- try {
- String json = slurp((InputStream) response.getEntity());
- System.out.println(format(json));
- } catch (IOException e) {
- System.err.println("can't get output: " + e.getMessage());
- }
- }
-
- protected String format(final String json) throws IOException {
- final StringIndenter formatter = new StringIndenter(json);
- final Writer outWriter = new StringWriter();
- IOUtils.copy(new StringReader(formatter.result()), outWriter, 2048);
- outWriter.close();
- return outWriter.toString();
- }
-
- protected abstract Response invoke(final String cmd);
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public void setUrl(String url) {
- this.url = url;
- client = WebClient.create(url).accept(MediaType.APPLICATION_JSON);
- if (ClientNameHolder.getCurrent() != null) {
- client.query("client", ClientNameHolder.getCurrent());
- }
- }
-
- public static String slurp(final InputStream from) throws IOException {
- ByteArrayOutputStream to = new ByteArrayOutputStream();
- byte[] buffer = new byte[1024];
- int length;
- while ((length = from.read(buffer)) != -1) {
- to.write(buffer, 0, length);
- }
- to.flush();
- return new String(to.toByteArray());
- }
-}
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.api;
+
+import jug.client.util.ClientNameHolder;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.codehaus.jettison.util.StringIndenter;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+public abstract class AbstractCommand {
+
+ protected String command;
+ protected String url;
+
+ protected WebClient client;
+
+ public void execute(final String cmd) {
+ final Response response = invoke(cmd);
+ if (response == null) {
+ return;
+ }
+
+ System.out.println("Status: " + response.getStatus());
+ try {
+ String json = slurp((InputStream) response.getEntity());
+ System.out.println(format(json));
+ } catch (IOException e) {
+ System.err.println("can't get output: " + e.getMessage());
+ }
+ }
+
+ protected String format(final String json) throws IOException {
+ final StringIndenter formatter = new StringIndenter(json);
+ final Writer outWriter = new StringWriter();
+ IOUtils.copy(new StringReader(formatter.result()), outWriter, 2048);
+ outWriter.close();
+ return outWriter.toString();
+ }
+
+ protected abstract Response invoke(final String cmd);
+
+ public void setCommand(String command) {
+ this.command = command;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ client = WebClient.create(url).accept(MediaType.APPLICATION_JSON);
+ if (ClientNameHolder.getCurrent() != null) {
+ client.query("client", ClientNameHolder.getCurrent());
+ }
+ }
+
+ public static String slurp(final InputStream from) throws IOException {
+ ByteArrayOutputStream to = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int length;
+ while ((length = from.read(buffer)) != -1) {
+ to.write(buffer, 0, length);
+ }
+ to.flush();
+ return new String(to.toByteArray());
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/Command.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/Command.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/Command.java
index dde75a0..52e5e8a 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/Command.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/api/Command.java
@@ -1,34 +1,34 @@
-/**
- * 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 jug.client.command.api;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface Command {
-
- String usage() default "";
-
- String name() default "";
-
- String description() default "";
-}
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE})
+public @interface Command {
+
+ String usage() default "";
+
+ String name() default "";
+
+ String description() default "";
+}
+
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/BestPollCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/BestPollCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/BestPollCommand.java
index 7222976..4393c89 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/BestPollCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/BestPollCommand.java
@@ -1,31 +1,31 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.AbstractCommand;
-import jug.client.command.api.Command;
-
-import javax.ws.rs.core.Response;
-
-@Command(name = "best", usage = "best", description = "find best poll")
-public class BestPollCommand extends AbstractCommand {
-
- @Override
- protected Response invoke(String cmd) {
- return client.path("api/subject/best").get();
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.AbstractCommand;
+import jug.client.command.api.Command;
+
+import javax.ws.rs.core.Response;
+
+@Command(name = "best", usage = "best", description = "find best poll")
+public class BestPollCommand extends AbstractCommand {
+
+ @Override
+ protected Response invoke(String cmd) {
+ return client.path("api/subject/best").get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/ExitCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/ExitCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/ExitCommand.java
index d1ed1f0..dc9a42a 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/ExitCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/ExitCommand.java
@@ -1,37 +1,37 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.AbstractCommand;
-import jug.client.command.api.Command;
-
-import javax.ws.rs.core.Response;
-
-// just to get it in the help
-@Command(name = "exit", usage = "exit", description = "exit from the cli")
-public class ExitCommand extends AbstractCommand {
-
- @Override
- public void execute(String cmd) {
- throw new UnsupportedOperationException("shouldn't be called directly");
- }
-
- @Override
- protected Response invoke(String cmd) {
- return null;
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.AbstractCommand;
+import jug.client.command.api.Command;
+
+import javax.ws.rs.core.Response;
+
+// just to get it in the help
+@Command(name = "exit", usage = "exit", description = "exit from the cli")
+public class ExitCommand extends AbstractCommand {
+
+ @Override
+ public void execute(String cmd) {
+ throw new UnsupportedOperationException("shouldn't be called directly");
+ }
+
+ @Override
+ protected Response invoke(String cmd) {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/HelpCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/HelpCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/HelpCommand.java
index 9c45efc..453ac63 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/HelpCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/HelpCommand.java
@@ -1,53 +1,53 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.AbstractCommand;
-import jug.client.command.api.Command;
-
-import javax.ws.rs.core.Response;
-import java.util.Map;
-
-@Command(name = "help", usage = "help", description = "print this help")
-public class HelpCommand extends AbstractCommand {
-
- private Map<String, Class<?>> commands;
-
- @Override
- public void execute(final String cmd) {
- for (Map.Entry<String, Class<?>> command : commands.entrySet()) {
- try {
- final Class<?> clazz = command.getValue();
- final Command annotation = clazz.getAnnotation(Command.class);
- System.out.println(annotation.name() + ": " + annotation.description());
- System.out.println("\tUsage: " + annotation.usage());
- } catch (Exception e) {
- // ignored = command not available
- }
- }
- }
-
- @Override
- protected Response invoke(String cmd) {
- return null;
- }
-
- public void setCommands(Map<String, Class<?>> commands) {
- this.commands = commands;
- }
-}
-
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.AbstractCommand;
+import jug.client.command.api.Command;
+
+import javax.ws.rs.core.Response;
+import java.util.Map;
+
+@Command(name = "help", usage = "help", description = "print this help")
+public class HelpCommand extends AbstractCommand {
+
+ private Map<String, Class<?>> commands;
+
+ @Override
+ public void execute(final String cmd) {
+ for (Map.Entry<String, Class<?>> command : commands.entrySet()) {
+ try {
+ final Class<?> clazz = command.getValue();
+ final Command annotation = clazz.getAnnotation(Command.class);
+ System.out.println(annotation.name() + ": " + annotation.description());
+ System.out.println("\tUsage: " + annotation.usage());
+ } catch (Exception e) {
+ // ignored = command not available
+ }
+ }
+ }
+
+ @Override
+ protected Response invoke(String cmd) {
+ return null;
+ }
+
+ public void setCommands(Map<String, Class<?>> commands) {
+ this.commands = commands;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/NewPollCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/NewPollCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/NewPollCommand.java
index a65bc6a..77c9017 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/NewPollCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/NewPollCommand.java
@@ -1,33 +1,33 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.Command;
-
-@Command(name = "new-poll", usage = "new-poll [<name>, <question>]", description = "create a new poll")
-public class NewPollCommand extends QueryAndPostCommand {
-
- @Override
- protected String getName() {
- return "name";
- }
-
- @Override
- protected String getPath() {
- return "api/subject/create";
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.Command;
+
+@Command(name = "new-poll", usage = "new-poll [<name>, <question>]", description = "create a new poll")
+public class NewPollCommand extends QueryAndPostCommand {
+
+ @Override
+ protected String getName() {
+ return "name";
+ }
+
+ @Override
+ protected String getPath() {
+ return "api/subject/create";
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollResultCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollResultCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollResultCommand.java
index ad05774..8f06a7a 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollResultCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollResultCommand.java
@@ -1,40 +1,40 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.AbstractCommand;
-import jug.client.command.api.Command;
-
-import javax.ws.rs.core.Response;
-
-import static jug.client.command.impl.PollResultCommand.RESULT_CMD;
-
-@Command(name = RESULT_CMD, usage = RESULT_CMD + " <name>", description = "result of a poll")
-public class PollResultCommand extends AbstractCommand {
-
- public static final String RESULT_CMD = "result";
-
- @Override
- protected Response invoke(String cmd) {
- if (RESULT_CMD.length() + 1 >= cmd.length()) {
- System.err.println("please specify a poll name");
- return null;
- }
-
- return client.path("api/subject/result/".concat(cmd.substring(RESULT_CMD.length() + 1))).get();
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.AbstractCommand;
+import jug.client.command.api.Command;
+
+import javax.ws.rs.core.Response;
+
+import static jug.client.command.impl.PollResultCommand.RESULT_CMD;
+
+@Command(name = RESULT_CMD, usage = RESULT_CMD + " <name>", description = "result of a poll")
+public class PollResultCommand extends AbstractCommand {
+
+ public static final String RESULT_CMD = "result";
+
+ @Override
+ protected Response invoke(String cmd) {
+ if (RESULT_CMD.length() + 1 >= cmd.length()) {
+ System.err.println("please specify a poll name");
+ return null;
+ }
+
+ return client.path("api/subject/result/".concat(cmd.substring(RESULT_CMD.length() + 1))).get();
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollsCommand.java
----------------------------------------------------------------------
diff --git a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollsCommand.java b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollsCommand.java
index 8d78e6a..8d968d7 100644
--- a/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollsCommand.java
+++ b/examples/polling-parent/polling-client/src/main/java/jug/client/command/impl/PollsCommand.java
@@ -1,31 +1,31 @@
-/**
- * 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 jug.client.command.impl;
-
-import jug.client.command.api.AbstractCommand;
-import jug.client.command.api.Command;
-
-import javax.ws.rs.core.Response;
-
-@Command(name = "polls", usage = "polls", description = "list polls")
-public class PollsCommand extends AbstractCommand {
-
- @Override
- public Response invoke(final String cmd) {
- return client.path("api/subject/list").get();
- }
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 jug.client.command.impl;
+
+import jug.client.command.api.AbstractCommand;
+import jug.client.command.api.Command;
+
+import javax.ws.rs.core.Response;
+
+@Command(name = "polls", usage = "polls", description = "list polls")
+public class PollsCommand extends AbstractCommand {
+
+ @Override
+ public Response invoke(final String cmd) {
+ return client.path("api/subject/list").get();
+ }
+}