Skip to content
Browse files

Snapshot

  • Loading branch information...
1 parent 5eb09d9 commit b04890d29bf93361927d6cde01e2af380a8475f7 @dmlloyd committed Sep 17, 2012
Showing with 656 additions and 20 deletions.
  1. +1 −0 .gitignore
  2. +41 −0 example/src/main/java/example1/BootTimePropertyType.java
  3. +56 −1 example/src/main/java/example1/DomainResource.java
  4. +2 −4 example/src/main/java/example1/DomainServerResource.java
  5. +3 −5 example/src/main/java/example1/FileHandlerResource.java
  6. +6 −0 example/src/main/java/example1/LoggingSubsystemResource.java
  7. +39 −0 example/src/main/java/example1/PropertyType.java
  8. +0 −3 example/src/main/java/example1/StandaloneServerResource.java
  9. +3 −2 tool/src/main/java/org/jboss/mgmt/annotation/Description.java
  10. +0 −1 tool/src/main/java/org/jboss/mgmt/annotation/Listener.java
  11. +34 −0 tool/src/main/java/org/jboss/mgmt/annotation/OperationHook.java
  12. +40 −0 tool/src/main/java/org/jboss/mgmt/annotation/OperationHooks.java
  13. +2 −0 tool/src/main/java/org/jboss/mgmt/annotation/xml/Mapping.java
  14. +2 −0 tool/src/main/java/org/jboss/mgmt/annotation/xml/XmlRender.java
  15. +73 −0 tool/src/main/java/org/jboss/mgmt/generator/AttributeBuilder.java
  16. +46 −0 tool/src/main/java/org/jboss/mgmt/generator/GeneralResourceBuilder.java
  17. +64 −0 tool/src/main/java/org/jboss/mgmt/generator/Generator.java
  18. +31 −0 tool/src/main/java/org/jboss/mgmt/generator/ModelBuilder.java
  19. +32 −0 tool/src/main/java/org/jboss/mgmt/generator/ReferenceBuilder.java
  20. +47 −0 tool/src/main/java/org/jboss/mgmt/generator/RootResourceBuilder.java
  21. +32 −0 tool/src/main/java/org/jboss/mgmt/generator/Session.java
  22. +4 −4 ...example1/DomainProfileResource.java → tool/src/main/java/org/jboss/mgmt/generator/SubBuilder.java
  23. +49 −0 tool/src/main/java/org/jboss/mgmt/generator/SubResourceBuilder.java
  24. +49 −0 tool/src/main/java/org/jboss/mgmt/model/Attribute.java
View
1 .gitignore
@@ -2,3 +2,4 @@ target/
*.ipr
*.iws
*.iml
+.idea
View
41 example/src/main/java/example1/BootTimePropertyType.java
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package example1;
+
+import org.jboss.mgmt.annotation.AttributeType;
+import org.jboss.mgmt.annotation.xml.XmlRender;
+
+import static org.jboss.mgmt.annotation.xml.XmlRender.As.ELEMENT;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+@AttributeType
+@XmlRender(as = ELEMENT)
+public interface BootTimePropertyType extends PropertyType {
+ String getName();
+
+ String getValue();
+
+ boolean isBootTime();
+}
View
57 example/src/main/java/example1/DomainResource.java
@@ -22,9 +22,64 @@
package example1;
+import java.util.List;
+import java.util.Map;
+import org.jboss.mgmt.Resource;
+import org.jboss.mgmt.annotation.Attribute;
+import org.jboss.mgmt.annotation.ModelRoot;
+import org.jboss.mgmt.annotation.SubResource;
+
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
-public interface DomainResource {
+@ModelRoot(name = "domain")
+public interface DomainResource extends Resource {
+
+ @Attribute
+ Map<String, BootTimePropertyType> getProperties();
+
+ @SubResource
+ List<String> getPathNames();
+
+ PathResource getPath(String name);
+
+ @SubResource
+ List<String> getProfileNames();
+
+ ProfileResource getProfile(String name);
+
+ @SubResource
+ List<String> getInterfaceNames();
+
+ // InterfaceResource getInterface(String name);
+
+ @SubResource
+ List<String> getSocketBindingGroupNames();
+
+ // SocketBindingGroup getSocketBindingGroup(String name);
+
+ @SubResource
+ List<String> getDeploymentNames();
+
+ // DomainDeployment getDeployment(String name);
+
+ @SubResource
+ List<String> getServerGroupNames();
+
+ // ServerGroup getServerGroup(String name);
+
+ @SubResource
+ List<String> getManagementClientContextNames();
+
+ // ManagementClientContext getManagementClientContext(String name);
+
+ @SubResource
+ List<String> getJvmNames();
+
+ // Jvm getJvm(String name);
+
+ @SubResource
+ List<String> getServers();
+ DomainServerResource getServer(String name);
}
View
6 example/src/main/java/example1/DomainServerResource.java
@@ -22,14 +22,12 @@
package example1;
-import org.jboss.mgmt.Access;
-import org.jboss.mgmt.Attribute;
-import org.jboss.mgmt.ResourceType;
+import org.jboss.mgmt.annotation.Access;
+import org.jboss.mgmt.annotation.Attribute;
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
-@ResourceType
public interface DomainServerResource extends ServerResource {
@Attribute(access = Access.READ_ONLY)
View
8 example/src/main/java/example1/FileHandlerResource.java
@@ -22,15 +22,13 @@
package example1;
-import org.jboss.mgmt.Attribute;
-import org.jboss.mgmt.AttributeType;
-import org.jboss.mgmt.Reference;
-import org.jboss.mgmt.ResourceType;
+import org.jboss.mgmt.annotation.Attribute;
+import org.jboss.mgmt.annotation.AttributeType;
+import org.jboss.mgmt.annotation.Reference;
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
-@ResourceType
public interface FileHandlerResource extends HandlerResource {
@AttributeType
View
6 example/src/main/java/example1/LoggingSubsystemResource.java
@@ -26,12 +26,18 @@
import org.jboss.mgmt.annotation.ModelRoot;
import org.jboss.mgmt.annotation.Provides;
import org.jboss.mgmt.annotation.SubResource;
+import org.jboss.mgmt.annotation.xml.Mapping;
+import org.jboss.mgmt.annotation.xml.XmlVersionMapping;
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
@Provides("logging")
@ModelRoot(name = "logging")
+@XmlVersionMapping({
+ @Mapping(xmlns = "ext:core.logging:1.0", version = "1.0"),
+ @Mapping(xmlns = "ext:core.logging:1.1", version = "1.1")
+})
public interface LoggingSubsystemResource extends SubsystemResource {
@SubResource
View
39 example/src/main/java/example1/PropertyType.java
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package example1;
+
+import org.jboss.mgmt.annotation.AttributeType;
+import org.jboss.mgmt.annotation.xml.XmlRender;
+
+import static org.jboss.mgmt.annotation.xml.XmlRender.As.ELEMENT;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+@AttributeType
+@XmlRender(as = ELEMENT)
+public interface PropertyType {
+ String getName();
+
+ String getValue();
+}
View
3 example/src/main/java/example1/StandaloneServerResource.java
@@ -22,12 +22,9 @@
package example1;
-import org.jboss.mgmt.ResourceType;
-
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
-@ResourceType
public interface StandaloneServerResource extends ServerResource {
// inline resource, cannot have conflicting attribute names
View
5 tool/src/main/java/org/jboss/mgmt/annotation/Description.java
@@ -25,13 +25,14 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
/**
- * A description for a resource.
+ * A description for a resource or attribute.
*/
-@Target(TYPE)
+@Target({TYPE, METHOD})
@Retention(SOURCE)
public @interface Description {
String value();
View
1 tool/src/main/java/org/jboss/mgmt/annotation/Listener.java
@@ -28,6 +28,5 @@
public @interface Listener {
Class<?> value();
-
RuntimeMode[] modes();
}
View
34 tool/src/main/java/org/jboss/mgmt/annotation/OperationHook.java
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.annotation;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public @interface OperationHook {
+ String operationName();
+
+ String[] versions() default {};
+
+
+}
View
40 tool/src/main/java/org/jboss/mgmt/annotation/OperationHooks.java
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
+/**
+ * Define operation hook classes. The class methods will be examined for the actual hooks.
+ *
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+@Retention(SOURCE)
+@Target(TYPE)
+public @interface OperationHooks {
+ Class<?>[] value();
+}
View
2 tool/src/main/java/org/jboss/mgmt/annotation/xml/Mapping.java
@@ -34,4 +34,6 @@
String xmlns();
String version();
+
+ String[] additionalXmlns() default {};
}
View
2 tool/src/main/java/org/jboss/mgmt/annotation/xml/XmlRender.java
@@ -41,4 +41,6 @@
}
As as();
+
+ boolean wrapperElement() default true;
}
View
73 tool/src/main/java/org/jboss/mgmt/generator/AttributeBuilder.java
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+import java.util.Locale;
+import org.jboss.mgmt.AttributeListener;
+import org.jboss.mgmt.AttributeValidator;
+import org.jboss.mgmt.VirtualAttribute;
+import org.jboss.mgmt.annotation.Access;
+import org.jboss.mgmt.annotation.RuntimeMode;
+import org.jboss.mgmt.annotation.xml.XmlRender;
+
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface AttributeBuilder<P extends GeneralResourceBuilder> extends SubBuilder<P> {
+ AttributeBuilder<P> name(String name);
+
+ AttributeBuilder<P> type(TypeMirror type);
+
+ AttributeBuilder<P> type(Class<?> type);
+
+ AttributeBuilder<P> description(Locale locale, String description);
+
+ AttributeBuilder<P> access(Access access);
+
+ AttributeBuilder<P> required(boolean required);
+
+ AttributeBuilder<P> virtual(TypeMirror virtual); // extends VirtualAttribute
+
+ AttributeBuilder<P> virtual(Class<? extends VirtualAttribute> virtual);
+
+ AttributeBuilder<P> defaultValue(String value);
+
+ AttributeBuilder<P> validator(TypeMirror validator);
+
+ AttributeBuilder<P> validator(Class<? extends AttributeValidator> validator);
+
+ AttributeBuilder<P> listener(TypeMirror listener, RuntimeMode... modes);
+
+ AttributeBuilder<P> listener(Class<? extends AttributeListener> listener, RuntimeMode... modes);
+
+ AttributeBuilder<P> version(String string);
+
+ AttributeBuilder<P> xmlRenderAs(XmlRender.As as);
+
+ AttributeBuilder<P> xmlName(String string);
+
+ ReferenceBuilder<AttributeBuilder<P>> reference();
+
+}
View
46 tool/src/main/java/org/jboss/mgmt/generator/GeneralResourceBuilder.java
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+import java.util.Locale;
+import org.jboss.mgmt.annotation.RuntimeMode;
+
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface GeneralResourceBuilder {
+ AttributeBuilder<? extends GeneralResourceBuilder> attribute();
+
+ GeneralResourceBuilder description(Locale locale, String description);
+
+ GeneralResourceBuilder operationHook(String opName, String version, ExecutableElement method);
+
+ GeneralResourceBuilder listener(TypeMirror listener, RuntimeMode... modes);
+
+ GeneralResourceBuilder provides(String token);
+
+ GeneralResourceBuilder subResource(String address, boolean named);
+}
View
64 tool/src/main/java/org/jboss/mgmt/generator/Generator.java
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+import java.util.Locale;
+import org.jboss.mgmt.AttributeListener;
+import org.jboss.mgmt.annotation.RuntimeMode;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public final class Generator {
+
+ private Generator() {
+ }
+
+ private static void EXAMPLE() {
+ // Annotation processor reads the data and then does this
+ openSession()
+ .model("domain")
+ .resource("bar")
+ .attribute()
+ .name("blah")
+ .done()
+ .provides("blah")
+ .done()
+ .resource("foo")
+ .subResource("blah", true)
+ .attribute()
+ .name("zap")
+ .description(Locale.ROOT, "Blah blah blah")
+ .description(Locale.US, "Yo blah blah blah")
+ .listener(AttributeListener.class, RuntimeMode.HOST, RuntimeMode.MANAGEMENT)
+ .done()
+ .done()
+ .done()
+ .done()
+ .generateSource("target/generated-sources/whatever");
+ }
+
+ public static Session openSession() {
+ return null;
+ }
+}
View
31 tool/src/main/java/org/jboss/mgmt/generator/ModelBuilder.java
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface ModelBuilder extends SubBuilder<Session> {
+
+ RootResourceBuilder resource(String key);
+}
View
32 tool/src/main/java/org/jboss/mgmt/generator/ReferenceBuilder.java
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface ReferenceBuilder<P> extends SubBuilder<P> {
+ ReferenceBuilder<P> scope(String enclosing);
+
+ ReferenceBuilder<P> referenceType(String type);
+}
View
47 tool/src/main/java/org/jboss/mgmt/generator/RootResourceBuilder.java
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+import java.util.Locale;
+import org.jboss.mgmt.annotation.RuntimeMode;
+
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface RootResourceBuilder extends GeneralResourceBuilder, SubBuilder<ModelBuilder> {
+
+ AttributeBuilder<? extends RootResourceBuilder> attribute();
+
+ RootResourceBuilder description(Locale locale, String description);
+
+ RootResourceBuilder operationHook(String opName, String version, ExecutableElement method);
+
+ RootResourceBuilder listener(TypeMirror listener, RuntimeMode... modes);
+
+ RootResourceBuilder provides(String token);
+
+ SubResourceBuilder<RootResourceBuilder> subResource(String address, boolean named);
+}
View
32 tool/src/main/java/org/jboss/mgmt/generator/Session.java
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface Session {
+ ModelBuilder model(String name);
+
+ Session generateSource(String destDir);
+}
View
8 .../java/example1/DomainProfileResource.java → .../org/jboss/mgmt/generator/SubBuilder.java
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2011, Red Hat, Inc., and individual contributors
+ * Copyright 2012, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -20,11 +20,11 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package example1;
+package org.jboss.mgmt.generator;
/**
* @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
*/
-public interface DomainProfileResource extends ProfileResource, NamedChildOf<DomainResource> {
-
+public interface SubBuilder<P> {
+ P done();
}
View
49 tool/src/main/java/org/jboss/mgmt/generator/SubResourceBuilder.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.generator;
+
+import java.util.Locale;
+import org.jboss.mgmt.annotation.RuntimeMode;
+
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public interface SubResourceBuilder<P extends GeneralResourceBuilder> extends GeneralResourceBuilder, SubBuilder<P> {
+
+ AttributeBuilder<? extends SubResourceBuilder<P>> attribute();
+
+ SubResourceBuilder<P> description(Locale locale, String description);
+
+ SubResourceBuilder<P> operationHook(String opName, String version, ExecutableElement method);
+
+ SubResourceBuilder<P> listener(TypeMirror listener, RuntimeMode... modes);
+
+ SubResourceBuilder<P> provides(String token);
+
+ SubResourceBuilder<P> requiresUniqueProvider(boolean required);
+
+ SubResourceBuilder<SubResourceBuilder<P>> subResource(String address, boolean named);
+}
View
49 tool/src/main/java/org/jboss/mgmt/model/Attribute.java
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2012, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.mgmt.model;
+
+import org.jboss.mgmt.annotation.Access;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a>
+ */
+public final class Attribute {
+ private String name;
+ private String camelHumpsName;
+
+ private AnnotationMirror annotationMirror;
+ private Access access;
+ private boolean required;
+ private String defaultValueString;
+ private TypeMirror virtual;
+ private TypeMirror[] validators;
+
+ private ExecutableElement primaryMethodElement;
+ private ExecutableElement linkMethodElement;
+
+
+}

0 comments on commit b04890d

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